From 44d4a1c7ff00d05651f3ec1c1ebcae9d33c0e8aa Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 24 Jul 2016 16:10:41 +0200 Subject: [PATCH] attack assault paradrop: Don't disclose defender's retreats 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 --- src/lib/subs/lndsub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 29131466b..eaabfbb7a 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -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; -- 2.43.0