Better diagnostics when build can't find suitable sectors
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Apr 2011 09:11:23 +0000 (11:11 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 May 2011 13:45:11 +0000 (15:45 +0200)
Report "No sectors" when there are no *owned* sectors, instead of "Bad
sector specification" when there are no sectors at all.

src/lib/commands/buil.c

index 3db8f913f79cb26ead97354467bce23a01833f6c..a77548ef6409f27a37abd5bb805e4eadae9af98f 100644 (file)
@@ -193,17 +193,16 @@ buil(void)
     gotsect = 0;
     while (number-- > 0) {
        while (nxtsct(&nstr, &sect)) {
-           gotsect++;
            if (!player->owner)
                continue;
+           gotsect = 1;
            if (build_it(&sect, type, sect.sct_item, tlev))
                putsect(&sect);
        }
        snxtsct_rewind(&nstr);
     }
-    if (!gotsect) {
-       pr("Bad sector specification.\n");
-    }
+    if (!gotsect)
+       pr("No sectors.\n");
     return RET_OK;
 }
 
@@ -619,15 +618,14 @@ build_bridge(char what)
        return RET_SYN;
     gotsect = 0;
     while (nxtsct(&nstr, &sect)) {
-       gotsect++;
        if (!player->owner)
            continue;
+       gotsect = 1;
        if (build_it(&sect, sect.sct_item))
            putsect(&sect);
     }
-    if (!gotsect) {
-       pr("Bad sector specification.\n");
-    }
+    if (!gotsect)
+       pr("No sectors.\n");
     return RET_OK;
 }