]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
g_maplist: refactor initialisation
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index 56d293f98076b0091ffdd50efb848f6a5142dec0..04706f615444d6dd93799473a4ef066b94b30c15 100644 (file)
@@ -118,12 +118,7 @@ void GotoFirstMap(entity this)
        {
                // cvar_set("_sv_init", "0");
                // we do NOT set this to 0 any more, so someone "accidentally" changing
-               // to this "init" map on a dedicated server will cause no permanent
-               // harm
-               if(autocvar_g_maplist_shuffle)
-                       ShuffleMaplist();
-               n = tokenizebyseparator(autocvar_g_maplist, " ");
-               cvar_set("g_maplist_index", ftos(n - 1)); // jump to map 0 in GotoNextMap
+               // to this "init" map on a dedicated server will cause no permanent harm
 
                MapInfo_Enumerate();
                MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
@@ -236,8 +231,9 @@ void cvar_changes_init()
                BADCVAR("timeformat");
                BADCVAR("timestamps");
                BADCVAR("g_require_stats");
-               BADCVAR("g_muteban_list");
+               BADCVAR("g_chatban_list");
                BADCVAR("g_playban_list");
+               BADCVAR("g_playban_minigames");
                BADCVAR("g_voteban_list");
                BADPREFIX("developer_");
                BADPREFIX("g_ban_");
@@ -305,6 +301,10 @@ void cvar_changes_init()
                BADCVAR("g_tdm");
                BADCVAR("g_tdm_on_dm_maps");
                BADCVAR("g_tdm_teams");
+               BADCVAR("g_tka");
+               BADCVAR("g_tka_on_ka_maps");
+               BADCVAR("g_tka_on_tdm_maps");
+               BADCVAR("g_tka_teams");
                BADCVAR("g_tmayhem");
                BADCVAR("g_tmayhem_teams");
                BADCVAR("g_vip");
@@ -409,7 +409,6 @@ void cvar_changes_init()
                BADCVAR("w_prop_interval");
                BADPREFIX("chat_");
                BADPREFIX("crypto_");
-               BADPREFIX("gameversion");
                BADPREFIX("g_chat_");
                BADPREFIX("g_ctf_captimerecord_");
                BADPREFIX("g_hats_");
@@ -453,6 +452,7 @@ void cvar_changes_init()
                BADCVAR("g_ban_sync_uri");
                BADCVAR("g_buffs");
                BADCVAR("g_ca_teams_override");
+               BADCVAR("g_ca_prevent_stalemate");
                BADCVAR("g_ctf_fullbrightflags");
                BADCVAR("g_ctf_ignore_frags");
                BADCVAR("g_ctf_leaderboard");
@@ -658,14 +658,18 @@ void GameplayMode_DelayedInit(entity this)
        if (!g_duel)
                MapReadSizes(mapname);
 
-       if (autocvar_g_maxplayers < 0 && teamplay)
+       if (autocvar_g_maxplayers < 0)
        {
-               // automatic maxplayers should be a multiple of team count
-               if (map_maxplayers == 0 || map_maxplayers > maxclients)
+               if (map_maxplayers <= 0)
                        map_maxplayers = maxclients; // unlimited, but may need rounding
-               int d = map_maxplayers % AVAILABLE_TEAMS;
-               int u = AVAILABLE_TEAMS - d;
-               map_maxplayers += (u <= d && u + map_maxplayers <= maxclients) ? u : -d;
+               map_maxplayers = bound(max(2, AVAILABLE_TEAMS * 2), map_maxplayers, maxclients);
+               if (teamplay)
+               {
+                       // automatic maxplayers should be a multiple of team count
+                       int down = map_maxplayers % AVAILABLE_TEAMS;
+                       int up = AVAILABLE_TEAMS - down;
+                       map_maxplayers += (up < down && up + map_maxplayers <= maxclients) ? up : -down;
+               }
        }
 
        if (warmup_stage < 0)
@@ -676,9 +680,9 @@ void GameplayMode_DelayedInit(entity this)
                if (teamplay)
                {
                        // automatic minplayers should be a multiple of team count
-                       int d = map_minplayers % AVAILABLE_TEAMS;
-                       int u = AVAILABLE_TEAMS - d;
-                       map_minplayers += (u < d && u + map_minplayers <= m) ? u : -d;
+                       int down = map_minplayers % AVAILABLE_TEAMS;
+                       int up = AVAILABLE_TEAMS - down;
+                       map_minplayers += (up < down && up + map_minplayers <= m) ? up : -down;
                }
        }
        else
@@ -1054,7 +1058,7 @@ spawnfunc(worldspawn)
        WinningConditionHelper(this); // set worldstatus
 
        if (autocvar_sv_autopause && server_is_dedicated && !wantrestart)
-               // INITPRIO_LAST is to soon: bots either didn't join yet or didn't leave yet, see: bot_fixcount()
+               // INITPRIO_LAST is too soon: bots either didn't join yet or didn't leave yet, see: bot_fixcount()
                defer(this, 5, Pause_TryPause_Dedicated);
 
        world_initialized = 1;
@@ -2144,16 +2148,26 @@ void readlevelcvars()
        g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
        g_pickup_respawntime_superweapon = cvar("g_pickup_respawntime_superweapon");
        g_pickup_respawntime_ammo = cvar("g_pickup_respawntime_ammo");
-       g_pickup_respawntime_short = cvar("g_pickup_respawntime_short");
-       g_pickup_respawntime_medium = cvar("g_pickup_respawntime_medium");
-       g_pickup_respawntime_long = cvar("g_pickup_respawntime_long");
+       g_pickup_respawntime_armor_small = cvar("g_pickup_respawntime_armor_small");
+       g_pickup_respawntime_armor_medium = cvar("g_pickup_respawntime_armor_medium");
+       g_pickup_respawntime_armor_big = cvar("g_pickup_respawntime_armor_big");
+       g_pickup_respawntime_armor_mega = cvar("g_pickup_respawntime_armor_mega");
+       g_pickup_respawntime_health_small = cvar("g_pickup_respawntime_health_small");
+       g_pickup_respawntime_health_medium = cvar("g_pickup_respawntime_health_medium");
+       g_pickup_respawntime_health_big = cvar("g_pickup_respawntime_health_big");
+       g_pickup_respawntime_health_mega = cvar("g_pickup_respawntime_health_mega");
        g_pickup_respawntime_powerup = cvar("g_pickup_respawntime_powerup");
        g_pickup_respawntimejitter_weapon = cvar("g_pickup_respawntimejitter_weapon");
        g_pickup_respawntimejitter_superweapon = cvar("g_pickup_respawntimejitter_superweapon");
        g_pickup_respawntimejitter_ammo = cvar("g_pickup_respawntimejitter_ammo");
-       g_pickup_respawntimejitter_short = cvar("g_pickup_respawntimejitter_short");
-       g_pickup_respawntimejitter_medium = cvar("g_pickup_respawntimejitter_medium");
-       g_pickup_respawntimejitter_long = cvar("g_pickup_respawntimejitter_long");
+       g_pickup_respawntimejitter_armor_small = cvar("g_pickup_respawntimejitter_armor_small");
+       g_pickup_respawntimejitter_armor_medium = cvar("g_pickup_respawntimejitter_armor_medium");
+       g_pickup_respawntimejitter_armor_big = cvar("g_pickup_respawntimejitter_armor_big");
+       g_pickup_respawntimejitter_armor_mega = cvar("g_pickup_respawntimejitter_armor_mega");
+       g_pickup_respawntimejitter_health_small = cvar("g_pickup_respawntimejitter_health_small");
+       g_pickup_respawntimejitter_health_medium = cvar("g_pickup_respawntimejitter_health_medium");
+       g_pickup_respawntimejitter_health_big = cvar("g_pickup_respawntimejitter_health_big");
+       g_pickup_respawntimejitter_health_mega = cvar("g_pickup_respawntimejitter_health_mega");
        g_pickup_respawntimejitter_powerup = cvar("g_pickup_respawntimejitter_powerup");
 
        g_pickup_shells = cvar("g_pickup_shells");