]> git.pond.sub.org Git - empserver/commitdiff
attack assault paradrop: Don't disclose defender's retreats
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 24 Jul 2016 14:10:41 +0000 (16:10 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:19 +0000 (20:09 +0200)
When an attacking land unit fails its morale check and retreats, the
retreat message needs to be prefixed with a newline to separate it
from the casualty characters.  However, the code also prints the
newline when a defending land unit retreats, leaking the retreat to
the attacker.  For instance, a fight that forces three defending to
retreat could look like this:

    !!!!!!!!!!!!!!!!!!
    !@!!!!!!!!!!!!!@!
    !

    - Casualties -
 Yours: 2
Theirs: 34

Messed up in Empire 3.  Fix by printing the newline only when an
attacking land unit retreats.  The example becomes:

    !!!!!!!!!!!!!!!!!!!@!!!!!!!!!!!!!@!!
    - Casualties -
 Yours: 2
Theirs: 34

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/lndsub.c

index 29131466b455bab984cb1baf2023e455ddc1ca8b..eaabfbb7ab15b2e25ed0c55ff5e7e25e9ab4c4f0 100644 (file)
@@ -213,7 +213,8 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
 
     ret_chance = llp->unit.land.lnd_retreat - llp->unit.land.lnd_effic;
     if (pct_chance(ret_chance)) {
-       pr("\n");
+       if (llp->unit.land.lnd_own == player->cnum)
+           pr("\n");
        lnd_print(llp->unit.land.lnd_own, llp, "fails morale check!");
        llp->unit.land.lnd_mission = 0;
        llp->unit.land.lnd_harden = 0;