summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-13 11:36:36 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-13 11:36:36 +0000
commitafc770043be553998555e9ac1cffca68dc482d48 (patch)
tree60e99ade9464b0a1de2ec246724a7bfe0957eec4 /src/main.cpp
parentcfcc1bc3a756185bd39dd858ebbe69b5916ac11b (diff)
downloadmana-afc770043be553998555e9ac1cffca68dc482d48.tar.gz
mana-afc770043be553998555e9ac1cffca68dc482d48.tar.bz2
mana-afc770043be553998555e9ac1cffca68dc482d48.tar.xz
mana-afc770043be553998555e9ac1cffca68dc482d48.zip
Merged cleanups and content changes from the trunk. Also fixed compiling with
OpenGL enabled.
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();