From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/game/base/game.cc | 86 +++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/game/base/game.cc') diff --git a/src/game/base/game.cc b/src/game/base/game.cc index bcb3567..7ec54b3 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -82,12 +82,12 @@ void Game::func_join(core::Player *player, std::string const &args) core::Entity *dock = ship->zone()->default_view(); if (dock) { - ship->get_location().assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())*2.0f))); + ship->get_location().assign(dock->location() + (dock->axis().forward() *((ship->radius() + dock->radius())*2.0f))); ship->get_axis().assign(dock->axis()); ship->set_state(core::Entity::Docked); player->set_view(dock); } - + std::string message("^B"); message.append(player->name()); message.append("^B joins the game."); @@ -233,15 +233,15 @@ void Game::func_launch(core::Player *player, std::string const &args) return; assert(player->view()->zone() == player->control()->zone()); - + Ship *ship = static_cast(player->control()); ship->shutdown_physics(); core::Entity *dock = player->view(); if (dock->type() == core::Entity::Globe) - ship->get_location().assign(dock->location() + (dock->axis().forward() * (Planet::safe_distance + ship->radius() + dock->radius()))); + ship->get_location().assign(dock->location() + (dock->axis().forward() *(Planet::safe_distance + ship->radius() + dock->radius()))); else - ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius() + dock->radius()))); + ship->get_location().assign(dock->location() + (dock->axis().forward() *(ship->radius() + dock->radius()))); ship->get_axis().assign(dock->axis()); ship->set_state(core::Entity::Normal); @@ -309,9 +309,9 @@ void Game::func_goto(core::Player *player, const std::string &args) ship->shutdown_physics(); if (dock->type() == core::Entity::Globe) - ship->get_location().assign(dock->location() + (dock->axis().forward() * (Planet::safe_distance + ship->radius() + dock->radius()))); + ship->get_location().assign(dock->location() + (dock->axis().forward() *(Planet::safe_distance + ship->radius() + dock->radius()))); else - ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius() + dock->radius()))); + ship->get_location().assign(dock->location() + (dock->axis().forward() *(ship->radius() + dock->radius()))); ship->get_axis().assign(dock->axis()); ship->get_axis().change_direction(180.0f); @@ -319,7 +319,7 @@ void Game::func_goto(core::Player *player, const std::string &args) ship->init_physics(ship->radius()); ship->set_state(core::Entity::Jump); - + player->set_view(0); player->send("Going to " + dock->name()); } else { @@ -333,7 +333,7 @@ Game::Game() : core::Module("Project::OSiRiON", true) { Default::clear(); ShipModel::clear(); - + Physics::init(); if (!load_ships()) { @@ -350,13 +350,13 @@ Game::Game() : core::Module("Project::OSiRiON", true) abort(); return; } - + // add engine functions core::Func *func = 0; func = core::Func::add("list_ship", Game::func_list_ship); func->set_info("[string] list ship statistics"); - + func = core::Func::add("join", Game::func_join); func->set_info("join the game"); @@ -445,7 +445,7 @@ bool Game::load_world() } } else if (worldini.got_key()) { - + if (worldini.in_section("world")) { if (worldini.got_key_string("zone", label)) { @@ -521,20 +521,20 @@ bool Game::load_zone(core::Zone *zone) while (zoneini.getline()) { - if (zoneini.got_section()) { + if (zoneini.got_section()) { if (zoneini.got_section("zone")) { continue; - + } else if (zoneini.got_section("star")) { star = new Star(); star->set_zone(zone); count ++; - + } else if (zoneini.got_section("navpoint")) { navpoint = new NavPoint(); navpoint->set_zone(zone); count ++; - + } else if (zoneini.got_section("jumpgate")) { jumppoint = new JumpGate(); jumppoint->set_zone(zone); @@ -544,17 +544,17 @@ bool Game::load_zone(core::Zone *zone) jumppoint = new JumpPoint(); jumppoint->set_zone(zone); count ++; - - } else if(zoneini.got_section("racetrack")) { + + } else if (zoneini.got_section("racetrack")) { racetrack = new RaceTrack(); racetrack->set_zone(zone); - - } else if(zoneini.got_section("checkpoint")) { + + } else if (zoneini.got_section("checkpoint")) { checkpoint = new CheckPoint(racetrack); if (!racetrack) { con_warn << zoneini.name() << " checkpoint without racetrack at line " << zoneini.line() << std::endl; } - + } else if (zoneini.got_section("planet")) { planet = new Planet(); planet->set_zone(zone); @@ -564,13 +564,13 @@ bool Game::load_zone(core::Zone *zone) station = new Station(); station->set_zone(zone); count ++; - + } else if (zoneini.got_section("entity")) { entity = new core::Entity(); entity->set_flag(core::Entity::Static); entity->set_zone(zone); count ++; - + } else { zoneini.unknown_section(); } @@ -593,7 +593,7 @@ bool Game::load_zone(core::Zone *zone) if (core::Parser::got_entity_key(zoneini, star)) { continue; } else if (zoneini.got_key_string("texture", star->entity_texture)) { - continue; + continue; } else { zoneini.unkown_key(); } @@ -619,12 +619,12 @@ bool Game::load_zone(core::Zone *zone) if (core::Parser::got_entity_key(zoneini, planet)) { continue; } else if (zoneini.got_key_string("texture", planet->entity_texture)) { - continue; + continue; } else if (zoneini.got_key_float("rotationspeed", planet->entity_rotationspeed)) { continue; } else if (zoneini.got_key_bool("dock", b)) { if (b) { - planet->set_flag(core::Entity::Dockable); + planet->set_flag(core::Entity::Dockable); } else { planet->unset_flag(core::Entity::Dockable); } @@ -636,7 +636,7 @@ bool Game::load_zone(core::Zone *zone) } else { zoneini.unkown_key(); } - + } else if (zoneini.in_section("station")) { if (core::Parser::got_entity_key(zoneini, station)) { continue; @@ -673,7 +673,7 @@ bool Game::load_zone(core::Zone *zone) zoneini.unkown_key(); } } - + } } zoneini.close(); @@ -707,7 +707,7 @@ bool Game::validate_zone(core::Zone *zone) if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) load_menus(entity, "zones/" + zone->label() + "/" + entity->label()); - } + } } return true; @@ -733,7 +733,7 @@ bool Game::load_menus(core::Entity *entity, const std::string &menufilename) if (inifile.is_open()) { while (inifile.getline()) { - + if (inifile.got_section()) { if (inifile.got_section("dealer")) { // dealer menu @@ -741,22 +741,22 @@ bool Game::load_menus(core::Entity *entity, const std::string &menufilename) menu_dealer = new MenuDescription(); menu_dealer->set_label("dealer"); menu_dealer->set_text("Ship dealer"); - + shipdealer = new ShipDealer(); if (entity->moduletype() == planet_enttype) { static_cast(entity)->set_shipdealer(shipdealer); } else if (entity->moduletype() == station_enttype) { static_cast(entity)->set_shipdealer(shipdealer); } - } + } } else { inifile.unknown_section(); } - + } else if (inifile.got_key()) { - + if (inifile.in_section("dealer")) { - + if (inifile.got_key_string("ship", strval)) { aux::to_label(strval); ShipModel *model = shipdealer->add(strval); @@ -771,7 +771,7 @@ bool Game::load_menus(core::Entity *entity, const std::string &menufilename) } else { inifile.unkown_key(); } - + } } } @@ -805,12 +805,12 @@ bool Game::load_menus(core::Entity *entity, const std::string &menufilename) menu_main->add_button(button); } - if (inifile.is_open()) { + if (inifile.is_open()) { size_t n = entity->menus().size(); con_debug << " " << inifile.name() << " " << n << " " << aux::plural("menu", n) << std::endl; inifile.close(); } - + return true; } @@ -841,8 +841,8 @@ bool Game::load_ships() shipmodel->shipmodel_label.assign(label); ShipModel::add(shipmodel); continue; - } else if (shipsini.got_key_string("name",shipmodel->shipmodel_name)) { - continue; + } else if (shipsini.got_key_string("name", shipmodel->shipmodel_name)) { + continue; } else if (shipsini.got_key_string("info", infostr)) { shipmodel->shipmodel_infotext.push_back(infostr); continue; @@ -856,7 +856,7 @@ bool Game::load_ships() continue; } else if (shipsini.got_key_bool("jumpdrive", shipmodel->shipmodel_jumpdrive)) { continue; - } else if (shipsini.got_key_float("acceleration",f)) { + } else if (shipsini.got_key_float("acceleration", f)) { shipmodel->set_acceleration(f); continue; } else if (shipsini.got_key_float("maxspeed", f)) { @@ -874,7 +874,7 @@ bool Game::load_ships() if (shipmodel && !ShipModel::find(shipmodel)) delete shipmodel; shipmodel = new ShipModel(); if (!Default::shipmodel) - Default::shipmodel = shipmodel; + Default::shipmodel = shipmodel; } else if (shipsini.got_section()) { shipsini.unknown_section(); @@ -934,7 +934,7 @@ bool Game::load_player() aux::to_label(str); Default::shipmodel = ShipModel::find(str); } - } + } } } -- cgit v1.2.3