From c186b58679c50b06966997d33d5e91a99c5621ea Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 16 Mar 2008 09:39:02 +0000 Subject: fixes compilation on soliter, abort dedicated server on error --- INSTALL | 24 ++++++++++++ README | 4 +- osirion.kdevelop.pcs | Bin 513259 -> 509823 bytes osirion.kdevses | 15 ++------ src/filesystem/diskfile.cc | 2 +- src/game/game.cc | 94 ++++++++++++++++++++++++--------------------- src/render/render.cc | 4 +- src/render/tga.cc | 2 +- src/server/server.cc | 2 +- 9 files changed, 84 insertions(+), 63 deletions(-) diff --git a/INSTALL b/INSTALL index 1e757f7..3296e35 100644 --- a/INSTALL +++ b/INSTALL @@ -38,6 +38,30 @@ Compiling the source code At present, 'make install' is neither tested nor supported. +Compiling the dedicated server only + + The included configure script is not yet capable of compiling the + dedicated server only. If you want to compile the dedicated server + on a system that does not have SDL or OpenGL, you will have to finish + the build manually. + + Start the build in the usual fashion: + + cd osirion/ + autoreconf -fi + ./configure + make + + When trying to build the render library, the build will fail with + an error message. Proceed by building the game library and the + osiriond binary: + + cd src/game + make + cd .. + make osiriond + cd .. + Installing game data The game data should be located in the 'data' diff --git a/README b/README index 7f42636..570daa5 100644 --- a/README +++ b/README @@ -149,7 +149,7 @@ Notes the Gimp, make sure to disable the option "origion at bottom left". At the moment, the only TGA files in the game are bitmaps/conchars.tga - and bitmaps/loader.tga + and bitmaps/loader.tga. Project contributors @@ -157,7 +157,7 @@ Project contributors IRC - The official Osirion irc channel is #osirion on irc.soliter.org + The official Osirion IRC channel is #osirion on irc.soliter.org Acknowledgements diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs index 380aece..78421bc 100644 Binary files a/osirion.kdevelop.pcs and b/osirion.kdevelop.pcs differ diff --git a/osirion.kdevses b/osirion.kdevses index 06a0b82..c9568e8 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,19 +1,10 @@ - - - + + + - - - - - - - - - diff --git a/src/filesystem/diskfile.cc b/src/filesystem/diskfile.cc index 85f6ccc..8f84baf 100644 --- a/src/filesystem/diskfile.cc +++ b/src/filesystem/diskfile.cc @@ -67,7 +67,7 @@ bool DiskFile::open(const char *filename) if (diskfile_handle) return true; - con_warn << "Could not open " << filename << std::endl; + con_error << "Could not open " << filename << std::endl; return false; } diff --git a/src/game/game.cc b/src/game/game.cc index ff42817..88718b4 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -20,13 +20,13 @@ namespace game ShipModel *default_shipmodel; /*----- engine game functions ------------------------------------- */ -// list the ship model registry +/// list the ship model registry void func_list_ship(std::string const &args) { ShipModel::list(); } -// a player joins the game +/// a player joins the game void func_join(core::Player *player, std::string const &args) { if (player->control()) @@ -118,35 +118,35 @@ void Game::init() ShipModel::clear(); // setup the game world - filesystem::IniFile f; - f.open("world"); + filesystem::IniFile worldini; + worldini.open("world"); - if (!f.is_open()) { + if (!worldini.is_open()) { return; } Star *star = 0; core::Entity *entity = 0; - while (f.getline()) { - if (f.got_key()) { - if (f.section().compare("star") == 0) { - if (f.got_key_string("name", star->entity_name)) + while (worldini.getline()) { + if (worldini.got_key()) { + if (worldini.section().compare("star") == 0) { + if (worldini.got_key_string("name", star->entity_name)) continue; - else if (f.got_key_string("model", star->entity_modelname)) + else if (worldini.got_key_string("model", star->entity_modelname)) continue; - else if (f.got_key_vector3f("location", star->entity_location )) + else if (worldini.got_key_vector3f("location", star->entity_location )) continue; - else if (f.got_key_color("color", star->entity_color)) + else if (worldini.got_key_color("color", star->entity_color)) continue; else - con_warn << f.name() << " unknown key '" << f.key() << "' at line " << f.line() << std::endl; + con_warn << worldini.name() << " unknown key '" << worldini.key() << "' at line " << worldini.line() << std::endl; - } else if (f.section().compare("entity") == 0) { + } else if (worldini.section().compare("entity") == 0) { std::string shapename; - if (f.got_key_string("shape", shapename)) { + if (worldini.got_key_string("shape", shapename)) { if (shapename.compare("axis") == 0) { entity->entity_shape = core::Entity::Axis; } else if (shapename.compare("cube") == 0) { @@ -156,35 +156,35 @@ void Game::init() } else if (shapename.compare("sphere") == 0) { entity->entity_shape = core::Entity::Sphere; } else { - con_warn << f.name() << " unknown shape '" << shapename << "' at line " << f.line() << std::endl; + con_warn << worldini.name() << " unknown shape '" << shapename << "' at line " << worldini.line() << std::endl; } continue; - } else if (f.got_key_string("name", entity->entity_name)) + } else if (worldini.got_key_string("name", entity->entity_name)) continue; - else if (f.got_key_string("model", entity->entity_modelname)) + else if (worldini.got_key_string("model", entity->entity_modelname)) continue; - else if (f.got_key_angle("direction", entity->entity_direction)) + else if (worldini.got_key_angle("direction", entity->entity_direction)) continue; - else if (f.got_key_angle("radius", entity->entity_radius)) + else if (worldini.got_key_angle("radius", entity->entity_radius)) continue; - else if (f.got_key_vector3f("location", entity->entity_location)) + else if (worldini.got_key_vector3f("location", entity->entity_location)) continue; - else if (f.got_key_color("color", entity->entity_color)) + else if (worldini.got_key_color("color", entity->entity_color)) continue; else - con_warn << f.name() << " unknown key '" << f.key() << "' at line " << f.line() << std::endl; + con_warn << worldini.name() << " unknown key '" << worldini.key() << "' at line " << worldini.line() << std::endl; } - } else if (f.got_section("star")) { + } else if (worldini.got_section("star")) { star = new Star(); - } else if (f.got_section("entity")) { + } else if (worldini.got_section("entity")) { entity = new core::Entity(); - } else if (f.got_section()) { - con_warn << f.name() << " unknown section '" << f.section() << "' at line " << f.line() << std::endl; + } else if (worldini.got_section()) { + con_warn << worldini.name() << " unknown section '" << worldini.section() << "' at line " << worldini.line() << std::endl; } } - f.close(); + worldini.close(); /* // the green cube @@ -220,42 +220,48 @@ void Game::init() axis->entity_name = "axis: Origin"; */ // read ship model specifications - f.open("ships"); - if (!f.is_open()) + // note: + // do not reuse the previous IniFile instance, some gcc versions do not like it + filesystem::IniFile shipsini; + shipsini.open("ships"); + if (!shipsini.is_open()) return; ShipModel *shipmodel = 0; default_shipmodel = 0; - while (f.getline()) { - if (f.got_key()) { - if (f.section() == "ship") { + while (shipsini.getline()) { + if (shipsini.got_key()) { + if (shipsini.section() == "ship") { - if (f.got_key_string("name",shipmodel->shipmodel_name)) { + if (shipsini.got_key_string("name",shipmodel->shipmodel_name)) { continue; - } else if (f.got_key_string("model", shipmodel->shipmodel_modelname)) { + } else if (shipsini.got_key_string("model", shipmodel->shipmodel_modelname)) { continue; - } else if (f.got_key("default")) { + } else if (shipsini.got_key("default")) { default_shipmodel = shipmodel; continue; - } else if (f.got_key_float("acceleration", shipmodel->shipmodel_acceleration)) { + } else if (shipsini.got_key_float("acceleration", shipmodel->shipmodel_acceleration)) { continue; - } else if (f.got_key_float("maxspeed", shipmodel->shipmodel_maxspeed)) { + } else if (shipsini.got_key_float("maxspeed", shipmodel->shipmodel_maxspeed)) { continue; - } else if (f.got_key_float("turnspeed", shipmodel->shipmodel_turnspeed)) { + } else if (shipsini.got_key_float("turnspeed", shipmodel->shipmodel_turnspeed)) { continue; } else { - con_warn << f.name() << " unknown key '" << f.key() << "' at line " << f.line() << std::endl; + con_warn << shipsini.name() << " unknown key '" << shipsini.key() << "' at line " << shipsini.line() << std::endl; } } - } else if (f.got_section("ship")) { + } else if (shipsini.got_section("ship")) { shipmodel = new ShipModel(); - } else if (f.got_section()) { - con_warn << f.name() << " unknown section '" << f.section() << "' at line " << f.line() << std::endl; + if (!default_shipmodel) + default_shipmodel = shipmodel; + + } else if (shipsini.got_section()) { + con_warn << shipsini.name() << " unknown section '" << shipsini.section() << "' at line " << shipsini.line() << std::endl; } } - f.close(); + shipsini.close(); if (!default_shipmodel) { con_error << "No default ship model\n"; diff --git a/src/render/render.cc b/src/render/render.cc index c6183c0..76f2373 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -24,11 +24,11 @@ void init() con_print << "Loading textures..." << std::endl; if (!TGA::texture(textures, "bitmaps/loader.tga", 0)) { - con_error << "Essential file bitmaps/loader.tga missing" << std::endl; + //con_error << "Essential file bitmaps/loader.tga missing" << std::endl; core::application()->shutdown(); } if (!TGA::texture(textures, "bitmaps/conchars.tga", 1)) { - con_error << "Essential file bitmaps/conchars.tga missing" << std::endl; + //con_error << "Essential file bitmaps/conchars.tga missing" << std::endl; core::application()->shutdown(); } diff --git a/src/render/tga.cc b/src/render/tga.cc index 18b8870..0eb2ef6 100644 --- a/src/render/tga.cc +++ b/src/render/tga.cc @@ -24,7 +24,7 @@ bool TGA::texture(GLuint textureArray[], const char *filename, int ID) image *pBitMap = load(filename); if (!pBitMap) { - con_warn << "Could not load " << filename << std::endl; + //con_warn << "Could not load " << filename << std::endl; return false; } diff --git a/src/server/server.cc b/src/server/server.cc index d68d278..49af573 100644 --- a/src/server/server.cc +++ b/src/server/server.cc @@ -72,7 +72,7 @@ void Server::run() server::Timer timer; float elapsed = 0; - while(true) { + while(connected()) { timer.mark(); frame(elapsed); elapsed = timer.elapsed(); -- cgit v1.2.3