From cfd770118980acf1983f53e01c3b8f34346b6426 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Sun, 10 Mar 2024 15:19:39 -0500 Subject: [PATCH] fix syncing by normalizing whitespace in room description --- src/expandoracommon/parseevent.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/expandoracommon/parseevent.cpp b/src/expandoracommon/parseevent.cpp index ae832dbb5..c0f1ebec2 100644 --- a/src/expandoracommon/parseevent.cpp +++ b/src/expandoracommon/parseevent.cpp @@ -5,13 +5,12 @@ #include "parseevent.h" -#include #include #include #include +#include #include "../global/TextUtils.h" -#include "../global/utils.h" #include "../mapdata/ExitDirection.h" #include "../parser/CommandId.h" #include "../parser/ConnectedRoomFlags.h" @@ -110,9 +109,11 @@ SharedParseEvent ParseEvent::createEvent(const CommandEnum c, auto result = std::make_shared(c); ParseEvent *const event = result.get(); + static const std::regex normalizeWhitespacePattern(R"(\s+)", std::regex::optimize); + // the moved strings are used by const ref here before they're moved. event->setProperty(moved_roomName); - event->setProperty(moved_roomDesc); + event->setProperty(RoomDesc{std::regex_replace(moved_roomDesc.getStdString(), normalizeWhitespacePattern, " ")}); event->setProperty(terrain); // After this block, the moved values are gone.