54 strcat(
"sv_vote_gametype_",type_name,
"_type")),
false);
60 int flag = GTV_FORBIDDEN;
66 strcat(
"sv_vote_gametype_",type_name,
"_type")),
false);
81 return flag | GTV_AVAILABLE;
86 int n, j, gametype_mask;
88 n =
min(MAPVOTE_COUNT, n);
90 for(j = 0; j < n; ++j)
123 return "That's not how to use this command.";
125 return "Suggestions are not accepted on this server.";
128 return "Can't suggest - voting is already in progress!";
131 return "The map you suggested is not available on this server.";
134 return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
138 return "The map you suggested does not support the current game mode.";
141 return "This map was already suggested.";
142 if(mapvote_suggestion_ptr >= MAPVOTE_COUNT)
149 mapvote_suggestion_ptr += 1;
156 return strcat(
"Suggestion of ", m,
" accepted.");
162 string pakfile, mapfile;
180 pakfile = whichpack(
strcat(mapfile,
".tga"));
182 pakfile = whichpack(
strcat(mapfile,
".jpg"));
184 pakfile = whichpack(
strcat(mapfile,
".png"));
188 if(i >= mapvote_screenshot_dirs_count)
235 bprint(
"Maplist contains no single playable map! Resetting it to default map list.\n" );
261 WriteHeader(
MSG_ONE, TE_CSQC_PICTURE);
278 if(mapvote_count < 8)
280 else if (mapvote_count < 16)
331 strcat(
"sv_vote_gametype_",type_name,
"_name")));
333 strcat(
"sv_vote_gametype_",type_name,
"_description")));
335 strcat(
"sv_vote_gametype_",type_name,
"_type")));
347 WriteHeader(MSG_ENTITY, ENT_CLIENT_MAPVOTE);
446 result =
strcat(result,
":didn't vote:",
ftos(didntvote));
494 int idx = it.mapvote - 1;
496 ++mapvote_selections[idx];
504 int firstPlace, secondPlace, currentPlace;
505 int firstPlaceVotes, secondPlaceVotes, currentVotes;
506 int mapvote_voters_real;
531 firstPlace = currentPlace;
549 error(
"No first place in map vote... WTF?");
551 if(secondPlace == -1 ||
time >
mapvote_timeout || (mapvote_voters_real - firstPlaceVotes) < firstPlaceVotes)
555 if(
time >
mapvote_keeptwotime || (mapvote_voters_real - firstPlaceVotes - secondPlaceVotes) < secondPlaceVotes)
560 result =
strcat(result,
":",
ftos(firstPlaceVotes));
562 result =
strcat(result,
":",
ftos(secondPlaceVotes),
"::");
572 if(i < mapvote_count_real)
578 result =
strcat(result,
":didn't vote:",
ftos(didntvote));
620 it.mapvote =
CS(it).impulse;
638 if(PlayerStats_GameReport_DelayMapVote) {
return; }
664 localcmd(
"fs_rescan\nrescan_pending 3\n");
711 if(lsmaps_reply !=
"") {
strunzone(lsmaps_reply); }
717 bprint(
"Cannot use this game type: no map for it found\n");
738 localcmd(
"sv_vote_gametype_hook_all\n");
743 LOG_TRACE(
"Selected gametype is not supported by any map");
784 n =
min(MAPVOTE_COUNT, n);
786 int really_available, which_available;
787 really_available = 0;
788 which_available = -1;
789 for(
int j = 0; j < n; ++j)
803 if ( really_available == 0 )
812 if ( really_available == 1 )
string MapInfo_Type_ToString(Gametype t)
string mapvote_maps[MAPVOTE_COUNT]
void GameTypeVote_SendOption(int i)
bool autocvar_g_maplist_votable_suggestions
int MapInfo_RequiredFlags()
float autocvar_g_maplist_votable_keeptwotime
int mapvote_suggestion_ptr
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void GotoNextMap(float reinit)
string mapvote_suggestions[MAPVOTE_COUNT]
void MapVote_CheckRules_1()
#define autocvar_g_maplist_votable
ERASEABLE void RandomSelection_Init()
float autocvar_sv_vote_gametype_timeout
ClientState CS(Client this)
#define FOREACH_CLIENT(cond, body)
bool GameTypeVote_Start()
string MapInfo_Type_ToText(Gametype t)
bool autocvar_sv_vote_gametype_default_current
bool GameTypeVote_SetGametype(Gametype type)
string mapvote_screenshot_dirs[MAPVOTE_SCREENSHOT_DIRS_COUNT]
float RandomSelection_chosen_float
int MapInfo_ForbiddenFlags()
void Map_Goto_SetStr(string nextmapname)
const int MAPVOTE_SCREENSHOT_DIRS_COUNT
string GameTypeVote_MapInfo_FixName(string m)
string autocvar_g_maplist_votable_screenshot_dir
int mapvote_screenshot_dirs_count
#define IS_REAL_CLIENT(v)
Gametype GameTypeVote_Type_FromString(string type_name)
Returns the gamtype ID from its name, if type_name isn't a real gametype it checks for sv_vote_gamety...
void MapVote_UnzoneStrings()
void MapVote_SendOption(int i)
int mapvote_selections[MAPVOTE_COUNT]
bool mapvote_maps_suggested[MAPVOTE_COUNT]
string autocvar_sv_vote_gametype_options
void Map_Goto(float reinit)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
int MapInfo_Map_supportedGametypes
Gametype MapInfo_Type_FromString(string gtype, bool dowarn)
Gametype MapInfo_CurrentGametype()
int mapvote_maps_flags[MAPVOTE_COUNT]
int MapInfo_CurrentFeatures()
bool MapVote_Finished(int mappos)
string MapInfo_ListAllowedMaps(Gametype type, float pRequiredFlags, float pForbiddenFlags)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool GameTypeVote_Finished(int pos)
int GameTypeVote_AvailabilityStatus(string type_name)
int mapvote_maps_screenshot_dir[MAPVOTE_COUNT]
int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametypeToSet)
void MapVote_SendPicture(entity to, int id)
bool autocvar_g_maplist_votable_nodetail
float DoNextMapOverride(float reinit)
float autocvar_g_maplist_votable_timeout
void MapVote_AddVotable(string nextMap, bool isSuggestion)
void GameLogEcho(string s)
float MapInfo_CheckMap(string s)
int GameTypeVote_GetMask()
bool Map_IsRecent(string m)
bool MapVote_CheckRules_2()
bool MapVote_SendEntity(entity this, entity to, int sf)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
string MapVote_Suggest(entity this, string m)
bool autocvar_g_maplist_votable_suggestions_override_mostrecent
#define RandomSelection_AddFloat(f, weight, priority)
bool GameTypeVote_AddVotable(string nextMode)
#define tokenizebyseparator
void MapVote_TouchVotes(entity voter)
float autocvar_sv_vote_gametype_keeptwotime
bool autocvar_g_maplist_votable_abstain
float autocvar_g_maplist_shuffle
float mapvote_initialized
string mapvote_maps_pakfile[MAPVOTE_COUNT]
string MapInfo_FixName(string s)
bool gametypevote_finished
bool autocvar_sv_eventlog
float _MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
float MapInfo_FilterGametype(Gametype pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
void MapVote_ClearAllVotes()
void MapInfo_SwitchGameType(Gametype t)
float mapvote_keeptwotime
bool autocvar_sv_vote_gametype
void FixClientCvars(entity e)
int autocvar_rescan_pending
float RandomSelection_best_priority