From eb9172b9d625b0c333d7ad406433d5d14129a2e6 Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Fri, 21 Nov 2014 01:22:54 +0100 Subject: [PATCH] [cppcheck] Part 1: Performance --- src/audio/sound_manager.cpp | 4 ++-- src/badguy/ghosttree.cpp | 3 +-- src/badguy/root.cpp | 3 +-- src/badguy/totem.cpp | 2 +- src/object/ambient_sound.cpp | 9 +++------ src/object/cloud_particle_system.cpp | 4 +--- src/object/coin_rain.cpp | 4 +--- src/object/falling_coin.cpp | 6 ++---- src/object/infoblock.cpp | 4 ++-- src/object/ispy.cpp | 2 +- src/object/lantern.cpp | 3 +-- src/object/moving_sprite.cpp | 3 +-- src/object/particles.cpp | 4 ++-- src/object/particlesystem_interactive.cpp | 2 +- src/object/path.cpp | 4 ++-- src/object/rainsplash.cpp | 6 ++---- src/sprite/sprite_data.cpp | 2 +- src/sprite/sprite_data.hpp | 2 +- src/supertux/console.cpp | 6 +++--- src/supertux/flip_level_transformer.cpp | 2 +- src/supertux/info_box.cpp | 8 +++----- src/supertux/info_box_line.cpp | 3 +-- src/supertux/levelintro.cpp | 3 +-- src/supertux/menu/language_menu.cpp | 4 ++-- src/supertux/textscroller.cpp | 2 +- src/supertux/tile.cpp | 2 +- src/supertux/tile.hpp | 2 +- src/trigger/trigger_base.cpp | 6 +++--- src/worldmap/sprite_change.cpp | 2 +- src/worldmap/worldmap.cpp | 8 ++++---- 30 files changed, 48 insertions(+), 67 deletions(-) diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index e9ef76459..d00c93ca1 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -225,7 +225,7 @@ SoundManager::remove_from_update(StreamSoundSource* sss) if( *i == sss ){ i = update_list.erase(i); } else { - i++; + ++i; } } } @@ -356,7 +356,7 @@ SoundManager::update() StreamSoundSources::iterator s = update_list.begin(); while( s != update_list.end() ){ (*s)->update(); - s++; + ++s; } } diff --git a/src/badguy/ghosttree.cpp b/src/badguy/ghosttree.cpp index 088d73bd1..b7b4bd6ab 100644 --- a/src/badguy/ghosttree.cpp +++ b/src/badguy/ghosttree.cpp @@ -44,7 +44,7 @@ GhostTree::GhostTree(const Reader& lisp) : willo_radius(200), willo_speed(1.8f), willo_color(0), - glow_sprite(), + glow_sprite(SpriteManager::current()->create("images/creatures/ghosttree/ghosttree-glow.sprite")), colorchange_timer(), suck_timer(), root_timer(), @@ -53,7 +53,6 @@ GhostTree::GhostTree(const Reader& lisp) : suck_lantern(0), willowisps() { - glow_sprite = SpriteManager::current()->create("images/creatures/ghosttree/ghosttree-glow.sprite"); set_colgroup_active(COLGROUP_TOUCHABLE); SoundManager::current()->preload("sounds/tree_howling.ogg"); SoundManager::current()->preload("sounds/tree_suck.ogg"); diff --git a/src/badguy/root.cpp b/src/badguy/root.cpp index 8e5423df0..33ac0af56 100644 --- a/src/badguy/root.cpp +++ b/src/badguy/root.cpp @@ -25,11 +25,10 @@ static const float HATCH_TIME = 0.75; Root::Root(const Vector& pos) : BadGuy(pos, "images/creatures/ghosttree/root.sprite", LAYER_TILES-1), mystate(STATE_APPEARING), - base_sprite(), + base_sprite(SpriteManager::current()->create("images/creatures/ghosttree/root-base.sprite")), offset_y(0), hatch_timer() { - base_sprite = SpriteManager::current()->create("images/creatures/ghosttree/root-base.sprite"); base_sprite->set_action("appearing", 1); base_sprite->set_animation_loops(1); // TODO: necessary because set_action ignores loops for default action physic.enable_gravity(false); diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index 5941a1b69..42afee2ab 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -86,7 +86,7 @@ Totem::active_update(float elapsed_time) Sector* s = Sector::current(); if (s) { // jump a bit if we find a suitable totem - for (std::vector::iterator i = s->moving_objects.begin(); i != s->moving_objects.end(); i++) { + for (std::vector::iterator i = s->moving_objects.begin(); i != s->moving_objects.end(); ++i) { Totem* t = dynamic_cast(*i); if (!t) continue; diff --git a/src/object/ambient_sound.cpp b/src/object/ambient_sound.cpp index 14539e61f..0965fc3ad 100644 --- a/src/object/ambient_sound.cpp +++ b/src/object/ambient_sound.cpp @@ -27,10 +27,10 @@ #include "util/reader.hpp" AmbientSound::AmbientSound(const Reader& lisp) : - name(), + name(""), position(), dimension(), - sample(), + sample(""), sound_source(), latency(), distance_factor(), @@ -41,7 +41,6 @@ AmbientSound::AmbientSound(const Reader& lisp) : currentvolume(), volume_ptr() { - name=""; position.x = 0; position.y = 0; @@ -51,7 +50,6 @@ AmbientSound::AmbientSound(const Reader& lisp) : distance_factor = 0; distance_bias = 0; maximumvolume = 1; - sample = ""; currentvolume = 0; if (!(lisp.get("x", position.x)&&lisp.get("y", position.y))) { @@ -97,7 +95,7 @@ AmbientSound::AmbientSound(Vector pos, float factor, float bias, float vol, std: name(), position(), dimension(), - sample(), + sample(file), sound_source(), latency(), distance_factor(), @@ -117,7 +115,6 @@ AmbientSound::AmbientSound(Vector pos, float factor, float bias, float vol, std: distance_factor=factor*factor; distance_bias=bias*bias; maximumvolume=vol; - sample=file; // set default silence_distance diff --git a/src/object/cloud_particle_system.cpp b/src/object/cloud_particle_system.cpp index 2cbbca273..396d295ee 100644 --- a/src/object/cloud_particle_system.cpp +++ b/src/object/cloud_particle_system.cpp @@ -24,10 +24,8 @@ CloudParticleSystem::CloudParticleSystem() : ParticleSystem(128), - cloudimage() + cloudimage(Surface::create("images/objects/particles/cloud.png")) { - cloudimage = Surface::create("images/objects/particles/cloud.png"); - virtual_width = 2000.0; // create some random clouds diff --git a/src/object/coin_rain.cpp b/src/object/coin_rain.cpp index 7e6b4c3ff..66a67afef 100644 --- a/src/object/coin_rain.cpp +++ b/src/object/coin_rain.cpp @@ -25,15 +25,13 @@ static const float DROP_TIME = .1f; // time duration between "drops" of coin rain CoinRain::CoinRain(const Vector& pos, bool emerge) : - sprite(), + sprite(SpriteManager::current()->create("images/objects/coin/coin.sprite")), position(pos), emerge_distance(0), timer(), counter(0), drop(0) { - sprite = SpriteManager::current()->create("images/objects/coin/coin.sprite"); - if(emerge) { emerge_distance = sprite->get_height(); } diff --git a/src/object/falling_coin.cpp b/src/object/falling_coin.cpp index ffa221c6e..975de6e51 100644 --- a/src/object/falling_coin.cpp +++ b/src/object/falling_coin.cpp @@ -21,11 +21,9 @@ FallingCoin::FallingCoin(const Vector& start_position, const int vel_x) : physic(), - pos(), - sprite() + pos(start_position), + sprite(SpriteManager::current()->create("images/objects/coin/coin.sprite")) { - pos = start_position; - sprite = SpriteManager::current()->create("images/objects/coin/coin.sprite"); physic.set_velocity_y(-800); physic.set_velocity_x(vel_x); } diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index c6e834542..d81fc9329 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -53,7 +53,7 @@ InfoBlock::InfoBlock(const Reader& lisp) : InfoBlock::~InfoBlock() { - for(std::vector::iterator i = lines.begin(); i != lines.end(); i++) { + for(std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { delete *i; } } @@ -73,7 +73,7 @@ InfoBlock::hit(Player& player) // first hide all other InfoBlocks' messages in same sector Sector* parent = Sector::current(); if (!parent) return; - for (Sector::GameObjects::iterator i = parent->gameobjects.begin(); i != parent->gameobjects.end(); i++) { + for (Sector::GameObjects::iterator i = parent->gameobjects.begin(); i != parent->gameobjects.end(); ++i) { InfoBlock* block = dynamic_cast(i->get()); if (!block) continue; if (block != this) block->hide_message(); diff --git a/src/object/ispy.cpp b/src/object/ispy.cpp index fa9e73ec2..949f69f77 100644 --- a/src/object/ispy.cpp +++ b/src/object/ispy.cpp @@ -118,7 +118,7 @@ Ispy::free_line_of_sight(Vector line_start, Vector line_end, const MovingObject* std::list solid_tilemaps = Sector::current()->solid_tilemaps; for (float test_x = lsx; test_x <= lex; test_x += 16) { for (float test_y = lsy; test_y <= ley; test_y += 16) { - for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) { + for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); ++i) { TileMap* solids = *i; const Tile* tile = solids->get_tile_at(Vector(test_x, test_y)); if(!tile) continue; diff --git a/src/object/lantern.cpp b/src/object/lantern.cpp index 798ccb438..db909a9be 100644 --- a/src/object/lantern.cpp +++ b/src/object/lantern.cpp @@ -42,9 +42,8 @@ Lantern::Lantern(const Reader& reader) : Lantern::Lantern(const Vector& pos) : Rock(pos, "images/objects/lantern/lantern.sprite"), lightcolor(0.0f, 0.0f, 0.0f), - lightsprite() + lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light.sprite")) { - lightsprite = SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light.sprite"); lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); updateColor(); SoundManager::current()->preload("sounds/willocatch.wav"); diff --git a/src/object/moving_sprite.cpp b/src/object/moving_sprite.cpp index 7d4f708f0..0a25d2f3c 100644 --- a/src/object/moving_sprite.cpp +++ b/src/object/moving_sprite.cpp @@ -79,10 +79,9 @@ MovingSprite::MovingSprite(const Reader& reader, int layer_, CollisionGroup coll MovingSprite::MovingSprite(const MovingSprite& other) : MovingObject(other), sprite_name(), - sprite(), + sprite(other.sprite->clone()), layer(other.layer) { - sprite = other.sprite->clone(); } /* MovingSprite& diff --git a/src/object/particles.cpp b/src/object/particles.cpp index 424c4f2fa..a51da08a1 100644 --- a/src/object/particles.cpp +++ b/src/object/particles.cpp @@ -65,7 +65,7 @@ Particles::~Particles() { // free particles for(std::vector::iterator i = particles.begin(); - i < particles.end(); i++) + i < particles.end(); ++i) delete (*i); } @@ -101,7 +101,7 @@ Particles::draw(DrawingContext& context) { // draw particles for(std::vector::iterator i = particles.begin(); - i != particles.end(); i++) { + i != particles.end(); ++i) { context.draw_filled_rect((*i)->pos, Vector(size,size), color,drawing_layer); } } diff --git a/src/object/particlesystem_interactive.cpp b/src/object/particlesystem_interactive.cpp index 880c4c56b..6cd527b84 100644 --- a/src/object/particlesystem_interactive.cpp +++ b/src/object/particlesystem_interactive.cpp @@ -80,7 +80,7 @@ ParticleSystem_Interactive::collision(Particle* object, Vector movement) dest.move(movement); Constraints constraints; - for(std::list::const_iterator i = Sector::current()->solid_tilemaps.begin(); i != Sector::current()->solid_tilemaps.end(); i++) { + for(std::list::const_iterator i = Sector::current()->solid_tilemaps.begin(); i != Sector::current()->solid_tilemaps.end(); ++i) { TileMap* solids = *i; // FIXME Handle a nonzero tilemap offset for(int x = starttilex; x*32 < max_x; ++x) { diff --git a/src/object/path.cpp b/src/object/path.cpp index c69e1a5cd..a646e96ed 100644 --- a/src/object/path.cpp +++ b/src/object/path.cpp @@ -99,7 +99,7 @@ Path::get_nearest_node_no(Vector reference_point) const int nearest_node_id = -1; float nearest_node_dist = 0; int id = 0; - for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); i++, id++) { + for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); ++i, ++id) { float dist = (i->position - reference_point).norm(); if ((nearest_node_id == -1) || (dist < nearest_node_dist)) { nearest_node_id = id; @@ -115,7 +115,7 @@ Path::get_farthest_node_no(Vector reference_point) const int farthest_node_id = -1; float farthest_node_dist = 0; int id = 0; - for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); i++, id++) { + for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); ++i, ++id) { float dist = (i->position - reference_point).norm(); if ((farthest_node_id == -1) || (dist > farthest_node_dist)) { farthest_node_id = id; diff --git a/src/object/rainsplash.cpp b/src/object/rainsplash.cpp index dcb6b4f1c..62ba8e188 100644 --- a/src/object/rainsplash.cpp +++ b/src/object/rainsplash.cpp @@ -18,11 +18,9 @@ RainSplash::RainSplash(Vector pos, bool vertical) : sprite(), - position(), - frame() + position(pos), + frame(0) { - frame = 0; - position = pos; if (vertical) sprite = SpriteManager::current()->create("images/objects/particles/rainsplash-vertical.sprite"); else sprite = SpriteManager::current()->create("images/objects/particles/rainsplash.sprite"); } diff --git a/src/sprite/sprite_data.cpp b/src/sprite/sprite_data.cpp index b777cdadb..e4d29e4dd 100644 --- a/src/sprite/sprite_data.cpp +++ b/src/sprite/sprite_data.cpp @@ -143,7 +143,7 @@ SpriteData::parse_action(const Reader& lisp, const std::string& basedir) } const SpriteData::Action* -SpriteData::get_action(const std::string act) +SpriteData::get_action(const std::string& act) { Actions::iterator i = actions.find(act); if(i == actions.end()) { diff --git a/src/sprite/sprite_data.hpp b/src/sprite/sprite_data.hpp index 7a8945ed0..78f51a91e 100644 --- a/src/sprite/sprite_data.hpp +++ b/src/sprite/sprite_data.hpp @@ -68,7 +68,7 @@ private: void parse_action(const Reader& lispreader, const std::string& basedir); /** Get an action */ - const Action* get_action(const std::string act); + const Action* get_action(const std::string& act); Actions actions; std::string name; diff --git a/src/supertux/console.cpp b/src/supertux/console.cpp index 71b0c5fc6..43d09e7f4 100644 --- a/src/supertux/console.cpp +++ b/src/supertux/console.cpp @@ -257,11 +257,11 @@ void Console::show_history(int offset_) { while ((offset_ > 0) && (m_history_position != m_history.end())) { - m_history_position++; + ++m_history_position; offset_--; } while ((offset_ < 0) && (m_history_position != m_history.begin())) { - m_history_position--; + --m_history_position; offset_++; } if (m_history_position == m_history.end()) { @@ -561,7 +561,7 @@ Console::draw(DrawingContext& context) } int skipLines = -m_offset; - for (std::list::iterator i = m_buffer.m_lines.begin(); i != m_buffer.m_lines.end(); i++) + for (std::list::iterator i = m_buffer.m_lines.begin(); i != m_buffer.m_lines.end(); ++i) { if (skipLines-- > 0) continue; lineNo++; diff --git a/src/supertux/flip_level_transformer.cpp b/src/supertux/flip_level_transformer.cpp index 3065fa833..0af377444 100644 --- a/src/supertux/flip_level_transformer.cpp +++ b/src/supertux/flip_level_transformer.cpp @@ -87,7 +87,7 @@ FlipLevelTransformer::transform_drawing_effect(DrawingEffect effect) void FlipLevelTransformer::transform_path(float height, float obj_height, Path& path) { - for (std::vector::iterator i = path.nodes.begin(); i != path.nodes.end(); i++) { + for (std::vector::iterator i = path.nodes.begin(); i != path.nodes.end(); ++i) { Vector& pos = i->position; pos.y = height - pos.y - obj_height; } diff --git a/src/supertux/info_box.cpp b/src/supertux/info_box.cpp index a5c62204d..46c4da9c9 100644 --- a/src/supertux/info_box.cpp +++ b/src/supertux/info_box.cpp @@ -24,14 +24,12 @@ InfoBox::InfoBox(const std::string& text) : firstline(0), - lines(), + // Split text string lines into a vector + lines(InfoBoxLine::split(text, 400)), images(), arrow_scrollup(), arrow_scrolldown() { - // Split text string lines into a vector - lines = InfoBoxLine::split(text, 400); - try { // get the arrow sprites @@ -49,7 +47,7 @@ InfoBox::InfoBox(const std::string& text) : InfoBox::~InfoBox() { for(std::vector::iterator i = lines.begin(); - i != lines.end(); i++) + i != lines.end(); ++i) delete *i; } diff --git a/src/supertux/info_box_line.cpp b/src/supertux/info_box_line.cpp index 20a287cba..bc103621f 100644 --- a/src/supertux/info_box_line.cpp +++ b/src/supertux/info_box_line.cpp @@ -89,12 +89,11 @@ InfoBoxLine::LineType get_linetype_by_format_char(char format_char) { InfoBoxLine::InfoBoxLine(char format_char, const std::string& text_) : lineType(NORMAL), - font(Resources::normal_font), + font(get_font_by_format_char(format_char)), color(), text(text_), image() { - font = get_font_by_format_char(format_char); lineType = get_linetype_by_format_char(format_char); color = get_color_by_format_char(format_char); if (lineType == IMAGE) diff --git a/src/supertux/levelintro.cpp b/src/supertux/levelintro.cpp index f4b77acbf..8d00022ef 100644 --- a/src/supertux/levelintro.cpp +++ b/src/supertux/levelintro.cpp @@ -31,12 +31,11 @@ LevelIntro::LevelIntro(const Level* level_, const Statistics* best_level_statistics_) : level(level_), best_level_statistics(best_level_statistics_), - player_sprite(), + player_sprite(SpriteManager::current()->create("images/creatures/tux/tux.sprite")), player_sprite_py(0), player_sprite_vy(0), player_sprite_jump_timer() { - player_sprite = SpriteManager::current()->create("images/creatures/tux/tux.sprite"); player_sprite->set_action("small-walk-right"); player_sprite_jump_timer.start(graphicsRandom.randf(5,10)); } diff --git a/src/supertux/menu/language_menu.cpp b/src/supertux/menu/language_menu.cpp index e7ff52404..508f1a464 100644 --- a/src/supertux/menu/language_menu.cpp +++ b/src/supertux/menu/language_menu.cpp @@ -40,7 +40,7 @@ LanguageMenu::LanguageMenu() int mnid = MNID_LANGUAGE_NEXT; std::set languages = g_dictionary_manager->get_languages(); - for (std::set::iterator i = languages.begin(); i != languages.end(); i++) + for (std::set::iterator i = languages.begin(); i != languages.end(); ++i) { add_entry(mnid++, i->get_name()); } @@ -76,7 +76,7 @@ LanguageMenu::menu_action(MenuItem* item) int mnid = MNID_LANGUAGE_NEXT; std::set languages = g_dictionary_manager->get_languages(); - for (std::set::iterator i = languages.begin(); i != languages.end(); i++) + for (std::set::iterator i = languages.begin(); i != languages.end(); ++i) { if (item->id == mnid++) { diff --git a/src/supertux/textscroller.cpp b/src/supertux/textscroller.cpp index 491e1ddb3..982089187 100644 --- a/src/supertux/textscroller.cpp +++ b/src/supertux/textscroller.cpp @@ -81,7 +81,7 @@ TextScroller::TextScroller(const std::string& filename) : TextScroller::~TextScroller() { - for(std::vector::iterator i = lines.begin(); i != lines.end(); i++) delete *i; + for(std::vector::iterator i = lines.begin(); i != lines.end(); ++i) delete *i; } void diff --git a/src/supertux/tile.cpp b/src/supertux/tile.cpp index ae8f2996c..1d6b3f115 100644 --- a/src/supertux/tile.cpp +++ b/src/supertux/tile.cpp @@ -154,7 +154,7 @@ Tile::print_debug(int id) const * in quotation marks because because the slope's gradient is taken. * Also, this uses the movement relative to the tilemaps own movement * (if any). --octo */ -bool Tile::check_movement_unisolid (const Vector movement) const +bool Tile::check_movement_unisolid (const Vector& movement) const { int slope_info; double mv_x; diff --git a/src/supertux/tile.hpp b/src/supertux/tile.hpp index 92fa06e49..d0dd42472 100644 --- a/src/supertux/tile.hpp +++ b/src/supertux/tile.hpp @@ -170,7 +170,7 @@ private: /** Returns zero if a unisolid tile is non-solid due to the movement * direction, non-zero if the tile is solid due to direction. */ - bool check_movement_unisolid (const Vector movement) const; + bool check_movement_unisolid (const Vector& movement) const; /** Returns zero if a unisolid tile is non-solid due to the position of the * tile and the object, non-zero if the tile is solid. */ diff --git a/src/trigger/trigger_base.cpp b/src/trigger/trigger_base.cpp index 1407cad7c..2c1ffb31f 100644 --- a/src/trigger/trigger_base.cpp +++ b/src/trigger/trigger_base.cpp @@ -31,7 +31,7 @@ TriggerBase::TriggerBase() : TriggerBase::~TriggerBase() { // unregister remove_listener hooks, so nobody will try to call us after we've been destroyed - for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); i++) { + for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); ++i) { Player* p = *i; p->del_remove_listener(this); } @@ -42,7 +42,7 @@ void TriggerBase::update(float ) { if (lasthit && !hit) { - for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); i++) { + for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); ++i) { Player* p = *i; event(*p, EVENT_LOSETOUCH); p->del_remove_listener(this); @@ -81,7 +81,7 @@ TriggerBase::collision(GameObject& other, const CollisionHit& ) void TriggerBase::object_removed(GameObject* object) { - for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); i++) { + for (std::list::iterator i = losetouch_listeners.begin(); i != losetouch_listeners.end(); ++i) { Player* p = *i; if (p == object) { losetouch_listeners.erase(i); diff --git a/src/worldmap/sprite_change.cpp b/src/worldmap/sprite_change.cpp index 69525590e..ff1460f54 100644 --- a/src/worldmap/sprite_change.cpp +++ b/src/worldmap/sprite_change.cpp @@ -79,7 +79,7 @@ SpriteChange::clear_stay_action() // if we are in a stay_group, also clear all stay actions in this group if (stay_group != "") { - for (std::list::iterator i = all_sprite_changes.begin(); i != all_sprite_changes.end(); i++) { + for (std::list::iterator i = all_sprite_changes.begin(); i != all_sprite_changes.end(); ++i) { SpriteChange* sc = *i; if (sc->stay_group != stay_group) continue; sc->in_stay_action = false; diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 3300fa8db..e5fba0392 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -330,7 +330,7 @@ WorldMap::load(const std::string& filename) } current_tileset = NULL; - if(solid_tilemaps.size() == 0) + if(solid_tilemaps.empty()) throw std::runtime_error("No solid tilemap specified"); move_to_spawnpoint("main"); @@ -718,7 +718,7 @@ WorldMap::tile_data_at(Vector p) { int dirs = 0; - for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) { + for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); ++i) { TileMap* tilemap = *i; const Tile* tile = tilemap->get_tile((int)p.x, (int)p.y); int dirdata = tile->getData(); @@ -1180,7 +1180,7 @@ float WorldMap::get_width() const { float width = 0; - for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) { + for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); ++i) { TileMap* solids = *i; if (solids->get_width() > width) width = solids->get_width(); } @@ -1191,7 +1191,7 @@ float WorldMap::get_height() const { float height = 0; - for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) { + for(std::list::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); ++i) { TileMap* solids = *i; if (solids->get_height() > height) height = solids->get_height(); } -- 2.11.0