diff --git a/include/core.h b/include/core.h index 12c4a12..9909dc7 100644 --- a/include/core.h +++ b/include/core.h @@ -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) diff --git a/source/basecode.cpp b/source/basecode.cpp index e67c1e2..4613a6b 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -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; diff --git a/source/interface.cpp b/source/interface.cpp index eedcad8..5bb8f56 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -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); diff --git a/source/manager.cpp b/source/manager.cpp index 32e1dda..4c6f151 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -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 diff --git a/source/netmsg.cpp b/source/netmsg.cpp index df83384..bb66ac8 100644 --- a/source/netmsg.cpp +++ b/source/netmsg.cpp @@ -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 diff --git a/source/support.cpp b/source/support.cpp index ffa86cb..a8b585c 100644 --- a/source/support.cpp +++ b/source/support.cpp @@ -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; }