summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ce68b7bb..a4ef29ee 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -43,7 +43,6 @@
#define NOGDI
#endif
-#include "animation.h"
#include "configuration.h"
#include "game.h"
#include "graphics.h"
@@ -216,15 +215,6 @@ void init_engine()
resman->addToSearchPath("data", true);
resman->addToSearchPath(TMW_DATADIR "data", true);
- 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);
@@ -232,16 +222,18 @@ 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))
{
@@ -299,11 +291,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();