From 22a1e0b5152a00a37c2dbf6c8549cea30330ff9c Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sun, 17 Aug 2014 06:23:28 +0200 Subject: [PATCH] Made code -Wshadow clean, missed a bunch of issues in the last commit --- src/addon/addon_manager.cpp | 4 +- src/addon/md5.cpp | 16 +++---- src/audio/ogg_sound_file.cpp | 10 ++-- src/audio/sound_manager.cpp | 6 +-- src/audio/stream_sound_source.cpp | 4 +- src/audio/stream_sound_source.hpp | 4 +- src/badguy/badguy.cpp | 8 ++-- src/badguy/bomb.cpp | 16 +++---- src/badguy/fish.cpp | 4 +- src/badguy/ghosttree.cpp | 6 +-- src/badguy/goldbomb.cpp | 8 ++-- src/badguy/kugelblitz.cpp | 16 +++---- src/badguy/mole_rock.cpp | 4 +- src/badguy/mrbomb.cpp | 10 ++-- src/badguy/skydive.cpp | 4 +- src/badguy/treewillowisp.cpp | 28 ++++++------ src/badguy/walking_badguy.cpp | 42 ++++++++--------- src/badguy/willowisp.cpp | 8 ++-- src/control/codecontroller.cpp | 4 +- src/control/joystick_manager.cpp | 4 +- src/object/background.cpp | 38 +++++++-------- src/object/bicycle_platform.cpp | 12 ++--- src/object/bonus_block.cpp | 16 +++---- src/object/broken_brick.cpp | 4 +- src/object/bullet.cpp | 4 +- src/object/camera.cpp | 94 +++++++++++++++++++------------------- src/object/candle.cpp | 8 ++-- src/object/display_effect.cpp | 4 +- src/object/display_effect.hpp | 2 +- src/object/floating_image.cpp | 12 ++--- src/object/floating_image.hpp | 16 +++---- src/object/icecrusher.cpp | 8 ++-- src/object/infoblock.cpp | 17 +++---- src/object/level_time.cpp | 4 +- src/object/moving_sprite.cpp | 22 ++++----- src/object/path_walker.cpp | 4 +- src/object/player.cpp | 32 ++++++------- src/object/pneumatic_platform.cpp | 10 ++-- src/object/powerup.cpp | 4 +- src/object/sprite_particle.cpp | 8 ++-- src/object/text_object.cpp | 38 +++++++-------- src/object/text_object.hpp | 12 ++--- src/object/tilemap.cpp | 18 ++++---- src/object/wind.cpp | 4 +- src/physfs/ofile_streambuf.cpp | 4 +- src/scripting/camera.cpp | 4 +- src/scripting/candle.cpp | 4 +- src/scripting/level_time.cpp | 4 +- src/scripting/platform.cpp | 4 +- src/scripting/squirrel_error.cpp | 4 +- src/scripting/thunderstorm.cpp | 4 +- src/scripting/tilemap.cpp | 4 +- src/scripting/wind.cpp | 4 +- src/supertux/console.cpp | 18 ++++---- src/supertux/fadeout.cpp | 4 +- src/supertux/game_session.cpp | 10 ++-- src/supertux/info_box_line.cpp | 4 +- src/supertux/levelintro.cpp | 6 +-- src/supertux/main.cpp | 4 +- src/supertux/menu/options_menu.cpp | 17 ++++--- src/supertux/physic.cpp | 8 ++-- src/supertux/sector.cpp | 50 ++++++++++---------- src/supertux/shrinkfade.cpp | 6 +-- src/supertux/tile.cpp | 8 ++-- src/supertux/timer.cpp | 6 +-- src/trigger/door.cpp | 4 +- src/trigger/scripttrigger.cpp | 4 +- src/trigger/secretarea_trigger.cpp | 4 +- src/util/ref.hpp | 12 ++--- src/video/drawing_context.cpp | 20 ++++---- src/video/font.cpp | 12 ++--- src/worldmap/level.cpp | 6 +-- src/worldmap/tux.cpp | 10 ++-- src/worldmap/worldmap.cpp | 52 ++++++++++----------- 74 files changed, 451 insertions(+), 447 deletions(-) diff --git a/src/addon/addon_manager.cpp b/src/addon/addon_manager.cpp index cf3e69aa0..c614ddffa 100644 --- a/src/addon/addon_manager.cpp +++ b/src/addon/addon_manager.cpp @@ -379,10 +379,10 @@ AddonManager::load_addons() // Search for infoFiles std::string infoFileName = ""; char** rc2 = PHYSFS_enumerateFiles("/"); - for(char** i = rc2; *i != 0; ++i) { + for(char** j = rc2; *j != 0; ++j) { // get filename of potential infoFile - std::string potentialInfoFileName = *i; + std::string potentialInfoFileName = *j; // make sure it looks like an infoFile static const std::string infoExt = ".nfo"; diff --git a/src/addon/md5.cpp b/src/addon/md5.cpp index cc5e83cba..3a95f2c85 100644 --- a/src/addon/md5.cpp +++ b/src/addon/md5.cpp @@ -89,33 +89,33 @@ void MD5::update (uint8_t* input, uint32_t input_length) { } void MD5::update(FILE *file) { - uint8_t buffer[1024]; + uint8_t buffer_[1024]; int len; - while ((len=fread(buffer, 1, 1024, file))) update(buffer, len); + while ((len=fread(buffer_, 1, 1024, file))) update(buffer_, len); fclose (file); } void MD5::update(std::istream& stream) { - uint8_t buffer[1024]; + uint8_t buffer_[1024]; int len; while (stream.good()) { - stream.read((char*)buffer, 1024); // note that return value of read is unusable. + stream.read((char*)buffer_, 1024); // note that return value of read is unusable. len=stream.gcount(); - update(buffer, len); + update(buffer_, len); } } void MD5::update(std::ifstream& stream) { - uint8_t buffer[1024]; + uint8_t buffer_[1024]; int len; while (stream.good()) { - stream.read((char*)buffer, 1024); // note that return value of read is unusable. + stream.read((char*)buffer_, 1024); // note that return value of read is unusable. len=stream.gcount(); - update(buffer, len); + update(buffer_, len); } } diff --git a/src/audio/ogg_sound_file.cpp b/src/audio/ogg_sound_file.cpp index 5429b5a89..ae5f06ead 100644 --- a/src/audio/ogg_sound_file.cpp +++ b/src/audio/ogg_sound_file.cpp @@ -18,14 +18,14 @@ #include -OggSoundFile::OggSoundFile(PHYSFS_file* file, double loop_begin, double loop_at) : +OggSoundFile::OggSoundFile(PHYSFS_file* file_, double loop_begin_, double loop_at_) : file(), vorbis_file(), loop_begin(), loop_at(), normal_buffer_loop() { - this->file = file; + this->file = file_; ov_callbacks callbacks = { cb_read, cb_seek, cb_close, cb_tell }; ov_open_callbacks(file, &vorbis_file, 0, 0, callbacks); @@ -37,11 +37,11 @@ OggSoundFile::OggSoundFile(PHYSFS_file* file, double loop_begin, double loop_at) bits_per_sample = 16; size = static_cast (ov_pcm_total(&vorbis_file, -1) * 2); - double samples_begin = loop_begin * rate; - double sample_loop = loop_at * rate; + double samples_begin = loop_begin_ * rate; + double sample_loop = loop_at_ * rate; this->loop_begin = (ogg_int64_t) samples_begin; - if(loop_begin < 0) { + if(loop_begin_ < 0) { this->loop_at = (ogg_int64_t) -1; } else { this->loop_at = (ogg_int64_t) sample_loop; diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index dd8fdce16..e9ef76459 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -125,9 +125,9 @@ SoundManager::intern_create_sound_source(const std::string& filename) buffer = load_file_into_buffer(*file); buffers.insert(std::make_pair(filename, buffer)); } else { - std::unique_ptr source(new StreamSoundSource); - source->set_sound_file(std::move(file)); - return std::move(source); + std::unique_ptr source_(new StreamSoundSource); + source_->set_sound_file(std::move(file)); + return std::move(source_); } log_debug << "Uncached sound \"" << filename << "\" requested to be played" << std::endl; diff --git a/src/audio/stream_sound_source.cpp b/src/audio/stream_sound_source.cpp index 2645e0d65..2c060598d 100644 --- a/src/audio/stream_sound_source.cpp +++ b/src/audio/stream_sound_source.cpp @@ -99,10 +99,10 @@ StreamSoundSource::update() } void -StreamSoundSource::set_fading(FadeState state, float fade_time) +StreamSoundSource::set_fading(FadeState state, float fade_time_) { this->fade_state = state; - this->fade_time = fade_time; + this->fade_time = fade_time_; this->fade_start_time = real_time; } diff --git a/src/audio/stream_sound_source.hpp b/src/audio/stream_sound_source.hpp index 1dbc63bf9..d84006618 100644 --- a/src/audio/stream_sound_source.hpp +++ b/src/audio/stream_sound_source.hpp @@ -38,9 +38,9 @@ public: } void update(); - void set_looping(bool looping) + void set_looping(bool looping_) { - this->looping = looping; + this->looping = looping_; } bool get_looping() const { diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 5aefab491..b0ffd2059 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -433,14 +433,14 @@ BadGuy::run_dead_script() } void -BadGuy::set_state(State state) +BadGuy::set_state(State state_) { - if(this->state == state) + if(this->state == state_) return; State laststate = this->state; - this->state = state; - switch(state) { + this->state = state_; + switch(state_) { case STATE_SQUISHED: state_timer.start(SQUISH_TIME); break; diff --git a/src/badguy/bomb.cpp b/src/badguy/bomb.cpp index efd0433b6..a16a9f03d 100644 --- a/src/badguy/bomb.cpp +++ b/src/badguy/bomb.cpp @@ -21,15 +21,15 @@ #include "sprite/sprite.hpp" #include "supertux/sector.hpp" -Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ ) : - BadGuy( pos, dir, custom_sprite ), +Bomb::Bomb(const Vector& pos, Direction dir_, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ ) : + BadGuy( pos, dir_, custom_sprite ), state(), grabbed(false), grabber(NULL), ticking() { state = STATE_TICKING; - set_action(dir == LEFT ? "ticking-left" : "ticking-right", 1); + set_action(dir_ == LEFT ? "ticking-left" : "ticking-right", 1); countMe = false; ticking = sound_manager->create_sound_source("sounds/fizz.wav"); @@ -104,10 +104,10 @@ Bomb::kill_fall() } void -Bomb::grab(MovingObject& object, const Vector& pos, Direction dir) +Bomb::grab(MovingObject& object, const Vector& pos, Direction dir_) { movement = pos - get_pos(); - this->dir = dir; + this->dir = dir_; // We actually face the opposite direction of Tux here to make the fuse more // visible instead of hiding it behind Tux @@ -118,13 +118,13 @@ Bomb::grab(MovingObject& object, const Vector& pos, Direction dir) } void -Bomb::ungrab(MovingObject& object, Direction dir) +Bomb::ungrab(MovingObject& object, Direction dir_) { - this->dir = dir; + this->dir = dir_; // portable objects are usually pushed away from Tux when dropped, but we // don't want that, so we set the position //FIXME: why don't we want that? shouldn't behavior be consistent? - set_pos(object.get_pos() + Vector(dir == LEFT ? -16 : 16, get_bbox().get_height()*0.66666 - 32)); + set_pos(object.get_pos() + Vector(dir_ == LEFT ? -16 : 16, get_bbox().get_height()*0.66666 - 32)); set_colgroup_active(COLGROUP_MOVING); grabbed = false; } diff --git a/src/badguy/fish.cpp b/src/badguy/fish.cpp index 67743d3bf..e00c5cd72 100644 --- a/src/badguy/fish.cpp +++ b/src/badguy/fish.cpp @@ -67,9 +67,9 @@ Fish::draw(DrawingContext& context) } HitResponse -Fish::hit(const CollisionHit& hit) +Fish::hit(const CollisionHit& hit_) { - if(hit.top) { + if(hit_.top) { physic.set_velocity_y(0); } diff --git a/src/badguy/ghosttree.cpp b/src/badguy/ghosttree.cpp index d0d234275..8ae325902 100644 --- a/src/badguy/ghosttree.cpp +++ b/src/badguy/ghosttree.cpp @@ -176,15 +176,15 @@ GhostTree::active_update(float elapsed_time) assert (suck_lantern); Vector pos = suck_lantern->get_pos(); Vector delta = get_bbox().get_middle() + SUCK_TARGET_OFFSET - pos; - Vector dir = delta.unit(); + Vector dir_ = delta.unit(); if (delta.norm() < 1) { - dir = delta; + dir_ = delta; suck_lantern->ungrab(*this, RIGHT); suck_lantern->remove_me(); suck_lantern = 0; sprite->set_action("swallow", 1); } else { - pos += dir; + pos += dir_; suck_lantern->grab(*this, pos, RIGHT); } } else { diff --git a/src/badguy/goldbomb.cpp b/src/badguy/goldbomb.cpp index fa180ead4..3569fe3a0 100644 --- a/src/badguy/goldbomb.cpp +++ b/src/badguy/goldbomb.cpp @@ -168,11 +168,11 @@ GoldBomb::kill_fall() } void -GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir) +GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir_) { if(tstate == STATE_TICKING){ movement = pos - get_pos(); - this->dir = dir; + this->dir = dir_; // We actually face the opposite direction of Tux here to make the fuse more // visible instead of hiding it behind Tux @@ -183,8 +183,8 @@ GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir) } else if(frozen){ movement = pos - get_pos(); - this->dir = dir; - sprite->set_action(dir == LEFT ? "iced-left" : "iced-right"); + this->dir = dir_; + sprite->set_action(dir_ == LEFT ? "iced-left" : "iced-right"); set_colgroup_active(COLGROUP_DISABLED); grabbed = true; } diff --git a/src/badguy/kugelblitz.cpp b/src/badguy/kugelblitz.cpp index ea3911416..7437ca370 100644 --- a/src/badguy/kugelblitz.cpp +++ b/src/badguy/kugelblitz.cpp @@ -99,10 +99,10 @@ Kugelblitz::collision_badguy(BadGuy& other , const CollisionHit& chit) } HitResponse -Kugelblitz::hit(const CollisionHit& hit) +Kugelblitz::hit(const CollisionHit& hit_) { // hit floor? - if(hit.bottom) { + if(hit_.bottom) { if (!groundhit_pos_set) { pos_groundhit = get_pos(); @@ -117,7 +117,7 @@ Kugelblitz::hit(const CollisionHit& hit) movement_timer.start(MOVETIME); lifetime.start(LIFETIME); - } else if(hit.top) { // bumped on roof + } else if(hit_.top) { // bumped on roof physic.set_velocity_y(0); } @@ -194,17 +194,17 @@ Kugelblitz::try_activate() float X_OFFSCREEN_DISTANCE = 400; float Y_OFFSCREEN_DISTANCE = 600; - Player* player = get_nearest_player(); - if (!player) return; - Vector dist = player->get_bbox().get_middle() - get_bbox().get_middle(); + Player* player_ = get_nearest_player(); + if (!player_) return; + Vector dist = player_->get_bbox().get_middle() - get_bbox().get_middle(); if ((fabsf(dist.x) <= X_OFFSCREEN_DISTANCE) && (fabsf(dist.y) <= Y_OFFSCREEN_DISTANCE)) { set_state(STATE_ACTIVE); if (!is_initialized) { // if starting direction was set to AUTO, this is our chance to re-orient the badguy if (start_dir == AUTO) { - Player* player = get_nearest_player(); - if (player && (player->get_bbox().p1.x > get_bbox().p2.x)) { + Player* player__ = get_nearest_player(); + if (player__ && (player__->get_bbox().p1.x > get_bbox().p2.x)) { dir = RIGHT; } else { dir = LEFT; diff --git a/src/badguy/mole_rock.cpp b/src/badguy/mole_rock.cpp index a0cf0c081..6b259704c 100644 --- a/src/badguy/mole_rock.cpp +++ b/src/badguy/mole_rock.cpp @@ -31,9 +31,9 @@ MoleRock::MoleRock(const Reader& reader) : sound_manager->preload("sounds/stomp.wav"); } -MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent = 0) : +MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent_ = 0) : BadGuy(pos, LEFT, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2), - parent(parent), + parent(parent_), initial_velocity(velocity) { physic.enable_gravity(true); diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index 438d328b2..4acf89878 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -113,20 +113,20 @@ MrBomb::kill_fall() } void -MrBomb::grab(MovingObject&, const Vector& pos, Direction dir) +MrBomb::grab(MovingObject&, const Vector& pos, Direction dir_) { assert(frozen); movement = pos - get_pos(); - this->dir = dir; - sprite->set_action(dir == LEFT ? "iced-left" : "iced-right"); + this->dir = dir_; + sprite->set_action(dir_ == LEFT ? "iced-left" : "iced-right"); set_colgroup_active(COLGROUP_DISABLED); grabbed = true; } void -MrBomb::ungrab(MovingObject& , Direction dir) +MrBomb::ungrab(MovingObject& , Direction dir_) { - this->dir = dir; + this->dir = dir_; set_colgroup_active(COLGROUP_MOVING); grabbed = false; } diff --git a/src/badguy/skydive.cpp b/src/badguy/skydive.cpp index 244686ed0..e1305575d 100644 --- a/src/badguy/skydive.cpp +++ b/src/badguy/skydive.cpp @@ -58,10 +58,10 @@ SkyDive::collision_badguy(BadGuy&, const CollisionHit& hit) } /* HitResponse collision_badguy */ void -SkyDive::grab (MovingObject&, const Vector& pos, Direction dir) +SkyDive::grab (MovingObject&, const Vector& pos, Direction dir_) { movement = pos - get_pos(); - this->dir = dir; + this->dir = dir_; is_grabbed = true; diff --git a/src/badguy/treewillowisp.cpp b/src/badguy/treewillowisp.cpp index a4d3d8dcf..5ca187e1d 100644 --- a/src/badguy/treewillowisp.cpp +++ b/src/badguy/treewillowisp.cpp @@ -28,9 +28,9 @@ static const std::string TREEWILLOSOUND = "sounds/willowisp.wav"; static const float SUCKSPEED = 25; -TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos, - float radius, float speed) : - BadGuy(tree->get_pos() + pos, "images/creatures/willowisp/willowisp.sprite", +TreeWillOWisp::TreeWillOWisp(GhostTree* tree_, const Vector& pos, + float radius_, float speed_) : + BadGuy(tree_->get_pos() + pos, "images/creatures/willowisp/willowisp.sprite", LAYER_OBJECTS - 20), was_sucked(false), mystate(STATE_DEFAULT), @@ -39,14 +39,14 @@ TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos, radius(), speed(), sound_source(), - tree(tree), + tree(tree_), suck_target() { sound_manager->preload(TREEWILLOSOUND); - this->radius = radius; + this->radius = radius_; this->angle = 0; - this->speed = speed; + this->speed = speed_; set_colgroup_active(COLGROUP_MOVING); } @@ -75,10 +75,10 @@ TreeWillOWisp::vanish() } void -TreeWillOWisp::start_sucking(Vector suck_target) +TreeWillOWisp::start_sucking(Vector suck_target_) { mystate = STATE_SUCKED; - this->suck_target = suck_target; + this->suck_target = suck_target_; was_sucked = true; } @@ -126,12 +126,12 @@ TreeWillOWisp::active_update(float elapsed_time) } if (mystate == STATE_SUCKED) { - Vector dir = suck_target - get_pos(); - if(dir.norm() < 5) { + Vector dir_ = suck_target - get_pos(); + if(dir_.norm() < 5) { vanish(); return; } - Vector newpos = get_pos() + dir * elapsed_time; + Vector newpos = get_pos() + dir_ * elapsed_time; movement = newpos - get_pos(); return; } @@ -152,10 +152,10 @@ TreeWillOWisp::active_update(float elapsed_time) } void -TreeWillOWisp::set_color(const Color& color) +TreeWillOWisp::set_color(const Color& color_) { - this->color = color; - sprite->set_color(color); + this->color = color_; + sprite->set_color(color_); } Color diff --git a/src/badguy/walking_badguy.cpp b/src/badguy/walking_badguy.cpp index ad74358b1..5e26d49da 100644 --- a/src/badguy/walking_badguy.cpp +++ b/src/badguy/walking_badguy.cpp @@ -21,13 +21,13 @@ #include "sprite/sprite.hpp" WalkingBadguy::WalkingBadguy(const Vector& pos, - const std::string& sprite_name, - const std::string& walk_left_action, - const std::string& walk_right_action, - int layer) : - BadGuy(pos, sprite_name, layer), - walk_left_action(walk_left_action), - walk_right_action(walk_right_action), + const std::string& sprite_name_, + const std::string& walk_left_action_, + const std::string& walk_right_action_, + int layer_) : + BadGuy(pos, sprite_name_, layer_), + walk_left_action(walk_left_action_), + walk_right_action(walk_right_action_), walk_speed(80), max_drop_height(-1), turn_around_timer(), @@ -37,13 +37,13 @@ WalkingBadguy::WalkingBadguy(const Vector& pos, WalkingBadguy::WalkingBadguy(const Vector& pos, Direction direction, - const std::string& sprite_name, - const std::string& walk_left_action, - const std::string& walk_right_action, - int layer) : - BadGuy(pos, direction, sprite_name, layer), - walk_left_action(walk_left_action), - walk_right_action(walk_right_action), + const std::string& sprite_name_, + const std::string& walk_left_action_, + const std::string& walk_right_action_, + int layer_) : + BadGuy(pos, direction, sprite_name_, layer_), + walk_left_action(walk_left_action_), + walk_right_action(walk_right_action_), walk_speed(80), max_drop_height(-1), turn_around_timer(), @@ -52,13 +52,13 @@ WalkingBadguy::WalkingBadguy(const Vector& pos, } WalkingBadguy::WalkingBadguy(const Reader& reader, - const std::string& sprite_name, - const std::string& walk_left_action, - const std::string& walk_right_action, - int layer) : - BadGuy(reader, sprite_name, layer), - walk_left_action(walk_left_action), - walk_right_action(walk_right_action), + const std::string& sprite_name_, + const std::string& walk_left_action_, + const std::string& walk_right_action_, + int layer_) : + BadGuy(reader, sprite_name_, layer_), + walk_left_action(walk_left_action_), + walk_right_action(walk_right_action_), walk_speed(80), max_drop_height(-1), turn_around_timer(), diff --git a/src/badguy/willowisp.cpp b/src/badguy/willowisp.cpp index 76298b3ad..7cc348a58 100644 --- a/src/badguy/willowisp.cpp +++ b/src/badguy/willowisp.cpp @@ -118,8 +118,8 @@ WillOWisp::active_update(float elapsed_time) if (dist.norm() > vanish_range) { vanish(); } else if (dist.norm() >= 1) { - Vector dir = dist.unit(); - movement = dir * elapsed_time * flyspeed; + Vector dir_ = dist.unit(); + movement = dir_ * elapsed_time * flyspeed; } else { /* We somehow landed right on top of the player without colliding. * Sit tight and avoid a division by zero. */ @@ -133,8 +133,8 @@ WillOWisp::active_update(float elapsed_time) } case STATE_VANISHING: { - Vector dir = dist.unit(); - movement = dir * elapsed_time * flyspeed; + Vector dir_ = dist.unit(); + movement = dir_ * elapsed_time * flyspeed; if(sprite->animation_done()) { remove_me(); } diff --git a/src/control/codecontroller.cpp b/src/control/codecontroller.cpp index 52b07a731..88116a350 100644 --- a/src/control/codecontroller.cpp +++ b/src/control/codecontroller.cpp @@ -23,9 +23,9 @@ CodeController::~CodeController() {} void -CodeController::press(Control c, bool pressed) +CodeController::press(Control c, bool pressed_) { - controls[c] = pressed; + controls[c] = pressed_; } void diff --git a/src/control/joystick_manager.cpp b/src/control/joystick_manager.cpp index f6fbbe4d5..5043b60fd 100644 --- a/src/control/joystick_manager.cpp +++ b/src/control/joystick_manager.cpp @@ -27,8 +27,8 @@ #include "util/log.hpp" #include "util/writer.hpp" -JoystickManager::JoystickManager(InputManager* parent) : - parent(parent), +JoystickManager::JoystickManager(InputManager* parent_) : + parent(parent_), joy_button_map(), joy_axis_map(), joy_hat_map(), diff --git a/src/object/background.cpp b/src/object/background.cpp index f49e05c62..7b0d75f00 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -135,34 +135,34 @@ Background::update(float delta) } void -Background::set_image(const std::string& name, float speed) +Background::set_image(const std::string& name_, float speed_) { - this->imagefile = name; - this->speed = speed; + this->imagefile = name_; + this->speed = speed_; - image = Surface::create(name); + image = Surface::create(name_); } void -Background::draw_image(DrawingContext& context, const Vector& pos) +Background::draw_image(DrawingContext& context, const Vector& pos_) { Sizef level(Sector::current()->get_width(), Sector::current()->get_height()); Sizef screen(SCREEN_WIDTH, SCREEN_HEIGHT); Sizef parallax_image_size = (1.0f - speed) * screen + level * speed; Rectf cliprect = context.get_cliprect(); - int start_x = static_cast(floorf((cliprect.get_left() - (pos.x - image->get_width() /2.0f)) / image->get_width())); - int end_x = static_cast(ceilf((cliprect.get_right() - (pos.x + image->get_width() /2.0f)) / image->get_width()))+1; - int start_y = static_cast(floorf((cliprect.get_top() - (pos.y - image->get_height()/2.0f)) / image->get_height())); - int end_y = static_cast(ceilf((cliprect.get_bottom() - (pos.y + image->get_height()/2.0f)) / image->get_height()))+1; + int start_x = static_cast(floorf((cliprect.get_left() - (pos_.x - image->get_width() /2.0f)) / image->get_width())); + int end_x = static_cast(ceilf((cliprect.get_right() - (pos_.x + image->get_width() /2.0f)) / image->get_width()))+1; + int start_y = static_cast(floorf((cliprect.get_top() - (pos_.y - image->get_height()/2.0f)) / image->get_height())); + int end_y = static_cast(ceilf((cliprect.get_bottom() - (pos_.y + image->get_height()/2.0f)) / image->get_height()))+1; switch(alignment) { case LEFT_ALIGNMENT: for(int y = start_y; y < end_y; ++y) { - Vector p(pos.x - parallax_image_size.width / 2.0f, - pos.y + y * image->get_height() - image->get_height() / 2.0f); + Vector p(pos_.x - parallax_image_size.width / 2.0f, + pos_.y + y * image->get_height() - image->get_height() / 2.0f); context.draw_surface(image, p, layer); } break; @@ -170,8 +170,8 @@ Background::draw_image(DrawingContext& context, const Vector& pos) case RIGHT_ALIGNMENT: for(int y = start_y; y < end_y; ++y) { - Vector p(pos.x + parallax_image_size.width / 2.0f - image->get_width(), - pos.y + y * image->get_height() - image->get_height() / 2.0f); + Vector p(pos_.x + parallax_image_size.width / 2.0f - image->get_width(), + pos_.y + y * image->get_height() - image->get_height() / 2.0f); context.draw_surface(image, p, layer); } break; @@ -179,8 +179,8 @@ Background::draw_image(DrawingContext& context, const Vector& pos) case TOP_ALIGNMENT: for(int x = start_x; x < end_x; ++x) { - Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f, - pos.y - parallax_image_size.height / 2.0f); + Vector p(pos_.x + x * image->get_width() - image->get_width() / 2.0f, + pos_.y - parallax_image_size.height / 2.0f); context.draw_surface(image, p, layer); } break; @@ -188,8 +188,8 @@ Background::draw_image(DrawingContext& context, const Vector& pos) case BOTTOM_ALIGNMENT: for(int x = start_x; x < end_x; ++x) { - Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f, - pos.y - image->get_height() + parallax_image_size.height / 2.0f); + Vector p(pos_.x + x * image->get_width() - image->get_width() / 2.0f, + pos_.y - image->get_height() + parallax_image_size.height / 2.0f); context.draw_surface(image, p, layer); } break; @@ -198,8 +198,8 @@ Background::draw_image(DrawingContext& context, const Vector& pos) for(int y = start_y; y < end_y; ++y) for(int x = start_x; x < end_x; ++x) { - Vector p(pos.x + x * image->get_width() - image->get_width()/2, - pos.y + y * image->get_height() - image->get_height()/2); + Vector p(pos_.x + x * image->get_width() - image->get_width()/2, + pos_.y + y * image->get_height() - image->get_height()/2); if (image_top.get() != NULL && (y < 0)) { diff --git a/src/object/bicycle_platform.cpp b/src/object/bicycle_platform.cpp index 5c0927b07..7387f72d7 100644 --- a/src/object/bicycle_platform.cpp +++ b/src/object/bicycle_platform.cpp @@ -37,9 +37,9 @@ BicyclePlatform::BicyclePlatform(const Reader& reader) : center = get_pos(); } -BicyclePlatform::BicyclePlatform(BicyclePlatform* master) : +BicyclePlatform::BicyclePlatform(BicyclePlatform* master_) : MovingSprite(*master), - master(master), + master(master_), slave(this), center(master->center), radius(master->radius), @@ -102,8 +102,8 @@ BicyclePlatform::update(float elapsed_time) angle = master->angle + M_PI; while (angle < 0) { angle += 2*M_PI; } while (angle > 2*M_PI) { angle -= 2*M_PI; } - Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5); - movement = dest - get_pos(); + Vector dest_ = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5); + movement = dest_ - get_pos(); } if (this == master) { float momentum_diff = momentum - slave->momentum; @@ -118,8 +118,8 @@ BicyclePlatform::update(float elapsed_time) while (angle < 0) { angle += 2*M_PI; } while (angle > 2*M_PI) { angle -= 2*M_PI; } angular_speed = std::min(std::max(angular_speed, static_cast(-128*M_PI*elapsed_time)), static_cast(128*M_PI*elapsed_time)); - Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5); - movement = dest - get_pos(); + Vector dest_ = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5); + movement = dest_ - get_pos(); center += Vector(angular_speed, 0) * elapsed_time * 32; slave->center += Vector(angular_speed, 0) * elapsed_time * 32; diff --git a/src/object/bonus_block.cpp b/src/object/bonus_block.cpp index 044f4705b..b3f80baeb 100644 --- a/src/object/bonus_block.cpp +++ b/src/object/bonus_block.cpp @@ -169,7 +169,7 @@ BonusBlock::hit(Player & player) } HitResponse -BonusBlock::collision(GameObject& other, const CollisionHit& hit){ +BonusBlock::collision(GameObject& other, const CollisionHit& hit_){ Player* player = dynamic_cast (&other); if (player) { @@ -193,7 +193,7 @@ BonusBlock::collision(GameObject& other, const CollisionHit& hit){ try_open(player); } } - return Block::collision(other, hit); + return Block::collision(other, hit_); } void @@ -337,12 +337,12 @@ BonusBlock::try_drop(Player *player) assert(sector); // First what's below the bonus block, if solid send it up anyway (excepting doll) - Rectf dest; - dest.p1.x = bbox.get_left() + 1; - dest.p1.y = bbox.get_bottom() + 1; - dest.p2.x = bbox.get_right() - 1; - dest.p2.y = dest.p1.y + 30; - if (!Sector::current()->is_free_of_statics(dest, this, true) && !(contents == CONTENT_1UP)) { + Rectf dest_; + dest_.p1.x = bbox.get_left() + 1; + dest_.p1.y = bbox.get_bottom() + 1; + dest_.p2.x = bbox.get_right() - 1; + dest_.p2.y = dest_.p1.y + 30; + if (!Sector::current()->is_free_of_statics(dest_, this, true) && !(contents == CONTENT_1UP)) { try_open(player); return; } diff --git a/src/object/broken_brick.cpp b/src/object/broken_brick.cpp index 3de3031c1..5340eda48 100644 --- a/src/object/broken_brick.cpp +++ b/src/object/broken_brick.cpp @@ -19,10 +19,10 @@ #include "math/random_generator.hpp" #include "sprite/sprite.hpp" -BrokenBrick::BrokenBrick(SpritePtr sprite, +BrokenBrick::BrokenBrick(SpritePtr sprite_, const Vector& pos, const Vector& nmovement) : timer(), - sprite(sprite), + sprite(sprite_), position(pos), movement(nmovement) { diff --git a/src/object/bullet.cpp b/src/object/bullet.cpp index f1a3d8a5b..c6a486774 100644 --- a/src/object/bullet.cpp +++ b/src/object/bullet.cpp @@ -27,13 +27,13 @@ const float BULLET_XM = 600; const float BULLET_STARTING_YM = 0; } -Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) : +Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type_) : physic(), life_count(3), sprite(), light(0.0f,0.0f,0.0f), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")), - type(type) + type(type_) { float speed = dir == RIGHT ? BULLET_XM : -BULLET_XM; physic.set_velocity_x(speed + xm); diff --git a/src/object/camera.cpp b/src/object/camera.cpp index 0f7539636..abca4a7e6 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -111,7 +111,7 @@ public: } }; -Camera::Camera(Sector* newsector, std::string name) : +Camera::Camera(Sector* newsector, std::string name_) : mode(NORMAL), translation(), sector(newsector), @@ -132,7 +132,7 @@ Camera::Camera(Sector* newsector, std::string name) : scrollspeed(), config() { - this->name = name; + this->name = name_; config = new CameraConfig(); reload_config(); } @@ -276,19 +276,19 @@ float clamp(float val, float min, float max) } void -Camera::keep_in_bounds(Vector& translation) +Camera::keep_in_bounds(Vector& translation_) { float width = sector->get_width(); float height = sector->get_height(); // don't scroll before the start or after the level's end - translation.x = clamp(translation.x, 0, width - SCREEN_WIDTH); - translation.y = clamp(translation.y, 0, height - SCREEN_HEIGHT); + translation_.x = clamp(translation_.x, 0, width - SCREEN_WIDTH); + translation_.y = clamp(translation_.y, 0, height - SCREEN_HEIGHT); if (height < SCREEN_HEIGHT) - translation.y = height/2.0 - SCREEN_HEIGHT/2.0; + translation_.y = height/2.0 - SCREEN_HEIGHT/2.0; if (width < SCREEN_WIDTH) - translation.x = width/2.0 - SCREEN_WIDTH/2.0; + translation_.x = width/2.0 - SCREEN_WIDTH/2.0; } void @@ -303,7 +303,7 @@ Camera::shake() void Camera::update_scroll_normal(float elapsed_time) { - const CameraConfig& config = *(this->config); + const CameraConfig& config_ = *(this->config); Player* player = sector->player; // TODO: co-op mode needs a good camera Vector player_pos(player->get_bbox().get_middle().x, @@ -317,13 +317,13 @@ Camera::update_scroll_normal(float elapsed_time) return; /****** Vertical Scrolling part ******/ - int ymode = config.ymode; + int ymode = config_.ymode; if(player->is_dying() || sector->get_height() == 19*32) { ymode = 0; } if(ymode == 1) { - cached_translation.y = player_pos.y - SCREEN_HEIGHT * config.target_y; + cached_translation.y = player_pos.y - SCREEN_HEIGHT * config_.target_y; } if(ymode == 2) { // target_y is the high we target our scrolling at. This is not always the @@ -335,7 +335,7 @@ Camera::update_scroll_normal(float elapsed_time) target_y = player->last_ground_y + player->get_bbox().get_height(); else target_y = player->get_bbox().p2.y; - target_y -= SCREEN_HEIGHT * config.target_y; + target_y -= SCREEN_HEIGHT * config_.target_y; // delta_y is the distance we'd have to travel to directly reach target_y float delta_y = cached_translation.y - target_y; @@ -345,32 +345,32 @@ Camera::update_scroll_normal(float elapsed_time) // limit the camera speed when jumping upwards if(player->fall_mode != Player::FALLING && player->fall_mode != Player::TRAMPOLINE_JUMP) { - speed_y = clamp(speed_y, -config.max_speed_y, config.max_speed_y); + speed_y = clamp(speed_y, -config_.max_speed_y, config_.max_speed_y); } // scroll with calculated speed cached_translation.y -= speed_y * elapsed_time; } if(ymode == 3) { - float halfsize = config.kirby_rectsize_y * 0.5f; + float halfsize = config_.kirby_rectsize_y * 0.5f; cached_translation.y = clamp(cached_translation.y, player_pos.y - SCREEN_HEIGHT * (0.5f + halfsize), player_pos.y - SCREEN_HEIGHT * (0.5f - halfsize)); } if(ymode == 4) { - float upperend = SCREEN_HEIGHT * config.edge_x; - float lowerend = SCREEN_HEIGHT * (1 - config.edge_x); + float upperend = SCREEN_HEIGHT * config_.edge_x; + float lowerend = SCREEN_HEIGHT * (1 - config_.edge_x); if (player_delta.y < -CAMERA_EPSILON) { // walking left - lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm; + lookahead_pos.y -= player_delta.y * config_.dynamic_speed_sm; if(lookahead_pos.y > lowerend) { lookahead_pos.y = lowerend; } } else if (player_delta.y > CAMERA_EPSILON) { // walking right - lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm; + lookahead_pos.y -= player_delta.y * config_.dynamic_speed_sm; if(lookahead_pos.y < upperend) { lookahead_pos.y = upperend; } @@ -391,12 +391,12 @@ Camera::update_scroll_normal(float elapsed_time) if(ymode != 0) { float top_edge, bottom_edge; - if(config.clamp_y <= 0) { + if(config_.clamp_y <= 0) { top_edge = 0; bottom_edge = SCREEN_HEIGHT; } else { - top_edge = SCREEN_HEIGHT*config.clamp_y; - bottom_edge = SCREEN_HEIGHT*(1-config.clamp_y); + top_edge = SCREEN_HEIGHT*config_.clamp_y; + bottom_edge = SCREEN_HEIGHT*(1-config_.clamp_y); } float peek_to = 0; @@ -417,24 +417,24 @@ Camera::update_scroll_normal(float elapsed_time) translation.y -= peek_pos.y; - if(config.clamp_y > 0) { + if(config_.clamp_y > 0) { translation.y = clamp(translation.y, - player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y), - player_pos.y - SCREEN_HEIGHT * config.clamp_y); + player_pos.y - SCREEN_HEIGHT * (1-config_.clamp_y), + player_pos.y - SCREEN_HEIGHT * config_.clamp_y); cached_translation.y = clamp(cached_translation.y, - player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y), - player_pos.y - SCREEN_HEIGHT * config.clamp_y); + player_pos.y - SCREEN_HEIGHT * (1-config_.clamp_y), + player_pos.y - SCREEN_HEIGHT * config_.clamp_y); } } /****** Horizontal scrolling part *******/ - int xmode = config.xmode; + int xmode = config_.xmode; if(player->is_dying()) xmode = 0; if(xmode == 1) { - cached_translation.x = player_pos.x - SCREEN_WIDTH * config.target_x; + cached_translation.x = player_pos.x - SCREEN_WIDTH * config_.target_x; } if(xmode == 2) { // our camera is either in leftscrolling, rightscrolling or @@ -452,9 +452,9 @@ Camera::update_scroll_normal(float elapsed_time) else walkDirection = LOOKAHEAD_RIGHT; float LEFTEND, RIGHTEND; - if(config.sensitive_x > 0) { - LEFTEND = SCREEN_WIDTH * config.sensitive_x; - RIGHTEND = SCREEN_WIDTH * (1-config.sensitive_x); + if(config_.sensitive_x > 0) { + LEFTEND = SCREEN_WIDTH * config_.sensitive_x; + RIGHTEND = SCREEN_WIDTH * (1-config_.sensitive_x); } else { LEFTEND = SCREEN_WIDTH; RIGHTEND = 0; @@ -482,7 +482,7 @@ Camera::update_scroll_normal(float elapsed_time) * sudden changes */ if(changetime < 0) { changetime = game_time; - } else if(game_time - changetime > config.dirchange_time) { + } else if(game_time - changetime > config_.dirchange_time) { if(lookahead_mode == LOOKAHEAD_LEFT && player_pos.x > cached_translation.x + RIGHTEND) { lookahead_mode = LOOKAHEAD_RIGHT; @@ -497,8 +497,8 @@ Camera::update_scroll_normal(float elapsed_time) changetime = -1; } - LEFTEND = SCREEN_WIDTH * config.edge_x; - RIGHTEND = SCREEN_WIDTH * (1-config.edge_x); + LEFTEND = SCREEN_WIDTH * config_.edge_x; + RIGHTEND = SCREEN_WIDTH * (1-config_.edge_x); // calculate our scroll target depending on scroll mode float target_x; @@ -516,32 +516,32 @@ Camera::update_scroll_normal(float elapsed_time) // limit our speed float player_speed_x = player_delta.x / elapsed_time; - float maxv = config.max_speed_x + (fabsf(player_speed_x * config.dynamic_max_speed_x)); + float maxv = config_.max_speed_x + (fabsf(player_speed_x * config_.dynamic_max_speed_x)); speed_x = clamp(speed_x, -maxv, maxv); // apply scrolling cached_translation.x -= speed_x * elapsed_time; } if(xmode == 3) { - float halfsize = config.kirby_rectsize_x * 0.5f; + float halfsize = config_.kirby_rectsize_x * 0.5f; cached_translation.x = clamp(cached_translation.x, player_pos.x - SCREEN_WIDTH * (0.5f + halfsize), player_pos.x - SCREEN_WIDTH * (0.5f - halfsize)); } if(xmode == 4) { - float LEFTEND = SCREEN_WIDTH * config.edge_x; - float RIGHTEND = SCREEN_WIDTH * (1 - config.edge_x); + float LEFTEND = SCREEN_WIDTH * config_.edge_x; + float RIGHTEND = SCREEN_WIDTH * (1 - config_.edge_x); if (player_delta.x < -CAMERA_EPSILON) { // walking left - lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm; + lookahead_pos.x -= player_delta.x * config_.dynamic_speed_sm; if(lookahead_pos.x > RIGHTEND) { lookahead_pos.x = RIGHTEND; } } else if (player_delta.x > CAMERA_EPSILON) { // walking right - lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm; + lookahead_pos.x -= player_delta.x * config_.dynamic_speed_sm; if(lookahead_pos.x < LEFTEND) { lookahead_pos.x = LEFTEND; } @@ -562,12 +562,12 @@ Camera::update_scroll_normal(float elapsed_time) if(xmode != 0) { float left_edge, right_edge; - if(config.clamp_x <= 0) { + if(config_.clamp_x <= 0) { left_edge = 0; right_edge = SCREEN_WIDTH; } else { - left_edge = SCREEN_WIDTH*config.clamp_x; - right_edge = SCREEN_WIDTH*(1-config.clamp_x); + left_edge = SCREEN_WIDTH*config_.clamp_x; + right_edge = SCREEN_WIDTH*(1-config_.clamp_x); } float peek_to = 0; @@ -588,14 +588,14 @@ Camera::update_scroll_normal(float elapsed_time) translation.x -= peek_pos.x; - if(config.clamp_x > 0) { + if(config_.clamp_x > 0) { translation.x = clamp(translation.x, - player_pos.x - SCREEN_WIDTH * (1-config.clamp_x), - player_pos.x - SCREEN_WIDTH * config.clamp_x); + player_pos.x - SCREEN_WIDTH * (1-config_.clamp_x), + player_pos.x - SCREEN_WIDTH * config_.clamp_x); cached_translation.x = clamp(cached_translation.x, - player_pos.x - SCREEN_WIDTH * (1-config.clamp_x), - player_pos.x - SCREEN_WIDTH * config.clamp_x); + player_pos.x - SCREEN_WIDTH * (1-config_.clamp_x), + player_pos.x - SCREEN_WIDTH * config_.clamp_x); } } diff --git a/src/object/candle.cpp b/src/object/candle.cpp index a9abc9d42..a3b8f1517 100644 --- a/src/object/candle.cpp +++ b/src/object/candle.cpp @@ -117,11 +117,11 @@ Candle::get_burning() } void -Candle::set_burning(bool burning) +Candle::set_burning(bool burning_) { - if (this->burning == burning) return; - this->burning = burning; - if (burning) { + if (this->burning == burning_) return; + this->burning = burning_; + if (burning_) { sprite->set_action("on"); } else { sprite->set_action("off"); diff --git a/src/object/display_effect.cpp b/src/object/display_effect.cpp index 89ac199df..e884a2b33 100644 --- a/src/object/display_effect.cpp +++ b/src/object/display_effect.cpp @@ -22,7 +22,7 @@ static const float BORDER_SIZE = 75; -DisplayEffect::DisplayEffect(std::string name) : +DisplayEffect::DisplayEffect(const std::string& name_) : screen_fade(NO_FADE), screen_fadetime(0), screen_fading(0), @@ -33,7 +33,7 @@ DisplayEffect::DisplayEffect(std::string name) : black(false), borders(false) { - this->name = name; + this->name = name_; } DisplayEffect::~DisplayEffect() diff --git a/src/object/display_effect.hpp b/src/object/display_effect.hpp index f2f877439..6ea34c7ae 100644 --- a/src/object/display_effect.hpp +++ b/src/object/display_effect.hpp @@ -26,7 +26,7 @@ class DisplayEffect : public GameObject, public ScriptInterface { public: - DisplayEffect(std::string name = ""); + DisplayEffect(const std::string& name = std::string()); virtual ~DisplayEffect(); void expose(HSQUIRRELVM vm, SQInteger table_idx); diff --git a/src/object/floating_image.cpp b/src/object/floating_image.cpp index 0c1956641..40d37402c 100644 --- a/src/object/floating_image.cpp +++ b/src/object/floating_image.cpp @@ -67,17 +67,17 @@ FloatingImage::get_action() } void -FloatingImage::fade_in(float fadetime) +FloatingImage::fade_in(float fadetime_) { - this->fadetime = fadetime; - fading = fadetime; + this->fadetime = fadetime_; + fading = fadetime_; } void -FloatingImage::fade_out(float fadetime) +FloatingImage::fade_out(float fadetime_) { - this->fadetime = fadetime; - fading = -fadetime; + this->fadetime = fadetime_; + fading = -fadetime_; } void diff --git a/src/object/floating_image.hpp b/src/object/floating_image.hpp index 85a7697fc..eb8c6e103 100644 --- a/src/object/floating_image.hpp +++ b/src/object/floating_image.hpp @@ -29,30 +29,30 @@ public: FloatingImage(const std::string& sprite); virtual ~FloatingImage(); - void set_layer(int layer) { - this->layer = layer; + void set_layer(int layer_) { + this->layer = layer_; } int get_layer() const { return layer; } - void set_pos(const Vector& pos) { - this->pos = pos; + void set_pos(const Vector& pos_) { + this->pos = pos_; } const Vector& get_pos() const { return pos; } - void set_anchor_point(AnchorPoint anchor) { - this->anchor = anchor; + void set_anchor_point(AnchorPoint anchor_) { + this->anchor = anchor_; } AnchorPoint get_anchor_point() const { return anchor; } - void set_visible(bool visible) { - this->visible = visible; + void set_visible(bool visible_) { + this->visible = visible_; } bool get_visible() const { return visible; diff --git a/src/object/icecrusher.cpp b/src/object/icecrusher.cpp index a83efced7..e8374ff60 100644 --- a/src/object/icecrusher.cpp +++ b/src/object/icecrusher.cpp @@ -79,10 +79,10 @@ IceCrusher::IceCrusher(const Reader& reader) : } */ void -IceCrusher::set_state(IceCrusherState state, bool force) +IceCrusher::set_state(IceCrusherState state_, bool force) { - if ((this->state == state) && (!force)) return; - switch(state) { + if ((this->state == state_) && (!force)) return; + switch(state_) { case IDLE: set_group(COLGROUP_STATIC); physic.enable_gravity (false); @@ -103,7 +103,7 @@ IceCrusher::set_state(IceCrusherState state, bool force) log_debug << "IceCrusher in invalid state" << std::endl; break; } - this->state = state; + this->state = state_; } HitResponse diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index 4269829b8..3996070cc 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -95,14 +95,15 @@ InfoBlock::hit(Player& player) } HitResponse -InfoBlock::collision(GameObject& other, const CollisionHit& hit){ - - Player* player = dynamic_cast (&other); - if (player) { - if (player->does_buttjump) - InfoBlock::hit(*player); - } - return Block::collision(other, hit); +InfoBlock::collision(GameObject& other, const CollisionHit& hit_) +{ + Player* player = dynamic_cast (&other); + if (player) + { + if (player->does_buttjump) + InfoBlock::hit(*player); + } + return Block::collision(other, hit_); } Player* diff --git a/src/object/level_time.cpp b/src/object/level_time.cpp index 4cf041d0d..0ab963f1b 100644 --- a/src/object/level_time.cpp +++ b/src/object/level_time.cpp @@ -120,9 +120,9 @@ LevelTime::get_time() } void -LevelTime::set_time(float time_left) +LevelTime::set_time(float time_left_) { - this->time_left = std::min(std::max(time_left, 0.0f), 999.0f); + this->time_left = std::min(std::max(time_left_, 0.0f), 999.0f); } /* EOF */ diff --git a/src/object/moving_sprite.cpp b/src/object/moving_sprite.cpp index 59a81ef69..a9d877a0f 100644 --- a/src/object/moving_sprite.cpp +++ b/src/object/moving_sprite.cpp @@ -21,11 +21,11 @@ #include -MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name, - int layer, CollisionGroup collision_group) : - sprite_name(sprite_name), +MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name_, + int layer_, CollisionGroup collision_group) : + sprite_name(sprite_name_), sprite(), - layer(layer) + layer(layer_) { bbox.set_pos(pos); sprite = sprite_manager->create(sprite_name); @@ -33,10 +33,10 @@ MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name, set_group(collision_group); } -MovingSprite::MovingSprite(const Reader& reader, const Vector& pos, int layer, CollisionGroup collision_group) : +MovingSprite::MovingSprite(const Reader& reader, const Vector& pos, int layer_, CollisionGroup collision_group) : sprite_name(), sprite(), - layer(layer) + layer(layer_) { bbox.set_pos(pos); if (!reader.get("sprite", sprite_name)) @@ -47,10 +47,10 @@ MovingSprite::MovingSprite(const Reader& reader, const Vector& pos, int layer, C set_group(collision_group); } -MovingSprite::MovingSprite(const Reader& reader, const std::string& sprite_name, int layer, CollisionGroup collision_group) : - sprite_name(sprite_name), +MovingSprite::MovingSprite(const Reader& reader, const std::string& sprite_name_, int layer_, CollisionGroup collision_group) : + sprite_name(sprite_name_), sprite(), - layer(layer) + layer(layer_) { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); @@ -61,10 +61,10 @@ MovingSprite::MovingSprite(const Reader& reader, const std::string& sprite_name, set_group(collision_group); } -MovingSprite::MovingSprite(const Reader& reader, int layer, CollisionGroup collision_group) : +MovingSprite::MovingSprite(const Reader& reader, int layer_, CollisionGroup collision_group) : sprite_name(), sprite(), - layer(layer) + layer(layer_) { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); diff --git a/src/object/path_walker.cpp b/src/object/path_walker.cpp index 47d18a4ea..a34db12a9 100644 --- a/src/object/path_walker.cpp +++ b/src/object/path_walker.cpp @@ -19,8 +19,8 @@ #include #include -PathWalker::PathWalker(const Path* path, bool running_) : - path(path), +PathWalker::PathWalker(const Path* path_, bool running_) : + path(path_), running(running_), current_node_nr(0), next_node_nr(0), diff --git a/src/object/player.cpp b/src/object/player.cpp index 5d7e640d5..8a09076fe 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -109,7 +109,7 @@ static const float DUCKED_TUX_HEIGHT = 31.8f; bool no_water = true; } -Player::Player(PlayerStatus* _player_status, const std::string& name) : +Player::Player(PlayerStatus* _player_status, const std::string& name_) : deactivated(), controller(), scripting_controller(), @@ -159,7 +159,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) : idle_stage(0), climbing(0) { - this->name = name; + this->name = name_; controller = g_input_manager->get_controller(); scripting_controller.reset(new CodeController()); // if/when we have complete penny gfx, we can @@ -260,9 +260,9 @@ Player::set_speedlimit(float newlimit) } void -Player::set_controller(Controller* controller) +Player::set_controller(Controller* controller_) { - this->controller = controller; + this->controller = controller_; } void @@ -815,18 +815,18 @@ Player::handle_input() if(moving_object) { // move the grabbed object a bit away from tux Rectf grabbed_bbox = moving_object->get_bbox(); - Rectf dest; - dest.p2.y = bbox.get_top() + bbox.get_height()*0.66666; - dest.p1.y = dest.p2.y - grabbed_bbox.get_height(); + Rectf dest_; + dest_.p2.y = bbox.get_top() + bbox.get_height()*0.66666; + dest_.p1.y = dest_.p2.y - grabbed_bbox.get_height(); if(dir == LEFT) { - dest.p2.x = bbox.get_left() - 1; - dest.p1.x = dest.p2.x - grabbed_bbox.get_width(); + dest_.p2.x = bbox.get_left() - 1; + dest_.p1.x = dest_.p2.x - grabbed_bbox.get_width(); } else { - dest.p1.x = bbox.get_right() + 1; - dest.p2.x = dest.p1.x + grabbed_bbox.get_width(); + dest_.p1.x = bbox.get_right() + 1; + dest_.p2.x = dest_.p1.x + grabbed_bbox.get_width(); } - if(Sector::current()->is_free_of_tiles(dest, true)) { - moving_object->set_pos(dest.p1); + if(Sector::current()->is_free_of_tiles(dest_, true)) { + moving_object->set_pos(dest_.p1); if(controller->hold(Controller::UP)) { grabbed_object->ungrab(*this, UP); } else { @@ -1034,10 +1034,10 @@ Player::set_bonus(BonusType type, bool animate) } void -Player::set_visible(bool visible) +Player::set_visible(bool visible_) { - this->visible = visible; - if( visible ) + this->visible = visible_; + if( visible_ ) set_group(COLGROUP_MOVING); else set_group(COLGROUP_DISABLED); diff --git a/src/object/pneumatic_platform.cpp b/src/object/pneumatic_platform.cpp index cba90384e..b295de829 100644 --- a/src/object/pneumatic_platform.cpp +++ b/src/object/pneumatic_platform.cpp @@ -33,12 +33,12 @@ PneumaticPlatform::PneumaticPlatform(const Reader& reader) : start_y = get_pos().y; } -PneumaticPlatform::PneumaticPlatform(PneumaticPlatform* master) : - MovingSprite(*master), - master(master), +PneumaticPlatform::PneumaticPlatform(PneumaticPlatform* master_) : + MovingSprite(*master_), + master(master_), slave(this), - start_y(master->start_y), - offset_y(-master->offset_y), + start_y(master_->start_y), + offset_y(-master_->offset_y), speed_y(0), contacts() { diff --git a/src/object/powerup.cpp b/src/object/powerup.cpp index 53fa40752..09feaafb0 100644 --- a/src/object/powerup.cpp +++ b/src/object/powerup.cpp @@ -57,8 +57,8 @@ PowerUp::PowerUp(const Reader& lisp) : } -PowerUp::PowerUp(const Vector& pos, const std::string& sprite_name) : - MovingSprite(pos, sprite_name, LAYER_OBJECTS, COLGROUP_MOVING), +PowerUp::PowerUp(const Vector& pos, const std::string& sprite_name_) : + MovingSprite(pos, sprite_name_, LAYER_OBJECTS, COLGROUP_MOVING), physic(), script(), no_physics(false), diff --git a/src/object/sprite_particle.cpp b/src/object/sprite_particle.cpp index 122404934..82e70fa15 100644 --- a/src/object/sprite_particle.cpp +++ b/src/object/sprite_particle.cpp @@ -25,12 +25,12 @@ #include SpriteParticle::SpriteParticle(std::string sprite_name, std::string action, - Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, + Vector position_, AnchorPoint anchor, Vector velocity_, Vector acceleration_, int drawing_layer_) : sprite(), - position(position), - velocity(velocity), - acceleration(acceleration), + position(position_), + velocity(velocity_), + acceleration(acceleration_), drawing_layer(drawing_layer_), light(0.0f,0.0f,0.0f), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")), diff --git a/src/object/text_object.cpp b/src/object/text_object.cpp index 7db2cac8a..ea1e4ebf9 100644 --- a/src/object/text_object.cpp +++ b/src/object/text_object.cpp @@ -21,7 +21,7 @@ #include "supertux/resources.hpp" #include "video/drawing_context.hpp" -TextObject::TextObject(std::string name) : +TextObject::TextObject(std::string name_) : font(), text(), fading(0), @@ -31,7 +31,7 @@ TextObject::TextObject(std::string name) : anchor(ANCHOR_MIDDLE), pos(0, 0) { - this->name = name; + this->name = name_; font = Resources::normal_font; centered = false; } @@ -59,51 +59,51 @@ TextObject::unexpose(HSQUIRRELVM vm, SQInteger table_idx) } void -TextObject::set_font(const std::string& name) +TextObject::set_font(const std::string& name_) { - if(name == "normal") { + if(name_ == "normal") { font = Resources::normal_font; - } else if(name == "big") { + } else if(name_ == "big") { font = Resources::big_font; - } else if(name == "small") { + } else if(name_ == "small") { font = Resources::small_font; } else { - log_warning << "Unknown font '" << name << "'." << std::endl; + log_warning << "Unknown font '" << name_ << "'." << std::endl; font = Resources::normal_font; } } void -TextObject::set_text(const std::string& text) +TextObject::set_text(const std::string& text_) { - this->text = text; + this->text = text_; } void -TextObject::fade_in(float fadetime) +TextObject::fade_in(float fadetime_) { - this->fadetime = fadetime; - fading = fadetime; + this->fadetime = fadetime_; + fading = fadetime_; } void -TextObject::fade_out(float fadetime) +TextObject::fade_out(float fadetime_) { - this->fadetime = fadetime; - fading = -fadetime; + this->fadetime = fadetime_; + fading = -fadetime_; } void -TextObject::set_visible(bool visible) +TextObject::set_visible(bool visible_) { - this->visible = visible; + this->visible = visible_; fading = 0; } void -TextObject::set_centered(bool centered) +TextObject::set_centered(bool centered_) { - this->centered = centered; + this->centered = centered_; } void diff --git a/src/object/text_object.hpp b/src/object/text_object.hpp index 4605eefa2..4a36b7159 100644 --- a/src/object/text_object.hpp +++ b/src/object/text_object.hpp @@ -45,15 +45,15 @@ public: void set_centered(bool centered); bool is_visible(); - void set_anchor_point(AnchorPoint anchor) { - this->anchor = anchor; + void set_anchor_point(AnchorPoint anchor_) { + this->anchor = anchor_; } AnchorPoint get_anchor_point() const { return anchor; } - void set_pos(const Vector& pos) { - this->pos = pos; + void set_pos(const Vector& pos_) { + this->pos = pos_; } void set_pos(float x, float y) { set_pos(Vector(x, y)); @@ -68,8 +68,8 @@ public: return pos.y; } - void set_anchor_point(int anchor) { - set_anchor_point((AnchorPoint) anchor); + void set_anchor_point(int anchor_) { + set_anchor_point((AnchorPoint) anchor_); } int get_anchor_point() { return (int) get_anchor_point(); diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index ed3d4723f..913609203 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -134,8 +134,8 @@ TileMap::TileMap(const Reader& reader) : } } -TileMap::TileMap(const TileSet *new_tileset, std::string name, int z_pos, - bool solid, size_t width, size_t height) : +TileMap::TileMap(const TileSet *new_tileset, std::string name_, int z_pos_, + bool solid, size_t width_, size_t height_) : tileset(new_tileset), tiles(), real_solid(solid), @@ -144,7 +144,7 @@ TileMap::TileMap(const TileSet *new_tileset, std::string name, int z_pos, speed_y(1), width(0), height(0), - z_pos(z_pos), + z_pos(z_pos_), offset(Vector(0,0)), movement(Vector(0,0)), drawing_effect(NO_EFFECT), @@ -155,12 +155,12 @@ TileMap::TileMap(const TileSet *new_tileset, std::string name, int z_pos, walker(), draw_target(DrawingContext::NORMAL) { - this->name = name; + this->name = name_; if (this->z_pos > (LAYER_GUI - 100)) this->z_pos = LAYER_GUI - 100; - resize(width, height); + resize(width_, height_); } TileMap::~TileMap() @@ -416,16 +416,16 @@ TileMap::change_all(uint32_t oldtile, uint32_t newtile) } void -TileMap::fade(float alpha, float seconds) +TileMap::fade(float alpha_, float seconds) { - this->alpha = alpha; + this->alpha = alpha_; this->remaining_fade_time = seconds; } void -TileMap::set_alpha(float alpha) +TileMap::set_alpha(float alpha_) { - this->alpha = alpha; + this->alpha = alpha_; this->current_alpha = alpha; this->remaining_fade_time = 0; update_effective_solid (); diff --git a/src/object/wind.cpp b/src/object/wind.cpp index b3af59f44..ea5f3a3be 100644 --- a/src/object/wind.cpp +++ b/src/object/wind.cpp @@ -53,9 +53,9 @@ Wind::Wind(const Reader& reader) : } void -Wind::update(float elapsed_time) +Wind::update(float elapsed_time_) { - this->elapsed_time = elapsed_time; + this->elapsed_time = elapsed_time_; if (!blowing) return; diff --git a/src/physfs/ofile_streambuf.cpp b/src/physfs/ofile_streambuf.cpp index c496b621e..6b862b726 100644 --- a/src/physfs/ofile_streambuf.cpp +++ b/src/physfs/ofile_streambuf.cpp @@ -53,8 +53,8 @@ OFileStreambuf::overflow(int c) return traits_type::eof(); if(c != traits_type::eof()) { - PHYSFS_sint64 res = PHYSFS_write(file, &c2, 1, 1); - if(res <= 0) + PHYSFS_sint64 res_ = PHYSFS_write(file, &c2, 1, 1); + if(res_ <= 0) return traits_type::eof(); } diff --git a/src/scripting/camera.cpp b/src/scripting/camera.cpp index a2a180ef3..4491cce61 100644 --- a/src/scripting/camera.cpp +++ b/src/scripting/camera.cpp @@ -20,8 +20,8 @@ #include "util/log.hpp" namespace scripting { -Camera::Camera(::Camera* camera) - : camera(camera) +Camera::Camera(::Camera* camera_) + : camera(camera_) { } Camera::~Camera() diff --git a/src/scripting/candle.cpp b/src/scripting/candle.cpp index 018ddb58c..3e4df4235 100644 --- a/src/scripting/candle.cpp +++ b/src/scripting/candle.cpp @@ -19,8 +19,8 @@ namespace scripting { -Candle::Candle(::Candle* candle) - : candle(candle) +Candle::Candle(::Candle* candle_) + : candle(candle_) { } Candle::~Candle() diff --git a/src/scripting/level_time.cpp b/src/scripting/level_time.cpp index e4e390e10..736b6b2ae 100644 --- a/src/scripting/level_time.cpp +++ b/src/scripting/level_time.cpp @@ -21,8 +21,8 @@ namespace scripting { -LevelTime::LevelTime(::LevelTime* level_time) - : level_time(level_time) +LevelTime::LevelTime(::LevelTime* level_time_) + : level_time(level_time_) { } LevelTime::~LevelTime() diff --git a/src/scripting/platform.cpp b/src/scripting/platform.cpp index 390879294..bbf137b44 100644 --- a/src/scripting/platform.cpp +++ b/src/scripting/platform.cpp @@ -21,8 +21,8 @@ namespace scripting { -Platform::Platform(::Platform* platform) - : platform(platform) +Platform::Platform(::Platform* platform_) + : platform(platform_) { } Platform::~Platform() diff --git a/src/scripting/squirrel_error.cpp b/src/scripting/squirrel_error.cpp index f83964113..d3445ccab 100644 --- a/src/scripting/squirrel_error.cpp +++ b/src/scripting/squirrel_error.cpp @@ -19,11 +19,11 @@ namespace scripting { -SquirrelError::SquirrelError(HSQUIRRELVM v, const std::string& message) throw() : +SquirrelError::SquirrelError(HSQUIRRELVM v, const std::string& message_) throw() : message() { std::ostringstream msg; - msg << "Squirrel error: " << message << " ("; + msg << "Squirrel error: " << message_ << " ("; const char* lasterr; sq_getlasterror(v); if(sq_gettype(v, -1) != OT_STRING) diff --git a/src/scripting/thunderstorm.cpp b/src/scripting/thunderstorm.cpp index 00e927e3a..739f6b021 100644 --- a/src/scripting/thunderstorm.cpp +++ b/src/scripting/thunderstorm.cpp @@ -20,8 +20,8 @@ namespace scripting { -Thunderstorm::Thunderstorm(::Thunderstorm* thunderstorm) - : thunderstorm(thunderstorm) +Thunderstorm::Thunderstorm(::Thunderstorm* thunderstorm_) + : thunderstorm(thunderstorm_) { } diff --git a/src/scripting/tilemap.cpp b/src/scripting/tilemap.cpp index 709bea213..be1799c62 100644 --- a/src/scripting/tilemap.cpp +++ b/src/scripting/tilemap.cpp @@ -21,8 +21,8 @@ namespace scripting { -TileMap::TileMap(::TileMap* tilemap) - : tilemap(tilemap) +TileMap::TileMap(::TileMap* tilemap_) + : tilemap(tilemap_) { } TileMap::~TileMap() diff --git a/src/scripting/wind.cpp b/src/scripting/wind.cpp index 32d8d5ad9..45d61309c 100644 --- a/src/scripting/wind.cpp +++ b/src/scripting/wind.cpp @@ -21,8 +21,8 @@ namespace scripting { -Wind::Wind(::Wind* wind) - : wind(wind) +Wind::Wind(::Wind* wind_) + : wind(wind_) { } Wind::~Wind() diff --git a/src/supertux/console.cpp b/src/supertux/console.cpp index b624e3fa3..523ffd766 100644 --- a/src/supertux/console.cpp +++ b/src/supertux/console.cpp @@ -184,15 +184,15 @@ Console::scroll(int numLines) } void -Console::show_history(int offset) +Console::show_history(int offset_) { - while ((offset > 0) && (history_position != history.end())) { + while ((offset_ > 0) && (history_position != history.end())) { history_position++; - offset--; + offset_--; } - while ((offset < 0) && (history_position != history.begin())) { + while ((offset_ < 0) && (history_position != history.begin())) { history_position--; - offset++; + offset_++; } if (history_position == history.end()) { inputBuffer = ""; @@ -204,11 +204,11 @@ Console::show_history(int offset) } void -Console::move_cursor(int offset) +Console::move_cursor(int offset_) { - if (offset == -65535) inputBufferPosition = 0; - if (offset == +65535) inputBufferPosition = inputBuffer.length(); - inputBufferPosition+=offset; + if (offset_ == -65535) inputBufferPosition = 0; + if (offset_ == +65535) inputBufferPosition = inputBuffer.length(); + inputBufferPosition+=offset_; if (inputBufferPosition < 0) inputBufferPosition = 0; if (inputBufferPosition > (int)inputBuffer.length()) inputBufferPosition = inputBuffer.length(); } diff --git a/src/supertux/fadeout.cpp b/src/supertux/fadeout.cpp index 8259beb6c..b03efce8f 100644 --- a/src/supertux/fadeout.cpp +++ b/src/supertux/fadeout.cpp @@ -18,8 +18,8 @@ #include "supertux/globals.hpp" #include "video/drawing_context.hpp" -FadeOut::FadeOut(float fade_time, Color color) - : color(color), fade_time(fade_time), accum_time(0) +FadeOut::FadeOut(float fade_time_, Color color_) + : color(color_), fade_time(fade_time_), accum_time(0) { } diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index b83453da1..0e621bdaf 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -266,14 +266,14 @@ GameSession::abort_level() } void -GameSession::set_editmode(bool edit_mode) +GameSession::set_editmode(bool edit_mode_) { - if (this->edit_mode == edit_mode) return; - this->edit_mode = edit_mode; + if (this->edit_mode == edit_mode_) return; + this->edit_mode = edit_mode_; - currentsector->get_players()[0]->set_edit_mode(edit_mode); + currentsector->get_players()[0]->set_edit_mode(edit_mode_); - if (edit_mode) { + if (edit_mode_) { // entering edit mode diff --git a/src/supertux/info_box_line.cpp b/src/supertux/info_box_line.cpp index 77b81959f..20a287cba 100644 --- a/src/supertux/info_box_line.cpp +++ b/src/supertux/info_box_line.cpp @@ -87,11 +87,11 @@ InfoBoxLine::LineType get_linetype_by_format_char(char format_char) { } // namespace -InfoBoxLine::InfoBoxLine(char format_char, const std::string& text) : +InfoBoxLine::InfoBoxLine(char format_char, const std::string& text_) : lineType(NORMAL), font(Resources::normal_font), color(), - text(text), + text(text_), image() { font = get_font_by_format_char(format_char); diff --git a/src/supertux/levelintro.cpp b/src/supertux/levelintro.cpp index 02215f945..d20a4a7b4 100644 --- a/src/supertux/levelintro.cpp +++ b/src/supertux/levelintro.cpp @@ -28,9 +28,9 @@ #include #include -LevelIntro::LevelIntro(const Level* level, const Statistics* best_level_statistics) : - level(level), - best_level_statistics(best_level_statistics), +LevelIntro::LevelIntro(const Level* level_, const Statistics* best_level_statistics_) : + level(level_), + best_level_statistics(best_level_statistics_), player_sprite(), player_sprite_py(0), player_sprite_vy(0), diff --git a/src/supertux/main.cpp b/src/supertux/main.cpp index ddbac88b2..ab41bea88 100644 --- a/src/supertux/main.cpp +++ b/src/supertux/main.cpp @@ -292,9 +292,9 @@ Main::run(int argc, char** argv) args.merge_into(*g_config); init_tinygettext(); } - catch(const std::exception& err) + catch(const std::exception& err_) { - log_fatal << "failed to init config or tinygettext: " << err.what() << std::endl; + log_fatal << "failed to init config or tinygettext: " << err_.what() << std::endl; } std::cout << "Error: " << err.what() << std::endl; diff --git a/src/supertux/menu/options_menu.cpp b/src/supertux/menu/options_menu.cpp index c0991c2c1..7877fa8a0 100644 --- a/src/supertux/menu/options_menu.cpp +++ b/src/supertux/menu/options_menu.cpp @@ -124,13 +124,16 @@ OptionsMenu::OptionsMenu(bool complete) } fullscreen_res->list.push_back("Desktop"); - std::ostringstream out; std::string fullscreen_size_str = "Desktop"; - if (g_config->fullscreen_size != Size(0, 0)) { - out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate; - fullscreen_size_str = out.str(); + std::ostringstream out; + if (g_config->fullscreen_size != Size(0, 0)) + { + out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate; + fullscreen_size_str = out.str(); + } } + size_t cnt = 0; for (std::vector::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i) { @@ -163,16 +166,16 @@ OptionsMenu::OptionsMenu(bool complete) std::ostringstream out; out << g_config->aspect_size.width << ":" << g_config->aspect_size.height; std::string aspect_ratio = out.str(); - size_t cnt = 0; + size_t cnt_ = 0; for(std::vector::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i) { if(*i == aspect_ratio) { aspect_ratio.clear(); - aspect->selected = cnt; + aspect->selected = cnt_; break; } - ++cnt; + ++cnt_; } if (!aspect_ratio.empty()) diff --git a/src/supertux/physic.cpp b/src/supertux/physic.cpp index 065e174fc..518e7198e 100644 --- a/src/supertux/physic.cpp +++ b/src/supertux/physic.cpp @@ -130,9 +130,9 @@ Physic::get_acceleration() const } void -Physic::enable_gravity(bool enable_gravity) +Physic::enable_gravity(bool enable_gravity_) { - gravity_enabled_flag = enable_gravity; + gravity_enabled_flag = enable_gravity_; } bool @@ -142,9 +142,9 @@ Physic::gravity_enabled() const } void -Physic::set_gravity_modifier(float gravity_modifier) +Physic::set_gravity_modifier(float gravity_modifier_) { - this->gravity_modifier = gravity_modifier; + this->gravity_modifier = gravity_modifier_; } Vector diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index 333a73778..86491e112 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -145,37 +145,37 @@ Sector::get_level() } GameObject* -Sector::parse_object(const std::string& name, const Reader& reader) +Sector::parse_object(const std::string& name_, const Reader& reader) { - if(name == "camera") { - Camera* camera = new Camera(this, "Camera"); - camera->parse(reader); - return camera; - } else if(name == "particles-snow") { + if(name_ == "camera") { + Camera* camera_ = new Camera(this, "Camera"); + camera_->parse(reader); + return camera_; + } else if(name_ == "particles-snow") { SnowParticleSystem* partsys = new SnowParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-rain") { + } else if(name_ == "particles-rain") { RainParticleSystem* partsys = new RainParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-comets") { + } else if(name_ == "particles-comets") { CometParticleSystem* partsys = new CometParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-ghosts") { + } else if(name_ == "particles-ghosts") { GhostParticleSystem* partsys = new GhostParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-clouds") { + } else if(name_ == "particles-clouds") { CloudParticleSystem* partsys = new CloudParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "money") { // for compatibility with old maps + } else if(name_ == "money") { // for compatibility with old maps return new Jumpy(reader); } else { try { - return ObjectFactory::instance().create(name, reader); + return ObjectFactory::instance().create(name_, reader); } catch(std::exception& e) { log_warning << e.what() << "" << std::endl; return 0; @@ -390,8 +390,8 @@ Sector::parse_old_format(const Reader& reader) } // add a camera - Camera* camera = new Camera(this, "Camera"); - add_object(camera); + Camera* camera_ = new Camera(this, "Camera"); + add_object(camera_); update_game_objects(); @@ -751,31 +751,31 @@ Sector::before_object_add(GameObject* object) solid_tilemaps.push_back(tilemap); } - Camera* camera = dynamic_cast (object); - if(camera != NULL) { + Camera* camera_ = dynamic_cast (object); + if(camera_ != NULL) { if(this->camera != 0) { log_warning << "Multiple cameras added. Ignoring" << std::endl; return false; } - this->camera = camera; + this->camera = camera_; } - Player* player = dynamic_cast (object); - if(player != NULL) { + Player* player_ = dynamic_cast (object); + if(player_ != NULL) { if(this->player != 0) { log_warning << "Multiple players added. Ignoring" << std::endl; return false; } - this->player = player; + this->player = player_; } - DisplayEffect* effect = dynamic_cast (object); - if(effect != NULL) { + DisplayEffect* effect_ = dynamic_cast (object); + if(effect_ != NULL) { if(this->effect != 0) { log_warning << "Multiple DisplayEffects added. Ignoring" << std::endl; return false; } - this->effect = effect; + this->effect = effect_; } if(_current == this) { @@ -1597,10 +1597,10 @@ Sector::get_ambient_blue() } void -Sector::set_gravity(float gravity) +Sector::set_gravity(float gravity_) { log_warning << "Changing a Sector's gravitational constant might have unforeseen side-effects" << std::endl; - this->gravity = gravity; + this->gravity = gravity_; } float diff --git a/src/supertux/shrinkfade.cpp b/src/supertux/shrinkfade.cpp index e74a5b23e..adee1532a 100644 --- a/src/supertux/shrinkfade.cpp +++ b/src/supertux/shrinkfade.cpp @@ -18,9 +18,9 @@ #include "supertux/shrinkfade.hpp" #include "video/drawing_context.hpp" -ShrinkFade::ShrinkFade(const Vector& dest, float fade_time) : - dest(dest), - fade_time(fade_time), +ShrinkFade::ShrinkFade(const Vector& dest_, float fade_time_) : + dest(dest_), + fade_time(fade_time_), accum_time(0), speedleft(), speedright(), diff --git a/src/supertux/tile.cpp b/src/supertux/tile.cpp index 61a2e0634..ae8f2996c 100644 --- a/src/supertux/tile.cpp +++ b/src/supertux/tile.cpp @@ -37,14 +37,14 @@ Tile::Tile() : } Tile::Tile(const std::vector& imagespecs_, const std::vector& editor_imagespecs_, - uint32_t attributes, uint32_t data, float fps) : + uint32_t attributes_, uint32_t data_, float fps_) : imagespecs(imagespecs_), images(), editor_imagespecs(editor_imagespecs_), editor_images(), - attributes(attributes), - data(data), - fps(fps) + attributes(attributes_), + data(data_), + fps(fps_) { correct_attributes(); } diff --git a/src/supertux/timer.cpp b/src/supertux/timer.cpp index 3df088dc5..735e4ab56 100644 --- a/src/supertux/timer.cpp +++ b/src/supertux/timer.cpp @@ -30,10 +30,10 @@ Timer::~Timer() } void -Timer::start(float period, bool cyclic) +Timer::start(float period_, bool cyclic_) { - this->period = period; - this->cyclic = cyclic; + this->period = period_; + this->cyclic = cyclic_; cycle_start = game_time; } diff --git a/src/trigger/door.cpp b/src/trigger/door.cpp index 3ee067cb9..2bb4f71f2 100644 --- a/src/trigger/door.cpp +++ b/src/trigger/door.cpp @@ -130,7 +130,7 @@ Door::event(Player& , EventType type) } HitResponse -Door::collision(GameObject& other, const CollisionHit& hit) +Door::collision(GameObject& other, const CollisionHit& hit_) { switch (state) { case CLOSED: @@ -159,7 +159,7 @@ Door::collision(GameObject& other, const CollisionHit& hit) break; } - return TriggerBase::collision(other, hit); + return TriggerBase::collision(other, hit_); } /* EOF */ diff --git a/src/trigger/scripttrigger.cpp b/src/trigger/scripttrigger.cpp index db1e308ef..439ec1130 100644 --- a/src/trigger/scripttrigger.cpp +++ b/src/trigger/scripttrigger.cpp @@ -47,13 +47,13 @@ ScriptTrigger::ScriptTrigger(const Reader& reader) : triggerevent = EVENT_TOUCH; } -ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script) : +ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script_) : triggerevent(), script() { bbox.set_pos(pos); bbox.set_size(32, 32); - this->script = script; + this->script = script_; triggerevent = EVENT_TOUCH; } diff --git a/src/trigger/secretarea_trigger.cpp b/src/trigger/secretarea_trigger.cpp index b35643032..335609917 100644 --- a/src/trigger/secretarea_trigger.cpp +++ b/src/trigger/secretarea_trigger.cpp @@ -51,11 +51,11 @@ SecretAreaTrigger::SecretAreaTrigger(const Reader& reader) : message_displayed = false; } -SecretAreaTrigger::SecretAreaTrigger(const Rectf& area, std::string fade_tilemap) : +SecretAreaTrigger::SecretAreaTrigger(const Rectf& area, std::string fade_tilemap_) : message_timer(), message_displayed(), message(_("You found a secret area!")), - fade_tilemap(fade_tilemap), + fade_tilemap(fade_tilemap_), script() { bbox = area; diff --git a/src/util/ref.hpp b/src/util/ref.hpp index 608686783..199cb2c88 100644 --- a/src/util/ref.hpp +++ b/src/util/ref.hpp @@ -25,8 +25,8 @@ template class Ref { public: - Ref(T* object = 0) - : object(object) + Ref(T* object_ = 0) + : object(object_) { if(object) object->ref(); @@ -49,13 +49,13 @@ public: return *this; } - Ref& operator= (T* object) + Ref& operator= (T* object_) { - if(object) - object->ref(); + if(object_) + object_->ref(); if(this->object) this->object->unref(); - this->object = object; + this->object = object_; return *this; } diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 3eacf3fe5..235126199 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -60,9 +60,9 @@ DrawingContext::~DrawingContext() } void -DrawingContext::clear_drawing_requests(DrawingRequests& requests) +DrawingContext::clear_drawing_requests(DrawingRequests& requests_) { - for(auto& request : requests) + for(auto& request : requests_) { if (request->request_data) { @@ -70,7 +70,7 @@ DrawingContext::clear_drawing_requests(DrawingRequests& requests) } request->~DrawingRequest(); } - requests.clear(); + requests_.clear(); } void @@ -357,12 +357,12 @@ public: }; void -DrawingContext::handle_drawing_requests(DrawingRequests& requests) +DrawingContext::handle_drawing_requests(DrawingRequests& requests_) { - std::stable_sort(requests.begin(), requests.end(), RequestPtrCompare()); + std::stable_sort(requests_.begin(), requests_.end(), RequestPtrCompare()); DrawingRequests::const_iterator i; - for(i = requests.begin(); i != requests.end(); ++i) { + for(i = requests_.begin(); i != requests_.end(); ++i) { const DrawingRequest& request = **i; switch(request.target) { @@ -487,13 +487,13 @@ DrawingContext::pop_target() } void -DrawingContext::set_target(Target target) +DrawingContext::set_target(Target target_) { - this->target = target; - if(target == LIGHTMAP) { + this->target = target_; + if(target_ == LIGHTMAP) { requests = &lightmap_requests; } else { - assert(target == NORMAL); + assert(target_ == NORMAL); requests = &drawing_requests; } } diff --git a/src/video/font.cpp b/src/video/font.cpp index bc51c7eee..41854451f 100644 --- a/src/video/font.cpp +++ b/src/video/font.cpp @@ -74,9 +74,9 @@ Font::Font(GlyphWidth glyph_width_, // scan for prefix-filename in addons search path char **rc = PHYSFS_enumerateFiles(fontdir.c_str()); for (char **i = rc; *i != NULL; i++) { - std::string filename(*i); - if( filename.rfind(fontname) != std::string::npos ) { - loadFontFile(fontdir + filename); + std::string filename_(*i); + if( filename_.rfind(fontname) != std::string::npos ) { + loadFontFile(fontdir + filename_); } } PHYSFS_freeList(rc); @@ -164,7 +164,7 @@ Font::loadFontSurface( const std::string &glyphimage, const std::string &shadowimage, const std::vector &chars, - GlyphWidth glyph_width, + GlyphWidth glyph_width_, int char_width ) { @@ -180,7 +180,7 @@ Font::loadFontSurface( SDL_Surface *surface = NULL; - if( glyph_width == VARIABLE ) { + if( glyph_width_ == VARIABLE ) { //this does not work: // surface = ((SDL::Texture *)glyph_surface.get_texture())->get_texture(); surface = IMG_Load_RW(get_physfs_SDLRWops("images/engine/fonts/"+glyphimage), 1); @@ -202,7 +202,7 @@ Font::loadFontSurface( Glyph glyph; glyph.surface_idx = surface_idx; - if( glyph_width == FIXED ) + if( glyph_width_ == FIXED ) { glyph.rect = Rectf(x, y, x + char_width, y + char_height); glyph.offset = Vector(0, 0); diff --git a/src/worldmap/level.cpp b/src/worldmap/level.cpp index 997f70994..ead77e211 100644 --- a/src/worldmap/level.cpp +++ b/src/worldmap/level.cpp @@ -29,7 +29,7 @@ namespace worldmap { -LevelTile::LevelTile(const std::string& basedir, const Reader& lisp) : +LevelTile::LevelTile(const std::string& basedir_, const Reader& lisp) : pos(), title(), solved(false), @@ -39,7 +39,7 @@ LevelTile::LevelTile(const std::string& basedir, const Reader& lisp) : statistics(), target_time(), extro_script(), - basedir(basedir), + basedir(basedir_), picture_cached(false), picture(0) { @@ -54,7 +54,7 @@ LevelTile::LevelTile(const std::string& basedir, const Reader& lisp) : lisp.get("extro-script", extro_script); - if (!PHYSFS_exists((basedir + name).c_str())) + if (!PHYSFS_exists((basedir_ + name).c_str())) { log_warning << "level file '" << name << "' does not exist and will not be added to the worldmap" << std::endl; diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index c76af1cd3..95c1c3dfd 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -291,14 +291,14 @@ Tux::tryContinueWalking(float elapsed_time) void Tux::updateInputDirection() { - Controller* controller = g_input_manager->get_controller(); - if(controller->hold(Controller::UP)) + Controller* controller_ = g_input_manager->get_controller(); + if(controller_->hold(Controller::UP)) input_direction = D_NORTH; - else if(controller->hold(Controller::DOWN)) + else if(controller_->hold(Controller::DOWN)) input_direction = D_SOUTH; - else if(controller->hold(Controller::LEFT)) + else if(controller_->hold(Controller::LEFT)) input_direction = D_WEST; - else if(controller->hold(Controller::RIGHT)) + else if(controller_->hold(Controller::RIGHT)) input_direction = D_EAST; } diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 12ffc5de9..90b5055fb 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -78,7 +78,7 @@ namespace worldmap { WorldMap* WorldMap::current_ = NULL; -WorldMap::WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint) : +WorldMap::WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint_) : tux(), m_savegame(savegame), tileset(NULL), @@ -102,7 +102,7 @@ WorldMap::WorldMap(const std::string& filename, Savegame& savegame, const std::s worldmap_table(), scripts(), ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), - force_spawnpoint(force_spawnpoint), + force_spawnpoint(force_spawnpoint_), in_level(false), pan_pos(), panning(false), @@ -237,10 +237,10 @@ WorldMap::move_to_spawnpoint(const std::string& spawnpoint, bool pan) } void -WorldMap::change(const std::string& filename, const std::string& force_spawnpoint) +WorldMap::change(const std::string& filename, const std::string& force_spawnpoint_) { g_screen_manager->pop_screen(); - g_screen_manager->push_screen(std::unique_ptr(new WorldMap(filename, m_savegame, force_spawnpoint))); + g_screen_manager->push_screen(std::unique_ptr(new WorldMap(filename, m_savegame, force_spawnpoint_))); } void @@ -253,25 +253,25 @@ WorldMap::load(const std::string& filename) lisp::Parser parser; const lisp::Lisp* root = parser.parse(map_filename); - const lisp::Lisp* level = root->get_lisp("supertux-level"); - if(level == NULL) + const lisp::Lisp* level_ = root->get_lisp("supertux-level"); + if(level_ == NULL) throw std::runtime_error("file isn't a supertux-level file."); - level->get("name", name); + level_->get("name", name); - const lisp::Lisp* sector = level->get_lisp("sector"); + const lisp::Lisp* sector = level_->get_lisp("sector"); if(!sector) throw std::runtime_error("No sector specified in worldmap file."); - const lisp::Lisp* tilesets_lisp = level->get_lisp("tilesets"); + const lisp::Lisp* tilesets_lisp = level_->get_lisp("tilesets"); if(tilesets_lisp != NULL) { tileset = tile_manager->parse_tileset_definition(*tilesets_lisp).release(); free_tileset = true; } std::string tileset_name; - if(level->get("tileset", tileset_name)) { + if(level_->get("tileset", tileset_name)) { if(tileset != NULL) { - log_warning << "multiple tilesets specified in level" << std::endl; + log_warning << "multiple tilesets specified in level_" << std::endl; } else { tileset = tile_manager->get_tileset(tileset_name); } @@ -540,11 +540,11 @@ WorldMap::finished_level(Level* gamelevel) Vector WorldMap::get_camera_pos_for_tux() { - Vector camera_offset; + Vector camera_offset_; Vector tux_pos = tux->get_pos(); - camera_offset.x = tux_pos.x - SCREEN_WIDTH/2; - camera_offset.y = tux_pos.y - SCREEN_HEIGHT/2; - return camera_offset; + camera_offset_.x = tux_pos.x - SCREEN_WIDTH/2; + camera_offset_.y = tux_pos.y - SCREEN_HEIGHT/2; + return camera_offset_; } void @@ -608,12 +608,12 @@ WorldMap::update(float delta) if(!panning) { camera_offset = get_camera_pos_for_tux(); } else { - Vector delta = pan_pos - camera_offset; - float mag = delta.norm(); + Vector delta__ = pan_pos - camera_offset; + float mag = delta__.norm(); if(mag > CAMERA_PAN_SPEED) { - delta *= CAMERA_PAN_SPEED/mag; + delta__ *= CAMERA_PAN_SPEED/mag; } - camera_offset += delta; + camera_offset += delta__; if(camera_offset == pan_pos) { panning = false; } @@ -676,8 +676,8 @@ WorldMap::update(float delta) if (enter_level && !tux->is_moving()) { /* Check level action */ - LevelTile* level = at_level(); - if (!level) { + LevelTile* level_ = at_level(); + if (!level_) { //Respawn if player on a tile with no level and nowhere to go. int tile_data = tile_data_at(tux->get_tile_pos()); if(!( tile_data & ( Tile::WORLDMAP_NORTH | Tile::WORLDMAP_SOUTH | Tile::WORLDMAP_WEST | Tile::WORLDMAP_EAST ))){ @@ -689,16 +689,16 @@ WorldMap::update(float delta) return; } - if (level->pos == tux->get_tile_pos()) { + if (level_->pos == tux->get_tile_pos()) { try { - Vector shrinkpos = Vector(level->pos.x*32 + 16 - camera_offset.x, - level->pos.y*32 + 8 - camera_offset.y); - std::string levelfile = levels_path + level->get_name(); + Vector shrinkpos = Vector(level_->pos.x*32 + 16 - camera_offset.x, + level_->pos.y*32 + 8 - camera_offset.y); + std::string levelfile = levels_path + level_->get_name(); // update state and savegame save_state(); - g_screen_manager->push_screen(std::unique_ptr(new GameSession(levelfile, m_savegame, &level->statistics)), + g_screen_manager->push_screen(std::unique_ptr(new GameSession(levelfile, m_savegame, &level_->statistics)), std::unique_ptr(new ShrinkFade(shrinkpos, 1.0f))); in_level = true; } catch(std::exception& e) { -- 2.11.0