mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
DemoPlayer: Refuse to overwrite demo
This commit is contained in:
parent
070ebe2895
commit
862a520857
|
@ -313,6 +313,7 @@ public:
|
||||||
void setPopup(int Popup) { m_Popup = Popup; }
|
void setPopup(int Popup) { m_Popup = Popup; }
|
||||||
|
|
||||||
int m_DemoPlayerState;
|
int m_DemoPlayerState;
|
||||||
|
char m_aDemoPlayerPopupHint[256];
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,6 +77,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
|
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
|
||||||
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
|
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
|
||||||
Part.VMargin(20.f/UI()->Scale(), &Part);
|
Part.VMargin(20.f/UI()->Scale(), &Part);
|
||||||
|
UI()->DoLabelScaled(&Part, m_aDemoPlayerPopupHint, 24.f, 0);
|
||||||
|
|
||||||
|
|
||||||
CUIRect Label, TextBox, Ok, Abort;
|
CUIRect Label, TextBox, Ok, Abort;
|
||||||
|
@ -100,6 +101,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
|
|
||||||
static int s_ButtonOk = 0;
|
static int s_ButtonOk = 0;
|
||||||
if(DoButton_Menu(&s_ButtonOk, Localize("Ok"), 0, &Ok) || m_EnterPressed)
|
if(DoButton_Menu(&s_ButtonOk, Localize("Ok"), 0, &Ok) || m_EnterPressed)
|
||||||
|
{
|
||||||
|
if (str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, m_aCurrentDemoFile) == 0)
|
||||||
|
str_copy(m_aDemoPlayerPopupHint, "Please use a different name", sizeof(m_aDemoPlayerPopupHint));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_DemoPlayerState = DEMOPLAYER_NONE;
|
m_DemoPlayerState = DEMOPLAYER_NONE;
|
||||||
|
|
||||||
|
@ -107,6 +112,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
str_format(aPath, sizeof(aPath), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
str_format(aPath, sizeof(aPath), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
||||||
Client()->DemoSlice(aPath);
|
Client()->DemoSlice(aPath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Box.HSplitBottom(60.f, &Box, &Part);
|
Box.HSplitBottom(60.f, &Box, &Part);
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
|
@ -376,8 +382,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
if(DoButton_Sprite(&s_SliceSaveButton, IMAGE_FILEICONS, SPRITE_FILE_DEMO2, 0, &Button, CUI::CORNER_ALL))
|
if(DoButton_Sprite(&s_SliceSaveButton, IMAGE_FILEICONS, SPRITE_FILE_DEMO2, 0, &Button, CUI::CORNER_ALL))
|
||||||
{
|
{
|
||||||
str_copy(m_aCurrentDemoFile, m_lDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
str_copy(m_aCurrentDemoFile, m_lDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||||
|
m_aDemoPlayerPopupHint[0] = '\0';
|
||||||
m_DemoPlayerState = DEMOPLAYER_SLICE_SAVE;
|
m_DemoPlayerState = DEMOPLAYER_SLICE_SAVE;
|
||||||
//Client()->DemoSlice();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// close button
|
// close button
|
||||||
|
|
Loading…
Reference in a new issue