Merge pull request #806 from ennorehling/master

Bugfix: Rosthauch, Abtreiben
This commit is contained in:
Enno Rehling 2018-09-16 10:15:05 +02:00 committed by GitHub
commit c5dd7d69df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 32 deletions

View file

@ -630,7 +630,7 @@ mark_travelthru(unit * u, region * r, const region_list * route,
} }
} }
ship *move_ship(ship * sh, region * from, region * to, region_list * route) void move_ship(ship * sh, region * from, region * to, region_list * route)
{ {
unit **iunit = &from->units; unit **iunit = &from->units;
unit **ulist = &to->units; unit **ulist = &to->units;
@ -663,8 +663,6 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route)
if (*iunit == u) if (*iunit == u)
iunit = &u->next; iunit = &u->next;
} }
return sh;
} }
static bool is_freezing(const unit * u) static bool is_freezing(const unit * u)
@ -857,23 +855,11 @@ static void drifting_ships(region * r)
} }
} }
if (rnext != NULL) {
/* Das Schiff und alle Einheiten darin werden nun von r
* nach rnext verschoben. Danach eine Meldung. */
add_regionlist(&route, rnext);
set_coast(sh, r, rnext);
sh = move_ship(sh, r, rnext, route);
free_regionlist(route);
if (firstu != NULL) { if (firstu != NULL) {
message *msg = msg_message("ship_drift", "ship dir", sh, dir); message *msg = msg_message("ship_drift", "ship dir", sh, dir);
msg_to_ship_inmates(sh, &firstu, &lastu, msg); msg_to_ship_inmates(sh, &firstu, &lastu, msg);
} }
}
if (sh != NULL) {
fset(sh, SF_DRIFTED); fset(sh, SF_DRIFTED);
if (ovl >= overload_start()) { if (ovl >= overload_start()) {
damage_ship(sh, damage_overload(ovl)); damage_ship(sh, damage_overload(ovl));
@ -887,9 +873,16 @@ static void drifting_ships(region * r)
sink_ship(sh); sink_ship(sh);
remove_ship(shp, sh); remove_ship(shp, sh);
} }
} else if (rnext != NULL) {
/* Das Schiff und alle Einheiten darin werden nun von r
* nach rnext verschoben. Danach eine Meldung. */
add_regionlist(&route, rnext);
if (*shp == sh) { set_coast(sh, r, rnext);
move_ship(sh, r, rnext, route);
free_regionlist(route);
}
else {
shp = &sh->next; shp = &sh->next;
} }
} }
@ -1970,7 +1963,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
if (fval(u, UFL_FOLLOWING)) if (fval(u, UFL_FOLLOWING))
caught_target(current_point, u); caught_target(current_point, u);
sh = move_ship(sh, starting_point, current_point, *routep); move_ship(sh, starting_point, current_point, *routep);
/* Hafengebühren ? */ /* Hafengebühren ? */

View file

@ -77,7 +77,7 @@ extern "C" {
bool canfly(struct unit *u); bool canfly(struct unit *u);
void leave_trail(struct ship *sh, struct region *from, void leave_trail(struct ship *sh, struct region *from,
struct region_list *route); struct region_list *route);
struct ship *move_ship(struct ship *sh, struct region *from, void move_ship(struct ship *sh, struct region *from,
struct region *to, struct region_list *route); struct region *to, struct region_list *route);
int walkingcapacity(const struct unit *u); int walkingcapacity(const struct unit *u);
int movement_speed(const struct unit * u); int movement_speed(const struct unit * u);

View file

@ -299,7 +299,7 @@ int sp_combatrosthauch(struct castorder * co)
for (w = 0; df->weapons[w].type != NULL; ++w) { for (w = 0; df->weapons[w].type != NULL; ++w) {
weapon *wp = df->weapons; weapon *wp = df->weapons;
int n = force; int n = force;
if (n < wp->used) n = wp->used; if (n > wp->used) n = wp->used;
if (n) { if (n) {
requirement *mat = wp->type->itype->construction->materials; requirement *mat = wp->type->itype->construction->materials;
bool iron = false; bool iron = false;