added load tries to waypoint loader

This commit is contained in:
jeefo 2016-03-13 20:05:42 +03:00
commit b08bd747f3
2 changed files with 10 additions and 0 deletions

View file

@ -1336,6 +1336,7 @@ private:
Vector m_learnPosition;
Vector m_foundBombOrigin;
int m_loadTries;
int m_cacheWaypointIndex;
int m_lastJumpWaypoint;
int m_visibilityIndex;

View file

@ -17,6 +17,7 @@ ConVar yb_waypoint_autodl_enable ("yb_waypoint_autodl_enable", "1");
void Waypoint::Init (void)
{
// this function initialize the waypoint structures..
m_loadTries = 0;
m_learnVelocity.Zero ();
m_learnPosition.Zero ();
@ -1056,6 +1057,13 @@ void Waypoint::InitTypes (void)
bool Waypoint::Load (void)
{
if (m_loadTries++ > 3)
{
sprintf (m_infoBuffer, "Giving up loading waypoint file. Something went wrong.", engine.GetMapName ());
AddLogEntry (true, LL_ERROR, m_infoBuffer);
return false;
}
MemoryFile fp (CheckSubfolderFile ());
WaypointHeader header;
@ -2470,6 +2478,7 @@ Waypoint::Waypoint (void)
m_findWPIndex = -1;
m_facingAtIndex = -1;
m_visibilityIndex = 0;
m_loadTries = 0;
m_isOnLadder = false;