@@ -329,20 +329,21 @@ void ShowNominateGamemodeMenu(int client)
329329 bool isRecentlyPlayed = (groupExclude > 0 && MultiMode_IsGamemodeRecentlyPlayed (gamemode , groupExclude ));
330330 bool canNominate = MMC_CanClientNominate (client , gamemode );
331331
332+ int minP = 0 , maxP = 0 , minT = - 1 , maxT = - 1 ;
333+ MultiMode_GetGamemodeLimits (gamemode , minP , maxP , minT , maxT );
332334 int players = GetRealClientCount ();
333- bool exceedsPlayerLimit = false ;
334- char playerLimitGesture [32 ];
335- int gIndex = MMC_FindGameModeIndex (gamemode );
336- if (gIndex != - 1 ) {
337- GameModeConfig gmCfg ;
338- GetGameModesList ().GetArray (gIndex , gmCfg );
339- if (gmCfg .minplayers > 0 && players < gmCfg .minplayers ) {
340- exceedsPlayerLimit = true ;
341- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , gmCfg .minplayers );
342- } else if (gmCfg .maxplayers > 0 && players > gmCfg .maxplayers ) {
343- exceedsPlayerLimit = true ;
344- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , gmCfg .maxplayers );
345- }
335+ bool exceedsLimit = false ;
336+ char limitGesture [32 ];
337+
338+ if (! MMC_IsTimeAllowed (minT , maxT )) {
339+ exceedsLimit = true ;
340+ strcopy (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_TIME );
341+ } else if (minP > 0 && players < minP ) {
342+ exceedsLimit = true ;
343+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , minP );
344+ } else if (maxP > 0 && players > maxP ) {
345+ exceedsLimit = true ;
346+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , maxP );
346347 }
347348
348349 char display [128 ];
@@ -352,9 +353,9 @@ void ShowNominateGamemodeMenu(int client)
352353 Format (display , sizeof (display ), " %s%s " , gamemode , GESTURE_EXCLUDED );
353354 menu .AddItem (gamemode , display , ITEMDRAW_DISABLED );
354355 }
355- else if (exceedsPlayerLimit )
356+ else if (exceedsLimit )
356357 {
357- Format (display , sizeof (display ), " %s%s " , gamemode , playerLimitGesture );
358+ Format (display , sizeof (display ), " %s%s " , gamemode , limitGesture );
358359 menu .AddItem (gamemode , display , ITEMDRAW_DISABLED );
359360 }
360361 else if (g_Cvar_Nominate_NominateSelectedGroupExclude .BoolValue && isNominated )
@@ -447,23 +448,21 @@ void ShowNominateSubGroupMenu(int client, const char[] gamemode)
447448 bool isRecentlyPlayed = (subgroupExclude > 0 && MultiMode_IsSubGroupRecentlyPlayed (gamemode , subgroup , subgroupExclude ));
448449 bool canNominate = MMC_CanClientNominate (client , gamemode , subgroup );
449450
451+ int minP = 0 , maxP = 0 , minT = - 1 , maxT = - 1 ;
452+ MultiMode_GetSubGroupLimits (gamemode , subgroup , minP , maxP , minT , maxT );
450453 int players = GetRealClientCount ();
451- bool exceedsPlayerLimit = false ;
452- char playerLimitGesture [32 ];
453- int gIdx = MMC_FindGameModeIndex (gamemode );
454- int sIdx = MMC_FindSubGroupIndex (gamemode , subgroup );
455- if (gIdx != - 1 && sIdx != - 1 ) {
456- GameModeConfig gmCfg ;
457- GetGameModesList ().GetArray (gIdx , gmCfg );
458- SubGroupConfig subCfg ;
459- gmCfg .subGroups .GetArray (sIdx , subCfg );
460- if (subCfg .minplayers > 0 && players < subCfg .minplayers ) {
461- exceedsPlayerLimit = true ;
462- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , subCfg .minplayers );
463- } else if (subCfg .maxplayers > 0 && players > subCfg .maxplayers ) {
464- exceedsPlayerLimit = true ;
465- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , subCfg .maxplayers );
466- }
454+ bool exceedsLimit = false ;
455+ char limitGesture [32 ];
456+
457+ if (! MMC_IsTimeAllowed (minT , maxT )) {
458+ exceedsLimit = true ;
459+ strcopy (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_TIME );
460+ } else if (minP > 0 && players < minP ) {
461+ exceedsLimit = true ;
462+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , minP );
463+ } else if (maxP > 0 && players > maxP ) {
464+ exceedsLimit = true ;
465+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , maxP );
467466 }
468467
469468 char display [128 ];
@@ -473,9 +472,9 @@ void ShowNominateSubGroupMenu(int client, const char[] gamemode)
473472 Format (display , sizeof (display ), " %s%s " , subgroup , GESTURE_EXCLUDED );
474473 menu .AddItem (subgroup , display , ITEMDRAW_DISABLED );
475474 }
476- else if (exceedsPlayerLimit )
475+ else if (exceedsLimit )
477476 {
478- Format (display , sizeof (display ), " %s%s " , subgroup , playerLimitGesture );
477+ Format (display , sizeof (display ), " %s%s " , subgroup , limitGesture );
479478 menu .AddItem (subgroup , display , ITEMDRAW_DISABLED );
480479 }
481480 else if (g_Cvar_Nominate_NominateSelectedGroupExclude .BoolValue && isNominated )
@@ -579,52 +578,29 @@ void ShowNominateMapMenu(int client, const char[] gamemode, const char[] subgrou
579578 bool isRecentlyPlayed = (mapExclude > 0 && MultiMode_IsMapRecentlyPlayed (gamemode , map , subgroup , mapExclude ));
580579 bool canNominate = MMC_CanClientNominate (client , gamemode , subgroup , map ) && ! MMC_IsMapAdminOnly (gamemode , map , subgroup );
581580
582- int players = GetRealClientCount ();
583- bool exceedsPlayerLimit = false ;
584- char playerLimitGesture [32 ];
585- int minP = 0 , maxP = 0 ;
586-
587- KeyValues mapKv = null ;
588- if (strlen (subgroup ) > 0 )
589- mapKv = MMC_GetSubGroupMapKv (g_kvGameModes , gamemode , subgroup , map );
590- else
591- mapKv = MMC_GetMapKv (g_kvGameModes , gamemode , map );
592-
593- if (mapKv != null ) {
594- minP = mapKv .GetNum (MAPCYCLE_KEY_MINPLAYERS , 0 );
595- maxP = mapKv .GetNum (MAPCYCLE_KEY_MAXPLAYERS , 0 );
596- delete mapKv ;
597- }
598-
599- if (minP == 0 && maxP == 0 && strlen (subgroup ) > 0 ) {
600- int sgIdx = MMC_FindSubGroupIndex (gamemode , subgroup );
601- int gIdx = MMC_FindGameModeIndex (gamemode );
602- if (gIdx != - 1 && sgIdx != - 1 ) {
603- GameModeConfig gmCfg ;
604- GetGameModesList ().GetArray (gIdx , gmCfg );
605- SubGroupConfig subCfg ;
606- gmCfg .subGroups .GetArray (sgIdx , subCfg );
607- minP = subCfg .minplayers ;
608- maxP = subCfg .maxplayers ;
609- }
610- }
611-
612- if (minP == 0 && maxP == 0 ) {
613- int gIdx = MMC_FindGameModeIndex (gamemode );
614- if (gIdx != - 1 ) {
615- GameModeConfig gmCfg ;
616- GetGameModesList ().GetArray (gIdx , gmCfg );
617- if (minP == 0 ) minP = gmCfg .minplayers ;
618- if (maxP == 0 ) maxP = gmCfg .maxplayers ;
619- }
581+ int minP = 0 , maxP = 0 , minT = - 1 , maxT = - 1 ;
582+ bool hasLimits = false ;
583+ if (strlen (subgroup ) > 0 ) {
584+ if (! MultiMode_GetSubGroupLimits (gamemode , subgroup , minP , maxP , minT , maxT ))
585+ MultiMode_GetGamemodeLimits (gamemode , minP , maxP , minT , maxT );
586+ hasLimits = true ;
587+ } else {
588+ hasLimits = MultiMode_GetGamemodeLimits (gamemode , minP , maxP , minT , maxT );
620589 }
621590
622- if (minP > 0 && players < minP ) {
623- exceedsPlayerLimit = true ;
624- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , minP );
591+ int players = GetRealClientCount ();
592+ bool exceedsLimit = false ;
593+ char limitGesture [32 ];
594+
595+ if (hasLimits && ! MMC_IsTimeAllowed (minT , maxT )) {
596+ exceedsLimit = true ;
597+ strcopy (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_TIME );
598+ } else if (minP > 0 && players < minP ) {
599+ exceedsLimit = true ;
600+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MINIMUM , minP );
625601 } else if (maxP > 0 && players > maxP ) {
626- exceedsPlayerLimit = true ;
627- Format (playerLimitGesture , sizeof (playerLimitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , maxP );
602+ exceedsLimit = true ;
603+ Format (limitGesture , sizeof (limitGesture ), GESTURE_EXCLUDED_PLAYERLIMIT_MAX , maxP );
628604 }
629605
630606 char displayName [256 ];
@@ -635,9 +611,9 @@ void ShowNominateMapMenu(int client, const char[] gamemode, const char[] subgrou
635611 Format (displayName , sizeof (displayName ), " %s%s " , displayName , GESTURE_EXCLUDED );
636612 menu .AddItem (map , displayName , ITEMDRAW_DISABLED );
637613 }
638- else if (exceedsPlayerLimit )
614+ else if (exceedsLimit )
639615 {
640- Format (displayName , sizeof (displayName ), " %s%s " , displayName , playerLimitGesture );
616+ Format (displayName , sizeof (displayName ), " %s%s " , displayName , limitGesture );
641617 menu .AddItem (map , displayName , ITEMDRAW_DISABLED );
642618 }
643619 else if (g_Cvar_Nominate_NominateSelectedMapExclude .BoolValue && isNominated )
0 commit comments