]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement the gametypevote global as bool both in server and client code
authorterencehill <piuntn@gmail.com>
Fri, 19 May 2023 14:12:46 +0000 (16:12 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 19 May 2023 14:12:46 +0000 (16:12 +0200)
qcsrc/client/mapvoting.qc
qcsrc/server/mapvoting.qc
qcsrc/server/mapvoting.qh

index e2aea3055ce0cd19fa5e686f0c6422160015f910..9e6f6395b26750d003b8bf744a72ccf45332ec0c 100644 (file)
@@ -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;
index a942cbf2ac34893c98d6f15eed562926a6b3c600..caa7a3c502b98854997fed6dea4fb202eea6c3ab 100644 (file)
@@ -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 )
        {
index 7bc8a84eabcc48a6995271ed59f1a221fe2933ac..ed8ef6ca1e206f85a9c0648045098b3b0ad74d53 100644 (file)
@@ -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;