Show unused tiles warning popup for all entities layer

This commit is contained in:
Corantin H 2023-12-26 19:11:36 +01:00
parent b77e91633f
commit e9958aca19
8 changed files with 38 additions and 12 deletions

View file

@ -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();
}
}

View file

@ -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();
}
}
}

View file

@ -144,6 +144,9 @@ void CLayerSpeedup::BrushDraw(std::shared_ptr<CLayer> 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<CLayer> pBrush, CU
m_pTiles[TgtIndex].m_Index = 0;
m_pSpeedupTile[TgtIndex].m_Force = 0;
m_pSpeedupTile[TgtIndex].m_Angle = 0;
if(!Empty)
ShowPreventUnusedTilesWarning();
}
else
{

View file

@ -144,6 +144,9 @@ void CLayerSwitch::BrushDraw(std::shared_ptr<CLayer> 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<CLayer> pBrush, CUI
m_pSwitchTile[TgtIndex].m_Type = 0;
m_pSwitchTile[TgtIndex].m_Number = 0;
m_pSwitchTile[TgtIndex].m_Delay = 0;
if(!Empty)
ShowPreventUnusedTilesWarning();
}
else
{

View file

@ -142,6 +142,9 @@ void CLayerTele::BrushDraw(std::shared_ptr<CLayer> 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<CLayer> pBrush, CUIRe
m_pTiles[TgtIndex].m_Index = 0;
m_pTeleTile[TgtIndex].m_Type = 0;
m_pTeleTile[TgtIndex].m_Number = 0;
if(!Empty)
ShowPreventUnusedTilesWarning();
}
else
{

View file

@ -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;
}
}

View file

@ -188,6 +188,8 @@ public:
protected:
void RecordStateChange(int x, int y, CTile Previous, CTile Tile);
void ShowPreventUnusedTilesWarning();
friend class CAutoMapper;
};

View file

@ -127,6 +127,9 @@ void CLayerTune::BrushDraw(std::shared_ptr<CLayer> 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<CLayer> pBrush, CUIRe
m_pTiles[TgtIndex].m_Index = 0;
m_pTuneTile[TgtIndex].m_Type = 0;
m_pTuneTile[TgtIndex].m_Number = 0;
if(!Empty)
ShowPreventUnusedTilesWarning();
}
else
{