diff --git a/src/client/item.cpp b/src/client/item.cpp index f6721c78..c0f810c0 100644 --- a/src/client/item.cpp +++ b/src/client/item.cpp @@ -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 :*/ diff --git a/src/client/item.h b/src/client/item.h index 12429b2b..161c43a1 100644 --- a/src/client/item.h +++ b/src/client/item.h @@ -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); diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index ec57d90e..0bb16459 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -440,6 +440,7 @@ void Client::registerLuaFunctions() g_lua.bindClassMemberFunction("setCount", &Item::setCount); g_lua.bindClassMemberFunction("getCount", &Item::getCount); g_lua.bindClassMemberFunction("getId", &Item::getId); + g_lua.bindClassMemberFunction("getName", &Item::getName); g_lua.bindClassMemberFunction("isStackable", &Item::isStackable); g_lua.bindClassMemberFunction("isMarketable", &Item::isMarketable); g_lua.bindClassMemberFunction("getMarketData", &Item::getMarketData); diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 0961b09b..b1c76b52 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -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(); 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 :*/