From 7ff05cfd27c82edacf743a67e4cae45ad18048f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Fri, 4 Oct 2024 20:37:12 +0200 Subject: [PATCH] [Player] Fixed crash when loading multiplayer level with outside player spawn position player::start_roomnum and object::roomnum encode a terrain cell number with the highest bit set. So when accessing Terrain_seg[] we need to remove that bit to get a valid index. --- Descent3/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Descent3/Player.cpp b/Descent3/Player.cpp index b0b517a15..2264e9614 100644 --- a/Descent3/Player.cpp +++ b/Descent3/Player.cpp @@ -1336,7 +1336,7 @@ int PlayerGetRandomStartPosition(int slot) { room *rp = &Rooms[Players[num].start_roomnum]; objnum = rp->objects; } else { - objnum = Terrain_seg[Players[num].start_roomnum].objects; + objnum = Terrain_seg[CELLNUM(Players[num].start_roomnum)].objects; } int bad = 0; for (; objnum != -1 && !bad; objnum = Objects[objnum].next) {