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(ATTR_HOUSEDOORID);
out->addU8(getDoorId()); out->addU8(getDoorId());
} }
uint16 aid = m_attribs.get<uint16>(ATTR_ACTION_ID); uint16 aid = m_attribs.get<uint16>(ATTR_ACTION_ID);
uint16 uid = m_attribs.get<uint16>(ATTR_UNIQUE_ID); uint16 uid = m_attribs.get<uint16>(ATTR_UNIQUE_ID);
if(aid) { if(aid) {
@ -204,10 +205,8 @@ void Item::serializeItem(const OutputBinaryTreePtr& out)
} }
out->endNode(); out->endNode();
if(!m_containerItems.empty()) { for(auto i : m_containerItems)
for(auto c : m_containerItems) i->serializeItem(out);
c->serializeItem(out);
}
} }
int Item::getSubType() 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); g_painter->setColor(Color::blue);
else if((m_flags & TILESTATE_PROTECTIONZONE) == TILESTATE_PROTECTIONZONE) else if((m_flags & TILESTATE_PROTECTIONZONE) == TILESTATE_PROTECTIONZONE)
g_painter->setColor(Color::green); g_painter->setColor(Color::green);
// first bottom items // first bottom items
if(drawFlags & (Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawOnBottom)) { if(drawFlags & (Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawOnBottom)) {
m_drawElevation = 0; m_drawElevation = 0;
@ -351,9 +352,8 @@ int Tile::getGroundSpeed()
uint8 Tile::getMinimapColorByte() uint8 Tile::getMinimapColorByte()
{ {
uint8 color = 255; // alpha uint8 color = 255; // alpha
if(m_minimapColor != 0) { if(m_minimapColor != 0)
return m_minimapColor; return m_minimapColor;
}
for(const ThingPtr& thing : m_things) { for(const ThingPtr& thing : m_things) {
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop()) if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())
@ -510,11 +510,9 @@ bool Tile::isWalkable(bool ignoreCreatures)
bool Tile::isPathable() bool Tile::isPathable()
{ {
for(const ThingPtr& thing : m_things) { for(const ThingPtr& thing : m_things)
if(thing->isNotPathable()) if(thing->isNotPathable())
return false; return false;
}
return true; return true;
} }
@ -536,19 +534,17 @@ bool Tile::isSingleDimension()
{ {
if(!m_walkingCreatures.empty()) if(!m_walkingCreatures.empty())
return false; return false;
for(const ThingPtr& thing : m_things) { for(const ThingPtr& thing : m_things)
if(thing->getHeight() != 1 || thing->getWidth() != 1) if(thing->getHeight() != 1 || thing->getWidth() != 1)
return false; return false;
}
return true; return true;
} }
bool Tile::isLookPossible() bool Tile::isLookPossible()
{ {
for(const ThingPtr& thing : m_things) { for(const ThingPtr& thing : m_things)
if(thing->blockProjectile()) if(thing->blockProjectile())
return false; return false;
}
return true; return true;
} }
@ -607,15 +603,11 @@ bool Tile::limitsFloorsView(bool isFreeView)
// ground and walls limits the view // ground and walls limits the view
ThingPtr firstThing = getThing(0); ThingPtr firstThing = getThing(0);
if(isFreeView){ if(isFreeView) {
if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom())) if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom()))
return true; 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 true;
}
return false; return false;
} }

View File

@ -110,7 +110,8 @@ 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 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; } uint32 getFlags() { return m_flags; }
void setHouseId(uint32 hid) { m_houseId = hid; } void setHouseId(uint32 hid) { m_houseId = hid; }