fixed another buffer overflow in config parser
fixed memory leak in translation fixed bots don't shoot through walls fixed bots don't buy anything, if server issues sv_restart 1 fixed inability to kick bot's, when playing on Xash3D engine
This commit is contained in:
parent
d75d5bad44
commit
2b005a6a98
6 changed files with 29 additions and 16 deletions
|
|
@ -1332,7 +1332,7 @@ public:
|
|||
|
||||
void ListBots (void);
|
||||
void SetWeaponMode (int selection);
|
||||
void CheckTeamEconomics (int team);
|
||||
void CheckTeamEconomics (int team, bool setTrue = false);
|
||||
|
||||
static void CallGameEntity (entvars_t *vars);
|
||||
inline void SetDeathMsgState (bool sent)
|
||||
|
|
|
|||
|
|
@ -2372,7 +2372,7 @@ bool Bot::IsLastEnemyViewable (void)
|
|||
bool Bot::LastEnemyShootable (void)
|
||||
{
|
||||
// don't allow shooting through walls
|
||||
if (!(m_aimFlags & AIM_LAST_ENEMY) || IsEntityNull (m_lastEnemy) || GetTaskId () == TASK_PAUSE || m_lastEnemyOrigin != nullvec)
|
||||
if (!(m_aimFlags & AIM_LAST_ENEMY) || m_lastEnemyOrigin == nullvec || IsEntityNull (m_lastEnemy))
|
||||
return false;
|
||||
|
||||
return GetShootingConeDeviation (GetEntity (), &m_lastEnemyOrigin) >= 0.90 && IsShootableThruObstacle (m_lastEnemyOrigin);
|
||||
|
|
@ -2932,7 +2932,7 @@ void Bot::ChooseAimDirection (void)
|
|||
{
|
||||
TraceLine (EyePosition (), m_lastEnemyOrigin, false, true, GetEntity (), &tr);
|
||||
|
||||
if (tr.flFraction <= 0.2 && tr.pHit == g_hostEntity)
|
||||
if (tr.flFraction <= 0.2 && tr.pHit == g_worldEdict)
|
||||
{
|
||||
if ((m_aimFlags & (AIM_LAST_ENEMY | AIM_PREDICT_PATH)) && m_wantsToFire)
|
||||
m_wantsToFire = false;
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void InitConfig (void)
|
|||
g_chatFactory.SetSize (CHAT_TOTAL);
|
||||
g_chatterFactory.SetSize (Chatter_Total);
|
||||
|
||||
#define SKIP_COMMENTS() if ((line[0] == '/') || (line[0] == '\r') || (line[0] == '\n') || (line[0] == 0) || (line[0] == ' ') || (line[0] == '\t')) continue;
|
||||
#define SKIP_COMMENTS() if (line[0] == '/' || line[0] == '\r' || line[0] == '\n' || line[0] == 0 || line[0] == ' ' || line[0] == '\t' || line[0] == ';') continue
|
||||
|
||||
// NAMING SYSTEM INITIALIZATION
|
||||
if (OpenConfig ("names.cfg", "Name configuration file not found.", &fp , true))
|
||||
|
|
@ -502,6 +502,7 @@ void InitConfig (void)
|
|||
SKIP_COMMENTS ();
|
||||
|
||||
strtrim (line);
|
||||
line[32] = 0;
|
||||
|
||||
BotName item;
|
||||
memset (&item, 0, sizeof (item));
|
||||
|
|
@ -3031,6 +3032,13 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
// such if necessary. Nothing really bot-related is done in this function. The actual bot
|
||||
// initialization stuff will be done later, when we'll be certain to have a multilayer game.
|
||||
|
||||
// get the engine functions from the engine...
|
||||
memcpy (&g_engfuncs, functionTable, sizeof (enginefuncs_t));
|
||||
g_pGlobals = pGlobals;
|
||||
|
||||
// register our cvars
|
||||
g_convarWrapper->PushRegisteredConVarsToEngine ();
|
||||
|
||||
static struct ModSupport
|
||||
{
|
||||
char name[10];
|
||||
|
|
@ -3049,13 +3057,6 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
{ "cs13", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike v1.3", CSV_OLD }, // assume cs13 = cs15
|
||||
};
|
||||
|
||||
// get the engine functions from the engine...
|
||||
memcpy (&g_engfuncs, functionTable, sizeof (enginefuncs_t));
|
||||
g_pGlobals = pGlobals;
|
||||
|
||||
// register our cvars
|
||||
g_convarWrapper->PushRegisteredConVarsToEngine ();
|
||||
|
||||
ModSupport *knownMod = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE_HLSDK (s_supportedMods); i++)
|
||||
|
|
@ -3131,8 +3132,6 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
|
||||
if (!g_funcPointers || !g_entityAPI)
|
||||
TerminateOnMalloc ();
|
||||
|
||||
GetEngineFunctions (functionTable, NULL);
|
||||
|
||||
// give the engine functions to the other DLL...
|
||||
(*g_funcPointers) (functionTable, pGlobals);
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ Bot *BotManager::GetHighestFragsBot (int team)
|
|||
return GetBot (bestIndex);
|
||||
}
|
||||
|
||||
void BotManager::CheckTeamEconomics (int team)
|
||||
void BotManager::CheckTeamEconomics (int team, bool setTrue)
|
||||
{
|
||||
// this function decides is players on specified team is able to buy primary weapons by calculating players
|
||||
// that have not enough money to buy primary (with economics), and if this result higher 80%, player is can't
|
||||
|
|
@ -675,7 +675,7 @@ void BotManager::CheckTeamEconomics (int team)
|
|||
|
||||
extern ConVar yb_economics_rounds;
|
||||
|
||||
if (!yb_economics_rounds.GetBool ())
|
||||
if (!yb_economics_rounds.GetBool () || setTrue)
|
||||
{
|
||||
m_economicsGood[team] = true;
|
||||
return; // don't check economics while economics disable
|
||||
|
|
@ -1158,7 +1158,7 @@ void Bot::Kick (void)
|
|||
{
|
||||
// this function kick off one bot from the server.
|
||||
|
||||
ServerCommand ("kick #%d", GETPLAYERUSERID (GetEntity ()));
|
||||
ServerCommand ("kick \"%s\"", STRING (pev->netname));
|
||||
CenterPrint ("Bot '%s' kicked", STRING (pev->netname));
|
||||
|
||||
// balances quota
|
||||
|
|
|
|||
|
|
@ -409,6 +409,12 @@ void NetworkMsg::Execute (void *p)
|
|||
}
|
||||
}
|
||||
|
||||
if (FStrEq (PTR_TO_STR (p), "#Game_will_restart_in"))
|
||||
{
|
||||
g_botManager->CheckTeamEconomics (TEAM_CF, true);
|
||||
g_botManager->CheckTeamEconomics (TEAM_TF, true);
|
||||
}
|
||||
|
||||
if (FStrEq (PTR_TO_STR (p), "#Terrorists_Win"))
|
||||
{
|
||||
g_botManager->SetLastWinner (TEAM_TF); // update last winner for economics
|
||||
|
|
|
|||
|
|
@ -289,6 +289,14 @@ void FreeLibraryMemory (void)
|
|||
// this function free's all allocated memory
|
||||
g_waypoint->Init (); // frees waypoint data
|
||||
|
||||
IterateArray (g_localizer->m_langTab, it)
|
||||
{
|
||||
delete[] g_localizer->m_langTab[it].original;
|
||||
delete[] g_localizer->m_langTab[it].translated;
|
||||
}
|
||||
g_localizer->m_langTab.RemoveAll ();
|
||||
|
||||
|
||||
delete [] g_experienceData;
|
||||
g_experienceData = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue