#include "g_world.qh"
#include "command/cmd.qh"
#include "command/getreplies.qh"
#include "../common/constants.qh"
#include "g_world.qh"
#include "command/cmd.qh"
#include "command/getreplies.qh"
#include "../common/constants.qh"
-float mapvote_suggestion_ptr;
-float mapvote_voters;
-float mapvote_selections[MAPVOTE_COUNT];
-float mapvote_maps_flags[MAPVOTE_COUNT];
-float mapvote_run;
-float mapvote_detail;
-float mapvote_abstain;
-.float mapvote;
+int mapvote_suggestion_ptr;
+int mapvote_voters;
+int mapvote_selections[MAPVOTE_COUNT];
+int mapvote_maps_flags[MAPVOTE_COUNT];
+bool mapvote_run;
+bool mapvote_detail;
+bool mapvote_abstain;
+.int mapvote;
* Returns the gamtype ID from its name, if type_name isn't a real gametype it
* checks for sv_vote_gametype_(type_name)_type
*/
* Returns the gamtype ID from its name, if type_name isn't a real gametype it
* checks for sv_vote_gametype_(type_name)_type
*/
- strcat("sv_vote_gametype_",type_name,"_type")));
+ strcat("sv_vote_gametype_",type_name,"_type")), false);
- strcat("sv_vote_gametype_",type_name,"_type")));
+ strcat("sv_vote_gametype_",type_name,"_type")), false);
n = tokenizebyseparator(autocvar_sv_vote_gametype_options, " ");
n = min(MAPVOTE_COUNT, n);
gametype_mask = 0;
for(j = 0; j < n; ++j)
n = tokenizebyseparator(autocvar_sv_vote_gametype_options, " ");
n = min(MAPVOTE_COUNT, n);
gametype_mask = 0;
for(j = 0; j < n; ++j)
- MapInfo_FilterGametype(GameTypeVote_GetMask(), 0, MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
+ _MapInfo_FilterGametype(GameTypeVote_GetMask(), 0, MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
- 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:suggested:", m, ":", ftos(self.playerid)));
+ GameLogEcho(strcat(":vote:suggested:", m, ":", ftos(this.playerid)));
pakfile = whichpack(strcat(mapfile, ".tga"));
if(pakfile == "")
pakfile = whichpack(strcat(mapfile, ".jpg"));
pakfile = whichpack(strcat(mapfile, ".tga"));
if(pakfile == "")
pakfile = whichpack(strcat(mapfile, ".jpg"));
}
if(i >= mapvote_screenshot_dirs_count)
i = 0; // FIXME maybe network this error case, as that means there is no mapshot on the server?
}
if(i >= mapvote_screenshot_dirs_count)
i = 0; // FIXME maybe network this error case, as that means there is no mapshot on the server?
- for(o = strstr(pakfile, "/", 0)+1; o > 0; o = strstr(pakfile, "/", 0)+1)
+ for(o = strstrofs(pakfile, "/", 0)+1; o > 0; o = strstrofs(pakfile, "/", 0)+1)
pakfile = substring(pakfile, o, -1);
mapvote_maps_screenshot_dir[mapvote_count] = i;
pakfile = substring(pakfile, o, -1);
mapvote_maps_screenshot_dir[mapvote_count] = i;
mapvote_timeout = time + autocvar_g_maplist_votable_timeout;
if(mapvote_count_real < 3 || mapvote_keeptwotime <= time)
mapvote_keeptwotime = 0;
mapvote_timeout = time + autocvar_g_maplist_votable_timeout;
if(mapvote_count_real < 3 || mapvote_keeptwotime <= time)
mapvote_keeptwotime = 0;
WriteHeader(MSG_ONE, TE_CSQC_PICTURE);
WriteByte(MSG_ONE, id);
WritePicture(MSG_ONE, strcat(mapvote_screenshot_dirs[mapvote_maps_screenshot_dir[id]], "/", mapvote_maps[id]), 3072);
WriteHeader(MSG_ONE, TE_CSQC_PICTURE);
WriteByte(MSG_ONE, id);
WritePicture(MSG_ONE, strcat(mapvote_screenshot_dirs[mapvote_maps_screenshot_dir[id]], "/", mapvote_maps[id]), 3072);
- float mask,power;
- mask = 0;
- for(i = 0, power = 1; i < mapvote_count; ++i, power *= 2)
- if(mapvote_maps_flags[i] & GTV_AVAILABLE )
- mask |= power;
+ int mask = 0;
+ for(int j = 0; j < mapvote_count; ++j)
+ {
+ if(mapvote_maps_flags[j] & GTV_AVAILABLE)
+ mask |= BIT(j);
+ }
- for ( i = 0; i < mapvote_count; ++i )
- WriteByte(MSG_ENTITY, mapvote_maps_flags[i]);
+ for (int j = 0; j < mapvote_count; ++j)
+ WriteByte(MSG_ENTITY, mapvote_maps_flags[j]);
strcat("sv_vote_gametype_",type_name,"_name")));
WriteString(MSG_ENTITY, cvar_string(
strcat("sv_vote_gametype_",type_name,"_description")));
strcat("sv_vote_gametype_",type_name,"_name")));
WriteString(MSG_ENTITY, cvar_string(
strcat("sv_vote_gametype_",type_name,"_description")));
- float i;
- float firstPlace, secondPlace, currentPlace;
- float firstPlaceVotes, secondPlaceVotes, currentVotes;
- float mapvote_voters_real;
+ int i;
+ int firstPlace, secondPlace, currentPlace;
+ int firstPlaceVotes, secondPlaceVotes, currentVotes;
+ int mapvote_voters_real;
- RandomSelection_Add(world, i, string_null, 1, mapvote_selections[i]);
+ RandomSelection_AddFloat(i, 1, mapvote_selections[i]);
if ( gametypevote && mapvote_maps[i] == MapInfo_Type_ToString(MapInfo_CurrentGametype()) )
{
currentVotes = mapvote_selections[i];
if ( gametypevote && mapvote_maps[i] == MapInfo_Type_ToString(MapInfo_CurrentGametype()) )
{
currentVotes = mapvote_selections[i];
- RandomSelection_Add(world, i, string_null, 1, mapvote_selections[i]);
+ RandomSelection_AddFloat(i, 1, mapvote_selections[i]);
secondPlace = RandomSelection_chosen_float;
secondPlaceVotes = RandomSelection_best_priority;
//dprint("Second place: ", ftos(secondPlace), "\n");
secondPlace = RandomSelection_chosen_float;
secondPlaceVotes = RandomSelection_best_priority;
//dprint("Second place: ", ftos(secondPlace), "\n");
mapvote_keeptwotime = 0;
result = strcat(":vote:keeptwo:", mapvote_maps[firstPlace]);
result = strcat(result, ":", ftos(firstPlaceVotes));
result = strcat(result, ":", mapvote_maps[secondPlace]);
result = strcat(result, ":", ftos(secondPlaceVotes), "::");
mapvote_keeptwotime = 0;
result = strcat(":vote:keeptwo:", mapvote_maps[firstPlace]);
result = strcat(result, ":", ftos(firstPlaceVotes));
result = strcat(result, ":", mapvote_maps[secondPlace]);
result = strcat(result, ":", ftos(secondPlaceVotes), "::");
- 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 )
if ( !GameTypeVote_SetGametype(GameTypeVote_Type_FromString(mapvote_maps[pos])) )
{
LOG_TRACE("Selected gametype is not supported by any map");
}
if ( !GameTypeVote_SetGametype(GameTypeVote_Type_FromString(mapvote_maps[pos])) )
{
LOG_TRACE("Selected gametype is not supported by any map");
}