diff --git a/src/TableData.cpp b/src/TableData.cpp index f59acac..daa5dc0 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -671,10 +671,10 @@ static void loadGruntworkPre(json& gruntwork, int32_t* nextId) { std::vector targetIDs; std::vector targetTypes; // target types are not exportable from gw, but load them anyway std::vector pathPoints; - int speed = (int)path["iBaseSpeed"]; - int taskID = (int)path["iTaskID"]; - bool relative = (bool)path["bRelative"]; - bool loop = (bool)path["bLoop"]; + int speed = path.find("iBaseSpeed") == path.end() ? NPC_DEFAULT_SPEED : (int)path["iBaseSpeed"]; + int taskID = path.find("iTaskID") == path.end() ? -1 : (int)path["iTaskID"]; + bool relative = path.find("bRelative") == path.end() ? false : (bool)path["bRelative"]; + bool loop = path.find("bLoop") == path.end() ? true : (bool)path["bLoop"]; // loop by default // target IDs for (json::iterator _tID = path["aNPCIDs"].begin(); _tID != path["aNPCIDs"].end(); _tID++)