From 90dd9e98661a3006cbe5ee27002954a0b978fb8b Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 8 Dec 2022 02:22:01 +0100 Subject: [PATCH] fixed the underflow of mpdist --- landgen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/landgen.cpp b/landgen.cpp index 5633d09e..b47ecf2e 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -2850,10 +2850,10 @@ EX void setdist(cell *c, int d, cell *from) { if(c == &out_of_bounds) return; if(fake::in()) return FPIU(setdist(c, d, from)); + if(d < -64) d = -64; /* otherwise it will underflow */ if(c->mpdist <= d) return; if(c->mpdist > d+1 && d < BARLEV) setdist(c, d+1, from); c->mpdist = d; - // printf("setdist %p %d [%p]\n", c, d, from); // this fixes the following problem: // http://steamcommunity.com/app/342610/discussions/0/1470840994970724215/