subs: Tighten the check for destroyed defending land unit
get_dland() tests efficiency to find out whether the defending land unit is gone. Doesn't work when somebody else has since built a new one with the same UID. Not sure that can happen. Check for a change of owner instead. Matches get_oland(). Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
25c96cc3ac
commit
0c6d1e422e
1 changed files with 4 additions and 5 deletions
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
* Steve McClure, 1996-2000
|
* Steve McClure, 1996-2000
|
||||||
* Markus Armbruster, 2006-2015
|
* Markus Armbruster, 2006-2016
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -1341,13 +1341,12 @@ static int
|
||||||
get_dland(struct combat *def, struct ulist *llp)
|
get_dland(struct combat *def, struct ulist *llp)
|
||||||
{
|
{
|
||||||
struct lndstr *lp = &llp->unit.land;
|
struct lndstr *lp = &llp->unit.land;
|
||||||
char buf[512];
|
|
||||||
|
|
||||||
getland(llp->unit.land.lnd_uid, lp);
|
getland(llp->unit.land.lnd_uid, lp);
|
||||||
|
|
||||||
if (lp->lnd_effic < LAND_MINEFF) {
|
if (lp->lnd_own != def->own) {
|
||||||
sprintf(buf, "was destroyed and is no longer a part of the defense");
|
lnd_print(llp->unit.land.lnd_own, llp,
|
||||||
lnd_print(llp->unit.land.lnd_own, llp, buf);
|
"was destroyed and is no longer a part of the defense");
|
||||||
lnd_put_one(llp);
|
lnd_put_one(llp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue