From: Markus Armbruster Date: Thu, 20 Jan 2011 06:49:44 +0000 (+0100) Subject: Fix attack when attacking sector gets taken by ally X-Git-Tag: v4.3.27~162 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=13d9057bd8c2d660f95dc226dfd9298bc87cabe0 Fix attack when attacking sector gets taken by ally When an attacking sector got lost while the player was at a prompt, and the new owner was allied to the player, the server got confused: 1. If the sector attacked with mil, the server let the ghost mil attack, but not occupy. 2. If the sector was allied, the server reported the sector loss and land units dropping out of the attack, but claimed the lost sector was yours. Fix 1. by dropping sectors from attack when they change owner away from the player, regardless of relations. Side effect: also drops any surviving land units there. Before, they dropped out only if the new owner wasn't allied to the player. That change's okay. Fix 2. the obvious way: change the messages. Broken in 4.0.0. --- diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index e2651352d..4c2f7ed22 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -285,16 +285,15 @@ att_get_combat(struct combat *com, int isdef) mil); com->troops = mil; } else { /* attacker */ - if (owner != player->cnum - && getrel(getnatp(owner), player->cnum) != ALLIED) { + if (owner != com->own && owner != player->cnum) { /* must be EF_SECTOR */ - if (com->mil) + if (com->troops) pr("WARNING: Your %d mil in %s were destroyed because %s just took the sector!\n", com->mil, xyas(com->x, com->y, player->cnum), cname(owner)); else - pr("You no longer own %s\n", - xyas(com->x, com->y, player->cnum)); + pr("%s just took %s!\n", + cname(owner), xyas(com->x, com->y, player->cnum)); return att_combat_init(com, EF_BAD); } if (com->troops && com->troops + 1 > mil) { @@ -1272,7 +1271,7 @@ get_ototal(int combat_mode, struct combat *off, struct emp_qelem *olist, } if (w < 0) { lnd_print(player->cnum, llp, - "is in a sector not owned by you"); + "can't attack from this sector now"); lnd_delete(llp); continue; }