diff --git a/include/core.h b/include/core.h index 0ee7b9f..ba4578e 100644 --- a/include/core.h +++ b/include/core.h @@ -62,7 +62,6 @@ using namespace Math; #if defined (COMPILER_VISUALC) && (COMPILER_VISUALC > 1000) #pragma comment (linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1") #pragma comment (linker, "/SECTION:.data,RW") - #pragma warning (disable : 4288) #endif typedef int (FAR *EntityAPI_t) (gamefuncs_t *, int); @@ -173,7 +172,7 @@ public: #include // defines bots tasks -enum TaskId_t +enum TaskID { TASK_NORMAL, TASK_PAUSE, @@ -622,7 +621,7 @@ struct KeywordFactory // tasks definition struct TaskItem { - TaskId_t id; // major task/action carried out + TaskID id; // major task/action carried out float desire; // desire (filled in) for this task int data; // additional data (waypoint index) float time; // time task expires @@ -1244,12 +1243,12 @@ public: void DeleteSearchNodes (void); void VerifyBreakable (edict_t *touch); - void RemoveCertainTask (TaskId_t id); - void StartTask (TaskId_t id, float desire, int data, float time, bool canContinue); + void RemoveCertainTask (TaskID id); + void StartTask (TaskID id, float desire, int data, float time, bool canContinue); void ResetTasks (void); TaskItem *GetTask (void); - inline TaskId_t GetTaskId (void) { return GetTask ()->id; }; + inline TaskID GetTaskId (void) { return GetTask ()->id; }; void TakeDamage (edict_t *inflictor, int damage, int armor, int bits); void TakeBlinded (const Vector &fade, int alpha); diff --git a/include/corelib.h b/include/corelib.h index 994ef16..8d0e82d 100644 --- a/include/corelib.h +++ b/include/corelib.h @@ -21,10 +21,6 @@ #include #include -#if defined (PLATFORM_WIN32) -#pragma warning (disable : 4100 4189 4239 4996 4244 383 473 981) -#endif - // // Title: Utility Classes Header // @@ -1059,9 +1055,7 @@ template class Array { private: T *m_elements; - T m_failed; -private: int m_resizeStep; int m_itemSize; int m_itemCount; @@ -1084,8 +1078,6 @@ public: m_itemSize = 0; m_itemCount = 0; m_resizeStep = resizeStep; - - m_failed = T (); } // @@ -1101,7 +1093,6 @@ public: m_itemSize = 0; m_itemCount = 0; m_resizeStep = 0; - m_failed = T (); AssignFrom (other); } @@ -1277,11 +1268,6 @@ public: // T &GetAt (int index) { - if (index >= m_itemCount) - { - m_failed = T (); - return m_failed; - } return m_elements[index]; } @@ -1546,9 +1532,6 @@ public: // T Pop (void) { - if (m_itemCount <= 0) - return m_failed; - T element = m_elements[m_itemCount - 1]; RemoveAt (m_itemCount - 1); @@ -1557,9 +1540,6 @@ public: T &Last (void) { - if (m_itemCount <= 0) - return m_failed; - return m_elements[m_itemCount - 1]; } @@ -2740,11 +2720,6 @@ public: return static_cast (ToFloat ()); } - String *operator -> (void) const - { - return (String *const) this; - } - friend String operator + (const String &s1, const String &s2) { String result (s1); diff --git a/include/globals.h b/include/globals.h index d5131b9..2803a25 100644 --- a/include/globals.h +++ b/include/globals.h @@ -126,4 +126,4 @@ static inline bool IsEntityNull (const edict_t *ent) static inline int GetTeam (edict_t *ent) { return g_clients[IndexOfEntity (ent) - 1].team; -} +} \ No newline at end of file diff --git a/source/basecode.cpp b/source/basecode.cpp index 4068175..8cc4719 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -2185,7 +2185,7 @@ void Bot::ResetTasks (void) m_tasks.RemoveAll (); } -void Bot::StartTask (TaskId_t id, float desire, int data, float time, bool resume) +void Bot::StartTask (TaskID id, float desire, int data, float time, bool resume) { if (!m_tasks.IsEmpty ()) { @@ -2268,7 +2268,7 @@ TaskItem *Bot::GetTask (void) return &m_tasks.Last (); } -void Bot::RemoveCertainTask (TaskId_t id) +void Bot::RemoveCertainTask (TaskID id) { // this function removes one task from the bot task stack. @@ -2418,7 +2418,7 @@ void Bot::CheckRadioCommands (void) m_targetEntity = m_radioEntity; // don't pause/camp/follow anymore - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_PAUSE || taskID == TASK_CAMP) GetTask ()->time = GetWorldTime (); @@ -2537,7 +2537,7 @@ void Bot::CheckRadioCommands (void) } else if ((IsEntityNull (m_enemy) && EntityIsVisible (m_radioEntity->v.origin)) || distance < 2048) { - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_PAUSE || taskID == TASK_CAMP) { @@ -2603,7 +2603,7 @@ void Bot::CheckRadioCommands (void) RadioMessage (Radio_Affirmative); // don't pause/camp anymore - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_PAUSE || taskID == TASK_CAMP) GetTask ()->time = GetWorldTime (); @@ -2646,7 +2646,7 @@ void Bot::CheckRadioCommands (void) else { // don't pause/camp anymore - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_PAUSE) GetTask ()->time = GetWorldTime (); @@ -2743,7 +2743,7 @@ void Bot::CheckRadioCommands (void) else { // don't pause anymore - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_PAUSE) GetTask ()->time = GetWorldTime (); @@ -2795,7 +2795,7 @@ void Bot::CheckRadioCommands (void) void Bot::TryHeadTowardRadioEntity (void) { - TaskId_t taskID = GetTaskId (); + TaskID taskID = GetTaskId (); if (taskID == TASK_MOVETOPOSITION || m_headedTime + 15.0f < GetWorldTime () || !IsAlive (m_radioEntity) || m_hasC4) return; diff --git a/source/interface.cpp b/source/interface.cpp index 149a32f..07c9cfd 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -3002,7 +3002,7 @@ struct DirectoryTransition DirectoryTransition (const String &oldName, const String &newName) { String rootPath; - rootPath->AssignFormat ("%s/addons/yapb/", GetModName ()); + rootPath.AssignFormat ("%s/addons/yapb/", GetModName ()); this->oldName = rootPath + oldName; this->newName = rootPath + newName; @@ -3010,8 +3010,8 @@ struct DirectoryTransition void TryToRename (void) { - if (access (oldName->GetBuffer (), 00) != -1) - rename (oldName->GetBuffer (), newName->GetBuffer ()); + if (access (oldName.GetBuffer (), 00) != -1) + rename (oldName.GetBuffer (), newName.GetBuffer ()); } }; diff --git a/source/manager.cpp b/source/manager.cpp index 863c1d4..4df3a36 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -232,32 +232,12 @@ Bot *BotManager::FindOneValidAliveBot (void) void BotManager::Think (void) { - // this function calls think () function for all available at call moment bots, and - // try to catch internal error if such shit occurs + // this function calls think () function for all available at call moment bots for (int i = 0; i < GetMaxClients (); i++) { if (m_bots[i] != NULL) - { - // use these try-catch blocks to prevent server crashes when error occurs -#if defined (NDEBUG) && !defined (PLATFORM_LINUX) && !defined (PLATFORM_OSX) - try - { - m_bots[i]->Think (); - } - catch (...) - { - // error occurred. kick off all bots and then print a warning message - RemoveAll (); - - ServerPrint ("**** INTERNAL BOT ERROR! PLEASE SHUTDOWN AND RESTART YOUR SERVER! ****"); - } -#else m_bots[i]->Think (); - -#endif - - } } }