Minor changes

Mainly code style
master
Allan Ference 11 years ago
parent 529b646316
commit 9cf878335a

@ -189,8 +189,9 @@ void Item::serializeItem(const OutputBinaryTreePtr& out)
if(isHouseDoor()) {
out->addU8(ATTR_HOUSEDOORID);
out->addU8(getDoorId());
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()

@ -43,7 +43,7 @@ void Map::loadOtbm(const std::string& fileName)
stdext::throw_exception("OTB isn't loaded yet to load a map.");
if(fin->getU32())
stdext::throw_exception("Unknown file version detected");
stdext::throw_exception("Unknown file version detected");
BinaryTreePtr root = fin->getBinaryTree();
if(root->getU8())

@ -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())))
return true;
}
} else if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || (firstThing->isOnBottom() && firstThing->blockProjectile())))
return true;
return false;
}

@ -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; }

Loading…
Cancel
Save