creatures, fixe

This commit is contained in:
Henrique
2011-08-15 02:09:27 -03:00
parent 92b54b6f55
commit e8448cddb9
24 changed files with 428 additions and 278 deletions

View File

@@ -7,44 +7,43 @@ Tile::Tile()
m_ground = NULL;
}
void Tile::addThing(Thing *thing)
void Tile::addThing(ThingPtr thing, uint8 stackpos)
{
if(!thing)
return;
if(thing->getType() == Thing::TYPE_ITEM) {
Item *item = thing->getItem();
if(item) {
ItemAttributes *itemAttributes = g_tibiaDat.getItemAttributes(item->getId());
if(itemAttributes->group == ITEM_GROUP_GROUND)
m_ground = item;
ThingAttributes *thingAttributes = thing->getAttributes();
if(thingAttributes) {
if(thing->getType() == Thing::TYPE_ITEM) {
if(thingAttributes->group == THING_GROUP_GROUND)
m_ground = thing;
else {
if(itemAttributes->alwaysOnTop)
if(thingAttributes->alwaysOnTop)
m_itemsTop.push_back(thing);
else
m_itemsBot.push_back(thing);
}
}
else if(thing->getType() == Thing::TYPE_CREATURE) {
m_creatures.push_back(thing);
}
}
else if(thing->getType() == Thing::TYPE_CREATURE) {
}
}
void Tile::draw(int x, int y, int z)
void Tile::draw(int x, int y)
{
if(m_ground)
m_ground->draw(x, y, z);
m_ground->draw(x, y);
for(auto it = m_itemsTop.begin(), end = m_itemsTop.end(); it != end; ++it)
(*it)->draw(x, y, z);
(*it)->draw(x, y);
for(auto it = m_creatures.begin(), end = m_creatures.end(); it != end; ++it)
(*it)->draw(x, y, z);
(*it)->draw(x, y);
for(auto it = m_itemsBot.begin(), end = m_itemsBot.end(); it != end; ++it)
(*it)->draw(x, y, z);
(*it)->draw(x, y);
}