Push my suggestion for CI tests.

This commit is contained in:
Jettford 2023-12-19 15:24:26 +00:00
parent e2391665b9
commit 79b4fa7d3e
6 changed files with 23 additions and 8 deletions

3
.gitmodules vendored
View File

@ -17,3 +17,6 @@
[submodule "thirdparty/AccountManager"]
path = thirdparty/AccountManager
url = https://github.com/DarkflameUniverse/AccountManager
[submodule "thirdparty/magic_enum"]
path = thirdparty/magic_enum
url = https://github.com/Neargye/magic_enum.git

View File

@ -297,6 +297,7 @@ set(INCLUDED_DIRECTORIES
"thirdparty/recastnavigation"
"thirdparty/SQLite"
"thirdparty/cpplinq"
"thirdparty/magic_enum/include"
"tests"
"tests/dCommonTests"

View File

@ -3,6 +3,8 @@
#include <cstdint>
#include "magic_enum/magic_enum.hpp"
enum class eGameMessageType : uint16_t {
GET_POSITION = 0,
GET_ROTATION = 1,
@ -1602,4 +1604,10 @@ enum class eGameMessageType : uint16_t {
GET_IS_ON_RAIL = 1772
};
template <>
struct magic_enum::customize::enum_range<eGameMessageType> {
static constexpr int min = 0;
static constexpr int max = 1772;
};
#endif //!__EGAMEMESSAGETYPE__H__

View File

@ -37,8 +37,6 @@
#include "ePlayerFlag.h"
#include "dConfig.h"
using namespace std;
void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) {
CBITSTREAM;
@ -49,11 +47,11 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
User* usr = UserManager::Instance()->GetUser(sysAddr);
if (!entity) {
LOG("Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
LOG("Failed to find associated entity (%llu), aborting GM (%4i) %s!", objectID, messageID, magic_enum::enum_name(messageID).data());
return;
}
if (messageID != eGameMessageType::READY_FOR_UPDATES) LOG_DEBUG("received game message ID: %i", messageID);
if (messageID != eGameMessageType::READY_FOR_UPDATES) LOG_DEBUG("Received GM with ID and name: %4i, %s", messageID, magic_enum::enum_name(messageID).data());
switch (messageID) {
@ -344,12 +342,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
SyncSkill sync = SyncSkill(inStream); // inStream replaced &bitStream
ostringstream buffer;
std::ostringstream buffer;
for (unsigned int k = 0; k < sync.sBitStream.size(); k++) {
char s;
s = sync.sBitStream.at(k);
buffer << setw(2) << hex << setfill('0') << (int)s << " ";
buffer << std::setw(2) << std::hex << std::setfill('0') << (int)s << " ";
}
if (usr != nullptr) {
@ -691,7 +689,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
GameMessages::HandleCancelDonationOnPlayer(inStream, entity);
break;
default:
LOG_DEBUG("Unknown game message ID: %i", messageID);
LOG_DEBUG("Received Unknown GM with ID: %4i, %s", messageID, magic_enum::enum_name(messageID).data());
break;
}
}

View File

@ -1244,7 +1244,11 @@ void HandlePacket(Packet* packet) {
}
default:
LOG("Unknown world packet received: %i", int(packet->data[3]));
if (packet->bitSize < (16 + sizeof(uint32_t) * 8)) break;
uint32_t messageId = *reinterpret_cast<uint32_t*>(&packet->data[3]);
const char* messageIdString = magic_enum::enum_name(static_cast<eWorldMessageType>(messageId)).data();
LOG("Unknown world packet received: (%4i) %s", messageId, messageIdString);
}
}

1
thirdparty/magic_enum vendored Submodule

@ -0,0 +1 @@
Subproject commit e26b05e0a04529ed2ac2571919f9755ba0afee18