diff options
| author | Shauren <shauren.trinity@gmail.com> | 2020-06-08 00:08:37 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-06-08 00:08:37 +0200 |
| commit | 5fce3604fc9613299f8780d30abbbe69c0c7e531 (patch) | |
| tree | 531af1ed3b22c3a5041918043a775cc55cd49708 /src/server/game/DataStores | |
| parent | e5a6552abcbf0f179aebb67751527242968522f7 (diff) | |
Core/PacketIO: Fixed receiving and sending db2 hotfix packets
Diffstat (limited to 'src/server/game/DataStores')
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 15 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.h | 30 |
2 files changed, 32 insertions, 13 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 4cdd36fbefa..54231bead60 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -1414,7 +1414,11 @@ void DB2Manager::LoadHotfixData() } _maxHotfixId = std::max(_maxHotfixId, id); - _hotfixData[id].emplace_back(tableHash, recordId); + HotfixRecord hotfixRecord; + hotfixRecord.TableHash = tableHash; + hotfixRecord.RecordID = recordId; + hotfixRecord.HotfixID = id; + _hotfixData.insert(hotfixRecord); ++_hotfixCount; deletedRecords[std::make_pair(tableHash, recordId)] = deleted; ++count; @@ -1463,7 +1467,7 @@ void DB2Manager::LoadHotfixBlob() uint32 DB2Manager::GetHotfixCount() const { - return _hotfixCount; + return _hotfixData.size(); } DB2Manager::HotfixContainer const& DB2Manager::GetHotfixData() const @@ -1485,8 +1489,11 @@ uint32 DB2Manager::GetEmptyAnimStateID() const void DB2Manager::InsertNewHotfix(uint32 tableHash, uint32 recordId) { - _hotfixData[++_maxHotfixId].emplace_back(tableHash, recordId); - ++_hotfixCount; + HotfixRecord hotfixRecord; + hotfixRecord.TableHash = tableHash; + hotfixRecord.RecordID = recordId; + hotfixRecord.HotfixID = ++_maxHotfixId; + _hotfixData.insert(hotfixRecord); } std::vector<uint32> DB2Manager::GetAreasForGroup(uint32 areaGroupId) const diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index a578fedbffc..cc508a8883f 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -227,11 +227,11 @@ struct TaxiPathBySourceAndDestination uint32 price; }; -typedef std::map<uint32, TaxiPathBySourceAndDestination> TaxiPathSetForSource; -typedef std::map<uint32, TaxiPathSetForSource> TaxiPathSetBySource; +using TaxiPathSetForSource = std::map<uint32, TaxiPathBySourceAndDestination>; +using TaxiPathSetBySource = std::map<uint32, TaxiPathSetForSource>; -typedef std::vector<TaxiPathNodeEntry const*> TaxiPathNodeList; -typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath; +using TaxiPathNodeList = std::vector<TaxiPathNodeEntry const*>; +using TaxiPathNodesByPath = std::vector<TaxiPathNodeList>; TC_GAME_API extern TaxiMask sTaxiNodesMask; TC_GAME_API extern TaxiMask sOldContinentsNodesMask; @@ -252,12 +252,24 @@ class TC_GAME_API DB2Manager public: DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry) - typedef std::map<int32 /*hotfixId*/, std::vector<std::pair<uint32 /*tableHash*/, int32 /*recordId*/>>> HotfixContainer; + struct HotfixRecord + { + uint32 TableHash = 0; + int32 RecordID = 0; + int32 HotfixID = 0; - typedef std::vector<ItemBonusEntry const*> ItemBonusList; - typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyContainer; - typedef std::set<MountTypeXCapabilityEntry const*, MountTypeXCapabilityEntryComparator> MountTypeXCapabilitySet; - typedef std::vector<MountXDisplayEntry const*> MountXDisplayContainer; + friend bool operator<(HotfixRecord const& left, HotfixRecord const& right) + { + return std::tie(left.HotfixID, left.TableHash, left.RecordID) < std::tie(right.HotfixID, right.TableHash, right.RecordID); + } + }; + + using HotfixContainer = std::set<HotfixRecord>; + + using ItemBonusList = std::vector<ItemBonusEntry const*>; + using MapDifficultyContainer = std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>>; + using MountTypeXCapabilitySet = std::set<MountTypeXCapabilityEntry const*, MountTypeXCapabilityEntryComparator>; + using MountXDisplayContainer = std::vector<MountXDisplayEntry const*>; static DB2Manager& Instance(); |
