+ if (total_players < minplayers)
+ {
+ if (game_starttime > time) // someone bailed during countdown, back to warmup
+ {
+ warmup_stage = autocvar_g_warmup; // CAN change it AFTER calling Nagger_ReadyCounted() this frame
+ game_starttime = time;
+ Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP, minplayers);
+ if (!sv_ready_restart_after_countdown) // if we ran reset_map() at start of countdown
+ FOREACH_CLIENT(IS_PLAYER(it), { GiveWarmupResources(it); });
+ }
+ if (warmup_limit > 0)
+ warmup_limit = -1;
+ return; // don't ReadyRestart if players are ready but too few
+ }
+ else if (minplayers && warmup_limit <= 0)
+ {
+ // there's enough players now but we're still in infinite warmup
+ warmup_limit = cvar("g_warmup_limit");
+ if (warmup_limit == 0)
+ warmup_limit = autocvar_timelimit * 60;
+ if (warmup_limit > 0)
+ game_starttime = time;
+ // implicit else: g_warmup -1 && g_warmup_limit -1 means
+ // warmup continues until enough players AND enough RUPs (no time limit)
+ }
+
+ if (humans_ready && humans_ready >= rint(human_players * bound(0.5, cvar("g_warmup_majority_factor"), 1)))
+ ReadyRestart(true);