forked from github/server
Durch GIB "leer" gewordene Schiffe können nicht sinken.
This commit is contained in:
parent
48e4caf496
commit
ed0b7f8af2
|
@ -302,7 +302,12 @@ static void transfer_ships(ship *s1, ship *s2, int n)
|
|||
if (s1->coast != NODIRECTION) {
|
||||
s2->coast = s1->coast;
|
||||
}
|
||||
scale_ship(s1, s1->number - n);
|
||||
if (n == s1->number) {
|
||||
s1->number = 0;
|
||||
}
|
||||
else {
|
||||
scale_ship(s1, s1->number - n);
|
||||
}
|
||||
}
|
||||
|
||||
static void transfer_units(ship *s1, ship *s2)
|
||||
|
|
|
@ -510,12 +510,15 @@ void ship_update_owner(ship * sh) {
|
|||
|
||||
unit *ship_owner(const ship * sh)
|
||||
{
|
||||
unit *owner = sh->_owner;
|
||||
if (!owner || (owner->ship != sh || owner->number <= 0)) {
|
||||
unit * heir = ship_owner_ex(sh, owner ? owner->faction : 0);
|
||||
return (heir && heir->number > 0) ? heir : 0;
|
||||
if (sh->number > 0) {
|
||||
unit *owner = sh->_owner;
|
||||
if (!owner || (owner->ship != sh || owner->number <= 0)) {
|
||||
unit * heir = ship_owner_ex(sh, owner ? owner->faction : 0);
|
||||
return (heir && heir->number > 0) ? heir : 0;
|
||||
}
|
||||
return owner;
|
||||
}
|
||||
return owner;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void write_ship_reference(const struct ship *sh, struct storage *store)
|
||||
|
|
27
src/laws.c
27
src/laws.c
|
@ -2584,22 +2584,27 @@ void sinkships(struct region * r)
|
|||
while (*shp) {
|
||||
ship *sh = *shp;
|
||||
|
||||
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
if (!ship_crewed(sh)) {
|
||||
/* ship is at sea, but not enough people to control it */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
||||
if (sh->number > 0) {
|
||||
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
if (!ship_crewed(sh)) {
|
||||
/* ship is at sea, but not enough people to control it */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
||||
damage_ship(sh, dmg);
|
||||
}
|
||||
}
|
||||
else if (!ship_owner(sh)) {
|
||||
/* any ship lying around without an owner slowly rots */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
||||
damage_ship(sh, dmg);
|
||||
}
|
||||
}
|
||||
else if (!ship_owner(sh)) {
|
||||
/* any ship lying around without an owner slowly rots */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
||||
damage_ship(sh, dmg);
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
sink_ship(sh);
|
||||
remove_ship(shp, sh);
|
||||
}
|
||||
}
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
sink_ship(sh);
|
||||
else {
|
||||
remove_ship(shp, sh);
|
||||
}
|
||||
if (*shp == sh)
|
||||
|
|
Loading…
Reference in New Issue