Add selection to tile

This commit is contained in:
Ahmed Samy 2013-12-14 23:06:52 +02:00
parent ec2518525a
commit 1790eee1c6
3 changed files with 14 additions and 1 deletions

View File

@ -568,6 +568,10 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<Tile>("isClickable", &Tile::isClickable); g_lua.bindClassMemberFunction<Tile>("isClickable", &Tile::isClickable);
g_lua.bindClassMemberFunction<Tile>("isPathable", &Tile::isPathable); g_lua.bindClassMemberFunction<Tile>("isPathable", &Tile::isPathable);
g_lua.bindClassMemberFunction<Tile>("overwriteMinimapColor", &Tile::overwriteMinimapColor); g_lua.bindClassMemberFunction<Tile>("overwriteMinimapColor", &Tile::overwriteMinimapColor);
g_lua.bindClassMemberFunction<Tile>("select", &Tile::select);
g_lua.bindClassMemberFunction<Tile>("unselect", &Tile::unselect);
g_lua.bindClassMemberFunction<Tile>("isSelected", &Tile::isSelected);
g_lua.bindClassMemberFunction<Tile>("remFlag", &Tile::remFlag);
g_lua.bindClassMemberFunction<Tile>("setFlag", &Tile::setFlag); g_lua.bindClassMemberFunction<Tile>("setFlag", &Tile::setFlag);
g_lua.bindClassMemberFunction<Tile>("setFlags", &Tile::setFlags); g_lua.bindClassMemberFunction<Tile>("setFlags", &Tile::setFlags);
g_lua.bindClassMemberFunction<Tile>("getFlags", &Tile::getFlags); g_lua.bindClassMemberFunction<Tile>("getFlags", &Tile::getFlags);

View File

@ -52,7 +52,6 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
TILESTATE_HARDCOREZONE, TILESTATE_HARDCOREZONE,
TILESTATE_REFRESH, TILESTATE_REFRESH,
TILESTATE_NOLOGOUT, TILESTATE_NOLOGOUT,
TILESTATE_TRANSLUECENT_LIGHT,
TILESTATE_LAST TILESTATE_LAST
}; };
@ -74,6 +73,9 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
break; break;
} }
} }
} else if(m_selected) {
g_painter->setColor(Color::darkGreen);
g_painter->setOpacity(0.9);
} }
if((thing->isGround() && drawFlags & Otc::DrawGround) || if((thing->isGround() && drawFlags & Otc::DrawGround) ||

View File

@ -112,6 +112,7 @@ public:
bool hasElevation(int elevation = 1); bool hasElevation(int elevation = 1);
void overwriteMinimapColor(uint8 color) { m_minimapColor = color; } void overwriteMinimapColor(uint8 color) { m_minimapColor = color; }
void remFlag(uint32 flag) { m_flags &= ~flag; }
void setFlag(uint32 flag) { m_flags |= flag; } void setFlag(uint32 flag) { m_flags |= flag; }
void setFlags(uint32 flags) { m_flags = flags; } void setFlags(uint32 flags) { m_flags = flags; }
bool hasFlag(uint32 flag) { return (m_flags & flag) == flag; } bool hasFlag(uint32 flag) { return (m_flags & flag) == flag; }
@ -121,6 +122,10 @@ public:
uint32 getHouseId() { return m_houseId; } uint32 getHouseId() { return m_houseId; }
bool isHouseTile() const { return m_houseId != 0 && (m_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE; } bool isHouseTile() const { return m_houseId != 0 && (m_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE; }
void select() { m_selected = true; }
void unselect() { m_selected = false; }
bool isSelected() { return m_selected; }
TilePtr asTile() { return static_self_cast<Tile>(); } TilePtr asTile() { return static_self_cast<Tile>(); }
private: private:
@ -133,6 +138,8 @@ private:
uint8 m_drawElevation; uint8 m_drawElevation;
uint8 m_minimapColor; uint8 m_minimapColor;
uint32 m_flags, m_houseId; uint32 m_flags, m_houseId;
stdext::boolean<false> m_selected;
}; };
#endif #endif