mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Improve code style of InitTilemapSkip
This commit is contained in:
parent
1810ff3949
commit
6c558c2138
|
@ -167,29 +167,29 @@ void CLayers::InitTilemapSkip()
|
|||
{
|
||||
for(int g = 0; g < NumGroups(); g++)
|
||||
{
|
||||
CMapItemGroup *pGroup = GetGroup(g);
|
||||
const CMapItemGroup *pGroup = GetGroup(g);
|
||||
|
||||
for(int l = 0; l < pGroup->m_NumLayers; l++)
|
||||
{
|
||||
CMapItemLayer *pLayer = GetLayer(pGroup->m_StartLayer + l);
|
||||
const CMapItemLayer *pLayer = GetLayer(pGroup->m_StartLayer + l);
|
||||
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
CMapItemLayerTilemap *pTmap = (CMapItemLayerTilemap *)pLayer;
|
||||
CTile *pTiles = (CTile *)m_pMap->GetData(pTmap->m_Data);
|
||||
for(int y = 0; y < pTmap->m_Height; y++)
|
||||
const CMapItemLayerTilemap *pTilemap = (CMapItemLayerTilemap *)pLayer;
|
||||
CTile *pTiles = (CTile *)m_pMap->GetData(pTilemap->m_Data);
|
||||
for(int y = 0; y < pTilemap->m_Height; y++)
|
||||
{
|
||||
for(int x = 1; x < pTmap->m_Width;)
|
||||
for(int x = 1; x < pTilemap->m_Width;)
|
||||
{
|
||||
int sx;
|
||||
for(sx = 1; x + sx < pTmap->m_Width && sx < 255; sx++)
|
||||
int SkippedX;
|
||||
for(SkippedX = 1; x + SkippedX < pTilemap->m_Width && SkippedX < 255; SkippedX++)
|
||||
{
|
||||
if(pTiles[y * pTmap->m_Width + x + sx].m_Index)
|
||||
if(pTiles[y * pTilemap->m_Width + x + SkippedX].m_Index)
|
||||
break;
|
||||
}
|
||||
|
||||
pTiles[y * pTmap->m_Width + x].m_Skip = sx - 1;
|
||||
x += sx;
|
||||
pTiles[y * pTilemap->m_Width + x].m_Skip = SkippedX - 1;
|
||||
x += SkippedX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue