removed SEH

This commit is contained in:
jeefo 2015-07-05 18:53:58 +03:00
commit 6847bd34a6
6 changed files with 18 additions and 64 deletions

View file

@ -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;

View file

@ -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 ());
}
};

View file

@ -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
}
}
}