aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/math
diff options
context:
space:
mode:
authorMax Horn2010-10-13 15:41:34 +0000
committerMax Horn2010-10-13 15:41:34 +0000
commit9b4d41d2d2a165a95b3b9223f53196fe51c0b14f (patch)
tree155156c08186657d76bdd9235b60fdafc3633960 /engines/sword25/math
parent8f4f0d16fc4e5cd4803203f2aaeb0ddc99e57204 (diff)
downloadscummvm-rg350-9b4d41d2d2a165a95b3b9223f53196fe51c0b14f.tar.gz
scummvm-rg350-9b4d41d2d2a165a95b3b9223f53196fe51c0b14f.tar.bz2
scummvm-rg350-9b4d41d2d2a165a95b3b9223f53196fe51c0b14f.zip
SWORD25: Convert object registries to singletons
svn-id: r53431
Diffstat (limited to 'engines/sword25/math')
-rw-r--r--engines/sword25/math/regionregistry.cpp7
-rw-r--r--engines/sword25/math/regionregistry.h15
2 files changed, 11 insertions, 11 deletions
diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp
index 1509ea9e5e..bcfb2cbc43 100644
--- a/engines/sword25/math/regionregistry.cpp
+++ b/engines/sword25/math/regionregistry.cpp
@@ -39,9 +39,12 @@
#include "sword25/math/regionregistry.h"
#include "sword25/math/region.h"
-namespace Sword25 {
+// TODO: Destroy the singletons when closing the engine;
+// even better, turn them into non-singleton members of
+// e.g. Sword25Engine.
+DECLARE_SINGLETON(Sword25::RegionRegistry)
-Common::SharedPtr<RegionRegistry> RegionRegistry::_instancePtr;
+namespace Sword25 {
void RegionRegistry::logErrorLn(const char *message) const {
BS_LOG_ERRORLN(message);
diff --git a/engines/sword25/math/regionregistry.h b/engines/sword25/math/regionregistry.h
index 78c2c08fc3..560d4ae4a9 100644
--- a/engines/sword25/math/regionregistry.h
+++ b/engines/sword25/math/regionregistry.h
@@ -35,7 +35,8 @@
#ifndef SWORD25_REGIONREGISTRY_H
#define SWORD25_REGIONREGISTRY_H
-#include "common/ptr.h"
+#include "common/singleton.h"
+
#include "sword25/kernel/common.h"
#include "sword25/kernel/persistable.h"
#include "sword25/kernel/objectregistry.h"
@@ -44,21 +45,17 @@ namespace Sword25 {
class Region;
-class RegionRegistry : public ObjectRegistry<Region>, public Persistable {
+class RegionRegistry :
+ public ObjectRegistry<Region>,
+ public Persistable,
+ public Common::Singleton<RegionRegistry> {
public:
- static RegionRegistry &instance() {
- if (!_instancePtr.get()) _instancePtr = Common::SharedPtr<RegionRegistry>(new RegionRegistry());
- return *_instancePtr.get();
- }
-
virtual bool persist(OutputPersistenceBlock &writer);
virtual bool unpersist(InputPersistenceBlock &reader);
private:
virtual void logErrorLn(const char *message) const;
virtual void logWarningLn(const char *message) const;
-
- static Common::SharedPtr<RegionRegistry> _instancePtr;
};
} // End of namespace Sword25