MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / jsonToSystemLocation

Function jsonToSystemLocation

source/game/StarSystemWorld.cpp:60–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60SystemLocation jsonToSystemLocation(Json const& json) {
61 if (auto location = json.optArray()) {
62 if (location->get(0).type() == Json::Type::String) {
63 String type = location->get(0).toString();
64 if (type == "coordinate")
65 return CelestialCoordinate(location->get(1));
66 else if (type == "orbit")
67 return CelestialOrbit::fromJson(location->get(1));
68 else if (type == "object")
69 return Uuid(location->get(1).toString());
70 } else if (auto position = jsonToMaybe<Vec2F>(*location, jsonToVec2F)) {
71 return *position;
72 }
73 }
74 return {};
75}
76
77Json jsonFromSystemLocation(SystemLocation const& location) {
78 if (auto coordinate = location.maybe<CelestialCoordinate>())

Callers 4

loadServerDataMethod · 0.85
QuestMethod · 0.85
makeQuestCallbacksMethod · 0.85

Calls 6

CelestialCoordinateClass · 0.85
UuidClass · 0.85
optArrayMethod · 0.80
typeMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected