From: Daniel Karbach Date: Mon, 21 Jan 2013 20:51:29 +0000 (+0100) Subject: minor performance improvements X-Git-Url: http://git.localhorst.tv/?p=l2e.git;a=commitdiff_plain;h=6ad33ca7db4f2d13311e2f8a9e77e57f907a576d minor performance improvements --- diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index 93530f1..6b6adac 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -123,7 +123,7 @@ void Entity::UpdateVelocity() { bool Entity::TileLock(const math::Vector &tileSize) const { // TODO: change position to point to the top-left corner of a tile Vector tilePosition(ToInt(position)); - return (tilePosition.X() % tileSize.X() == 0) && (tilePosition.Y() % tileSize.Y() == 0); + return tilePosition % tileSize == Vector(); } diff --git a/src/math/Fixed.h b/src/math/Fixed.h index 7fe099c..7a5e13d 100644 --- a/src/math/Fixed.h +++ b/src/math/Fixed.h @@ -51,7 +51,7 @@ public: public: int Int() const { return IntPart() * Sigma(); } int Sigma() const { - if (IntPart() == 0 && FracPart() == 0) { + if (RawInt() == 0) { return 0; } else if (SignPart() == 0) { return 1;