From b08bd747f3fb707126bc03e6bb3eec53c23947e7 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sun, 13 Mar 2016 20:05:42 +0300 Subject: [PATCH] added load tries to waypoint loader --- include/core.h | 1 + source/waypoint.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/core.h b/include/core.h index 2ce9eed..d0d76b1 100644 --- a/include/core.h +++ b/include/core.h @@ -1336,6 +1336,7 @@ private: Vector m_learnPosition; Vector m_foundBombOrigin; + int m_loadTries; int m_cacheWaypointIndex; int m_lastJumpWaypoint; int m_visibilityIndex; diff --git a/source/waypoint.cpp b/source/waypoint.cpp index 3e2f9da..61040a0 100644 --- a/source/waypoint.cpp +++ b/source/waypoint.cpp @@ -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;