From: Markus Armbruster Date: Sun, 6 Nov 2011 18:40:21 +0000 (+0100) Subject: Make add require confirmation for unadvisable actions X-Git-Tag: v4.3.29~23 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=6d98cd31341a4e6a21837ab61b031923fd864e3b;ds=sidebyside 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. --- diff --git a/src/lib/commands/add.c b/src/lib/commands/add.c index 5580a9032..6d8f649cc 100644 --- a/src/lib/commands/add.c +++ b/src/lib/commands/add.c @@ -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);