]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mapvoting.qc
Merge branch 'master' into Lyberta/WaypointIcons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mapvoting.qc
index 5c564d56db45fc7baeabeb9c6fd22240cc4263df..ac64f630ff1d5181372a33c21fb4e67bde03588a 100644 (file)
@@ -1,8 +1,11 @@
 #include "mapvoting.qh"
 
-#include <server/defs.qh>
+#include <server/client.qh>
+#include <common/weapons/_all.qh>
+#include <common/stats.qh>
+#include <server/gamelog.qh>
 #include <server/miscfunctions.qh>
-#include "g_world.qh"
+#include "world.qh"
 #include "command/cmd.qh"
 #include "command/getreplies.qh"
 #include "../common/constants.qh"
@@ -46,10 +49,10 @@ entity mapvote_ent;
  */
 Gametype GameTypeVote_Type_FromString(string type_name)
 {
-       Gametype type = MapInfo_Type_FromString(type_name);
+       Gametype type = MapInfo_Type_FromString(type_name, false);
        if (type == NULL)
                type = MapInfo_Type_FromString(cvar_string(
-                       strcat("sv_vote_gametype_",type_name,"_type")));
+                       strcat("sv_vote_gametype_",type_name,"_type")), false);
        return type;
 }
 
@@ -57,11 +60,11 @@ int GameTypeVote_AvailabilityStatus(string type_name)
 {
        int flag = GTV_FORBIDDEN;
 
-       Gametype type = MapInfo_Type_FromString(type_name);
+       Gametype type = MapInfo_Type_FromString(type_name, false);
        if ( type == NULL )
        {
                type = MapInfo_Type_FromString(cvar_string(
-                       strcat("sv_vote_gametype_",type_name,"_type")));
+                       strcat("sv_vote_gametype_",type_name,"_type")), false);
                flag |= GTV_CUSTOM;
        }
 
@@ -525,7 +528,7 @@ bool MapVote_CheckRules_2()
                        }
                }
        firstPlaceVotes = RandomSelection_best_priority;
-       if ( autocvar_sv_vote_gametype_default_current && currentVotes == firstPlaceVotes )
+       if ( autocvar_sv_vote_gametype_default_current && firstPlaceVotes == 0 )
                firstPlace = currentPlace;
        else
                firstPlace = RandomSelection_chosen_float;
@@ -591,9 +594,9 @@ void MapVote_Tick()
        int totalvotes = 0;
        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // hide scoreboard again
-               if(GetResourceAmount(it, RESOURCE_HEALTH) != 2342)
+               if(GetResource(it, RES_HEALTH) != 2342)
                {
-                       SetResourceAmountExplicit(it, RESOURCE_HEALTH, 2342);
+                       SetResourceExplicit(it, RES_HEALTH, 2342);
                        CS(it).impulse = 0;
 
                        msg_entity = it;
@@ -726,14 +729,14 @@ bool GameTypeVote_Finished(int pos)
        if(!gametypevote || gametypevote_finished)
                return false;
 
+       localcmd("sv_vote_gametype_hook_all\n");
+       localcmd("sv_vote_gametype_hook_", mapvote_maps[pos], "\n");
+
        if ( !GameTypeVote_SetGametype(GameTypeVote_Type_FromString(mapvote_maps[pos])) )
        {
                LOG_TRACE("Selected gametype is not supported by any map");
        }
 
-       localcmd("sv_vote_gametype_hook_all\n");
-       localcmd("sv_vote_gametype_hook_", mapvote_maps[pos], "\n");
-
        gametypevote_finished = true;
 
        return true;