]> git.pond.sub.org Git - empserver/commitdiff
(move_ground): explore() used endsect without initialized in certain
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 10 Feb 2004 10:49:21 +0000 (10:49 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 10 Feb 2004 10:49:21 +0000 (10:49 +0000)
cases, e.g. `expl X,Y N X,Y'.  Other callers might have had similar
problems.  Fix: always assign to *END.  Thanks to Marc Olzheim for
help with debugging and fixing this.

src/lib/subs/move.c

index e435d03b4945cb4d7a2f5e8b8db589b78357f4c2..d20175e7443819fe27d7bd5eafe8bd91d914907a 100644 (file)
@@ -76,6 +76,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
     s_char prompt[128];
     s_char buf[1024];
 
+    *end = *start;
     if (mobility <= 0.0)
        return -1;
     *dam = 0;
@@ -101,7 +102,6 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
        }
        if ((total_mcost * weight) > mobility) {
            pr("Not enough mobility to go all the way. Nothing moved.\n");
-           *end = *start;
            return -1;
        }
     }