Introduce Item::getName()
This commit is contained in:
parent
2c36ca7215
commit
05f7f6a4cf
|
@ -58,6 +58,11 @@ ItemPtr Item::createFromOtb(int id)
|
|||
return item;
|
||||
}
|
||||
|
||||
std::string Item::getName()
|
||||
{
|
||||
return g_things.findItemTypeByClientId(m_clientId)->getName();
|
||||
}
|
||||
|
||||
void Item::draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView)
|
||||
{
|
||||
if(m_clientId == 0)
|
||||
|
@ -370,3 +375,4 @@ ThingType* Item::rawGetThingType()
|
|||
{
|
||||
return g_things.rawGetThingType(m_clientId, ThingCategoryItem);
|
||||
}
|
||||
/* vim: set ts=4 sw=4 et :*/
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
uint32 getId() { return m_clientId; }
|
||||
uint16 getClientId() { return m_clientId; }
|
||||
uint16 getServerId() { return m_serverId; }
|
||||
std::string getName();
|
||||
bool isValid();
|
||||
|
||||
void unserializeItem(const BinaryTreePtr& in);
|
||||
|
|
|
@ -440,6 +440,7 @@ void Client::registerLuaFunctions()
|
|||
g_lua.bindClassMemberFunction<Item>("setCount", &Item::setCount);
|
||||
g_lua.bindClassMemberFunction<Item>("getCount", &Item::getCount);
|
||||
g_lua.bindClassMemberFunction<Item>("getId", &Item::getId);
|
||||
g_lua.bindClassMemberFunction<Item>("getName", &Item::getName);
|
||||
g_lua.bindClassMemberFunction<Item>("isStackable", &Item::isStackable);
|
||||
g_lua.bindClassMemberFunction<Item>("isMarketable", &Item::isMarketable);
|
||||
g_lua.bindClassMemberFunction<Item>("getMarketData", &Item::getMarketData);
|
||||
|
|
|
@ -56,10 +56,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom())
|
||||
break;
|
||||
|
||||
Color prevColor = g_painter->getColor();
|
||||
float prevOpacity = g_painter->getOpacity();
|
||||
bool restore = false;
|
||||
|
||||
if(g_map.showZones() && thing->isGround()) {
|
||||
for(unsigned int i = 0; i < sizeof(flags) / sizeof(tileflags_t); ++i) {
|
||||
tileflags_t flag = flags[i];
|
||||
|
@ -78,8 +75,8 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
|
||||
|
||||
if(restore) {
|
||||
g_painter->setOpacity(prevOpacity);
|
||||
g_painter->setColor(prevColor);
|
||||
g_painter->resetOpacity();
|
||||
g_painter->resetColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +140,6 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||
CreaturePtr creature = thing->static_self_cast<Creature>();
|
||||
if(creature && (!creature->isWalking() || !animate))
|
||||
creature->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,10 +307,9 @@ ThingPtr Tile::getTopThing()
|
|||
{
|
||||
if(isEmpty())
|
||||
return nullptr;
|
||||
for(const ThingPtr& thing : m_things) {
|
||||
for(const ThingPtr& thing : m_things)
|
||||
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop() && !thing->isCreature())
|
||||
return thing;
|
||||
}
|
||||
return m_things[m_things.size() - 1];
|
||||
}
|
||||
|
||||
|
@ -657,9 +652,9 @@ void Tile::checkTranslucentLight()
|
|||
}
|
||||
|
||||
if(translucent)
|
||||
tile->m_flags = tile->m_flags | TILESTATE_TRANSLUECENT_LIGHT;
|
||||
tile->m_flags |= TILESTATE_TRANSLUECENT_LIGHT;
|
||||
else
|
||||
tile->m_flags = tile->m_flags & ~TILESTATE_TRANSLUECENT_LIGHT;
|
||||
tile->m_flags &= ~TILESTATE_TRANSLUECENT_LIGHT;
|
||||
}
|
||||
|
||||
/* vim: set ts=8 sw=4 tw=0 et :*/
|
||||
/* vim: set ts=4 sw=4 et :*/
|
||||
|
|
Loading…
Reference in New Issue