diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-09 20:23:01 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-09 20:23:01 +0000 |
commit | 0ecdd8bc98ba583bbee801b838d785c6f881d7df (patch) | |
tree | 0ae456cb1254544e43de8abf8fa4dbb6afc91e79 /src/game/base/collision.cc | |
parent | e5be0871b6fed09eed40ff17201d1c7a4a990744 (diff) |
removed physics references, transfer inventory on ship aquisition
Diffstat (limited to 'src/game/base/collision.cc')
-rw-r--r-- | src/game/base/collision.cc | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/game/base/collision.cc b/src/game/base/collision.cc deleted file mode 100644 index e009b7a..0000000 --- a/src/game/base/collision.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - base/collision.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2. -*/ - -#include "base/collision.h" -#include "base/game.h" -#include "base/planet.h" -#include "core/zone.h" -#include "math/functions.h" -#include "math/vector3f.h" - -namespace game -{ - -void Collision::distance_test(core::EntityControlable *first, core::Entity *second) -{ - if (!first->owner()) - return; - - if (first->state() == core::Entity::Docked) - return; - - // FIXME - use distancesquared - const float d = math::distance(first->location(), second->location()); - const float r = first->radius() + second->radius(); - - if (second->type() == core::Entity::Globe) { - // collision with a star or a planet - - if ((d - r) < 0.0f) { - // crash zone - if ((first->moduletype() == ship_enttype) && (first->state() != core::Entity::Destroyed)) { - first->owner()->send_warning("^RBOOM!^N"); - static_cast<Ship *>(first)->explode(); - first->entity_speed = 0; - } - } else if (first->owner()->last_warning() + 5.0f < core::application()->time()) { - // warning zone: star corona or planet atmosphere - if ((second->moduletype() == star_enttype) && (d - r < 50.0f)) { - first->owner()->send_warning("^3Warning: entering star corona!^N"); - } else if ((second->moduletype() == planet_enttype) && (d - r < planet_safe_distance)) { - first->owner()->send_warning("^3Warning: entering planet gravity well!^N"); - } - } - } -} - -void Collision::frame_zone(core::Zone *zone) -{ - core::Zone::Content::iterator first; - core::Zone::Content::iterator second; - - for (first = zone->content().begin(); first != zone->content().end(); first ++) { - second = first; - for (second++; second != zone->content().end(); second++) { - if ((*first)->type() == core::Entity::Controlable) { - distance_test(static_cast<core::EntityControlable *>((*first)), (*second)); - } else if ((*second)->type() == core::Entity::Controlable) { - distance_test(static_cast<core::EntityControlable *>((*second)), (*first)); - } - } - } -} - -void Collision::frame(const float elapsed) -{ - for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) { - frame_zone((*it).second); - } -} - -} // namespace game - |