Merge pull request #581 from ennorehling/follow-nodrift

FEATURE: ships that FOLLOW or use PIRACY are not affected by storms.
This commit is contained in:
Enno Rehling 2016-09-25 08:37:18 +02:00 committed by GitHub
commit 3bbd2bcce8
1 changed files with 5 additions and 4 deletions

View File

@ -1790,7 +1790,7 @@ bool can_takeoff(const ship * sh, const region * from, const region * to)
return true;
}
static void sail(unit * u, order * ord, region_list ** routep)
static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
{
region *starting_point = u->region;
region *current_point, *last_point;
@ -1800,8 +1800,8 @@ static void sail(unit * u, order * ord, region_list ** routep)
faction *f = u->faction;
region *next_point = NULL;
int error;
double damage_storm = config_get_flt("rules.ship.damage_storm", 0.02);
bool storms_enabled = config_get_int("rules.ship.storms", 1) != 0;
bool storms_enabled = drifting && (config_get_int("rules.ship.storms", 1) != 0);
double damage_storm = storms_enabled ? config_get_flt("rules.ship.damage_storm", 0.02) : 0.0;
int lighthouse_div = config_get_int("rules.storm.lighthouse.divisor", 0);
const char *token = getstrtoken();
@ -2277,7 +2277,8 @@ void move_cmd(unit * u, order * ord)
assert(u->number);
if (u->ship && u == ship_owner(u->ship)) {
sail(u, ord, &route);
bool drifting = (getkeyword(ord) == K_MOVE);
sail(u, ord, &route, drifting);
}
else {
travel(u, &route);