]> git.pond.sub.org Git - empserver/commitdiff
(fort): Refuse to fortify land units embarked on land units. Properly
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Jan 2004 13:36:25 +0000 (13:36 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Jan 2004 13:36:25 +0000 (13:36 +0000)
report failure to fortify.

src/lib/commands/fort.c

index 90a18b462b045cdb22f78c9b65216bff5e808511..07bb252e2249d3889facc29d0b6365c69a0faccf 100644 (file)
@@ -79,6 +79,10 @@ fort(void)
            pr("%s is on a ship and can't be fortified\n", prland(&land));
            continue;
        }
+       if (land.lnd_land >= 0) {
+           pr("%s is on a land unit and can't be fortified\n", prland(&land));
+           continue;
+       }
 
        hard_amt = fort_amt;
 
@@ -90,10 +94,13 @@ fort(void)
                continue;
        }
 
-       nunits++;
-
-       lnd_fortify (&land, hard_amt);
+       if (lnd_fortify (&land, hard_amt) <= 0) {
+           pr("%s can't be fortified%s\n", prland(&land),
+              land.lnd_harden >= land_mob_max ? " any further" : "");
+           continue;
+       }
 
+       nunits++;
        pr("%s hardened to %d\n", prland(&land), land.lnd_harden);
 
        putland(land.lnd_uid, &land);