diff options
| author | Choupom <andycootlapin@hotmail.fr> | 2010-12-15 12:49:36 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-03 12:54:29 +0100 |
| commit | b565d4ab18e9517e6d20924cf3e05fa2994252f3 (patch) | |
| tree | b695ea70bb15184e5980b03c4f281b32c2d95ec6 | |
| parent | a72848e78032014adb1bf053c4556bf1072b0c2d (diff) | |
| download | zcatch-b565d4ab18e9517e6d20924cf3e05fa2994252f3.tar.gz zcatch-b565d4ab18e9517e6d20924cf3e05fa2994252f3.zip | |
fixed so Make/Clear Collision buttons are hidden on game layer
| -rw-r--r-- | src/game/editor/ed_layer_tiles.cpp | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp index 5707587e..43ed7488 100644 --- a/src/game/editor/ed_layer_tiles.cpp +++ b/src/game/editor/ed_layer_tiles.cpp @@ -324,38 +324,47 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty(); if(m_pEditor->m_Map.m_pGameLayer == this) InGameGroup = false; - static int s_ColclButton = 0; - if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), InGameGroup?0:-1, &Button, 0, Localize("Removes collision from this layer"))) + + if(InGameGroup) { - CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer; - int w = min(gl->m_Width, m_Width); - int h = min(gl->m_Height, m_Height); - for(int y = 0; y < h; y++) - for(int x = 0; x < w; x++) + static int s_ColclButton = 0; + if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), 0, &Button, 0, Localize("Removes collision from this layer"))) + { + CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer; + int w = min(gl->m_Width, m_Width); + int h = min(gl->m_Height, m_Height); + for(int y = 0; y < h; y++) { - if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID) - if(m_pTiles[y*m_Width+x].m_Index) - gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR; + for(int x = 0; x < w; x++) + { + if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID) + { + if(m_pTiles[y*m_Width+x].m_Index) + gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR; + } + } } - - return 1; - } - static int s_ColButton = 0; - pToolBox->HSplitBottom(5.0f, pToolBox, &Button); - pToolBox->HSplitBottom(12.0f, pToolBox, &Button); - if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), InGameGroup?0:-1, &Button, 0, Localize("Constructs collision from this layer"))) - { - CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer; - int w = min(gl->m_Width, m_Width); - int h = min(gl->m_Height, m_Height); - for(int y = 0; y < h; y++) - for(int x = 0; x < w; x++) + return 1; + } + + static int s_ColButton = 0; + pToolBox->HSplitBottom(5.0f, pToolBox, &Button); + pToolBox->HSplitBottom(12.0f, pToolBox, &Button); + if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), 0, &Button, 0, Localize("Constructs collision from this layer"))) + { + CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer; + int w = min(gl->m_Width, m_Width); + int h = min(gl->m_Height, m_Height); + for(int y = 0; y < h; y++) { - if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID) - gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR; + for(int x = 0; x < w; x++) + { + if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID) + gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR; + } } - - return 1; + return 1; + } } enum |