diff options
-rw-r--r-- | src/game/base/game.cc | 4 | ||||
-rw-r--r-- | src/game/base/game.h | 1 | ||||
-rw-r--r-- | src/game/base/racetrack.cc | 18 | ||||
-rw-r--r-- | src/game/base/racetrack.h | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc index 30970f9..d80fb3e 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -191,7 +191,9 @@ void Game::func_target_dock(core::Player *player, core::Entity *entity) JumpGate *jumpgate = static_cast<JumpGate *>(entity); jumpgate->func_dock(ship); return; - + } else if (entity->moduletype() == race_enttype) { + RaceTrack *race = static_cast<RaceTrack *>(entity); + race->func_dock(ship); } else { ship->get_location().assign(entity->location()); ship->set_state(core::Entity::Docked); diff --git a/src/game/base/game.h b/src/game/base/game.h index 4f583a8..908aeb6 100644 --- a/src/game/base/game.h +++ b/src/game/base/game.h @@ -34,6 +34,7 @@ const unsigned int jumppoint_enttype = 260; const unsigned int jumpgate_enttype = 261; const unsigned int station_enttype = 262; const unsigned int cargopod_enttype = 263; +const unsigned int race_enttype = 264; // planet docking distance const float planet_safe_distance = 50.0f; diff --git a/src/game/base/racetrack.cc b/src/game/base/racetrack.cc index 51526ea..67b8327 100644 --- a/src/game/base/racetrack.cc +++ b/src/game/base/racetrack.cc @@ -28,6 +28,8 @@ CheckPoint::CheckPoint(RaceTrack *parent) } else { die(); } + + set_flag(core::Entity::NonSolid); } CheckPoint::~CheckPoint() @@ -42,9 +44,11 @@ RaceTrack::RaceTrack() : EntityDynamic() track_player = 0; track_racestart = 0; track_checkpointtime = 0; + entity_moduletypeid = race_enttype; set_state(core::Entity::NoPower); set_flag(core::Entity::Dockable); + set_flag(core::Entity::NonSolid); } RaceTrack::~RaceTrack() @@ -57,7 +61,7 @@ void RaceTrack::add_checkpoint(CheckPoint *checkpoint) track_checkpoints.push_back(checkpoint); } -void RaceTrack::reset() +void RaceTrack::reset_race() { if (track_player) { track_player->set_mission_target(0); @@ -73,7 +77,7 @@ void RaceTrack::reset() set_state(core::Entity::NoPower); } -void RaceTrack::dock(core::Entity *entity) +void RaceTrack::func_dock(core::Entity *entity) { if (entity->moduletype() != ship_enttype) @@ -123,12 +127,12 @@ void RaceTrack::frame(float seconds) } if (!player) { - reset(); + reset_race(); return; } if (!player->control() || (player->control()->zone() != zone())) { - reset(); + reset_race(); return; } @@ -137,7 +141,7 @@ void RaceTrack::frame(float seconds) if (math::distance(location(), player->control()->location()) > radius()) { std::string message("^BNo cheating!"); core::server()->broadcast(message); - reset(); + reset_race(); return; } @@ -172,7 +176,7 @@ void RaceTrack::frame(float seconds) std::string message("^BToo slow, race lost!"); core::server()->broadcast(message); - reset(); + reset_race(); return; } @@ -205,7 +209,7 @@ void RaceTrack::frame(float seconds) player->send(msgstr.str()); player->sound("game/buy"); - reset(); + reset_race(); } } } diff --git a/src/game/base/racetrack.h b/src/game/base/racetrack.h index ef7375a..da810a3 100644 --- a/src/game/base/racetrack.h +++ b/src/game/base/racetrack.h @@ -43,10 +43,10 @@ public: void add_checkpoint(CheckPoint *checkpoint); /// reset the race track - void reset(); + void reset_race(); /// entity received a docking request - virtual void dock(core::Entity *entity); + virtual void func_dock(core::Entity *entity); /// run one time frame virtual void frame(float elapsed); |