From 465f07a9b774d147bc7a55d600bdfd1cd9a7c4d4 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 29 May 2024 11:31:54 +1000 Subject: [PATCH] fix unknown tech logging --- source/game/StarPlayerTech.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/game/StarPlayerTech.cpp b/source/game/StarPlayerTech.cpp index 3f2db05..bf8053f 100644 --- a/source/game/StarPlayerTech.cpp +++ b/source/game/StarPlayerTech.cpp @@ -10,11 +10,12 @@ PlayerTech::PlayerTech(Json const& json) { m_availableTechs = jsonToStringSet(json.get("availableTechs")); m_enabledTechs = jsonToStringSet(json.get("enabledTechs")); auto techDatabase = Root::singleton().techDatabase(); - for (auto p : json.get("equippedTechs", JsonObject()).iterateObject()) { - if (techDatabase->contains(p.second.toString())) - m_equippedTechs.set(TechTypeNames.getLeft(p.first), p.second.toString()); + for (auto& p : json.getObject("equippedTechs")) { + String techName = p.second.toString(); + if (techDatabase->contains(techName)) + m_equippedTechs.set(TechTypeNames.getLeft(p.first), techName); else - Logger::warn("Missing tech '%s' in slot '%s'", p.second.toString(), p.first); + Logger::warn("Unequipping unknown tech '{}' from slot '{}'", techName, p.first); } }