show button to mapper when placing unused tiles

This commit is contained in:
Tim Schumacher 2016-05-01 18:08:07 +02:00
parent e61456f381
commit aeea3777a3
4 changed files with 18 additions and 1 deletions

View file

@ -721,6 +721,7 @@ public:
m_SpeedupMaxSpeed = 0;
m_SpeedupAngle = 0;
m_LargeLayerWasWarned = false;
m_PreventUnusedTilesWasWarned = false;
m_AllowPlaceUnusedTiles = false;
}
@ -782,12 +783,14 @@ public:
POPEVENT_NEW,
POPEVENT_SAVE,
POPEVENT_LARGELAYER,
POPEVENT_PREVENTUNUSEDTILES
};
int m_PopupEventType;
int m_PopupEventActivated;
int m_PopupEventWasActivated;
bool m_LargeLayerWasWarned;
bool m_PreventUnusedTilesWasWarned;
bool m_AllowPlaceUnusedTiles;
enum

View file

@ -46,6 +46,11 @@ void CLayerGame::SetTile(int x, int y, CTile tile)
} else {
CTile air = {TILE_AIR};
CLayerTiles::SetTile(x, y, air);
if(!m_pEditor->m_PreventUnusedTilesWasWarned) {
m_pEditor->m_PopupEventType = m_pEditor->POPEVENT_PREVENTUNUSEDTILES;
m_pEditor->m_PopupEventActivated = true;
m_pEditor->m_PreventUnusedTilesWasWarned = true;
}
}
}
}

View file

@ -1318,6 +1318,11 @@ void CLayerFront::SetTile(int x, int y, CTile tile)
} else {
CTile air = {TILE_AIR};
CLayerTiles::SetTile(x, y, air);
if(!m_pEditor->m_PreventUnusedTilesWasWarned) {
m_pEditor->m_PopupEventType = m_pEditor->POPEVENT_PREVENTUNUSEDTILES;
m_pEditor->m_PopupEventActivated = true;
m_pEditor->m_PreventUnusedTilesWasWarned = true;
}
}
}

View file

@ -1040,6 +1040,8 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View)
pEditor->UI()->DoLabel(&Label, "Save map", 20.0f, 0);
else if(pEditor->m_PopupEventType == POPEVENT_LARGELAYER)
pEditor->UI()->DoLabel(&Label, "Large layer", 20.0f, 0);
else if(pEditor->m_PopupEventType == POPEVENT_PREVENTUNUSEDTILES)
pEditor->UI()->DoLabel(&Label, "Unused tiles disabled", 20.0f, 0);
View.HSplitBottom(10.0f, &View, 0);
View.HSplitBottom(20.0f, &View, &ButtonBar);
@ -1058,6 +1060,8 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View)
pEditor->UI()->DoLabel(&Label, "The file already exists.\nDo you want to overwrite the map?", 10.0f, -1);
else if(pEditor->m_PopupEventType == POPEVENT_LARGELAYER)
pEditor->UI()->DoLabel(&Label, "You are trying to set the height or width of a layer to more than 1000 tiles. This is actually possible, but only rarely necessary. It may cause the editor to work slower, larger file size as well as higher memory usage for client and server.", 10.0f, -1, Label.w-10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_PREVENTUNUSEDTILES)
pEditor->UI()->DoLabel(&Label, "Unused tiles can't be placed by default because they could get a use later and then destroy your map. If you are mapping for a different gametype you can activate the 'Unused' switch to be able to place every tile.", 10.0f, -1, Label.w-10.0f);
// button bar
ButtonBar.VSplitLeft(30.0f, 0, &ButtonBar);
@ -1081,7 +1085,7 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View)
}
ButtonBar.VSplitRight(30.0f, &ButtonBar, 0);
ButtonBar.VSplitRight(110.0f, &ButtonBar, &Label);
if(pEditor->m_PopupEventType != POPEVENT_LARGELAYER)
if(pEditor->m_PopupEventType != POPEVENT_LARGELAYER && pEditor->m_PopupEventType != POPEVENT_PREVENTUNUSEDTILES)
{
static int s_AbortButton = 0;
if(pEditor->DoButton_Editor(&s_AbortButton, "Abort", 0, &Label, 0, 0))