]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/add.c
Make add require confirmation for unadvisable actions
[empserver] / src / lib / commands / add.c
index 5580a903246386ab6c4709d5d995527040687888..6d8f649ccf3770e59dd2623e460c2d41a0589c4d 100644 (file)
@@ -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);