summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-08-07 01:59:38 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-08-07 01:59:38 +0000
commit16793c9b9b3fb5fd64fdf434ef6b5501803cb670 (patch)
tree626ec25bb4a0b3e387621c0e998f76997a33b881 /src/main.cpp
parentd25e1c9b0dac7fcfe803083af1189489d5a9ad88 (diff)
downloadmana-16793c9b9b3fb5fd64fdf434ef6b5501803cb670.tar.gz
mana-16793c9b9b3fb5fd64fdf434ef6b5501803cb670.tar.bz2
mana-16793c9b9b3fb5fd64fdf434ef6b5501803cb670.tar.xz
mana-16793c9b9b3fb5fd64fdf434ef6b5501803cb670.zip
A bunch of cleanups.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3476ffdd..eb20c169 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -210,15 +210,6 @@ void init_engine()
SDL_WM_SetCaption("The Mana World", NULL);
SDL_WM_SetIcon(IMG_Load(TMW_DATADIR "data/icons/tmw-icon.png"), NULL);
- int width, height, bpp;
- bool fullscreen, hwaccel;
-
- width = (int)config.getValue("screenwidth", 800);
- height = (int)config.getValue("screenheight", 600);
- bpp = 0;
- fullscreen = ((int)config.getValue("screen", 0) == 1);
- hwaccel = ((int)config.getValue("hwaccel", 0) == 1);
-
#ifdef USE_OPENGL
bool useOpenGL = (config.getValue("opengl", 0) == 1);
@@ -226,16 +217,17 @@ void init_engine()
Image::setLoadAsOpenGL(useOpenGL);
// Create the graphics context
- if (useOpenGL) {
- graphics = new OpenGLGraphics();
- } else {
- graphics = new Graphics();
- }
+ graphics = useOpenGL ? new OpenGLGraphics() : new Graphics();
#else
// Create the graphics context
graphics = new Graphics();
#endif
+ int width = (int)config.getValue("screenwidth", 800);
+ int height = (int)config.getValue("screenheight", 600);
+ int bpp = 0;
+ bool fullscreen = ((int)config.getValue("screen", 0) == 1);
+ bool hwaccel = ((int)config.getValue("hwaccel", 0) == 1);
// Try to set the desired video mode
if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel))
@@ -293,11 +285,8 @@ void exit_engine()
delete gui;
delete graphics;
- std::vector<Spriteset *>::iterator iter;
- for (iter = hairset.begin(); iter != hairset.end(); ++iter)
- {
- (*iter)->decRef();
- }
+ std::for_each(hairset.begin(), hairset.end(),
+ std::mem_fun(&Spriteset::decRef));
hairset.clear();
playerset[0]->decRef();