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.
This commit is contained in:
Markus Armbruster 2011-01-20 07:49:44 +01:00
parent 16c68eb403
commit 13d9057bd8

View file

@ -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;
}