From 9189e67ad762af7004d31f7a7a05a22cd6533c1b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 7 Sep 2008 20:37:52 -0400 Subject: [PATCH] Simplify tests for presence of load Instead of counting the load with lnd_nland() / lnd_nxlight(), check whether there's at least one loaded with lnd_first_on_land() / pln_first_on_land(). --- src/lib/commands/load.c | 4 ++-- src/lib/subs/trdsub.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index ba01f2f6..8bdb1091 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -529,7 +529,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, prland(&land), land.lnd_land); continue; } - if (lnd_nland(&land)) { + if (lnd_first_on_land(&land) >= 0) { if (noisy) pr("%s cannot be loaded since it is carrying units\n", prland(&land)); @@ -977,7 +977,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy, prland(&land), land.lnd_land); continue; } - if (lnd_nland(&land)) { + if (lnd_first_on_land(&land) >= 0) { if (noisy) pr("%s cannot be loaded since it is carrying units\n", prland(&land)); diff --git a/src/lib/subs/trdsub.c b/src/lib/subs/trdsub.c index 6efe4c28..80ba1b89 100644 --- a/src/lib/subs/trdsub.c +++ b/src/lib/subs/trdsub.c @@ -148,7 +148,7 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp) land.lnd_tech, land.lnd_effic, lchr[(int)land.lnd_type].l_name, land.lnd_uid); - if (lnd_nxlight(&land)) { + if (pln_first_on_land(&land) >= 0) { snxtitem_all(&ni, EF_PLANE); while (nxtitem(&ni, &plane)) { if (plane.pln_land == land.lnd_uid) {