From: terencehill Date: Fri, 19 May 2023 14:12:46 +0000 (+0200) Subject: Implement the gametypevote global as bool both in server and client code X-Git-Tag: xonotic-v0.8.6~101 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=07129f4648e5573178f4280fe6e81dd1bd5e2276;p=xonotic%2Fxonotic-data.pk3dir.git Implement the gametypevote global as bool both in server and client code --- diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index e2aea3055..9e6f6395b 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -39,7 +39,7 @@ int mv_columns; int mv_mouse_selection; int mv_selection_keyboard; -float gametypevote; +bool gametypevote; string mapvote_chosenmap; vector gtv_text_size; vector gtv_text_size_small; @@ -732,14 +732,10 @@ void MapVote_Init() mv_ownvote = -1; mv_timeout = ReadCoord(); - gametypevote = ReadByte(); - - if(gametypevote) - { + int gametypevote_flags = ReadByte(); + gametypevote = boolean(gametypevote_flags & BIT(0)); + if(gametypevote_flags) mapvote_chosenmap = strzone(ReadString()); - if ( gametypevote == 2 ) - gametypevote = 0; - } MapVote_ReadMask(); int i; diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index a942cbf2a..caa7a3c50 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -366,13 +366,13 @@ bool MapVote_SendEntity(entity this, entity to, int sf) if ( gametypevote ) { // gametype vote - WriteByte(MSG_ENTITY, 1); + WriteByte(MSG_ENTITY, BIT(0)); // gametypevote_flags WriteString(MSG_ENTITY, autocvar_nextmap); } else if ( autocvar_sv_vote_gametype ) { // map vote but gametype has been chosen via voting screen - WriteByte(MSG_ENTITY, 2); + WriteByte(MSG_ENTITY, BIT(1)); // gametypevote_flags WriteString(MSG_ENTITY, MapInfo_Type_ToText(MapInfo_CurrentGametype())); } else @@ -473,7 +473,7 @@ bool MapVote_Finished(int mappos) { if ( GameTypeVote_Finished(mappos) ) { - gametypevote = 0; + gametypevote = false; if(autocvar_nextmap != "") { Map_Goto_SetStr(autocvar_nextmap); @@ -829,7 +829,7 @@ bool GameTypeVote_Start() mapvote_count_real = mapvote_count; - gametypevote = 1; + gametypevote = true; if ( really_available == 0 ) { diff --git a/qcsrc/server/mapvoting.qh b/qcsrc/server/mapvoting.qh index 7bc8a84ea..ed8ef6ca1 100644 --- a/qcsrc/server/mapvoting.qh +++ b/qcsrc/server/mapvoting.qh @@ -34,6 +34,6 @@ float GameTypeVote_Start(); float GameTypeVote_Finished(float pos); string GameTypeVote_MapInfo_FixName(string m); -float gametypevote; +bool gametypevote; string getmapname_stored; float mapvote_initialized;