]> git.pond.sub.org Git - empserver/commitdiff
(move, explore): Return early when interdiction destroys everything
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 13 Aug 2004 10:05:32 +0000 (10:05 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 13 Aug 2004 10:05:32 +0000 (10:05 +0000)
moved.  Without that, loyalty computation divided by zero and crashed
when moving civilians to a sector without civilians.  Found and
debugged by Jeff Cotter.  Closes #1005005.

src/lib/commands/expl.c
src/lib/commands/move.c

index 40c332c70ffb29512498376c5a72a810a8b95528..c671abd7a6caac7f695388f56fe63d5e9b6f31d5 100644 (file)
@@ -192,6 +192,12 @@ explore(void)
      *      Check for a multitude of problems
      */
     getsect(endsect.sct_x, endsect.sct_y, &chksect);
+    if (amount <= 0) {
+       getsect(start.sct_x, start.sct_y, &start);
+       sect.sct_flags &= ~MOVE_IN_PROGRESS;
+       putsect(&sect);
+       return RET_FAIL;
+    }
     if (chksect.sct_type == '.') {
        pr("Bridge disappeared!\n");
        getsect(start.sct_x, start.sct_y, &start);
index c735ef682f02a155ed3840f63dad8c32077898a7..8d8d185ae873922dc315b2b97dfbeb56caeded05 100644 (file)
@@ -269,6 +269,13 @@ move(void)
        pr("%d mob left in %s\n", left,
           xyas(start.sct_x, start.sct_y, player->cnum));
 
+    if (amount <= 0) {
+       getsect(x, y, &start);
+       start.sct_flags &= ~MOVE_IN_PROGRESS;
+       putsect(&start);
+       return RET_OK;
+    }
+
 /* If the sector that things are going to is no longer
    owned by the player, and was the starting sector,
    try to find somewhere to dump the stuff.  If nowhere