From fdd01602487a1d833f57c99b4a31e85068ba3ade Mon Sep 17 00:00:00 2001 From: JadeShrineMaiden Date: Sun, 30 Aug 2020 23:29:28 +0100 Subject: [PATCH 1/2] Colliding NPC IID quickfix --- src/NPCManager.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index 995f3c7..7f67d27 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -15,7 +15,9 @@ std::vector NPCManager::RespawnPoints; void NPCManager::init() { // load NPCs from NPCs.json into our NPC manager - + // Temporary fix, IDs will be pulled from json later + int i; + try { std::ifstream inFile(settings::NPCJSON); nlohmann::json npcData; @@ -25,6 +27,11 @@ void NPCManager::init() { for (nlohmann::json::iterator npc = npcData.begin(); npc != npcData.end(); npc++) { BaseNPC tmp(npc.value()["x"], npc.value()["y"], npc.value()["z"], npc.value()["id"]); + + // Temporary fix, IDs will be pulled from json later + tmp.appearanceData.iNPC_ID = i; + i++; + NPCs[tmp.appearanceData.iNPC_ID] = tmp; if (npc.value()["id"] == 641 || npc.value()["id"] == 642) @@ -47,7 +54,11 @@ void NPCManager::init() { for (nlohmann::json::iterator npc = npcData.begin(); npc != npcData.end(); npc++) { BaseNPC tmp(npc.value()["iX"], npc.value()["iY"], npc.value()["iZ"], npc.value()["iNPCType"], npc.value()["iHP"], npc.value()["iConditionBitFlag"], npc.value()["iAngle"], npc.value()["iBarkerType"]); - + + // Temporary fix, IDs will be pulled from json later + tmp.appearanceData.iNPC_ID = i; + i++; + NPCs[tmp.appearanceData.iNPC_ID] = tmp; } From 1e344c2dd8d1238643622406eb7a4e62e2f51ee7 Mon Sep 17 00:00:00 2001 From: JadeShrineMaiden Date: Mon, 31 Aug 2020 01:36:29 +0100 Subject: [PATCH 2/2] Small tweak --- src/NPCManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index 7f67d27..b83a47a 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -16,7 +16,7 @@ std::vector NPCManager::RespawnPoints; void NPCManager::init() { // load NPCs from NPCs.json into our NPC manager // Temporary fix, IDs will be pulled from json later - int i; + int i = 0; try { std::ifstream inFile(settings::NPCJSON);