Make add require confirmation for unadvisable actions
Deleting a country in state STAT_SANCT, STAT_ACTIVE or STAT_GOD is risky, because any references to this country become dangling, which makes ef_verify() unhappy. For a reason: we may well have code that isn't prepared for dangling references, and breaks. Replacing a country that is being used is risky, because it can get us into weird states. For instance, replacing a player by a visitor can result in a visitor that owns stuff.
This commit is contained in:
parent
d2057af7a2
commit
6d98cd3134
1 changed files with 10 additions and 0 deletions
|
@ -108,6 +108,16 @@ add(void)
|
|||
pr("Illegal status\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
if (stat == STAT_UNUSED
|
||||
? natp->nat_stat >= STAT_SANCT : natp->nat_stat != STAT_UNUSED) {
|
||||
pr("Country %s (#%d) status is %s.\n"
|
||||
"%s it in this state is normally a bad idea.",
|
||||
natp->nat_cnam, natp->nat_cnum,
|
||||
symbol_by_value(natp->nat_stat, nation_status),
|
||||
stat == STAT_UNUSED ? "Deleting" : "Replacing");
|
||||
if (!askyn("Are you sure? "))
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (getplayer(natp->nat_cnum)) {
|
||||
pr("%s (#%d) is logged in!\n",
|
||||
natp->nat_cnam, natp->nat_cnum);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue