diff --git a/include/prototypes.h b/include/prototypes.h index d569033e..729c561e 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -452,7 +452,7 @@ extern int unitsatxy(coord, coord, int, int, int); extern int planesatxy(coord, coord, int, int); extern int asw_shipsatxy(coord, coord, int, int, struct plnstr *, struct shiplist **); -extern int has_units(coord, coord, natid, struct lndstr *); +extern int has_units(coord, coord, natid); extern int adj_units(coord, coord, natid); extern int islist(char *); /* maps.c */ diff --git a/src/lib/subs/list.c b/src/lib/subs/list.c index 32c6f813..e78cde2b 100644 --- a/src/lib/subs/list.c +++ b/src/lib/subs/list.c @@ -256,14 +256,14 @@ adj_units(coord x, coord y, natid own) for (i = DIR_FIRST; i <= DIR_LAST; i++) { getsect(x + diroff[i][0], y + diroff[i][1], §); - if (has_units(sect.sct_x, sect.sct_y, own, NULL)) + if (has_units(sect.sct_x, sect.sct_y, own)) return 1; } return 0; } int -has_units(coord x, coord y, natid cn, struct lndstr *lp) +has_units(coord x, coord y, natid cn) { int n; struct lndstr land; @@ -271,12 +271,6 @@ has_units(coord x, coord y, natid cn, struct lndstr *lp) for (n = 0; ef_read(EF_LAND, n, &land); n++) { if (land.lnd_x != x || land.lnd_y != y) continue; - if (lp) { - /* Check this unit. If it is this one, we don't want - it included in the count. */ - if (lp->lnd_uid == land.lnd_uid) - continue; - } if (land.lnd_own == cn) return 1; } diff --git a/src/lib/subs/sect.c b/src/lib/subs/sect.c index e25fbc45..7929db5e 100644 --- a/src/lib/subs/sect.c +++ b/src/lib/subs/sect.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Dave Pare, 1989 * Steve McClure, 1996 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2014 */ #include @@ -83,7 +83,7 @@ sct_prewrite(int id, void *old, void *new) sp->sct_oldown = own; } - if (own && !civs && !mil && !has_units(sp->sct_x, sp->sct_y, own, NULL) + if (own && !civs && !mil && !has_units(sp->sct_x, sp->sct_y, own) && !(sp->sct_flags & MOVE_IN_PROGRESS)) { /* more cruft! */ own = sp->sct_own = 0; diff --git a/src/lib/update/plague.c b/src/lib/update/plague.c index 68de8cb1..b722265f 100644 --- a/src/lib/update/plague.c +++ b/src/lib/update/plague.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Steve McClure, 1998-2000 - * Markus Armbruster, 2004-2012 + * Markus Armbruster, 2004-2014 */ #include @@ -100,7 +100,7 @@ do_plague(struct sctstr *sp, struct natstr *np, int etu) } } if (sp->sct_item[I_CIVIL] == 0 && sp->sct_item[I_MILIT] == 0 - && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) { + && !has_units(sp->sct_x, sp->sct_y, sp->sct_own)) { makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y); sp->sct_own = 0; sp->sct_oldown = 0; diff --git a/src/lib/update/populace.c b/src/lib/update/populace.c index 91151980..0cf2dc9e 100644 --- a/src/lib/update/populace.c +++ b/src/lib/update/populace.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Dave Pare, 1986 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2014 */ #include @@ -51,7 +51,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu) sp->sct_oldown = sp->sct_own; } if (!civ && !mil && !sp->sct_item[I_UW] - && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) { + && !has_units(sp->sct_x, sp->sct_y, sp->sct_own)) { makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y); sp->sct_own = 0; sp->sct_oldown = 0; diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index e324b279..5f348a6a 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Dave Pare, 1986 * Steve McClure, 1996 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2014 */ #include @@ -287,7 +287,7 @@ produce_sect(int natnum, int etu, struct bp *bp, int p_sect[][2]) * they all starved or were plagued off. */ if (vec[I_CIVIL] == 0 && vec[I_MILIT] == 0 && - !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) { + !has_units(sp->sct_x, sp->sct_y, sp->sct_own)) { if (!player->simulation) { makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y); sp->sct_own = 0;