summaryrefslogtreecommitdiff
path: root/src/vector.h
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2010-02-09 01:42:50 +0100
committerBertram <bertram@cegetel.net>2010-02-09 01:42:50 +0100
commit56f501c8148b1061a02547d37b20eeeeb64029db (patch)
tree718e48289066706bc3851830f3c6b03150e66b97 /src/vector.h
parent8b4d9f9b5eaf175baf0c4209c312133bb457742c (diff)
downloadmana-56f501c8148b1061a02547d37b20eeeeb64029db.tar.gz
mana-56f501c8148b1061a02547d37b20eeeeb64029db.tar.bz2
mana-56f501c8148b1061a02547d37b20eeeeb64029db.tar.xz
mana-56f501c8148b1061a02547d37b20eeeeb64029db.zip
Made the Beings' logic be able to handle any tile height/width.
This is the First step to get rid of most hardcoded 32 values.
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/vector.h b/src/vector.h
index 3a5c01c1..0122435f 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -71,6 +71,16 @@ class Vector
}
/**
+ * Scale vector operator.
+ */
+ Vector operator*(const Vector &v) const
+ {
+ return Vector(x * v.x,
+ y * v.y,
+ z * v.z);
+ }
+
+ /**
* In-place scale vector operator.
*/
Vector &operator*=(float c)
@@ -145,6 +155,22 @@ class Vector
}
/**
+ * In-place > test vector operator.
+ */
+ bool operator>(const Vector &v)
+ {
+ return (x > v.x || y > v.y || z > v.z);
+ }
+
+ /**
+ * In-place > test vector operator against a float.
+ */
+ bool operator>(float c)
+ {
+ return (x > c || y > c || z > c);
+ }
+
+ /**
* Returns the length of this vector. This method does a relatively
* slow square root.
*/