mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Ask for confirmation before placing border tiles (fixes #2823)
This commit is contained in:
parent
f92a4753c3
commit
bb2be60a08
|
@ -1298,9 +1298,10 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
if(pT)
|
||||
{
|
||||
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
||||
if(DoButton_Ex(&s_BorderBut, "Border", 0, &Button, 0, "Adds border tiles", CUI::CORNER_ALL))
|
||||
if(DoButton_Ex(&s_BorderBut, "Border", 0, &Button, 0, "Place tiles in a 2-tile wide border at the edges of the layer", CUI::CORNER_ALL))
|
||||
{
|
||||
DoMapBorder();
|
||||
m_PopupEventType = POPEVENT_PLACE_BORDER_TILES;
|
||||
m_PopupEventActivated = true;
|
||||
}
|
||||
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
|
||||
}
|
||||
|
@ -6401,7 +6402,7 @@ void CEditor::Init()
|
|||
ms_PickerColor = ColorHSVA(1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void CEditor::DoMapBorder()
|
||||
void CEditor::PlaceBorderTiles()
|
||||
{
|
||||
CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
|
||||
|
|
|
@ -812,6 +812,7 @@ public:
|
|||
POPEVENT_PREVENTUNUSEDTILES,
|
||||
POPEVENT_IMAGEDIV16,
|
||||
POPEVENT_IMAGE_MAX,
|
||||
POPEVENT_PLACE_BORDER_TILES
|
||||
};
|
||||
|
||||
int m_PopupEventType;
|
||||
|
@ -934,7 +935,7 @@ public:
|
|||
float m_CommandBox;
|
||||
char m_aSettingsCommand[256];
|
||||
|
||||
void DoMapBorder();
|
||||
void PlaceBorderTiles();
|
||||
int DoButton_Editor_Common(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
|
||||
int DoButton_Editor(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
|
||||
int DoButton_Env(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pToolTip, ColorRGBA Color);
|
||||
|
|
|
@ -1100,6 +1100,8 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pEditor->UI()->DoLabel(&Label, "Image width/height", 20.0f, 0);
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_IMAGE_MAX)
|
||||
pEditor->UI()->DoLabel(&Label, "Max images", 20.0f, 0);
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_PLACE_BORDER_TILES)
|
||||
pEditor->UI()->DoLabel(&Label, "Place border tiles", 20.0f, 0);
|
||||
|
||||
View.HSplitBottom(10.0f, &View, 0);
|
||||
View.HSplitBottom(20.0f, &View, &ButtonBar);
|
||||
|
@ -1125,6 +1127,8 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pEditor->UI()->DoLabel(&Label, "The width or height of this image is not divisible by 16. This is required for images used in tile layers for Teeworlds 0.7 compatibility.", 10.0f, -1, Label.w - 10.0f);
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_IMAGE_MAX)
|
||||
pEditor->UI()->DoLabel(&Label, "The client only allows a maximum of 64 images.", 10.0f, -1, Label.w - 10.0f);
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_PLACE_BORDER_TILES)
|
||||
pEditor->UI()->DoLabel(&Label, "This is going to overwrite any existing tiles around the edges of the layer.\nContinue?", 10.0f, -1, Label.w - 10.0f);
|
||||
|
||||
// button bar
|
||||
ButtonBar.VSplitLeft(30.0f, 0, &ButtonBar);
|
||||
|
@ -1145,6 +1149,8 @@ int CEditor::PopupEvent(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
}
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_SAVE)
|
||||
pEditor->CallbackSaveMap(pEditor->m_aFileSaveName, IStorage::TYPE_SAVE, pEditor);
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_PLACE_BORDER_TILES)
|
||||
pEditor->PlaceBorderTiles();
|
||||
pEditor->m_PopupEventWasActivated = false;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue