diff options
author | Nayd <dnpd.dd@gmail.com> | 2014-11-26 02:21:50 +0000 |
---|---|---|
committer | Nayd <dnpd.dd@gmail.com> | 2014-11-26 02:21:50 +0000 |
commit | 24c173f387044496d581255545ed94c988f3ae3b (patch) | |
tree | 1bb4a1518fc3971f707f02a439ed25fb875eb7e8 /src/server/game/Chat/Chat.cpp | |
parent | c73474305320c926c7d81cd8ae576d5c3a72f1c9 (diff) |
Core: Use the correct function to convert strings to unsigned longs and unsigned long longs
Fixes wrong data being inserted into the database (i.e explored zones).
More info in #13493
Fixes #13493
Thanks to @jackpoz for finding the code issue and @Vavehl for an expectional bug report.
Conflicts:
src/server/game/Entities/Player/Player.cpp
src/server/game/Globals/ObjectMgr.cpp
src/server/scripts/Commands/cs_misc.cpp
src/server/scripts/Commands/cs_modify.cpp
Diffstat (limited to 'src/server/game/Chat/Chat.cpp')
-rw-r--r-- | src/server/game/Chat/Chat.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 6f614994489..f05ce5bded9 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -982,7 +982,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) if (!idS) return 0; - uint32 id = (uint32)atol(idS); + uint32 id = atoul(idS); switch (type) { @@ -995,13 +995,10 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) if (!talentEntry) return 0; - int32 rank = param1_str ? (uint32)atol(param1_str) : 0; + uint32 rank = param1_str ? atol(param1_str) : 0u; if (rank >= MAX_TALENT_RANK) return 0; - if (rank < 0) - rank = 0; - return talentEntry->RankID[rank]; } case SPELL_LINK_ENCHANT: @@ -1009,7 +1006,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) return id; case SPELL_LINK_GLYPH: { - uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0; + uint32 glyph_prop_id = param1_str ? atoul(param1_str) : 0; GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id); if (!glyphPropEntry) @@ -1082,7 +1079,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text) } case SPELL_LINK_CREATURE: { - uint32 lowguid = (uint32)atol(idS); + uint32 lowguid = atoul(idS); if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid)) return ObjectGuid(HIGHGUID_UNIT, data->id, lowguid); @@ -1091,7 +1088,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text) } case SPELL_LINK_GAMEOBJECT: { - uint32 lowguid = (uint32)atol(idS); + uint32 lowguid = atoul(idS); if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid)) return ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, lowguid); |