mirror of
https://github.com/edubart/otclient.git
synced 2025-12-22 16:27:10 +01:00
creatures, fixe
This commit is contained in:
31
src/tile.cpp
31
src/tile.cpp
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user