From: Ondřej Hošek Date: Wed, 12 Oct 2005 14:57:47 +0000 (+0000) Subject: * Fixed a few own mistakes from a previous commit X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=267c14b530f86b58090e6e054a0a775076729061;p=supertux.git * Fixed a few own mistakes from a previous commit * Fixed uninitialised variable warnings SVN-Revision: 2838 --- diff --git a/src/badguy/snowball.cpp b/src/badguy/snowball.cpp index 847008c0c..65319d85d 100644 --- a/src/badguy/snowball.cpp +++ b/src/badguy/snowball.cpp @@ -29,7 +29,7 @@ SnowBall::SnowBall(const lisp::Lisp& reader) reader.get("x", start_position.x); reader.get("y", start_position.y); //This is for a hidden badguy :) - bool fluffy = false; + fluffy = false; reader.get("fluffy",fluffy); bbox.set_size(31.8, 31.8); if (fluffy) sprite = sprite_manager->create("fluffy"); @@ -56,7 +56,7 @@ SnowBall::write(lisp::Writer& writer) writer.write_float("y", start_position.y); if (fluffy) { // don't give us away at every snowball - writer.write_bool("fluffy", true) + writer.write_bool("fluffy", true); } writer.end_list("snowball"); diff --git a/src/badguy/snowball.hpp b/src/badguy/snowball.hpp index 3e340340c..5357490ea 100644 --- a/src/badguy/snowball.hpp +++ b/src/badguy/snowball.hpp @@ -38,6 +38,7 @@ protected: bool collision_squished(Player& player); bool set_direction; Direction initial_direction; + bool fluffy; }; #endif diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index e5a9b5ca6..f6d745aed 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -166,7 +166,7 @@ Yeti::kill_fall() } void -Yeti::write(lisp::Writer& ) +Yeti::write(lisp::Writer& writer) { writer.start_list("yeti"); diff --git a/src/collision_grid_iterator.hpp b/src/collision_grid_iterator.hpp index 0f7877778..79acb00a9 100644 --- a/src/collision_grid_iterator.hpp +++ b/src/collision_grid_iterator.hpp @@ -46,6 +46,9 @@ public: end_y = int(bbox.p2.y / grid.cell_height) + 2; if(end_y > (int) grid.cells_y) end_y = grid.cells_y; + + timestamp = grid.iterator_timestamp++; + entry = 0; if(start_x >= end_x) { printf("bad region.\n"); @@ -53,9 +56,6 @@ public: end_y = 0; return; } - - timestamp = grid.iterator_timestamp++; - entry = 0; } MovingObject* next() diff --git a/src/object/path.cpp b/src/object/path.cpp index ce49d2b44..251afd029 100644 --- a/src/object/path.cpp +++ b/src/object/path.cpp @@ -34,7 +34,7 @@ Path::Path(const lisp::Lisp& reader) { forward = true; - float x,y; + float x = 0, y = 0; lisp::ListIterator iter(&reader); diff --git a/src/player_status.cpp b/src/player_status.cpp index 1367c9894..1e37c7cab 100644 --- a/src/player_status.cpp +++ b/src/player_status.cpp @@ -154,7 +154,7 @@ PlayerStatus::read(const lisp::Lisp& lisp) bonus = NO_BONUS; } } - bool val; + bool val = false; if(lisp.get("key-brass", val) && val == true) set_keys(KEY_BRASS); if(lisp.get("key-iron", val) && val == true) diff --git a/src/sector.cpp b/src/sector.cpp index 9e3ae22d5..f1f4baeb4 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -243,7 +243,7 @@ Sector::parse_old_format(const lisp::Lisp& reader) song_title = "chipdisko.ogg"; reader.get("music", song_title); - int width, height = 15; + int width = 30, height = 15; reader.get("width", width); reader.get("height", height); diff --git a/src/tile.cpp b/src/tile.cpp index f2ec18a23..5f74a99af 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -52,7 +52,7 @@ Tile::parse(const lisp::Lisp& reader) throw std::runtime_error("Missing tile-id."); } - bool value; + bool value = false; if(reader.get("solid", value) && value) attributes |= SOLID; if(reader.get("unisolid", value) && value) @@ -111,7 +111,7 @@ Tile::parse_images(const lisp::Lisp& images_lisp) const lisp::Lisp* ptr = cur->get_cdr(); std::string file; - float x, y, w, h; + float x = 0, y = 0, w = 0, h = 0; ptr->get_car()->get(file); ptr = ptr->get_cdr(); ptr->get_car()->get(x); ptr = ptr->get_cdr(); ptr->get_car()->get(y); ptr = ptr->get_cdr(); diff --git a/src/trigger/scripttrigger.cpp b/src/trigger/scripttrigger.cpp index c5e93eb3f..07939924e 100644 --- a/src/trigger/scripttrigger.cpp +++ b/src/trigger/scripttrigger.cpp @@ -34,11 +34,11 @@ ScriptTrigger::ScriptTrigger(const lisp::Lisp& reader) { - bool must_activate; + bool must_activate = false; reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); - float w, h; + float w = 0, h = 0; reader.get("width", w); reader.get("height", h); bbox.set_size(w, h); diff --git a/src/trigger/sequence_trigger.cpp b/src/trigger/sequence_trigger.cpp index 7ef726d92..68860ec8b 100644 --- a/src/trigger/sequence_trigger.cpp +++ b/src/trigger/sequence_trigger.cpp @@ -30,7 +30,7 @@ SequenceTrigger::SequenceTrigger(const lisp::Lisp& reader) { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); - float w, h; + float w = 0, h = 0; reader.get("width", w); reader.get("height", h); bbox.set_size(w, h);