subs: Drop has_units() parameter lp, it's always null now

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-28 21:59:05 +01:00
parent 7c1b1661f5
commit 5d0faf7a88
6 changed files with 11 additions and 17 deletions

View file

@ -452,7 +452,7 @@ extern int unitsatxy(coord, coord, int, int, int);
extern int planesatxy(coord, coord, int, int); extern int planesatxy(coord, coord, int, int);
extern int asw_shipsatxy(coord, coord, int, int, struct plnstr *, extern int asw_shipsatxy(coord, coord, int, int, struct plnstr *,
struct shiplist **); 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 adj_units(coord, coord, natid);
extern int islist(char *); extern int islist(char *);
/* maps.c */ /* maps.c */

View file

@ -256,14 +256,14 @@ adj_units(coord x, coord y, natid own)
for (i = DIR_FIRST; i <= DIR_LAST; i++) { for (i = DIR_FIRST; i <= DIR_LAST; i++) {
getsect(x + diroff[i][0], y + diroff[i][1], &sect); getsect(x + diroff[i][0], y + diroff[i][1], &sect);
if (has_units(sect.sct_x, sect.sct_y, own, NULL)) if (has_units(sect.sct_x, sect.sct_y, own))
return 1; return 1;
} }
return 0; return 0;
} }
int int
has_units(coord x, coord y, natid cn, struct lndstr *lp) has_units(coord x, coord y, natid cn)
{ {
int n; int n;
struct lndstr land; 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++) { for (n = 0; ef_read(EF_LAND, n, &land); n++) {
if (land.lnd_x != x || land.lnd_y != y) if (land.lnd_x != x || land.lnd_y != y)
continue; 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) if (land.lnd_own == cn)
return 1; return 1;
} }

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1989 * Dave Pare, 1989
* Steve McClure, 1996 * Steve McClure, 1996
* Markus Armbruster, 2004-2013 * Markus Armbruster, 2004-2014
*/ */
#include <config.h> #include <config.h>
@ -83,7 +83,7 @@ sct_prewrite(int id, void *old, void *new)
sp->sct_oldown = own; 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)) { && !(sp->sct_flags & MOVE_IN_PROGRESS)) {
/* more cruft! */ /* more cruft! */
own = sp->sct_own = 0; own = sp->sct_own = 0;

View file

@ -28,7 +28,7 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Steve McClure, 1998-2000 * Steve McClure, 1998-2000
* Markus Armbruster, 2004-2012 * Markus Armbruster, 2004-2014
*/ */
#include <config.h> #include <config.h>
@ -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 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); makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
sp->sct_own = 0; sp->sct_own = 0;
sp->sct_oldown = 0; sp->sct_oldown = 0;

View file

@ -28,7 +28,7 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1986 * Dave Pare, 1986
* Markus Armbruster, 2004-2013 * Markus Armbruster, 2004-2014
*/ */
#include <config.h> #include <config.h>
@ -51,7 +51,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
sp->sct_oldown = sp->sct_own; sp->sct_oldown = sp->sct_own;
} }
if (!civ && !mil && !sp->sct_item[I_UW] 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); makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
sp->sct_own = 0; sp->sct_own = 0;
sp->sct_oldown = 0; sp->sct_oldown = 0;

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1986 * Dave Pare, 1986
* Steve McClure, 1996 * Steve McClure, 1996
* Markus Armbruster, 2004-2013 * Markus Armbruster, 2004-2014
*/ */
#include <config.h> #include <config.h>
@ -287,7 +287,7 @@ produce_sect(int natnum, int etu, struct bp *bp, int p_sect[][2])
* they all starved or were plagued off. * they all starved or were plagued off.
*/ */
if (vec[I_CIVIL] == 0 && vec[I_MILIT] == 0 && 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) { if (!player->simulation) {
makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y); makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
sp->sct_own = 0; sp->sct_own = 0;