X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmapvoting.qc;h=145f3f0251cdcd7fe219d17f5cc88ba7e95dc8df;hb=0514f7948727cfa572b33bd29d1bdf2c13cd866d;hp=ceb2cdd07850a884875e4895d71f614e3de7867e;hpb=25f7a4a5f137ffb344c47107636fcfc7cdfa2045;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index ceb2cdd07..145f3f025 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -1,17 +1,19 @@ #include "mapvoting.qh" -#include -#include -#include "g_world.qh" -#include "command/cmd.qh" -#include "command/getreplies.qh" -#include "../common/constants.qh" +#include +#include #include -#include "../common/mapinfo.qh" -#include "../common/playerstats.qh" +#include #include -#include "../common/util.qh" - +#include +#include +#include +#include +#include +#include +#include +#include +#include // definitions @@ -46,10 +48,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 +59,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; } @@ -404,7 +406,7 @@ bool MapVote_SendEntity(entity this, entity to, int sf) void MapVote_Spawn() { - Net_LinkEntity(mapvote_ent = spawn(), false, 0, MapVote_SendEntity); + Net_LinkEntity(mapvote_ent = new(mapvote_ent), false, 0, MapVote_SendEntity); } void MapVote_TouchMask() @@ -525,7 +527,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; @@ -726,14 +728,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;