Capital obliteration failed to charge money and report news

Commit 221e88f1 (v4.3.15) made caploss() expect the new owner in
sct_own, so it can distinguish between sack and obliteration.  Commit
0d139ee1 (v4.3.17) broke that in sct_prewrite(): it moved zapping the
sector owner after caploss(), and passed 0 instead of the old owner to
caploss().  Because of that, obliterating a capital didn't make the
news and didn't cost the victim money.  Fix that.
This commit is contained in:
Markus Armbruster 2008-11-15 16:43:13 -05:00
parent 2ce0a58a0d
commit fe69514067

View file

@ -65,7 +65,7 @@ sct_prewrite(int id, void *old, void *new)
struct sctstr *oldsp = old; struct sctstr *oldsp = old;
struct sctstr *sp = new; struct sctstr *sp = new;
int mil, civs; int mil, civs;
natid own; natid own, prev_own;
bridge_damaged(sp); bridge_damaged(sp);
item_prewrite(sp->sct_item); item_prewrite(sp->sct_item);
@ -73,6 +73,7 @@ sct_prewrite(int id, void *old, void *new)
mil = sp->sct_item[I_MILIT]; mil = sp->sct_item[I_MILIT];
civs = sp->sct_item[I_CIVIL]; civs = sp->sct_item[I_CIVIL];
own = sp->sct_own; own = sp->sct_own;
prev_own = oldsp->sct_own;
if (own && !civs) { if (own && !civs) {
sp->sct_work = 100; sp->sct_work = 100;
@ -82,18 +83,15 @@ sct_prewrite(int id, void *old, void *new)
if (own && !civs && !mil && !has_units(sp->sct_x, sp->sct_y, own, NULL) if (own && !civs && !mil && !has_units(sp->sct_x, sp->sct_y, own, NULL)
&& !(sp->sct_flags & MOVE_IN_PROGRESS)) { && !(sp->sct_flags & MOVE_IN_PROGRESS)) {
/* more cruft! */ /* more cruft! */
own = 0; own = sp->sct_own = 0;
sp->sct_mobil = 0; sp->sct_mobil = 0;
if (sp->sct_type == SCT_CAPIT || sp->sct_type == SCT_MOUNT) if (sp->sct_type == SCT_CAPIT || sp->sct_type == SCT_MOUNT)
caploss(sp, own, ""); caploss(sp, prev_own, "");
} }
/* We've avoided assigning to sp->sct_own, in case oldsp == sp */ if (prev_own != own)
if (oldsp->sct_own != own) lost_and_found(EF_SECTOR, prev_own, own,
lost_and_found(EF_SECTOR, oldsp->sct_own, own,
0, sp->sct_x, sp->sct_y); 0, sp->sct_x, sp->sct_y);
sp->sct_own = own;
} }
void void