summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/font.cpp
authorandyq <andyq>2003-01-21 20:37:00 (UTC)
committer andyq <andyq>2003-01-21 20:37:00 (UTC)
commit0a6563fcc2f49857c581d9def24407a3a4ef526c (patch) (side-by-side diff)
treef1b82a4bd7582ef2cb722cffb87eecff1e1f96e6 /noncore/games/sfcave-sdl/font.cpp
parent50b5915b48fc5cbacf23e4d2b75d7a266f141a4a (diff)
downloadopie-0a6563fcc2f49857c581d9def24407a3a4ef526c.zip
opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.gz
opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.bz2
Clean up of code - fixed memory leaks (most of them) and added new custom config menu
Diffstat (limited to 'noncore/games/sfcave-sdl/font.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/font.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/noncore/games/sfcave-sdl/font.cpp b/noncore/games/sfcave-sdl/font.cpp
index 2976d48..1988252 100644
--- a/noncore/games/sfcave-sdl/font.cpp
+++ b/noncore/games/sfcave-sdl/font.cpp
@@ -8,7 +8,7 @@ BFont *FontHandler :: whiteFont;
BFont *FontHandler :: colouredFont;
BFont *FontHandler :: helpFont;
-void FontHandler :: init()
+bool FontHandler :: init()
{
// Load font images
// Convert to fonts
@@ -17,15 +17,27 @@ void FontHandler :: init()
whiteFont = new BFont( IMAGES_PATH "score_font.bmp" );
helpFont = new BFont( IMAGES_PATH "help_font.bmp" );
colouredFont = 0;
+
+ // Check if we are installed correctly (we need fonts to function)
+ if ( menuSelFont == 0 || menuUnSelFont == 0 || whiteFont == 0 || helpFont == 0 )
+ {
+ printf( "One or more fonts are not installed correctly\n" );
+ return false;
+ }
+
+ return true;
}
void FontHandler :: cleanUp()
{
- delete menuSelFont;
- delete menuUnSelFont;
- delete whiteFont;
- delete helpFont;
-
+ if ( menuSelFont )
+ delete menuSelFont;
+ if ( menuUnSelFont )
+ delete menuUnSelFont;
+ if ( whiteFont )
+ delete whiteFont;
+ if ( helpFont )
+ delete helpFont;
if ( colouredFont )
delete colouredFont;
}