diff --git a/src/game/editor/mapitems/layer_front.cpp b/src/game/editor/mapitems/layer_front.cpp index f046299c4..b553ead21 100644 --- a/src/game/editor/mapitems/layer_front.cpp +++ b/src/game/editor/mapitems/layer_front.cpp @@ -27,12 +27,7 @@ void CLayerFront::SetTile(int x, int y, CTile Tile) { CTile air = {TILE_AIR}; CLayerTiles::SetTile(x, y, air); - if(!m_pEditor->m_PreventUnusedTilesWasWarned) - { - m_pEditor->m_PopupEventType = CEditor::POPEVENT_PREVENTUNUSEDTILES; - m_pEditor->m_PopupEventActivated = true; - m_pEditor->m_PreventUnusedTilesWasWarned = true; - } + ShowPreventUnusedTilesWarning(); } } diff --git a/src/game/editor/mapitems/layer_game.cpp b/src/game/editor/mapitems/layer_game.cpp index eb0ee541f..168595d97 100644 --- a/src/game/editor/mapitems/layer_game.cpp +++ b/src/game/editor/mapitems/layer_game.cpp @@ -56,12 +56,7 @@ void CLayerGame::SetTile(int x, int y, CTile Tile) { CTile air = {TILE_AIR}; CLayerTiles::SetTile(x, y, air); - if(!m_pEditor->m_PreventUnusedTilesWasWarned) - { - m_pEditor->m_PopupEventType = CEditor::POPEVENT_PREVENTUNUSEDTILES; - m_pEditor->m_PopupEventActivated = true; - m_pEditor->m_PreventUnusedTilesWasWarned = true; - } + ShowPreventUnusedTilesWarning(); } } } diff --git a/src/game/editor/mapitems/layer_speedup.cpp b/src/game/editor/mapitems/layer_speedup.cpp index 02795a431..9222bf551 100644 --- a/src/game/editor/mapitems/layer_speedup.cpp +++ b/src/game/editor/mapitems/layer_speedup.cpp @@ -144,6 +144,9 @@ void CLayerSpeedup::BrushDraw(std::shared_ptr pBrush, float wx, float wy m_pSpeedupTile[Index].m_Angle = 0; m_pSpeedupTile[Index].m_Type = 0; m_pTiles[Index].m_Index = 0; + + if(pSpeedupLayer->m_pTiles[y * pSpeedupLayer->m_Width + x].m_Index != TILE_AIR) + ShowPreventUnusedTilesWarning(); } SSpeedupTileStateChange::SData Current{ @@ -258,6 +261,9 @@ void CLayerSpeedup::FillSelection(bool Empty, std::shared_ptr pBrush, CU m_pTiles[TgtIndex].m_Index = 0; m_pSpeedupTile[TgtIndex].m_Force = 0; m_pSpeedupTile[TgtIndex].m_Angle = 0; + + if(!Empty) + ShowPreventUnusedTilesWarning(); } else { diff --git a/src/game/editor/mapitems/layer_switch.cpp b/src/game/editor/mapitems/layer_switch.cpp index 6d59903b6..35d9a1045 100644 --- a/src/game/editor/mapitems/layer_switch.cpp +++ b/src/game/editor/mapitems/layer_switch.cpp @@ -144,6 +144,9 @@ void CLayerSwitch::BrushDraw(std::shared_ptr pBrush, float wx, float wy) m_pSwitchTile[Index].m_Flags = 0; m_pSwitchTile[Index].m_Delay = 0; m_pTiles[Index].m_Index = 0; + + if(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index != TILE_AIR) + ShowPreventUnusedTilesWarning(); } SSwitchTileStateChange::SData Current{ @@ -265,6 +268,9 @@ void CLayerSwitch::FillSelection(bool Empty, std::shared_ptr pBrush, CUI m_pSwitchTile[TgtIndex].m_Type = 0; m_pSwitchTile[TgtIndex].m_Number = 0; m_pSwitchTile[TgtIndex].m_Delay = 0; + + if(!Empty) + ShowPreventUnusedTilesWarning(); } else { diff --git a/src/game/editor/mapitems/layer_tele.cpp b/src/game/editor/mapitems/layer_tele.cpp index 0006a74c9..a4faf3277 100644 --- a/src/game/editor/mapitems/layer_tele.cpp +++ b/src/game/editor/mapitems/layer_tele.cpp @@ -142,6 +142,9 @@ void CLayerTele::BrushDraw(std::shared_ptr pBrush, float wx, float wy) m_pTeleTile[Index].m_Number = 0; m_pTeleTile[Index].m_Type = 0; m_pTiles[Index].m_Index = 0; + + if(pTeleLayer->m_pTiles[y * pTeleLayer->m_Width + x].m_Index != TILE_AIR) + ShowPreventUnusedTilesWarning(); } STeleTileStateChange::SData Current{ @@ -254,6 +257,9 @@ void CLayerTele::FillSelection(bool Empty, std::shared_ptr pBrush, CUIRe m_pTiles[TgtIndex].m_Index = 0; m_pTeleTile[TgtIndex].m_Type = 0; m_pTeleTile[TgtIndex].m_Number = 0; + + if(!Empty) + ShowPreventUnusedTilesWarning(); } else { diff --git a/src/game/editor/mapitems/layer_tiles.cpp b/src/game/editor/mapitems/layer_tiles.cpp index a3ed05c33..c134a78e7 100644 --- a/src/game/editor/mapitems/layer_tiles.cpp +++ b/src/game/editor/mapitems/layer_tiles.cpp @@ -1259,3 +1259,13 @@ void CLayerTiles::ModifyEnvelopeIndex(FIndexModifyFunction Func) { Func(&m_ColorEnv); } + +void CLayerTiles::ShowPreventUnusedTilesWarning() +{ + if(!m_pEditor->m_PreventUnusedTilesWasWarned) + { + m_pEditor->m_PopupEventType = CEditor::POPEVENT_PREVENTUNUSEDTILES; + m_pEditor->m_PopupEventActivated = true; + m_pEditor->m_PreventUnusedTilesWasWarned = true; + } +} diff --git a/src/game/editor/mapitems/layer_tiles.h b/src/game/editor/mapitems/layer_tiles.h index ca8e84e88..c778c8d45 100644 --- a/src/game/editor/mapitems/layer_tiles.h +++ b/src/game/editor/mapitems/layer_tiles.h @@ -188,6 +188,8 @@ public: protected: void RecordStateChange(int x, int y, CTile Previous, CTile Tile); + void ShowPreventUnusedTilesWarning(); + friend class CAutoMapper; }; diff --git a/src/game/editor/mapitems/layer_tune.cpp b/src/game/editor/mapitems/layer_tune.cpp index 0a41fcc7b..c14a67767 100644 --- a/src/game/editor/mapitems/layer_tune.cpp +++ b/src/game/editor/mapitems/layer_tune.cpp @@ -127,6 +127,9 @@ void CLayerTune::BrushDraw(std::shared_ptr pBrush, float wx, float wy) m_pTuneTile[Index].m_Number = 0; m_pTuneTile[Index].m_Type = 0; m_pTiles[Index].m_Index = 0; + + if(pTuneLayer->m_pTiles[y * pTuneLayer->m_Width + x].m_Index != TILE_AIR) + ShowPreventUnusedTilesWarning(); } STuneTileStateChange::SData Current{ @@ -235,6 +238,9 @@ void CLayerTune::FillSelection(bool Empty, std::shared_ptr pBrush, CUIRe m_pTiles[TgtIndex].m_Index = 0; m_pTuneTile[TgtIndex].m_Type = 0; m_pTuneTile[TgtIndex].m_Number = 0; + + if(!Empty) + ShowPreventUnusedTilesWarning(); } else {