From 638c1345291c912bbd318f2d98eaf38efa7dd104 Mon Sep 17 00:00:00 2001 From: Bluub Date: Sat, 19 Jun 2021 13:47:46 +0200 Subject: [PATCH] reinterpet instead of static --- sources/Map/LuaMap.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sources/Map/LuaMap.cpp b/sources/Map/LuaMap.cpp index a52d98ea..11e3d0d3 100644 --- a/sources/Map/LuaMap.cpp +++ b/sources/Map/LuaMap.cpp @@ -184,7 +184,7 @@ namespace BBM { LuaG::State state(L); int index = 1; - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.newTable(); for (int i = 0; i < 17; i++) { state.push(index++); @@ -204,7 +204,7 @@ namespace BBM { LuaG::State state(L); int index = 1; - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.newTable(); for (int i = 0; i < 17; i++) { state.push(index++); @@ -227,7 +227,7 @@ namespace BBM auto x2 = state.getNumber(-2); auto y1 = state.getNumber(-3); auto x1 = state.getNumber(-4); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); Vector2f fst(x1, y1); Vector2f snd(x2, y2); auto path = map->pathfind(fst, snd); @@ -250,7 +250,7 @@ namespace BBM int LuaMap::getPlayer(lua_State *L) { LuaG::State state(L); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.newTable(); state.push("x"); state.push(map->_player.x); @@ -264,7 +264,7 @@ namespace BBM int LuaMap::getPlayerRound(lua_State *L) { LuaG::State state(L); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.newTable(); state.push("x"); state.push(map->_roundedPlayer.x); @@ -278,7 +278,7 @@ namespace BBM int LuaMap::getClosestSafeSpace(lua_State *L) { LuaG::State state(L); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); Vector2f closest = map->findSafeSpace(); state.newTable(); state.push("x"); @@ -293,7 +293,7 @@ namespace BBM int LuaMap::getDangerLevelPlayer(lua_State *L) { LuaG::State state(L); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); lua_pushboolean(L, map->_danger[map->_roundedPlayer.y][map->_roundedPlayer.x] > 0); return 1; } @@ -303,7 +303,7 @@ namespace BBM LuaG::State state(L); auto y = state.getNumber(-1); auto x = state.getNumber(-2); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.push(map->_danger[y][x]); return 1; } @@ -313,7 +313,7 @@ namespace BBM LuaG::State state(L); auto y = state.getNumber(-1); auto x = state.getNumber(-2); - const LuaMap *map = static_cast(state.getPointer(state.getFirstUpValueIdx())); + const LuaMap *map = reinterpret_cast(state.getPointer(state.getFirstUpValueIdx())); state.push(map->_map[y][x]); return 1; }