ScoreRules_generic();
}
-void ActivateTeamplay()
-{
- serverflags |= SERVERFLAG_TEAMPLAY;
- teamplay = 1;
- cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
-}
-
void InitGameplayMode()
{
VoteReset();
// find out good world mins/maxs bounds, either the static bounds found by looking for solid, or the mapinfo specified bounds
get_mi_min_max(1);
- world.mins = mi_min;
- world.maxs = mi_max;
+ // assign reflectively to avoid "assignment to world" warning
+ int done = 0; for (int i = 0, n = numentityfields(); i < n; ++i) {
+ string k = entityfieldname(i); vector v = (k == "mins") ? mi_min : (k == "maxs") ? mi_max : '0 0 0';
+ if (v) {
+ putentityfieldstring(i, world, sprintf("%d %d %d", v));
+ if (++done == 2) break;
+ }
+ }
// currently, NetRadiant's limit is 131072 qu for each side
// distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
// set the distance according to map size but don't go over the limit to avoid issues with float precision
max_shot_distance = min(230000, vlen(world.maxs - world.mins));
MapInfo_LoadMapSettings(mapname);
- serverflags &= ~SERVERFLAG_TEAMPLAY;
- teamplay = 0;
- cvar_set("teamplay", "0"); // DP needs this for sending proper getstatus replies.
+ GameRules_teams(false);
if (!cvar_value_issafe(world.fog))
{
- LOG_INFO("The current map contains a potentially harmful fog setting, ignored\n");
+ LOG_INFO("The current map contains a potentially harmful fog setting, ignored");
world.fog = string_null;
}
if(MapInfo_Map_fog != "")
// FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
// also remember the lowest-scoring player
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
float t;
if(IS_PLAYER(it) || it.caplayer)
t = it.team;
cb1 = cb1 + bvalue;
}
}
- if(t == NUM_TEAM_2)
+ else if(t == NUM_TEAM_2)
{
if(c2 >= 0)
{
cb2 = cb2 + bvalue;
}
}
- if(t == NUM_TEAM_3)
+ else if(t == NUM_TEAM_3)
{
if(c3 >= 0)
{
cb3 = cb3 + bvalue;
}
}
- if(t == NUM_TEAM_4)
+ else if(t == NUM_TEAM_4)
{
if(c4 >= 0)
{
}
}
}
- ));
+ });
// if the player who has a forced team has not joined yet, reserve the spot
if(autocvar_g_campaign)
return;
}
- if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && this.wasplayer)) {
+ if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(this).wasplayer)) {
Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
return; // changing teams is not allowed
}
lowest_player_score = 999999999;
// find the lowest-scoring player & bot of that team
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, {
if(it.isbot)
{
if(it.totalfrags < lowest_bot_score)
lowest_player_score = it.totalfrags;
}
}
- ));
+ });
// prefers to move a bot...
if(lowest_bot != NULL)