From e331bce0d6ddff35866634326608921fbc237d30 Mon Sep 17 00:00:00 2001 From: Andrew Copland Date: Mon, 23 Mar 2020 21:54:30 +0000 Subject: [PATCH] Get std::string explicitly from json --- src/Body.cpp | 2 +- src/Frame.cpp | 2 +- src/Ship.cpp | 2 +- src/scenegraph/ModelSkin.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Body.cpp b/src/Body.cpp index ebbcb274e..70b4a0f08 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -44,7 +44,7 @@ Body::Body(const Json &jsonObj, Space *space) : Properties().LoadFromJson(bodyObj); m_frame = bodyObj["index_for_frame"]; - m_label = bodyObj["label"]; + m_label = bodyObj["label"].get(); Properties().Set("label", m_label); m_dead = bodyObj["dead"]; diff --git a/src/Frame.cpp b/src/Frame.cpp index cb6d848f4..7ce6e39be 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -192,7 +192,7 @@ FrameId Frame::FromJson(const Json &frameObj, Space *space, FrameId parent, doub f->m_flags = frameObj["flags"]; f->m_radius = frameObj["radius"]; - f->m_label = frameObj["label"]; + f->m_label = frameObj["label"].get(); f->m_pos = frameObj["pos"]; f->m_angSpeed = frameObj["ang_speed"]; diff --git a/src/Ship.cpp b/src/Ship.cpp index 161156f64..d8cfba8e2 100644 --- a/src/Ship.cpp +++ b/src/Ship.cpp @@ -188,7 +188,7 @@ Ship::Ship(const Json &jsonObj, Space *space) : m_navLights->LoadFromJson(shipObj); - m_shipName = shipObj["name"]; + m_shipName = shipObj["name"].get(); Properties().Set("shipName", m_shipName); } catch (Json::type_error &) { throw SavedGameCorruptException(); diff --git a/src/scenegraph/ModelSkin.cpp b/src/scenegraph/ModelSkin.cpp index 44c498d6a..9173f7ee6 100644 --- a/src/scenegraph/ModelSkin.cpp +++ b/src/scenegraph/ModelSkin.cpp @@ -111,10 +111,10 @@ namespace SceneGraph { if (decalsArray.size() != MAX_DECAL_MATERIALS) throw SavedGameCorruptException(); for (unsigned int i = 0; i < MAX_DECAL_MATERIALS; i++) { Json arrayElem = decalsArray[i]; - m_decals[i] = arrayElem["decal"]; + m_decals[i] = arrayElem["decal"].get(); } - m_label = modelSkinObj["label"]; + m_label = modelSkinObj["label"].get(); } catch (Json::type_error &) { throw SavedGameCorruptException(); }