DemoPlayer: Refuse to overwrite demo

This commit is contained in:
east 2014-08-25 11:19:00 +02:00
parent 070ebe2895
commit 862a520857
2 changed files with 13 additions and 6 deletions

View file

@ -313,6 +313,7 @@ public:
void setPopup(int Popup) { m_Popup = Popup; }
int m_DemoPlayerState;
char m_aDemoPlayerPopupHint[256];
enum
{

View file

@ -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;
char aPath[512];
str_format(aPath, sizeof(aPath), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
Client()->DemoSlice(aPath);
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);
}
}
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