diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-22 19:25:20 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-22 19:25:20 +0000 |
commit | 41472ab7f6cdbfc55c44c6487956a36f7fb16508 (patch) | |
tree | 5594d2ac8647498bfd2ffcb5c1df05a35f826633 /src/game-server | |
parent | d1939f5475ffc6b8dd13a3da85dd6e85bc387e43 (diff) | |
download | manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.tar.gz manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.tar.xz manaserv-41472ab7f6cdbfc55c44c6487956a36f7fb16508.zip |
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/being.hpp | 2 | ||||
-rw-r--r-- | src/game-server/collisiondetection.cpp | 9 | ||||
-rw-r--r-- | src/game-server/collisiondetection.hpp | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp index 6c7ff39..870fd78 100644 --- a/src/game-server/being.hpp +++ b/src/game-server/being.hpp @@ -48,7 +48,7 @@ enum Direction */ enum { - DAMAGE_PHYSICAL, + DAMAGE_PHYSICAL = 0, DAMAGE_MAGICAL, DAMAGE_OTHER }; diff --git a/src/game-server/collisiondetection.cpp b/src/game-server/collisiondetection.cpp index 7f0817c..110ef57 100644 --- a/src/game-server/collisiondetection.cpp +++ b/src/game-server/collisiondetection.cpp @@ -193,3 +193,12 @@ Collision::diskWithCircleSector(const Point &diskCenter, int diskRadius, return false; } +bool +Collision::CircleWithCircle(const Point ¢er1, int radius1, + const Point ¢er2, int radius2) +{ + int distx = center1.x - center2.x; + int disty = center1.y - center2.y; + double dist = sqrt((distx * distx) + (disty * disty)); + return (dist < radius1 + radius2); +} diff --git a/src/game-server/collisiondetection.hpp b/src/game-server/collisiondetection.hpp index 95c77d4..f3b5afa 100644 --- a/src/game-server/collisiondetection.hpp +++ b/src/game-server/collisiondetection.hpp @@ -47,6 +47,14 @@ namespace Collision diskWithCircleSector(const Point &diskCenter, int diskRadius, const Point §orCenter, int sectorRadius, int halfTopAngle, int placeAngle); + + /** + * Checks if two circles intersect. + */ + bool + CircleWithCircle(const Point ¢er1, int radius1, + const Point ¢er2, int radius2); + } #endif |