Remove option SLOW_WAR
SLOW_WAR has issues: * The check whether the attacker old-owns the attacked sector is broken, because att_abort() uses sect.sct_oldown uninitialized. Spotted by the Clang Static Analyzer. * Its implementation in setrel() is somewhat scary. It's actually okay, because that part of setrel() only runs within decl(). Other callers don't reach it: update_main() because player->god != 0 there, and the rest because they never pass a rel < HOSTILE. * Documentation is a bit vague. SLOW_WAR hasn't been used in a public game in years. Fixing it is not worth it, so remove it instead.
This commit is contained in:
parent
a94ae5f8c1
commit
439f111f98
23 changed files with 11 additions and 274 deletions
|
@ -53,7 +53,6 @@ setrel(natid us, natid them, int rel)
|
|||
int n_up = 0;
|
||||
int n_down = 0;
|
||||
char *addendum = NULL;
|
||||
int theirrel;
|
||||
|
||||
if (rel < AT_WAR)
|
||||
rel = AT_WAR;
|
||||
|
@ -84,34 +83,6 @@ setrel(natid us, natid them, int rel)
|
|||
n_up = N_UP_HOSTILE;
|
||||
n_down = N_DOWN_HOSTILE;
|
||||
} else if (rel < HOSTILE) {
|
||||
if (opt_SLOW_WAR) {
|
||||
struct natstr *natp2;
|
||||
double cost;
|
||||
|
||||
if (!player->god) {
|
||||
natp2 = themnp;
|
||||
theirrel = getrel(natp2, us);
|
||||
if (theirrel <= MOBILIZATION) {
|
||||
rel = theirrel;
|
||||
cost = 0;
|
||||
} else if (us == player->cnum && !update_running) {
|
||||
if (mynp->nat_money < War_Cost) {
|
||||
mpr(us, "You don't have the money!\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
rel = MOBILIZATION;
|
||||
cost = War_Cost;
|
||||
} else { /* nreport is forcing us to decl war */
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (rel >= oldrel) {
|
||||
if (us == player->cnum && !update_running)
|
||||
mpr(us, "No change required for that!\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
player->dolcost += cost;
|
||||
}
|
||||
}
|
||||
addendum = "Declaration made (give 'em hell).";
|
||||
n_down = N_DECL_WAR;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue