aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Common.h15
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp2
-rw-r--r--src/server/game/Conditions/ConditionMgr.h14
-rw-r--r--src/server/game/Spells/SpellInfo.h2
4 files changed, 24 insertions, 9 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 908cd487822..7a1ea247a94 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -161,4 +161,19 @@ namespace Trinity
}
}
+//! Hash implementation for std::pair to allow using pairs in unordered_set or as key for unordered_map
+//! Individual types used in pair must be hashable by boost::hash
+namespace std
+{
+ template<class K, class V>
+ struct hash<std::pair<K, V>>
+ {
+ public:
+ size_t operator()(std::pair<K, V> const& key) const
+ {
+ return boost::hash_value(key);
+ }
+ };
+}
+
#endif
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 2a7cdc3d50b..32314d92fdc 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -2187,7 +2187,7 @@ void ConditionMgr::Clean()
NpcVendorConditionContainerStore.clear();
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
- for (std::list<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr)
+ for (std::vector<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr)
delete *itr;
AllocatedMemoryStore.clear();
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index ff429cdbd26..0411e421c56 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -213,13 +213,13 @@ struct Condition
std::string ToString(bool ext = false) const; /// For logging purpose
};
-typedef std::list<Condition*> ConditionContainer;
-typedef std::map<uint32 /*SourceEntry*/, ConditionContainer> ConditionsByEntryMap;
-typedef std::map<ConditionSourceType /*SourceType*/, ConditionsByEntryMap> ConditionEntriesByTypeMap;
-typedef std::map<uint32, ConditionsByEntryMap> ConditionEntriesByCreatureIdMap;
-typedef std::map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionsByEntryMap> SmartEventConditionContainer;
+typedef std::vector<Condition*> ConditionContainer;
+typedef std::unordered_map<uint32 /*SourceEntry*/, ConditionContainer> ConditionsByEntryMap;
+typedef std::unordered_map<ConditionSourceType /*SourceType*/, ConditionsByEntryMap> ConditionEntriesByTypeMap;
+typedef std::unordered_map<uint32, ConditionsByEntryMap> ConditionEntriesByCreatureIdMap;
+typedef std::unordered_map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionsByEntryMap> SmartEventConditionContainer;
-typedef std::map<uint32, ConditionContainer> ConditionReferenceContainer;//only used for references
+typedef std::unordered_map<uint32, ConditionContainer> ConditionReferenceContainer;//only used for references
class ConditionMgr
{
@@ -271,7 +271,7 @@ class ConditionMgr
static void LogUselessConditionValue(Condition* cond, uint8 index, uint32 value);
void Clean(); // free up resources
- std::list<Condition*> AllocatedMemoryStore; // some garbage collection :)
+ std::vector<Condition*> AllocatedMemoryStore; // some garbage collection :)
ConditionEntriesByTypeMap ConditionStore;
ConditionReferenceContainer ConditionReferenceStore;
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index ecb55b25afd..241e7df9544 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -249,7 +249,7 @@ public:
uint32 ItemType;
uint32 TriggerSpell;
flag96 SpellClassMask;
- std::list<Condition*>* ImplicitTargetConditions;
+ std::vector<Condition*>* ImplicitTargetConditions;
SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0),
RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0),