Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/filesystem/diskfile.cc2
-rw-r--r--src/game/game.cc94
-rw-r--r--src/render/render.cc4
-rw-r--r--src/render/tga.cc2
-rw-r--r--src/server/server.cc2
5 files changed, 55 insertions, 49 deletions
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();