From 0dd148f4625f534c509d60e4eaa77961679cddbe Mon Sep 17 00:00:00 2001 From: bonkmaykr Date: Mon, 29 Jan 2024 03:55:44 -0600 Subject: [PATCH] attempting fix for #1 --- src/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 2525be9..1960112 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -814,7 +814,28 @@ void lookUpWorldName(std::string alias, char* buffer/*replies*/) { auto key = worldsmarks.find(alias); if (key != worldsmarks.end()) { std::cout << "info: found world \"" + alias + "\" in database, commencing teleport.\n"; + internalTypes::markEntry details; + json failsafe = { + {"name", "FALLBACK"}, + {"url", "rel:GroundZero/GroundZero.world"}, + {"room", "GroundZero#Reception"}, + {"position", {0, 0, 0, 0}}, + {"blacklist", true} + }; + std::cout << "info: found world \"" + alias + "\" in database, commencing teleport.\n"; + + details.name = worldsmarks.value(alias, failsafe).value("name", "null"); + details.url = worldsmarks.value(alias, failsafe).value("url", "null"); + details.room = worldsmarks.value(alias, failsafe).value("room", "null"); + std::cout << "info: found world \"" + alias + "\" in database, commencing teleport.\n"; + details.position.x = worldsmarks.value(alias, failsafe).value("position", "null")[0]; + details.position.y = worldsmarks.value(alias, failsafe).value("position", "null")[1]; + details.position.z = worldsmarks.value(alias, failsafe).value("position", "null")[2]; + details.position.yaw = worldsmarks.value(alias, failsafe).value("position", "null")[3]; + std::cout << "info: found world \"" + alias + "\" in database, commencing teleport.\n"; + + /* details.name = (*key)["name"].get(); details.url = (*key)["url"].get(); details.room = (*key)["room"].get(); @@ -822,6 +843,7 @@ void lookUpWorldName(std::string alias, char* buffer/*replies*/) { details.position.y = (*key)["position"][1]; details.position.z = (*key)["position"][2]; details.position.yaw = (*key)["position"][3]; + */ sprintf(buffer, mainConf->getValue("world_not_found_msg", "Taking you there now, teleport to me!").c_str()); handleTeleportRequest(details);