Skip to content

Commit e2d128d

Browse files
committed
[c++] Fix Moghouse entry in WoTG + SoA
1 parent d77afb5 commit e2d128d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/map/packets/c2s/0x05e_maprect.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "0x05e_maprect.h"
2323

24+
#include <string_view>
25+
2426
#include "common/utils.h"
2527
#include "entities/charentity.h"
2628
#include "enums/msg_std.h"
@@ -63,8 +65,13 @@ void GP_CLI_COMMAND_MAPRECT::process(MapSession* PSession, CCharEntity* PChar) c
6365

6466
PChar->ClearTrusts();
6567

66-
auto isMogHouseExit = std::memcmp(&this->RectID, "zmrq", 4) == 0; // zmrq is the universal Mog House exit zoneline
67-
auto isMogHouseEntrance = std::memcmp(&this->RectID, "zmr", 3) == 0; // zmr* are zone-specific Mog House entry zonelines
68+
// RectID is a uint32_t holding a 4-character zoneline tag (fourcc); reinterpret as exactly 4 bytes (no trailing NUL).
69+
const std::string_view rectView(reinterpret_cast<const char*>(&this->RectID), 4);
70+
71+
const auto isMogHouseExit = rectView == "zmrq"; // universal Mog House exit zoneline
72+
73+
const std::string_view mogEntrancePrefix = rectView.substr(0, 3);
74+
const auto isMogHouseEntrance = mogEntrancePrefix == "zmr" || mogEntrancePrefix == "zms"; // zmr* classic cities; zms* WoTG [S] + Adoulin
6875

6976
if (PChar->status == STATUS_TYPE::NORMAL)
7077
{

0 commit comments

Comments
 (0)