Skip to content

Commit 06e4bec

Browse files
committed
fix bot roster with class limits
1 parent 8159177 commit 06e4bec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/game/server/tf/bot/tf_bot.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ ETFClass CTFBot::GetPresetClassToSpawn() const
11731173
{
11741174
ETFClass iClass = desiredRoster[i];
11751175

1176-
if ( currentRoster.m_count[ iClass ] > classCount[ iClass ] )
1176+
if ( currentRoster.m_count[ iClass ] > classCount[ iClass ] || !TFGameRules()->CanBotChooseClass( const_cast< CTFBot * >( this ), iClass ) )
11771177
{
11781178
// if we have enough of this class, skip it
11791179
classCount[ iClass ]++;
@@ -1229,6 +1229,10 @@ const char *CTFBot::GetNextSpawnClassname( void )
12291229
{
12301230
iNextClass = (ETFClass)GetClassIndexFromString( pszForceClass );
12311231
}
1232+
if ( !TFGameRules()->CanPlayerChooseClass( const_cast< CTFBot * >( this ), iNextClass ) )
1233+
{
1234+
iNextClass = TF_CLASS_UNDEFINED;
1235+
}
12321236

12331237
if ( m_iReservedPlayerClass != TF_CLASS_UNDEFINED )
12341238
{

0 commit comments

Comments
 (0)