Get std::string explicitly from json

master
Andrew Copland 2020-03-23 21:54:30 +00:00
parent cde7642711
commit e331bce0d6
4 changed files with 5 additions and 5 deletions

View File

@ -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<std::string>();
Properties().Set("label", m_label);
m_dead = bodyObj["dead"];

View File

@ -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<std::string>();
f->m_pos = frameObj["pos"];
f->m_angSpeed = frameObj["ang_speed"];

View File

@ -188,7 +188,7 @@ Ship::Ship(const Json &jsonObj, Space *space) :
m_navLights->LoadFromJson(shipObj);
m_shipName = shipObj["name"];
m_shipName = shipObj["name"].get<std::string>();
Properties().Set("shipName", m_shipName);
} catch (Json::type_error &) {
throw SavedGameCorruptException();

View File

@ -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<std::string>();
}
m_label = modelSkinObj["label"];
m_label = modelSkinObj["label"].get<std::string>();
} catch (Json::type_error &) {
throw SavedGameCorruptException();
}