#include "mapvoting.qh"
+#include <server/defs.qh>
+#include <server/gamelog.qh>
+#include <server/miscfunctions.qh>
#include "g_world.qh"
#include "command/cmd.qh"
#include "command/getreplies.qh"
#include <common/net_linked.qh>
#include "../common/mapinfo.qh"
#include "../common/playerstats.qh"
+#include <common/state.qh>
#include "../common/util.qh"
*/
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;
}
{
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;
}
void MapVote_ClearAllVotes()
{
- FOREACH_CLIENT(true, LAMBDA(it.mapvote = 0));
+ FOREACH_CLIENT(true, { it.mapvote = 0; });
}
void MapVote_UnzoneStrings()
{
for(int j = 0; j < mapvote_count; ++j)
{
- if ( mapvote_maps[j] )
- {
- strunzone(mapvote_maps[j]);
- mapvote_maps[j] = string_null;
- }
- if ( mapvote_maps_pakfile[j] )
- {
- strunzone(mapvote_maps_pakfile[j]);
- mapvote_maps_pakfile[j] = string_null;
- }
+ strfree(mapvote_maps[j]);
+ strfree(mapvote_maps_pakfile[j]);
}
}
GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]));
}
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(FixClientCvars(it)));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), { FixClientCvars(it); });
if(gametypevote)
{
}
}
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;
return;
int totalvotes = 0;
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
// hide scoreboard again
- if(it.health != 2342)
+ if(GetResource(it, RES_HEALTH) != 2342)
{
- it.health = 2342;
- it.impulse = 0;
+ SetResourceExplicit(it, RES_HEALTH, 2342);
+ CS(it).impulse = 0;
msg_entity = it;
WriteByte(MSG_ONE, SVC_FINALE);
if ( !(mapvote_maps_flags[it.mapvote-1] & GTV_AVAILABLE) )
it.mapvote = 0;
// use impulses as new vote
- if(it.impulse >= 1 && it.impulse <= mapvote_count)
- if( mapvote_maps_flags[it.impulse - 1] & GTV_AVAILABLE )
+ if(CS(it).impulse >= 1 && CS(it).impulse <= mapvote_count)
+ if( mapvote_maps_flags[CS(it).impulse - 1] & GTV_AVAILABLE )
{
- it.mapvote = it.impulse;
+ it.mapvote = CS(it).impulse;
MapVote_TouchVotes(it);
}
- it.impulse = 0;
+ CS(it).impulse = 0;
if(it.mapvote)
++totalvotes;
- ));
+ });
MapVote_CheckRules_1(); // just count
}
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;