Use const pointers and static_cast for tile data

This commit is contained in:
Robert Müller 2022-12-13 22:11:53 +01:00
parent b82ec33921
commit 39217e10a9

View file

@ -3450,15 +3450,16 @@ void CGameContext::OnInit()
void CGameContext::CreateAllEntities(bool Initial)
{
CMapItemLayerTilemap *pTileMap = m_Layers.GameLayer();
CTile *pTiles = (CTile *)Kernel()->RequestInterface<IMap>()->GetData(pTileMap->m_Data);
const CMapItemLayerTilemap *pTileMap = m_Layers.GameLayer();
const CTile *pTiles = static_cast<CTile *>(Kernel()->RequestInterface<IMap>()->GetData(pTileMap->m_Data));
CTile *pFront = nullptr;
CSwitchTile *pSwitch = nullptr;
const CTile *pFront = nullptr;
if(m_Layers.FrontLayer())
pFront = (CTile *)Kernel()->RequestInterface<IMap>()->GetData(m_Layers.FrontLayer()->m_Front);
pFront = static_cast<CTile *>(Kernel()->RequestInterface<IMap>()->GetData(m_Layers.FrontLayer()->m_Front));
const CSwitchTile *pSwitch = nullptr;
if(m_Layers.SwitchLayer())
pSwitch = (CSwitchTile *)Kernel()->RequestInterface<IMap>()->GetData(m_Layers.SwitchLayer()->m_Switch);
pSwitch = static_cast<CSwitchTile *>(Kernel()->RequestInterface<IMap>()->GetData(m_Layers.SwitchLayer()->m_Switch));
for(int y = 0; y < pTileMap->m_Height; y++)
{