File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,16 +55,6 @@ void ElunaMgr::Destroy(ElunaInfo const& info)
5555 Destroy (info.key );
5656}
5757
58- ElunaInfoKey::ElunaInfoKey (uint32 mapId, uint32 instanceId)
59- {
60- value = MakeKey (mapId, instanceId).value ;
61- }
62-
63- bool ElunaInfoKey::operator ==(const ElunaInfoKey& other) const
64- {
65- return value == other.value ;
66- }
67-
6858constexpr ElunaInfoKey ElunaInfoKey::MakeKey (uint32 mapId, uint32 instanceId)
6959{
7060 return ElunaInfoKey (instanceId | (static_cast <uint64>(mapId) << 32 ));
@@ -75,26 +65,6 @@ constexpr ElunaInfoKey ElunaInfoKey::MakeGlobalKey(uint32 instanceId)
7565 return MakeKey (GLOBAL_MAP_ID , instanceId);
7666}
7767
78- bool ElunaInfoKey::IsValid () const
79- {
80- return value != INVALID_KEY_VALUE ;
81- }
82-
83- bool ElunaInfoKey::IsGlobal () const
84- {
85- return IsValid () && GetMapId () == GLOBAL_MAP_ID ;
86- }
87-
88- uint32 ElunaInfoKey::GetMapId () const
89- {
90- return value >> 32 ;
91- }
92-
93- uint32 ElunaInfoKey::GetInstanceId () const
94- {
95- return value & 0xFFFFFFFF ;
96- }
97-
9868ElunaInfo::ElunaInfo (uint32 mapId, uint32 instanceId)
9969{
10070 key = ElunaInfoKey::MakeKey (mapId, instanceId);
Original file line number Diff line number Diff line change @@ -16,23 +16,22 @@ class Eluna;
1616struct ElunaInfoKey
1717{
1818public:
19- ElunaInfoKey () : value(INVALID_KEY_VALUE ) {}
20- ElunaInfoKey (uint64 key) : value(key) {}
21- ElunaInfoKey (uint32 mapId, uint32 instanceId);
19+ constexpr ElunaInfoKey () : value(INVALID_KEY_VALUE ) {}
20+ constexpr ElunaInfoKey (uint64 key) : value(key) {}
2221 ~ElunaInfoKey () {}
2322
24- bool operator ==(const ElunaInfoKey& other) const ;
23+ constexpr bool operator ==(const ElunaInfoKey& other) const { return value == other. value ; }
2524
2625public:
2726 static constexpr ElunaInfoKey MakeKey (uint32 mapId, uint32 instanceId);
2827 static constexpr ElunaInfoKey MakeGlobalKey (uint32 instanceId);
2928
30- bool IsValid () const ;
31- bool IsGlobal () const ;
29+ constexpr bool IsValid () const { return value != INVALID_KEY_VALUE ; };
30+ constexpr bool IsGlobal () const { return IsValid () && GetMapId () == GLOBAL_MAP_ID ; };
31+
32+ constexpr uint32 GetMapId () const { return value >> 32 ; };
33+ constexpr uint32 GetInstanceId () const { return value & 0xFFFFFFFF ; };
3234
33- uint32 GetMapId () const ;
34- uint32 GetInstanceId () const ;
35-
3635public:
3736 static uint64 const INVALID_KEY_VALUE = std::numeric_limits<uint64>().max();
3837 static uint32 const GLOBAL_MAP_ID = std::numeric_limits<uint32>().max();
You can’t perform that action at this time.
0 commit comments