summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-03-05 22:33:09 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-03-05 22:33:09 +0000
commit5f9bbd205fec7d66643861a5204c6cc7dec639ba (patch)
treead21b3432c3cafb10a9e4a7d32b600cebe74d92c /src/main.cpp
parenta74208583e806fcfdc485428fb4f9e694e962455 (diff)
downloadmana-5f9bbd205fec7d66643861a5204c6cc7dec639ba.tar.gz
mana-5f9bbd205fec7d66643861a5204c6cc7dec639ba.tar.bz2
mana-5f9bbd205fec7d66643861a5204c6cc7dec639ba.tar.xz
mana-5f9bbd205fec7d66643861a5204c6cc7dec639ba.zip
Merged new_playerset branch into trunk.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index af6d21e3..27bd5373 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,7 +26,9 @@
#include <getopt.h>
#include <iostream>
#include <physfs.h>
+#include <sstream>
#include <unistd.h>
+#include <vector>
#include <SDL_image.h>
#include <guichan/actionlistener.hpp>
@@ -78,7 +80,8 @@
// Account infos
char n_server, n_character;
-Spriteset *hairset = NULL, *playerset = NULL;
+std::vector<Spriteset *> hairset;
+Spriteset *playerset = NULL;
Graphics *graphics;
// TODO Anyone knows a good location for this? Or a way to make it non-global?
@@ -265,11 +268,24 @@ void init_engine()
playerset = resman->createSpriteset(
"graphics/sprites/player_male_base.png", 64, 64);
- hairset = resman->createSpriteset(
- "graphics/sprites/player_male_hair.png", 40, 40);
-
if (!playerset) logger->error("Couldn't load player spriteset!");
- if (!hairset) logger->error("Couldn't load hair spriteset!");
+
+ for (int i=0; i < NR_HAIR_STYLES; i++)
+ {
+ std::stringstream filename;
+ filename << "graphics/sprites/hairstyle" << (i + 1) << ".png";
+ printf("hairstyle: %s\n", filename.str().c_str());
+ Spriteset *tmp = ResourceManager::getInstance()->createSpriteset(
+ filename.str(), 40, 40);
+ if (!tmp) {
+ logger->error("Unable to load hairstyle");
+ } else {
+ hairset.push_back(tmp);
+ }
+ }
+ /*hairset = resman->createSpriteset(
+ "graphics/sprites/player_male_hair.png", 29, 29);
+ if (!hairset) logger->error("Couldn't load hair spriteset!");*/
gui = new Gui(graphics);
state = UPDATE_STATE; /**< Initial game state */
@@ -304,7 +320,12 @@ void exit_engine()
config.write();
delete gui;
delete graphics;
- delete hairset;
+ //delete hairset;
+ for (unsigned int i = 0; i < hairset.size(); i++)
+ {
+ delete hairset[i];
+ }
+ hairset.clear();
delete playerset;
// Shutdown libxml