Minor changes

Mainly code style
This commit is contained in:
Allan Ference 2013-08-14 18:58:13 +02:00
parent 529b646316
commit 9cf878335a
4 changed files with 15 additions and 23 deletions

View File

@ -191,6 +191,7 @@ void Item::serializeItem(const OutputBinaryTreePtr& out)
out->addU8(ATTR_HOUSEDOORID);
out->addU8(getDoorId());
}
uint16 aid = m_attribs.get<uint16>(ATTR_ACTION_ID);
uint16 uid = m_attribs.get<uint16>(ATTR_UNIQUE_ID);
if(aid) {
@ -204,10 +205,8 @@ void Item::serializeItem(const OutputBinaryTreePtr& out)
}
out->endNode();
if(!m_containerItems.empty()) {
for(auto c : m_containerItems)
c->serializeItem(out);
}
for(auto i : m_containerItems)
i->serializeItem(out);
}
int Item::getSubType()

View File

@ -52,6 +52,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
g_painter->setColor(Color::blue);
else if((m_flags & TILESTATE_PROTECTIONZONE) == TILESTATE_PROTECTIONZONE)
g_painter->setColor(Color::green);
// first bottom items
if(drawFlags & (Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawOnBottom)) {
m_drawElevation = 0;
@ -351,9 +352,8 @@ int Tile::getGroundSpeed()
uint8 Tile::getMinimapColorByte()
{
uint8 color = 255; // alpha
if(m_minimapColor != 0) {
if(m_minimapColor != 0)
return m_minimapColor;
}
for(const ThingPtr& thing : m_things) {
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())
@ -510,11 +510,9 @@ bool Tile::isWalkable(bool ignoreCreatures)
bool Tile::isPathable()
{
for(const ThingPtr& thing : m_things) {
for(const ThingPtr& thing : m_things)
if(thing->isNotPathable())
return false;
}
return true;
}
@ -536,19 +534,17 @@ bool Tile::isSingleDimension()
{
if(!m_walkingCreatures.empty())
return false;
for(const ThingPtr& thing : m_things) {
for(const ThingPtr& thing : m_things)
if(thing->getHeight() != 1 || thing->getWidth() != 1)
return false;
}
return true;
}
bool Tile::isLookPossible()
{
for(const ThingPtr& thing : m_things) {
for(const ThingPtr& thing : m_things)
if(thing->blockProjectile())
return false;
}
return true;
}
@ -607,15 +603,11 @@ bool Tile::limitsFloorsView(bool isFreeView)
// ground and walls limits the view
ThingPtr firstThing = getThing(0);
if(isFreeView){
if(isFreeView) {
if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom()))
return true;
}
else
{
if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || (firstThing->isOnBottom() && firstThing->blockProjectile())))
} else if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || (firstThing->isOnBottom() && firstThing->blockProjectile())))
return true;
}
return false;
}

View File

@ -110,7 +110,8 @@ public:
bool hasElevation(int elevation = 1);
void overwriteMinimapColor(uint8 color) { m_minimapColor = color; }
void setFlags(tileflags_t flags) { m_flags |= (uint32)flags; }
void setFlag(tileflags_t flag) { m_flags |= (uint32)flag; }
void setFlags(tileflags_t flags) { m_flags = (uint32)flags; }
uint32 getFlags() { return m_flags; }
void setHouseId(uint32 hid) { m_houseId = hid; }