diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index 0e3c1b26..06d6a520 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -1301,50 +1301,49 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe { s_tradeAllowedCommandsInit = true; - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("addFriend")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("addIgnore")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("closeContainer")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("combatSpam")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("find")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("gc")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("getAttributes")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("getAttributesBatch")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("getFriendList")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("getIgnoreList")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("groupChat")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("groupChat")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("gsay")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("gtell")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("guildsay")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("kneel")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("maskscent")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("meditate")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("newbiehelper")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("openContainer")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("prose")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("removeFriend")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("removeIgnore")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("requestBiography")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("requestCharacterMatch")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("requestDraftSlots")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("requestManfSchematicSlots")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("requestResourceWeights")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("setMatchMakingCharacterId")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("setMatchMakingPersonalId")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("setMood")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("setMoodInternal")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("setSpokenLanguage")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("sitServer")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("social")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("socialInternal")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("spatialChat")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("spatialChatInternal")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("stand")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("synchronizedUiListen")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("synchronizedUiStopListening")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("target")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("tip")); - s_tradeAllowedCommands.push_back (Crc::normalizeAndCalculate("waypoint")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("addFriend")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("addIgnore")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("closeContainer")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("combatSpam")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("find")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("gc")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("getAttributes")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("getAttributesBatch")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("getFriendList")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("getIgnoreList")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("groupChat")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("gsay")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("gtell")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("guildsay")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("kneel")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("maskscent")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("meditate")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("newbiehelper")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("openContainer")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("prose")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("removeFriend")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("removeIgnore")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("requestBiography")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("requestCharacterMatch")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("requestDraftSlots")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("requestManfSchematicSlots")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("requestResourceWeights")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("setMatchMakingCharacterId")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("setMatchMakingPersonalId")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("setMood")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("setMoodInternal")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("setSpokenLanguage")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("sitServer")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("social")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("socialInternal")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("spatialChat")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("spatialChatInternal")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("stand")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("synchronizedUiListen")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("synchronizedUiStopListening")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("target")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("tip")); + s_tradeAllowedCommands.push_back(constcrcnormalizecalc("waypoint")); s_tradeAllowedCommands.push_back (CommandTable::getNullCommand().m_commandHash); diff --git a/engine/shared/library/sharedFoundation/include/public/sharedFoundation/CrcConstexpr.hpp b/engine/shared/library/sharedFoundation/include/public/sharedFoundation/CrcConstexpr.hpp index d70fed60..2c514c2e 100644 --- a/engine/shared/library/sharedFoundation/include/public/sharedFoundation/CrcConstexpr.hpp +++ b/engine/shared/library/sharedFoundation/include/public/sharedFoundation/CrcConstexpr.hpp @@ -65,5 +65,41 @@ constexpr const uint32 constcrc(const char *string) return (crc ^ CRC_INIT); } +constexpr const uint32 constcrcnormalizecalc(const char *input) +{ + char* output = (char*) malloc( input + 1 ); + bool previousIsSlash = true; + for ( ; *input; ++input) + { + const char c = *input; + if (c == '\\' || c == '/') + { + if (!previousIsSlash) + { + // convert all backslashes to forward slashes and disallow multiple slashes in a row + *(output++) = '/'; + previousIsSlash = true; + } + } + else + if (c == '.') + { + // disallow dots after slashes. this will also handle multiple dots, and slashes following the dots + if (!previousIsSlash) + *(output++) = '.'; + } + else + { + // lowercase all other characters + *(output++) = static_cast(tolower(c)); + previousIsSlash = false; + } + } + + *output = '\0'; + + return constcrc(output); +} + // ======================================================================