summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-09-13 21:33:02 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-09-13 21:33:02 +0000
commita68d11c8f32ac8795a27fe3bc27e1943ee6dc813 (patch)
tree09576a6d6bb87ce2fd2b2a1e577a4b8e9ee5d5ea /src/being.cpp
parenta4ebc80ec3aa5d5b7faf51ad878d11bd4a8915e9 (diff)
downloadmana-a68d11c8f32ac8795a27fe3bc27e1943ee6dc813.tar.gz
mana-a68d11c8f32ac8795a27fe3bc27e1943ee6dc813.tar.bz2
mana-a68d11c8f32ac8795a27fe3bc27e1943ee6dc813.tar.xz
mana-a68d11c8f32ac8795a27fe3bc27e1943ee6dc813.zip
Merge createBeing and add_node.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp
index a0b9a88c..579ad54f 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -53,8 +53,14 @@ PATH_NODE::PATH_NODE(unsigned short x, unsigned short y):
{
}
-void add_node(Being *being)
+Being* createBeing(unsigned int id, unsigned short job, Map *map)
{
+ Being *being = new Being;
+
+ being->setId(id);
+ being->job = job;
+ being->setMap(map);
+
beings.push_back(being);
// If the being is a player, request the name
@@ -64,20 +70,25 @@ void add_node(Being *being)
WFIFOSET(6);
}
// If the being is a monster then load the monsterset
- else if (being->job >= 1002 && monsterset.find(
- being->job - 1002) == monsterset.end()) {
+ else if (being->job >= 1002 &&
+ monsterset.find(being->job - 1002) == monsterset.end())
+ {
std::stringstream filename;
+
filename << "graphics/sprites/monster" << (being->job - 1002) << ".png";
logger->log("%s",filename.str().c_str());
- ResourceManager *resman = ResourceManager::getInstance();
- Image *monsterbitmap = resman->getImage(filename.str());
+
+ Image *monsterbitmap =
+ ResourceManager::getInstance()->getImage(filename.str());
+
if (!monsterbitmap) {
logger->error("Unable to load monster.png");
- }
- else {
+ } else {
monsterset[being->job - 1002] = new Spriteset(monsterbitmap, 60, 60);
}
}
+
+ return being;
}
void remove_node(unsigned int id)