From fe695140678bf252b37ca5b3458e32cab601f3d5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 15 Nov 2008 16:43:13 -0500 Subject: [PATCH] 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. --- src/lib/subs/sect.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/subs/sect.c b/src/lib/subs/sect.c index cae10971..1effb104 100644 --- a/src/lib/subs/sect.c +++ b/src/lib/subs/sect.c @@ -65,7 +65,7 @@ sct_prewrite(int id, void *old, void *new) struct sctstr *oldsp = old; struct sctstr *sp = new; int mil, civs; - natid own; + natid own, prev_own; bridge_damaged(sp); item_prewrite(sp->sct_item); @@ -73,6 +73,7 @@ sct_prewrite(int id, void *old, void *new) mil = sp->sct_item[I_MILIT]; civs = sp->sct_item[I_CIVIL]; own = sp->sct_own; + prev_own = oldsp->sct_own; if (own && !civs) { 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) && !(sp->sct_flags & MOVE_IN_PROGRESS)) { /* more cruft! */ - own = 0; + own = sp->sct_own = 0; sp->sct_mobil = 0; 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 (oldsp->sct_own != own) - lost_and_found(EF_SECTOR, oldsp->sct_own, own, + if (prev_own != own) + lost_and_found(EF_SECTOR, prev_own, own, 0, sp->sct_x, sp->sct_y); - - sp->sct_own = own; } void