diff --git a/src/move.c b/src/move.c index b815f5ea5..70425b72e 100644 --- a/src/move.c +++ b/src/move.c @@ -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 **ulist = &to->units; @@ -663,8 +663,6 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route) if (*iunit == u) iunit = &u->next; } - - return sh; } static bool is_freezing(const unit * u) @@ -857,39 +855,34 @@ static void drifting_ships(region * r) } } - if (rnext != NULL) { + if (firstu != NULL) { + message *msg = msg_message("ship_drift", "ship dir", sh, dir); + msg_to_ship_inmates(sh, &firstu, &lastu, msg); + } + fset(sh, SF_DRIFTED); + if (ovl >= overload_start()) { + damage_ship(sh, damage_overload(ovl)); + msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh)); + } + else { + damage_ship(sh, damage_drift); + } + if (sh->damage >= sh->size * DAMAGE_SCALE) { + msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh)); + sink_ship(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. */ + * nach rnext verschoben. Danach eine Meldung. */ add_regionlist(&route, rnext); set_coast(sh, r, rnext); - sh = move_ship(sh, r, rnext, route); + move_ship(sh, r, rnext, route); free_regionlist(route); - - if (firstu != NULL) { - message *msg = msg_message("ship_drift", "ship dir", sh, dir); - msg_to_ship_inmates(sh, &firstu, &lastu, msg); - } } - - if (sh != NULL) { - fset(sh, SF_DRIFTED); - if (ovl >= overload_start()) { - damage_ship(sh, damage_overload(ovl)); - msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh)); - } - else { - damage_ship(sh, damage_drift); - } - if (sh->damage >= sh->size * DAMAGE_SCALE) { - msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh)); - sink_ship(sh); - remove_ship(shp, sh); - } - } - - if (*shp == sh) { + else { shp = &sh->next; } } @@ -1970,7 +1963,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting) if (fval(u, UFL_FOLLOWING)) caught_target(current_point, u); - sh = move_ship(sh, starting_point, current_point, *routep); + move_ship(sh, starting_point, current_point, *routep); /* Hafengebühren ? */ diff --git a/src/move.h b/src/move.h index ceab50aa3..754b708aa 100644 --- a/src/move.h +++ b/src/move.h @@ -77,7 +77,7 @@ extern "C" { bool canfly(struct unit *u); void leave_trail(struct ship *sh, struct region *from, 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); int walkingcapacity(const struct unit *u); int movement_speed(const struct unit * u); diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index 976c29aed..06a78c4f4 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -299,7 +299,7 @@ int sp_combatrosthauch(struct castorder * co) for (w = 0; df->weapons[w].type != NULL; ++w) { weapon *wp = df->weapons; int n = force; - if (n < wp->used) n = wp->used; + if (n > wp->used) n = wp->used; if (n) { requirement *mat = wp->type->itype->construction->materials; bool iron = false;