From 3221a265295302fd3d27326be52b634941a4ed75 Mon Sep 17 00:00:00 2001 From: z411 Date: Thu, 25 Nov 2021 16:30:58 -0300 Subject: [PATCH] ToS: Using numeric ToS revision comparison --- qcsrc/menu/xonotic/dialog_termsofservice.qc | 9 ++++----- qcsrc/menu/xonotic/dialog_termsofservice.qh | 2 +- qcsrc/menu/xonotic/util.qc | 4 ++-- qcsrc/menu/xonotic/util.qh | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_termsofservice.qc b/qcsrc/menu/xonotic/dialog_termsofservice.qc index 0abfd7d93..c23cc2747 100644 --- a/qcsrc/menu/xonotic/dialog_termsofservice.qc +++ b/qcsrc/menu/xonotic/dialog_termsofservice.qc @@ -10,11 +10,11 @@ void Close_Clicked(entity btn, entity me) { - LOG_INFO("Accepted ToS version ", _Nex_ExtResponseSystem_NewToS); - cvar_set("_termsofservice_accepted", _Nex_ExtResponseSystem_NewToS); + LOG_INFOF("Accepted ToS version %d", _Nex_ExtResponseSystem_NewToS); + cvar_set("_termsofservice_accepted", ftos(_Nex_ExtResponseSystem_NewToS)); localcmd("saveconfig"); if (main.firstRunDialog.shouldShow()) - main.firstDraw = true; + main.firstDraw = true; Dialog_Close(btn, me); } @@ -71,8 +71,7 @@ void XonoticToS_OnGet(entity fh, entity me, int status) bool XonoticToSDialog_shouldShow() { - LOG_INFO("newtos value: ", _Nex_ExtResponseSystem_NewToS); - return (_Nex_ExtResponseSystem_NewToS != "" && _Nex_ExtResponseSystem_NewToS != autocvar__termsofservice_accepted); + return (_Nex_ExtResponseSystem_NewToS && _Nex_ExtResponseSystem_NewToS > autocvar__termsofservice_accepted); } void XonoticToSDialog_fill(entity me) diff --git a/qcsrc/menu/xonotic/dialog_termsofservice.qh b/qcsrc/menu/xonotic/dialog_termsofservice.qh index 50e22cf91..6f4046613 100644 --- a/qcsrc/menu/xonotic/dialog_termsofservice.qh +++ b/qcsrc/menu/xonotic/dialog_termsofservice.qh @@ -1,6 +1,6 @@ #pragma once -string autocvar__termsofservice_accepted; +float autocvar__termsofservice_accepted; #include "rootdialog.qh" CLASS(XonoticToSDialog, XonoticRootDialog) diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index c41687b9c..6e551f559 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -440,8 +440,8 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data) if(un_tosversion != "") { - _Nex_ExtResponseSystem_NewToS = strzone(un_tosversion); - LOG_INFO("Latest ToS version is ", un_tosversion); + _Nex_ExtResponseSystem_NewToS = stof(un_tosversion); + LOG_INFOF("Latest ToS version is %d", _Nex_ExtResponseSystem_NewToS); } if(un_bannedservers != "") diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index bbe29a072..9e90c7776 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -47,6 +47,6 @@ string _Nex_ExtResponseSystem_PromotedServers; float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh; string _Nex_ExtResponseSystem_RecommendedServers; float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh; -string _Nex_ExtResponseSystem_NewToS; +float _Nex_ExtResponseSystem_NewToS; void CheckSendCvars(entity me, string cvarnamestring); -- 2.39.2