aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/kernel')
-rw-r--r--engines/sword25/kernel/callbackregistry.cpp2
-rw-r--r--engines/sword25/kernel/callbackregistry.h13
2 files changed, 13 insertions, 2 deletions
diff --git a/engines/sword25/kernel/callbackregistry.cpp b/engines/sword25/kernel/callbackregistry.cpp
index 5c2f9f9119..b9b48ed18f 100644
--- a/engines/sword25/kernel/callbackregistry.cpp
+++ b/engines/sword25/kernel/callbackregistry.cpp
@@ -117,7 +117,7 @@ CallbackPtr BS_CallbackRegistry::FindPtrByName(const Common::String &Name) const
Common::String BS_CallbackRegistry::FindNameByPtr(CallbackPtr Ptr) const {
// Eintrag in der Map finden und den Namen zurückgeben.
PtrToNameMap::const_iterator It = m_PtrToNameMap.find(Ptr);
- return It == m_PtrToNameMap.end() ? "" : It->second;
+ return It == m_PtrToNameMap.end() ? "" : It->_value;
}
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/kernel/callbackregistry.h b/engines/sword25/kernel/callbackregistry.h
index 38e917cf15..72b8135e47 100644
--- a/engines/sword25/kernel/callbackregistry.h
+++ b/engines/sword25/kernel/callbackregistry.h
@@ -43,6 +43,7 @@
#include "common/str.h"
#include "common/hash-str.h"
#include "common/hashmap.h"
+#include "sword25/kernel/bs_stdint.h"
#include "sword25/kernel/common.h"
namespace Sword25 {
@@ -67,7 +68,17 @@ public:
private:
typedef Common::HashMap<Common::String, CallbackPtr, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> NameToPtrMap;
NameToPtrMap m_NameToPtrMap;
- typedef Common::HashMap<CallbackPtr, Common::String, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> PtrToNameMap;
+
+ struct CallbackPtr_EqualTo {
+ bool operator()(CallbackPtr x, CallbackPtr y) const { return x == y; }
+ };
+ struct CallbackPtr_Hash {
+ uint operator()(CallbackPtr x) const {
+ return static_cast<uint>((int64)x % ((int64)1 << sizeof(uint)));
+ }
+ };
+
+ typedef Common::HashMap<CallbackPtr, Common::String, CallbackPtr_Hash, CallbackPtr_EqualTo> PtrToNameMap;
PtrToNameMap m_PtrToNameMap;
CallbackPtr FindPtrByName(const Common::String &Name) const;