void Close_Clicked(entity btn, entity me)
{
- cvar_set("_termsofservice_accepted", "1");
+ LOG_INFO("Setting _termsofservice_accepted to ", _Nex_ExtResponseSystem_NewToS);
+ cvar_set("_termsofservice_accepted", _Nex_ExtResponseSystem_NewToS);
localcmd("saveconfig");
if (main.firstRunDialog.shouldShow())
{
- main.dialogToShow = main.firstRunDialog;
+ main.firstDraw = true;
}
Dialog_Close(btn, me);
}
void XonoticToSDialog_loadXonoticToS(entity me)
{
- /*string ToSText = "";
- int fh = fopen("tos.txt", FILE_READ);
- if (fh >= 0)
- {
- for (string line; (line = fgets(fh)); ) {
- if (ToSText != "")
- {
- ToSText = strcat(ToSText, "\n", line);
- }
- else
- {
- ToSText = line;
- }
- }
- fclose(fh);
- }
- LOG_INFO("Test: ", _Nex_ExtResponseSystem_TOS, ": ", ftos(XonoticToSDialog_shouldShow()));
- me.textBox.setText(me.textBox, ToSText);*/
string downloadurl = "http://maria.omaera.org/tos.txt";
url_single_fopen(downloadurl, FILE_READ, XonoticToS_OnGet, me);
}
bool XonoticToSDialog_shouldShow()
{
- //return (_Nex_ExtResponseSystem_TOS && !autocvar__termsofservice_accepted);
LOG_INFO("newtos value: ", _Nex_ExtResponseSystem_NewToS);
- return (_Nex_ExtResponseSystem_NewToS != "");
+ return (_Nex_ExtResponseSystem_NewToS != autocvar__termsofservice_accepted);
}
void XonoticToSDialog_fill(entity me)
#pragma once
+string autocvar__termsofservice_accepted;
+
#include "rootdialog.qh"
CLASS(XonoticToSDialog, XonoticRootDialog)
METHOD(XonoticToSDialog, shouldShow, bool());
{
SUPER(MainWindow).draw(me);
- if(me.dialogToShow)
- {
- DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
- me.dialogToShow = NULL;
+ if (me.firstDraw) {
+ if (me.ToSDialog.shouldShow())
+ DialogOpenButton_Click_withCoords(NULL, me.ToSDialog, '0 0 0', eX * conwidth + eY * conheight);
+ else if(me.firstRunDialog.shouldShow())
+ DialogOpenButton_Click_withCoords(NULL, me.firstRunDialog, '0 0 0', eX * conwidth + eY * conheight);
+
+ me.firstDraw = false;
}
//-------------------------------------
me.initializeDialog(me, n);
me.disconnectDialogVisibility = 1;
-
- if (me.ToSDialog.shouldShow())
- {
- me.dialogToShow = me.ToSDialog;
- }
- else if(me.firstRunDialog.shouldShow())
- {
- me.dialogToShow = me.firstRunDialog;
- }
}
ATTRIB(MainWindow, languageWarningDialog, entity);
ATTRIB(MainWindow, mainNexposee, entity);
ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND);
- ATTRIB(MainWindow, dialogToShow, entity);
+ ATTRIB(MainWindow, firstDraw, bool, true);
ATTRIB(MainWindow, demostartconfirmDialog, entity);
ATTRIB(MainWindow, demotimeconfirmDialog, entity);
ATTRIB(MainWindow, resetDialog, entity);
{
UpdateNotification_URI_Get_Callback(id, status, data);
}
- else if (id == URI_GET_TOS)
- {
- TOS_URI_Get_Callback(id, status, data);
- }
else
{
LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
if(un_tosversion != "")
{
- if(autocvar__termsofservice_accepted != un_tosversion) {
- _Nex_ExtResponseSystem_NewToS = strzone(un_tosversion);
- LOG_INFO("Setting netwos value to ", un_tosversion);
- }
+ _Nex_ExtResponseSystem_NewToS = strzone(un_tosversion);
+ LOG_INFO("Setting netwos value to ", un_tosversion);
}
if(un_bannedservers != "")
}
}
-void TOS_URI_Get_Callback(float id, float status, string data)
-{
- if(_Nex_ExtResponseSystem_TOS)
- {
- LOG_TRACE("error: TOS_URI_Get_Callback has been called before");
- return;
- }
- if(status != 0)
- {
- LOG_TRACEF("error receiving tos: status is %d", status);
- return;
- }
-
- _Nex_ExtResponseSystem_TOS = strzone(data);
- LOG_INFO("Data: ", _Nex_ExtResponseSystem_TOS);
- LOG_INFO("New TOS version: ", _Nex_ExtResponseSystem_NewToS);
-}
-
// END OF URI SYSTEM ////////////////////////////////////////////////////////
void updateCheck()
void UpdateNotification_URI_Get_Callback(float id, float status, string data);
-void TOS_URI_Get_Callback(float id, float status, string data);
-
// game type list box stuff (does not NEED to contain all game types, other
// types stay available via console)
entity GameType_GetID(int cnt);
float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh;
string _Nex_ExtResponseSystem_RecommendedServers;
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
-string _Nex_ExtResponseSystem_TOS;
string _Nex_ExtResponseSystem_NewToS;
void CheckSendCvars(entity me, string cvarnamestring);
-
-string autocvar__termsofservice_accepted = "0";