diff --git a/dGame/dGameMessages/GameMessageFields.inc b/dGame/dGameMessages/GameMessageFields.inc index f086c5a35..32ccce592 100644 --- a/dGame/dGameMessages/GameMessageFields.inc +++ b/dGame/dGameMessages/GameMessageFields.inc @@ -205,7 +205,6 @@ json ToJson(const GameMessages::ReportBug& m); json ToJson(const GameMessages::VerifyAck& m); json ToJson(const GameMessages::Help& m); json ToJson(const GameMessages::DisplayGuildCreateBox& m); -json ToJson(const GameMessages::GetEditorLevel& m); json ToJson(const GameMessages::OpenPropertyVendor& m); json ToJson(const GameMessages::OpenPropertyManagement& m); json ToJson(const GameMessages::DownloadPropertyData& m); @@ -1815,12 +1814,6 @@ json ToJson(const GameMessages::DisplayGuildCreateBox& m) { j["bShow"] = ToJson(m.bShow); return j; } -json ToJson(const GameMessages::GetEditorLevel& m) { - json j = json::object(); - j["editorEnabled"] = ToJson(m.editorEnabled); - j["editorLevel"] = ToJson(m.editorLevel); - return j; -} json ToJson(const GameMessages::OpenPropertyVendor& m) { json j = json::object(); return j; @@ -2751,7 +2744,6 @@ const std::vector& Entries() { { MessageType::Game::VERIFY_ACK, eDirection::TO_CLIENT, "VerifyAck", &ReadWith }, { MessageType::Game::HELP, eDirection::TO_CLIENT, "Help", &ReadWith }, { MessageType::Game::DISPLAY_GUILD_CREATE_BOX, eDirection::TO_CLIENT, "DisplayGuildCreateBox", &ReadWith }, - { MessageType::Game::GET_EDITOR_LEVEL, eDirection::TO_SERVER, "GetEditorLevel", &ReadWith }, { MessageType::Game::OPEN_PROPERTY_VENDOR, eDirection::TO_CLIENT, "OpenPropertyVendor", &ReadWith }, { MessageType::Game::OPEN_PROPERTY_MANAGEMENT, eDirection::TO_CLIENT, "OpenPropertyManagement", &ReadWith }, { MessageType::Game::DOWNLOAD_PROPERTY_DATA, eDirection::TO_CLIENT, "DownloadPropertyData", &ReadWith }, diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index c75e059ad..13d140271 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -225,7 +225,6 @@ namespace { { TOGGLE_GHOST_REFERENCE_OVERRIDE, []() { return std::make_unique(); } }, { SET_GHOST_REFERENCE_POSITION, []() { return std::make_unique(); } }, { MODIFY_GHOSTING_DISTANCE, []() { return std::make_unique(); } }, - { GET_EDITOR_LEVEL, []() { return std::make_unique(); } }, }; }; diff --git a/dGame/dGameMessages/PlayerMessages.cpp b/dGame/dGameMessages/PlayerMessages.cpp index b484d2adf..a9277d14c 100644 --- a/dGame/dGameMessages/PlayerMessages.cpp +++ b/dGame/dGameMessages/PlayerMessages.cpp @@ -267,28 +267,4 @@ namespace GameMessages { bool DisplayGuildCreateBox::Deserialize(RakNet::BitStream& bitStream) { return bitStream.Read(bShow); } - - void GetEditorLevel::Serialize(RakNet::BitStream& bitStream) const { - bitStream.Write(editorEnabled); - bitStream.Write(editorLevel); - } - - bool GetEditorLevel::Deserialize(RakNet::BitStream& bitStream) { - // A question: whatever it carries is not needed to answer it - if (bitStream.GetNumberOfUnreadBits() < 33) return true; - return bitStream.Read(editorEnabled) && bitStream.Read(editorLevel); - } - - void GetEditorLevel::Handle(Entity& entity, const SystemAddress& sysAddr) { - // Only about the asker's own character - auto* const player = PlayerManager::GetPlayer(sysAddr); - if (!player || player != &entity) return; - const auto* const character = entity.GetComponent(); - if (!character) return; - GetEditorLevel answer; - answer.target = entity.GetObjectID(); - answer.editorEnabled = character->GetEditorEnabled(); - answer.editorLevel = character->GetEditorLevel(); - answer.SendToClient(sysAddr); - } } diff --git a/dGame/dGameMessages/PlayerMessages.h b/dGame/dGameMessages/PlayerMessages.h index 8e2bf40b8..5faedcd7f 100644 --- a/dGame/dGameMessages/PlayerMessages.h +++ b/dGame/dGameMessages/PlayerMessages.h @@ -193,18 +193,6 @@ namespace GameMessages { bool bShow{ true }; }; - - // Client -> server, and the server's answer to that client: whether the client's level editor is on for the - // player and at which level (the character's editor level, 0 for none). What a client sends is not used. - struct GetEditorLevel : public NetGameMsg { - GetEditorLevel() : NetGameMsg(MessageType::Game::GET_EDITOR_LEVEL) {} - void Serialize(RakNet::BitStream& bitStream) const override; - bool Deserialize(RakNet::BitStream& bitStream) override; - void Handle(Entity& entity, const SystemAddress& sysAddr) override; - - bool editorEnabled{ false }; - int32_t editorLevel{ 0 }; - }; } #endif // PLAYERMESSAGES_H diff --git a/docs/ZonePublish.md b/docs/ZonePublish.md index cc358f1e6..2ba781f90 100644 --- a/docs/ZonePublish.md +++ b/docs/ZonePublish.md @@ -158,4 +158,5 @@ answered as any other: its player is here, so the world is sent to it again. The clients to the new instance as any world reload does; a client with its editor on loses its connection there. A character's editor level is told to the client in the character's save (`edit`), with the character (the editor -flag and level after the GM level) and in answer to the GetEditorLevel game message. +flag and level after the GM level). GetEditorLevel (627) is one of the client's local messages, answered by its own +character component; it is never sent over the network. diff --git a/tests/dGameTests/dComponentsTests/CharacterSaveFieldsTests.cpp b/tests/dGameTests/dComponentsTests/CharacterSaveFieldsTests.cpp index 54d43c20b..b64e5f0f8 100644 --- a/tests/dGameTests/dComponentsTests/CharacterSaveFieldsTests.cpp +++ b/tests/dGameTests/dComponentsTests/CharacterSaveFieldsTests.cpp @@ -439,19 +439,3 @@ TEST_F(CharacterSaveFieldsTests, EditorLevelIsSerializedAfterTheGmLevel) { EXPECT_EQ(gmBlock(eGameMasterLevel::CIVILIAN), (std::pair{ false, 0 })); } -// GetEditorLevel's answer: one bit, then the level as 32 bits -TEST_F(CharacterSaveFieldsTests, GetEditorLevelAnswerLayout) { - GameMessages::GetEditorLevel answer; - answer.editorEnabled = true; - answer.editorLevel = 9; - RakNet::BitStream stream; - answer.Serialize(stream); - EXPECT_EQ(stream.GetNumberOfBitsUsed(), 33u); - GameMessages::GetEditorLevel read; - ASSERT_TRUE(read.Deserialize(stream)); - EXPECT_TRUE(read.editorEnabled); - EXPECT_EQ(read.editorLevel, 9); - // A question with nothing in it reads too - RakNet::BitStream empty; - EXPECT_TRUE(GameMessages::GetEditorLevel().Deserialize(empty)); -}