summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-24 00:13:24 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-24 00:13:24 +0000
commit4789ebb11407eb9402c385f3cc6fa242d91214c2 (patch)
tree6bf5bed52073ae19ef4b5b08e7fe92af603f04d8 /src/main.cpp
parent1b7ff9ad4160fd0ff79d2da658eca8d8c8abf815 (diff)
downloadmana-client-4789ebb11407eb9402c385f3cc6fa242d91214c2.tar.gz
mana-client-4789ebb11407eb9402c385f3cc6fa242d91214c2.tar.bz2
mana-client-4789ebb11407eb9402c385f3cc6fa242d91214c2.tar.xz
mana-client-4789ebb11407eb9402c385f3cc6fa242d91214c2.zip
Implemented caching of spritesets, including a lot of cleanups to the new
animation system. Action now refers to the Spriteset directly and AnimatedSprite refers to the current Action directly instead of using the std::map with a std::string constantly. Some methods and parameters are marked as const. The READ_PROP macro was replaced by static methods. Warnings are logged when unnamed actions are defined or when actions refer to undefined imagesets. Code is more tolerant towards missing actions.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5ecb4f35..28debf47 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,8 +56,6 @@
#endif
#include "sound.h"
-#include "graphic/spriteset.h"
-
#include "gui/char_server.h"
#include "gui/char_select.h"
#include "gui/connection.h"
@@ -76,6 +74,7 @@
#include "resources/image.h"
#include "resources/resourcemanager.h"
+#include "resources/spriteset.h"
#include "utils/dtor.h"
#include "utils/tostring.h"
@@ -244,17 +243,17 @@ void init_engine()
// Initialize for drawing
graphics->_beginDraw();
- playerset[0] = resman->createSpriteset(
+ playerset[0] = resman->getSpriteset(
"graphics/sprites/player_male_base.png", 64, 64);
if (!playerset[0]) logger->error("Couldn't load male player spriteset!");
- playerset[1] = resman->createSpriteset(
+ playerset[1] = resman->getSpriteset(
"graphics/sprites/player_female_base.png", 64, 64);
if (!playerset[1]) logger->error("Couldn't load female player spriteset!");
for (int i=0; i < NR_HAIR_STYLES; i++)
{
- Spriteset *tmp = ResourceManager::getInstance()->createSpriteset(
+ Spriteset *tmp = ResourceManager::getInstance()->getSpriteset(
"graphics/sprites/hairstyle" + toString(i + 1) + ".png",
40, 40);
if (!tmp) {
@@ -288,10 +287,16 @@ void exit_engine()
config.write();
delete gui;
delete graphics;
- for_each(hairset.begin(), hairset.end(), make_dtor(hairset));
+
+ std::vector<Spriteset *>::iterator iter;
+ for (iter = hairset.begin(); iter != hairset.end(); ++iter)
+ {
+ (*iter)->decRef();
+ }
hairset.clear();
- delete playerset[0];
- delete playerset[1];
+
+ playerset[0]->decRef();
+ playerset[1]->decRef();
// Shutdown libxml
xmlCleanupParser();