From 39217e10a9cc810d7b4edd7fd91cdc6937269818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 13 Dec 2022 22:11:53 +0100 Subject: [PATCH] Use `const` pointers and `static_cast` for tile data --- src/game/server/gamecontext.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 103d86137..5ae403833 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3450,15 +3450,16 @@ void CGameContext::OnInit() void CGameContext::CreateAllEntities(bool Initial) { - CMapItemLayerTilemap *pTileMap = m_Layers.GameLayer(); - CTile *pTiles = (CTile *)Kernel()->RequestInterface()->GetData(pTileMap->m_Data); + const CMapItemLayerTilemap *pTileMap = m_Layers.GameLayer(); + const CTile *pTiles = static_cast(Kernel()->RequestInterface()->GetData(pTileMap->m_Data)); - CTile *pFront = nullptr; - CSwitchTile *pSwitch = nullptr; + const CTile *pFront = nullptr; if(m_Layers.FrontLayer()) - pFront = (CTile *)Kernel()->RequestInterface()->GetData(m_Layers.FrontLayer()->m_Front); + pFront = static_cast(Kernel()->RequestInterface()->GetData(m_Layers.FrontLayer()->m_Front)); + + const CSwitchTile *pSwitch = nullptr; if(m_Layers.SwitchLayer()) - pSwitch = (CSwitchTile *)Kernel()->RequestInterface()->GetData(m_Layers.SwitchLayer()->m_Switch); + pSwitch = static_cast(Kernel()->RequestInterface()->GetData(m_Layers.SwitchLayer()->m_Switch)); for(int y = 0; y < pTileMap->m_Height; y++) {