diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-09 22:31:26 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-09 22:31:26 +0100 |
commit | bade85c7890c2255dba41b084132ef892bf365fa (patch) | |
tree | 55b5b317e3450d8ac505c317a4a53f2f724f63b2 /src/being.cpp | |
parent | b7f93f0b2ec91e04d3ed9035c9e21015b8b57cdd (diff) | |
download | mana-bade85c7890c2255dba41b084132ef892bf365fa.tar.gz mana-bade85c7890c2255dba41b084132ef892bf365fa.tar.bz2 mana-bade85c7890c2255dba41b084132ef892bf365fa.tar.xz mana-bade85c7890c2255dba41b084132ef892bf365fa.zip |
Got rid of non-sensical Vector operator overloads
Just because something is the kind of calculation that seems to be
required does not mean it makes sense in general. Let's try to keep
things understandable.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/being.cpp b/src/being.cpp index 4b972e3d..1c66f673 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -532,13 +532,15 @@ void Being::logic() const float nominalLength = dir.length(); // When we've not reached our destination, move to it. - if (nominalLength > 1.0f && mWalkSpeed > 0.0f) + if (nominalLength > 1.0f && !mWalkSpeed.isNull()) { // The deplacement of a point along a vector is calculated // using the Unit Vector (â) multiplied by the point speed. // â = a / ||a|| (||a|| is the a length.) // Then, diff = (dir/||dir||) * speed. - Vector diff = dir.normalized() * mWalkSpeed; + const Vector normalizedDir = dir.normalized(); + Vector diff(normalizedDir.x * mWalkSpeed.x, + normalizedDir.y * mWalkSpeed.y); // Test if we don't miss the destination by a move too far: if (diff.length() > nominalLength) |