Disable buyicon/buymenu according to info_map_parameters (#205)

This commit is contained in:
In-line 2017-11-11 16:30:31 +04:00 committed by Dmitry Novikov
parent 8c9ee510bb
commit 022115cc35
4 changed files with 36 additions and 2 deletions

View File

@ -667,6 +667,7 @@ public:
// has a style of gameplay when aren't any teams
bool IsFreeForAll() const;
bool CanPlayerBuy(CBasePlayer *pPlayer) const;
VFUNC bool HasRoundTimeExpired();
VFUNC bool IsBombPlanted();

View File

@ -4928,3 +4928,21 @@ void CHalfLifeMultiplay::ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTea
CSGameRules()->CheckWinConditions();
}
}
bool CHalfLifeMultiplay::CanPlayerBuy(CBasePlayer *pPlayer) const
{
if (pPlayer->m_iTeam == CT && m_bCTCantBuy)
{
return false;
}
else if (pPlayer->m_iTeam == TERRORIST && m_bTCantBuy)
{
return false;
}
else if (m_bCTCantBuy && m_bTCantBuy)
{
return false;
}
return true;
}

View File

@ -6154,11 +6154,21 @@ void OLD_CheckBuyZone(CBasePlayer *player)
{
const char *pszSpawnClass = nullptr;
if (player->m_iTeam == TERRORIST)
pszSpawnClass = "info_player_deathmatch";
#ifdef REGAMEDLL_FIXES
if (!CSGameRules()->CanPlayerBuy(player))
{
return;
}
#endif
if (player->m_iTeam == TERRORIST)
{
pszSpawnClass = "info_player_deathmatch";
}
else if (player->m_iTeam == CT)
{
pszSpawnClass = "info_player_start";
}
if (pszSpawnClass)
{

View File

@ -1812,6 +1812,11 @@ void CBuyZone::BuyTouch(CBaseEntity *pOther)
if (pev->team == UNASSIGNED || pev->team == p->m_iTeam)
{
#ifdef REGAMEDLL_FIXES
if (!CSGameRules()->CanPlayerBuy(p))
return;
#endif
p->m_signals.Signal(SIGNAL_BUY);
}
}