mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-14 10:20:05 +00:00
Tolerate missing optional fields when loading gruntwork
These are already allowed to be absent in paths.json, but the gruntwork loading logic wasn't updated accordingly.
This commit is contained in:
parent
384a2ece78
commit
3c6afa0322
@ -671,10 +671,10 @@ static void loadGruntworkPre(json& gruntwork, int32_t* nextId) {
|
|||||||
std::vector<int32_t> targetIDs;
|
std::vector<int32_t> targetIDs;
|
||||||
std::vector<int32_t> targetTypes; // target types are not exportable from gw, but load them anyway
|
std::vector<int32_t> targetTypes; // target types are not exportable from gw, but load them anyway
|
||||||
std::vector<Vec3> pathPoints;
|
std::vector<Vec3> pathPoints;
|
||||||
int speed = (int)path["iBaseSpeed"];
|
int speed = path.find("iBaseSpeed") == path.end() ? NPC_DEFAULT_SPEED : (int)path["iBaseSpeed"];
|
||||||
int taskID = (int)path["iTaskID"];
|
int taskID = path.find("iTaskID") == path.end() ? -1 : (int)path["iTaskID"];
|
||||||
bool relative = (bool)path["bRelative"];
|
bool relative = path.find("bRelative") == path.end() ? false : (bool)path["bRelative"];
|
||||||
bool loop = (bool)path["bLoop"];
|
bool loop = path.find("bLoop") == path.end() ? true : (bool)path["bLoop"]; // loop by default
|
||||||
|
|
||||||
// target IDs
|
// target IDs
|
||||||
for (json::iterator _tID = path["aNPCIDs"].begin(); _tID != path["aNPCIDs"].end(); _tID++)
|
for (json::iterator _tID = path["aNPCIDs"].begin(); _tID != path["aNPCIDs"].end(); _tID++)
|
||||||
|
Loading…
Reference in New Issue
Block a user