From 90909fb803e0c40a67b08cd41f6d0d447ee62f74 Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Sat, 17 Dec 2022 11:54:18 -0500 Subject: Fix door logic, off by 1 error We were popping the door from the vector and then referencing it by it's index which meant we'd always reference the WRONG door --- src/CApi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/CApi.h') diff --git a/src/CApi.h b/src/CApi.h index c6ffea3..9dbf4d9 100644 --- a/src/CApi.h +++ b/src/CApi.h @@ -236,9 +236,9 @@ static int c_open_door(lua_State *L) { can_open = true; // erase key lvl->heldKeys.erase(lvl->heldKeys.begin() + k); - lvl->doorPositions.erase(lvl->doorPositions.begin() + i); lvl->map[lvl->doorPositions[i].y][lvl->doorPositions[i].x] = BLANK_SPACE; + lvl->doorPositions.erase(lvl->doorPositions.begin() + i); break; } } -- cgit v1.2.3-54-g00ecf