From bfac52eb6d5bd16ad4b4421b34cac4338dd9c231 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 19 Jan 2021 19:25:03 +0100 Subject: [PATCH] move_ground: Fix getsect() error checking move_ground() has code to handle getsect() failure. It's dead, because it assumes getsect() returns a negative value on failure. It actually returns zero then. The mistake can be traced back all the way back to BSD Empire 1.1. Fix it. Signed-off-by: Markus Armbruster --- src/lib/subs/move.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/subs/move.c b/src/lib/subs/move.c index e1b036321..95ac4e820 100644 --- a/src/lib/subs/move.c +++ b/src/lib/subs/move.c @@ -111,7 +111,7 @@ move_ground(struct sctstr *start, struct sctstr *end, curx = start->sct_x; cury = start->sct_y; total_mcost = 0.0; - if (getsect(curx, cury, §) < 0) { + if (!getsect(curx, cury, §)) { logerror("move_path: getsect %d,%d", curx, cury); return -1; } @@ -191,7 +191,7 @@ move_ground(struct sctstr *start, struct sctstr *end, */ tmpx = curx + diroff[dir][0]; tmpy = cury + diroff[dir][1]; - if (getsect(tmpx, tmpy, &next) < 0) { + if (!getsect(tmpx, tmpy, &next)) { pr("You can't go there...\n"); *movstr = 0; continue; -- 2.43.0