]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mapvoting.qc
Merge branch 'master' into terencehill/itemstime
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mapvoting.qc
index 7a016fd4b313c6653f0c1c2498a944ae72cdb58e..9a2cb1871706d7cb40978ac6a805ef05b093ee7f 100644 (file)
@@ -5,8 +5,12 @@ float GameTypeVote_AvailabilityStatus(string gtname)
                return GTV_FORBIDDEN;
        
        if ( autocvar_nextmap != "" )
-       if ( !MapInfo_Get_ByName(autocvar_nextmap, FALSE, type) )
-               return GTV_FORBIDDEN;
+       {
+               if ( !MapInfo_Get_ByName(autocvar_nextmap, FALSE, 0) )
+                       return GTV_FORBIDDEN;
+               if (!(MapInfo_Map_supportedGametypes & type))
+                       return GTV_FORBIDDEN;
+       }
        
        return GTV_AVAILABLE;
 }
@@ -252,10 +256,20 @@ float MapVote_SendEntity(entity to, float sf)
                WriteByte(MSG_ENTITY, mapvote_detail);
                WriteCoord(MSG_ENTITY, mapvote_timeout);
                
-               WriteByte(MSG_ENTITY, gametypevote);
-
-               if(gametypevote)
+               if ( gametypevote )
+               {
+                       // gametype vote
+                       WriteByte(MSG_ENTITY, 1);
                        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);
+                       WriteString(MSG_ENTITY, MapInfo_Type_ToText(MapInfo_CurrentGametype()));
+               }
+               else
+                       WriteByte(MSG_ENTITY, 0); // map vote
 
                MapVote_WriteMask();
 
@@ -529,12 +543,11 @@ void MapVote_Tick()
 
 void MapVote_Start()
 {
-       if(mapvote_run)
-               return;
+       // if mapvote is already running, don't do this initialization again
+       if(mapvote_run) { return; }
 
-       // wait for stats to be sent first
-       if(!playerstats_waitforme)
-               return;
+       // don't start mapvote until after playerstats gamereport is sent
+       if(PlayerStats_GameReport_DelayMapVote) { return; }
 
        MapInfo_Enumerate();
        if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1))