fix $where in the lobby

This commit is contained in:
Martin Michelsen
2025-03-01 19:30:10 -08:00
parent d02a3d7d64
commit ddc52c06ae
+6 -2
View File
@@ -2775,11 +2775,14 @@ ChatCommandDefinition cc_where(
{"$where"}, {"$where"},
+[](const ServerArgs& a) -> void { +[](const ServerArgs& a) -> void {
auto l = a.c->require_lobby(); auto l = a.c->require_lobby();
uint32_t floor = l->is_game() ? a.c->floor : 0x0F;
Episode episode = l->is_game() ? l->episode : Episode::EP1;
send_text_message_printf(a.c, "$C7%01" PRIX32 ":%s X:%" PRId32 " Z:%" PRId32, send_text_message_printf(a.c, "$C7%01" PRIX32 ":%s X:%" PRId32 " Z:%" PRId32,
a.c->floor, floor,
FloorDefinition::get(l->episode, a.c->floor).short_name, FloorDefinition::get(episode, floor).short_name,
static_cast<int32_t>(a.c->pos.x.load()), static_cast<int32_t>(a.c->pos.x.load()),
static_cast<int32_t>(a.c->pos.z.load())); static_cast<int32_t>(a.c->pos.z.load()));
if (l->is_game()) {
for (auto lc : l->clients) { for (auto lc : l->clients) {
if (lc && (lc != a.c)) { if (lc && (lc != a.c)) {
string name = lc->character()->disp.name.decode(lc->language()); string name = lc->character()->disp.name.decode(lc->language());
@@ -2787,6 +2790,7 @@ ChatCommandDefinition cc_where(
name.c_str(), lc->floor, FloorDefinition::get(l->episode, lc->floor).short_name); name.c_str(), lc->floor, FloorDefinition::get(l->episode, lc->floor).short_name);
} }
} }
}
}, },
unavailable_on_proxy_server); unavailable_on_proxy_server);