mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 14:08:00 +03:00
Moved SelectDefaultTeam the function to CHalfLifeMultiplay.
This commit is contained in:
parent
aaf1d9648e
commit
21b0689030
@ -790,8 +790,7 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
team = BOT_TEAM_CT;
|
||||
else
|
||||
{
|
||||
TeamName defaultTeam = SelectDefaultTeam();
|
||||
|
||||
TeamName defaultTeam = CSGameRules()->SelectDefaultTeam();
|
||||
if (defaultTeam == TERRORIST)
|
||||
team = BOT_TEAM_T;
|
||||
|
||||
@ -1175,7 +1174,7 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
|
||||
|
||||
if (nTeamSlot == UNASSIGNED)
|
||||
{
|
||||
nTeamSlot = SelectDefaultTeam();
|
||||
nTeamSlot = CSGameRules()->SelectDefaultTeam();
|
||||
}
|
||||
|
||||
if (nTeamSlot == UNASSIGNED || CSGameRules()->TeamFull(nTeamSlot))
|
||||
|
@ -388,63 +388,6 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer)
|
||||
}
|
||||
}
|
||||
|
||||
TeamName SelectDefaultTeam()
|
||||
{
|
||||
TeamName team = UNASSIGNED;
|
||||
|
||||
if (CSGameRules()->m_iNumTerrorist < CSGameRules()->m_iNumCT)
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
else if (CSGameRules()->m_iNumTerrorist > CSGameRules()->m_iNumCT)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
// Choose the team that's losing
|
||||
else if (CSGameRules()->m_iNumTerroristWins < CSGameRules()->m_iNumCTWins)
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
else if (CSGameRules()->m_iNumCTWins < CSGameRules()->m_iNumTerroristWins)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Teams and scores are equal, pick a random team
|
||||
if (RANDOM_LONG(0, 1) == 0)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
else
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
}
|
||||
|
||||
if (CSGameRules()->TeamFull(team))
|
||||
{
|
||||
// Pick the opposite team
|
||||
if (team == TERRORIST)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
else
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
|
||||
// No choices left
|
||||
if (CSGameRules()->TeamFull(team))
|
||||
{
|
||||
return UNASSIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
return team;
|
||||
|
||||
}
|
||||
|
||||
void CheckStartMoney()
|
||||
{
|
||||
int money = int(startmoney.value);
|
||||
@ -1594,8 +1537,7 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
||||
case MENU_SLOT_TEAM_RANDOM:
|
||||
{
|
||||
// Attempt to auto-select a team
|
||||
team = SelectDefaultTeam();
|
||||
|
||||
team = CSGameRules()->SelectDefaultTeam();
|
||||
if (team == UNASSIGNED)
|
||||
{
|
||||
if (cv_bot_auto_vacate.value > 0.0f && !player->IsBot())
|
||||
|
@ -125,7 +125,6 @@ void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMe
|
||||
void ShowVGUIMenu_(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
|
||||
void ListPlayers(CBasePlayer *current);
|
||||
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
|
||||
TeamName SelectDefaultTeam();
|
||||
void CheckStartMoney();
|
||||
void ClientPutInServer(edict_t *pEntity);
|
||||
int Q_strlen_(const char *str);
|
||||
|
@ -632,6 +632,7 @@ public:
|
||||
// BOMB MAP FUNCTIONS
|
||||
VFUNC BOOL IsThereABomber();
|
||||
VFUNC BOOL IsThereABomb();
|
||||
VFUNC TeamName SelectDefaultTeam();
|
||||
|
||||
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
|
||||
void SendMOTDToClient(edict_t *client);
|
||||
|
@ -4879,3 +4879,45 @@ void CHalfLifeMultiplay::ServerActivate()
|
||||
ReadMultiplayCvars();
|
||||
CheckMapConditions();
|
||||
}
|
||||
|
||||
TeamName CHalfLifeMultiplay::SelectDefaultTeam()
|
||||
{
|
||||
TeamName team = UNASSIGNED;
|
||||
if (m_iNumTerrorist < m_iNumCT)
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
else if (m_iNumTerrorist > m_iNumCT)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
// Choose the team that's losing
|
||||
else if (m_iNumTerroristWins < m_iNumCTWins)
|
||||
{
|
||||
team = TERRORIST;
|
||||
}
|
||||
else if (m_iNumCTWins < m_iNumTerroristWins)
|
||||
{
|
||||
team = CT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Teams and scores are equal, pick a random team
|
||||
team = (RANDOM_LONG(0, 1) == 0) ? CT : TERRORIST;
|
||||
}
|
||||
|
||||
if (TeamFull(team))
|
||||
{
|
||||
// Pick the opposite team
|
||||
team = (team == TERRORIST) ? CT : TERRORIST;
|
||||
|
||||
// No choices left
|
||||
if (TeamFull(team))
|
||||
{
|
||||
return UNASSIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
return team;
|
||||
|
||||
}
|
@ -421,6 +421,7 @@ public:
|
||||
// BOMB MAP FUNCTIONS
|
||||
virtual BOOL IsThereABomber() = 0;
|
||||
virtual BOOL IsThereABomb() = 0;
|
||||
virtual TeamName SelectDefaultTeam() = 0;
|
||||
|
||||
virtual bool HasRoundTimeExpired() = 0;
|
||||
virtual bool IsBombPlanted() = 0;
|
||||
|
@ -272,7 +272,7 @@ FunctionHook g_FunctionHooks[] =
|
||||
{ 0x01D64260, "_Z11ListPlayersP11CBasePlayer", (size_t)&ListPlayers },
|
||||
{ 0x01D64460, "CountTeamPlayers", (size_t)&CountTeamPlayers }, //extern c func
|
||||
{ 0x01D64580, "_Z15ProcessKickVoteP11CBasePlayerS0_", (size_t)&ProcessKickVote },
|
||||
{ 0x01D64920, "_Z17SelectDefaultTeamv", (size_t)&SelectDefaultTeam },
|
||||
//{ 0x01D64920, "_Z17SelectDefaultTeamv", (size_t)&SelectDefaultTeam },
|
||||
{ 0x01D649A0, "_Z15CheckStartMoneyv", (size_t)&CheckStartMoney },
|
||||
{ 0x01D649F0, "_Z17ClientPutInServerP7edict_s", (size_t)&ClientPutInServer },
|
||||
{ 0x01D64F00, "Q_strlen", (size_t)&Q_strlen_ },
|
||||
|
Loading…
x
Reference in New Issue
Block a user