forked from github/server
Durch GIB "leer" gewordene Schiffe können nicht sinken.
This commit is contained in:
parent
48e4caf496
commit
ed0b7f8af2
|
@ -302,8 +302,13 @@ static void transfer_ships(ship *s1, ship *s2, int n)
|
||||||
if (s1->coast != NODIRECTION) {
|
if (s1->coast != NODIRECTION) {
|
||||||
s2->coast = s1->coast;
|
s2->coast = s1->coast;
|
||||||
}
|
}
|
||||||
|
if (n == s1->number) {
|
||||||
|
s1->number = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
scale_ship(s1, s1->number - n);
|
scale_ship(s1, s1->number - n);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void transfer_units(ship *s1, ship *s2)
|
static void transfer_units(ship *s1, ship *s2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -510,6 +510,7 @@ void ship_update_owner(ship * sh) {
|
||||||
|
|
||||||
unit *ship_owner(const ship * sh)
|
unit *ship_owner(const ship * sh)
|
||||||
{
|
{
|
||||||
|
if (sh->number > 0) {
|
||||||
unit *owner = sh->_owner;
|
unit *owner = sh->_owner;
|
||||||
if (!owner || (owner->ship != sh || owner->number <= 0)) {
|
if (!owner || (owner->ship != sh || owner->number <= 0)) {
|
||||||
unit * heir = ship_owner_ex(sh, owner ? owner->faction : 0);
|
unit * heir = ship_owner_ex(sh, owner ? owner->faction : 0);
|
||||||
|
@ -517,6 +518,8 @@ unit *ship_owner(const ship * sh)
|
||||||
}
|
}
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void write_ship_reference(const struct ship *sh, struct storage *store)
|
void write_ship_reference(const struct ship *sh, struct storage *store)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2584,6 +2584,7 @@ void sinkships(struct region * r)
|
||||||
while (*shp) {
|
while (*shp) {
|
||||||
ship *sh = *shp;
|
ship *sh = *shp;
|
||||||
|
|
||||||
|
if (sh->number > 0) {
|
||||||
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
||||||
if (fval(r->terrain, SEA_REGION)) {
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
if (!ship_crewed(sh)) {
|
if (!ship_crewed(sh)) {
|
||||||
|
@ -2602,6 +2603,10 @@ void sinkships(struct region * r)
|
||||||
sink_ship(sh);
|
sink_ship(sh);
|
||||||
remove_ship(shp, sh);
|
remove_ship(shp, sh);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
remove_ship(shp, sh);
|
||||||
|
}
|
||||||
if (*shp == sh)
|
if (*shp == sh)
|
||||||
shp = &sh->next;
|
shp = &sh->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue