//----------------------------------------------------------------------------- // Frame-based update //----------------------------------------------------------------------------- void CVehicleBayVGuiScreen::OnTick() { BaseClass::OnTick(); if (!GetEntity()) return; C_BaseTFPlayer *pLocalPlayer = C_BaseTFPlayer::GetLocalPlayer(); if ( !pLocalPlayer ) return; int nBankResources = pLocalPlayer ? pLocalPlayer->GetBankResources() : 0; // Set the vehicles costs for ( int i = 0; i < NUM_VEHICLES; i++ ) { if ( !m_pVehicleButtons[i] ) continue; char buf[128]; int iCost = CalculateObjectCost( g_ValidVehicles[i], pLocalPlayer->GetNumObjects( g_ValidVehicles[i] ), pLocalPlayer->GetTeamNumber() ); Q_snprintf( buf, sizeof( buf ), "%s : %d", GetObjectInfo( g_ValidVehicles[i] )->m_pStatusName, iCost ); m_pVehicleButtons[i]->SetText( buf ); // Can't build if the game hasn't started if ( CurrentActIsAWaitingAct() ) { m_pVehicleButtons[i]->SetEnabled( false ); } else { m_pVehicleButtons[i]->SetEnabled( nBankResources >= iCost ); } } }