aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorJohannes Schickel2009-12-09 17:05:23 +0000
committerJohannes Schickel2009-12-09 17:05:23 +0000
commit0d43cc61d26e9cd68611c1c45cbf220b50e3b3f3 (patch)
tree202bde3591ef878186845a33ae5ad7e474f5d714 /graphics
parent8f34e4b11c77740ad9a8e316f30382e8ad9cd4dc (diff)
downloadscummvm-rg350-0d43cc61d26e9cd68611c1c45cbf220b50e3b3f3.tar.gz
scummvm-rg350-0d43cc61d26e9cd68611c1c45cbf220b50e3b3f3.tar.bz2
scummvm-rg350-0d43cc61d26e9cd68611c1c45cbf220b50e3b3f3.zip
Cleanup: remove "s_initialized" from CursorManager and FontManager implementation, these classes are Singletons, so they will ever only be initialized once at most anyway.
svn-id: r46313
Diffstat (limited to 'graphics')
-rw-r--r--graphics/cursorman.cpp9
-rw-r--r--graphics/font.h2
-rw-r--r--graphics/fontman.cpp26
3 files changed, 17 insertions, 20 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 0491081d1a..98b0de8a1d 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -31,14 +31,9 @@ DECLARE_SINGLETON(Graphics::CursorManager);
namespace Graphics {
-static bool s_initialized = false;
-
CursorManager::CursorManager() {
- if (!s_initialized) {
- s_initialized = true;
- _cursorStack.clear();
- _cursorPaletteStack.clear();
- }
+ _cursorStack.clear();
+ _cursorPaletteStack.clear();
}
bool CursorManager::isVisible() {
diff --git a/graphics/font.h b/graphics/font.h
index 6f7b666485..5044e96af3 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -141,7 +141,7 @@ public:
};
#define DEFINE_FONT(n) \
- const NewFont *n; \
+ const NewFont *n = 0; \
void create_##n() { \
n = new NewFont(desc); \
}
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index 05abb4e4c7..99c64ca976 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -29,30 +29,32 @@ DECLARE_SINGLETON(Graphics::FontManager);
namespace Graphics {
-const ScummFont *g_scummfont;
+const ScummFont *g_scummfont = 0;
extern const NewFont *g_sysfont;
extern const NewFont *g_sysfont_big;
extern const NewFont *g_consolefont;
-static bool s_initialized = false;
-
FontManager::FontManager() {
- if (!s_initialized) {
- // FIXME : this need to be freed
- s_initialized = true;
- g_scummfont = new ScummFont;
- INIT_FONT(g_sysfont)
- INIT_FONT(g_sysfont_big)
- INIT_FONT(g_consolefont)
- }
+ // This assert should *never* trigger, because
+ // FontManager is a singleton, thus there is only
+ // one instance of it per time. (g_scummfont gets
+ // reset to 0 in the desctructor of this class).
+ assert(g_scummfont == 0);
+ g_scummfont = new ScummFont;
+ INIT_FONT(g_sysfont)
+ INIT_FONT(g_sysfont_big)
+ INIT_FONT(g_consolefont)
}
FontManager::~FontManager() {
- s_initialized = false;
delete g_scummfont;
+ g_scummfont = 0;
delete g_sysfont;
+ g_sysfont = 0;
delete g_sysfont_big;
+ g_sysfont_big = 0;
delete g_consolefont;
+ g_consolefont = 0;
}
const Font *FontManager::getFontByName(const Common::String &name) const {