From b4c4491229726113b58c4445ccd29b5627b07b7f Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 19 Oct 2020 16:19:01 -0700 Subject: [PATCH] Fix sign/unsigned comparison bug. We are comparing a signed char with unsigned int. The signed char will be sign exetended when converted to unsigned int causing an unexpected result. --- src/teleport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/teleport.c b/src/teleport.c index 0e47f9735..cb8bb4f40 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1191,10 +1191,10 @@ struct monst *mtmp; sent out of his room (caller might resort to goodpos() if we report failure here, so this isn't full prevention) */ if (mtmp->isshk && inhishop(mtmp)) { - if (levl[x][y].roomno != ESHK(mtmp)->shoproom) + if (levl[x][y].roomno != (unsigned char) ESHK(mtmp)->shoproom) return FALSE; } else if (mtmp->ispriest && inhistemple(mtmp)) { - if (levl[x][y].roomno != EPRI(mtmp)->shroom) + if (levl[x][y].roomno != (unsigned char) EPRI(mtmp)->shroom) return FALSE; } /* current location is */