mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-28 22:15:49 -04:00
in theory this will "normalize" these chars...worst case i turn this into
an lower case only version since the hard coded strings generally aren't slashes
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
+36
@@ -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<char>(tolower(c));
|
||||
previousIsSlash = false;
|
||||
}
|
||||
}
|
||||
|
||||
*output = '\0';
|
||||
|
||||
return constcrc(output);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user