From b460b3193e54b7364bb75ff26ce6f999887e454b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 12 Nov 2010 16:24:17 +0000 Subject: moved global entity info type to core::Entity::infotype(), automatic generation of jumppoint and jumpgate names and descriptions, prepared game code for the seperation of Entity::radius() and Model::radius() --- src/game/base/game.cc | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/game/base/game.cc') diff --git a/src/game/base/game.cc b/src/game/base/game.cc index fa83a0a..30970f9 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -887,7 +887,7 @@ Game::Game() : core::Module("Project::OSiRiON", true) return; } - // add engine functions + // add game functions core::Func *func = 0; func = core::Func::add("join", Game::func_join); @@ -966,8 +966,17 @@ Game::~Game() // clear defaults Default::clear(); + // clear Cargo + Cargo::done(); + + // clear ShipModel + ShipModel::done(); + + // clear Templates + Template::done(); + // clear Factions - Faction::clear(); + Faction::done(); } bool Game::load_world() @@ -1081,6 +1090,7 @@ bool Game::load_zone(core::Zone *zone) while (zoneini.getline()) { if (zoneini.got_section()) { + if (zoneini.got_section("zone")) { continue; @@ -1094,24 +1104,28 @@ bool Game::load_zone(core::Zone *zone) navpoint = new NavPoint(); entity = navpoint; navpoint->set_zone(zone); + navpoint->set_radius(0); count ++; } else if (zoneini.got_section("jumpgate")) { jumppoint = new JumpGate(); entity = jumppoint; jumppoint->set_zone(zone); + jumppoint->set_radius(0); count ++; } else if (zoneini.got_section("jumppoint")) { jumppoint = new JumpPoint(); entity = jumppoint; jumppoint->set_zone(zone); + jumppoint->set_radius(0); count ++; } else if (zoneini.got_section("racetrack")) { racetrack = new RaceTrack(); entity = racetrack; racetrack->set_zone(zone); + racetrack->set_radius(0); } else if (zoneini.got_section("checkpoint")) { checkpoint = new CheckPoint(racetrack); @@ -1119,6 +1133,7 @@ bool Game::load_zone(core::Zone *zone) if (!racetrack) { zoneini.unknown_error("checkpoint without racetrack"); } + checkpoint->set_radius(0); } else if (zoneini.got_section("planet")) { planet = new Planet(); @@ -1130,11 +1145,13 @@ bool Game::load_zone(core::Zone *zone) station = new Station(); entity = station; station->set_zone(zone); + station->set_radius(0); count ++; } else if (zoneini.got_section("entity")) { entity = new core::Entity(); entity->set_zone(zone); + entity->set_radius(0); count ++; } else if (zoneini.got_section("cargo")) { @@ -1422,6 +1439,15 @@ bool Game::validate_zone(core::Zone *zone) } } + if (!entity->radius()) { + if (entity->model()) { + entity->set_radius(entity->model()->radius()); + } else { + entity->set_radius(0.25f); + } + con_debug << " " << entity->label() << " radius set to " << entity->radius() << std::endl; + } + // initialize physics on planets and entities with a model if ((entity->entity_moduletypeid == planet_enttype) || (entity->model())) { entity->reset(); -- cgit v1.2.3