Distinguish between sacking and obliterating a capital
Make caploss() transfer money, loans and market lots to the player only if he actually took the capital, not if he obliterated it to deity. To make this work, caploss() needs to be called after the sector is updated for damage and change of ownership. Change callers accordingly. Closes #914049.
This commit is contained in:
parent
f6308422c3
commit
221e88f106
3 changed files with 19 additions and 14 deletions
|
@ -106,8 +106,6 @@ coll(void)
|
||||||
pr("That is more than is owed!\n");
|
pr("That is more than is owed!\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (sect.sct_type == SCT_CAPIT || sect.sct_type == SCT_MOUNT)
|
|
||||||
caploss(§, sect.sct_own, "that was %s's capital!\n");
|
|
||||||
sect.sct_item[I_MILIT] = 1; /* FIXME now where did this guy come from? */
|
sect.sct_item[I_MILIT] = 1; /* FIXME now where did this guy come from? */
|
||||||
|
|
||||||
/* Consider modifying takeover to take a "no che" argument and
|
/* Consider modifying takeover to take a "no che" argument and
|
||||||
|
@ -123,6 +121,8 @@ coll(void)
|
||||||
sect.sct_dist_x = sect.sct_x;
|
sect.sct_dist_x = sect.sct_x;
|
||||||
sect.sct_dist_y = sect.sct_y;
|
sect.sct_dist_y = sect.sct_y;
|
||||||
|
|
||||||
|
if (sect.sct_type == SCT_CAPIT || sect.sct_type == SCT_MOUNT)
|
||||||
|
caploss(§, loan.l_lonee, "that was %s's capital!\n");
|
||||||
putsect(§);
|
putsect(§);
|
||||||
nreport(player->cnum, N_SEIZE_SECT, loan.l_lonee, 1);
|
nreport(player->cnum, N_SEIZE_SECT, loan.l_lonee, 1);
|
||||||
owed = loan_owed(&loan, time(&now));
|
owed = loan_owed(&loan, time(&now));
|
||||||
|
|
|
@ -51,8 +51,10 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
||||||
struct comstr comm;
|
struct comstr comm;
|
||||||
long lose;
|
long lose;
|
||||||
long gain;
|
long gain;
|
||||||
int loan_num = 0;
|
char *verb;
|
||||||
int comm_num = 0;
|
int loan_num, comm_num;
|
||||||
|
|
||||||
|
CANT_HAPPEN(sp->sct_own && sp->sct_own != player->cnum);
|
||||||
|
|
||||||
natp = getnatp(coun);
|
natp = getnatp(coun);
|
||||||
if (natp->nat_stat != STAT_ACTIVE)
|
if (natp->nat_stat != STAT_ACTIVE)
|
||||||
|
@ -71,18 +73,20 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
||||||
lose = 3000;
|
lose = 3000;
|
||||||
natp->nat_money -= lose;
|
natp->nat_money -= lose;
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
wu(0, coun, "* %s just sacked your capital! *\n", cname(player->cnum));
|
if (gain >= 0 && sp->sct_own) {
|
||||||
|
|
||||||
if (gain >= 0) {
|
|
||||||
gain = (0.2 + 0.8 * (sp->sct_effic / 100.0)) * gain;
|
gain = (0.2 + 0.8 * (sp->sct_effic / 100.0)) * gain;
|
||||||
player->dolcost -= gain;
|
player->dolcost -= gain;
|
||||||
} else
|
} else
|
||||||
gain = 0;
|
gain = 0;
|
||||||
|
verb = sp->sct_own ? "sacked" : "obliterated";
|
||||||
|
wu(0, coun, "* %s just %s your capital! *\n",
|
||||||
|
cname(player->cnum), verb);
|
||||||
wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain);
|
wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain);
|
||||||
wu(0, coun, "You need to use 'capital' to activate a new capital.\n");
|
wu(0, coun, "You need to use 'capital' to activate a new capital.\n");
|
||||||
wu(0, 0, "%s just took %s's capital and gained $%d\n",
|
wu(0, 0, "%s just %s %s's capital and gained $%ld\n",
|
||||||
cname(player->cnum), cname(coun), -(int)(player->dolcost));
|
cname(player->cnum), verb, cname(coun), gain);
|
||||||
if (opt_LOANS) {
|
|
||||||
|
if (opt_LOANS && sp->sct_own) {
|
||||||
for (loan_num = 0; getloan(loan_num, &loan); loan_num++) {
|
for (loan_num = 0; getloan(loan_num, &loan); loan_num++) {
|
||||||
if (loan.l_status == LS_SIGNED && loan.l_loner == coun) {
|
if (loan.l_status == LS_SIGNED && loan.l_loner == coun) {
|
||||||
loan.l_loner = player->cnum;
|
loan.l_loner = player->cnum;
|
||||||
|
@ -91,7 +95,7 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_MARKET) {
|
if (opt_MARKET && sp->sct_own) {
|
||||||
for (comm_num = 0; getcomm(comm_num, &comm); comm_num++) {
|
for (comm_num = 0; getcomm(comm_num, &comm); comm_num++) {
|
||||||
if (comm.com_owner == 0)
|
if (comm.com_owner == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -91,6 +91,7 @@ static int
|
||||||
checksect(struct sctstr *sp)
|
checksect(struct sctstr *sp)
|
||||||
{
|
{
|
||||||
int mil, civs, loyalcivs;
|
int mil, civs, loyalcivs;
|
||||||
|
natid own;
|
||||||
|
|
||||||
item_prewrite(sp->sct_item);
|
item_prewrite(sp->sct_item);
|
||||||
|
|
||||||
|
@ -113,9 +114,7 @@ checksect(struct sctstr *sp)
|
||||||
if (sp->sct_own && !loyalcivs && !(sp->sct_flags & MOVE_IN_PROGRESS)) {
|
if (sp->sct_own && !loyalcivs && !(sp->sct_flags & MOVE_IN_PROGRESS)) {
|
||||||
if (!mil && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
|
if (!mil && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
|
||||||
/* more cruft! */
|
/* more cruft! */
|
||||||
if (sp->sct_type == SCT_CAPIT || sp->sct_type == SCT_MOUNT)
|
own = sp->sct_own;
|
||||||
caploss(sp, sp->sct_own, "");
|
|
||||||
|
|
||||||
if (sp->sct_oldown == sp->sct_own) {
|
if (sp->sct_oldown == sp->sct_own) {
|
||||||
makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
|
makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
|
||||||
sp->sct_own = 0;
|
sp->sct_own = 0;
|
||||||
|
@ -123,6 +122,8 @@ checksect(struct sctstr *sp)
|
||||||
} else
|
} else
|
||||||
takeover(sp, sp->sct_oldown);
|
takeover(sp, sp->sct_oldown);
|
||||||
sp->sct_mobil = 0;
|
sp->sct_mobil = 0;
|
||||||
|
if (sp->sct_type == SCT_CAPIT || sp->sct_type == SCT_MOUNT)
|
||||||
|
caploss(sp, own, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue