(move, explore): Return early when interdiction destroys everything

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.
This commit is contained in:
Markus Armbruster 2004-08-13 10:05:32 +00:00
parent 9549adefdc
commit 73308d9c57
2 changed files with 13 additions and 0 deletions

View 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);