mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #14 from east/demoslice
Demoslice: Refuse to overwrite demo
This commit is contained in:
commit
9cf25ef203
|
@ -313,6 +313,7 @@ public:
|
|||
void setPopup(int Popup) { m_Popup = Popup; }
|
||||
|
||||
int m_DemoPlayerState;
|
||||
char m_aDemoPlayerPopupHint[256];
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
|
||||
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
|
||||
Part.VMargin(20.f/UI()->Scale(), &Part);
|
||||
UI()->DoLabelScaled(&Part, m_aDemoPlayerPopupHint, 24.f, 0);
|
||||
|
||||
|
||||
CUIRect Label, TextBox, Ok, Abort;
|
||||
|
@ -101,11 +102,16 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static int s_ButtonOk = 0;
|
||||
if(DoButton_Menu(&s_ButtonOk, Localize("Ok"), 0, &Ok) || m_EnterPressed)
|
||||
{
|
||||
m_DemoPlayerState = DEMOPLAYER_NONE;
|
||||
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;
|
||||
|
||||
char aPath[512];
|
||||
str_format(aPath, sizeof(aPath), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
||||
Client()->DemoSlice(aPath);
|
||||
char aPath[512];
|
||||
str_format(aPath, sizeof(aPath), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
||||
Client()->DemoSlice(aPath);
|
||||
}
|
||||
}
|
||||
|
||||
Box.HSplitBottom(60.f, &Box, &Part);
|
||||
|
@ -376,8 +382,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
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));
|
||||
m_aDemoPlayerPopupHint[0] = '\0';
|
||||
m_DemoPlayerState = DEMOPLAYER_SLICE_SAVE;
|
||||
//Client()->DemoSlice();
|
||||
}
|
||||
|
||||
// close button
|
||||
|
|
Loading…
Reference in a new issue