Add/use temporary variables to improve readability

This commit is contained in:
Robert Müller 2022-08-14 12:49:13 +02:00
parent 45a20ff277
commit 813522f1fc

View file

@ -700,14 +700,15 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
TILE_TELECHECKOUT,
TILE_TELEINWEAPON,
TILE_TELEINHOOK};
mem_copy(((CLayerTele *)pTiles)->m_pTeleTile, pTeleData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTeleTile));
CTeleTile *pLayerTeleTiles = ((CLayerTele *)pTiles)->m_pTeleTile;
mem_copy(pLayerTeleTiles, pTeleData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTeleTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
pTiles->m_pTiles[i].m_Index = 0;
for(int TilesRep : s_aTilesRep)
{
if(((CLayerTele *)pTiles)->m_pTeleTile[i].m_Type == TilesRep)
if(pLayerTeleTiles[i].m_Type == TilesRep)
pTiles->m_pTiles[i].m_Index = TilesRep;
}
}
@ -721,11 +722,12 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
if(Size >= (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSpeedupTile))
{
mem_copy(((CLayerSpeedup *)pTiles)->m_pSpeedupTile, pSpeedupData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSpeedupTile));
CSpeedupTile *pLayerSpeedupTiles = ((CLayerSpeedup *)pTiles)->m_pSpeedupTile;
mem_copy(pLayerSpeedupTiles, pSpeedupData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSpeedupTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
if(((CLayerSpeedup *)pTiles)->m_pSpeedupTile[i].m_Force > 0)
if(pLayerSpeedupTiles[i].m_Force > 0)
pTiles->m_pTiles[i].m_Index = TILE_BOOST;
else
pTiles->m_pTiles[i].m_Index = 0;
@ -767,7 +769,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
TILE_ALLOW_TELE_GUN,
TILE_ALLOW_BLUE_TELE_GUN};
CSwitchTile *pLayerSwitchTiles = ((CLayerSwitch *)pTiles)->m_pSwitchTile;
mem_copy(((CLayerSwitch *)pTiles)->m_pSwitchTile, pSwitchData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSwitchTile));
mem_copy(pLayerSwitchTiles, pSwitchData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSwitchTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
@ -799,7 +801,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
if(Size >= (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTuneTile))
{
CTuneTile *pLayerTuneTiles = ((CLayerTune *)pTiles)->m_pTuneTile;
mem_copy(((CLayerTune *)pTiles)->m_pTuneTile, pTuneData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTuneTile));
mem_copy(pLayerTuneTiles, pTuneData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTuneTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{