···604604 return;
605605 }
606606607607- // XXX: This may be broken if there are multiple known universes - how do we determine which to use then?
608608- const JSONNode universe = lighthousedb["known_universes"][0];
609609- const std::string id = universe["id"].asString();
610607 JSONNode info = {};
611611- for (const JSONNode &u : chap_info["universes"].asArray()) {
612612- if (u["universeID"].asString() == id) {
613613- DEV_INFO("Found info for universe %s", id.c_str());
614614- info = u;
608608+ bool universe_found = false;
609609+610610+ // XXX: This may be broken if there are multiple known universes - how do we determine which to use then?
611611+ auto known_universes = lighthousedb["known_universes"].asArray();
612612+ for (auto &universe : known_universes) {
613613+ const std::string id = universe["id"].asString();
614614+ for (const JSONNode &u : chap_info["universes"].asArray()) {
615615+ if (u["universeID"].asString() == id) {
616616+ DEV_INFO("Found info for universe %s", id.c_str());
617617+ info = u;
618618+ universe_found = true;
619619+ break;
620620+ }
621621+ }
622622+ if (universe_found) {
615623 break;
616624 }
617625 }
618626619627 if (info.isInvalid()) {
620620- DEV_ERR("Couldn't find chaperone info for universe %s, playspace center will be off", id.c_str());
628628+ DEV_ERR("Couldn't find chaperone info for any known universe, playspace center will be off");
621629 return;
622630 }
623631