prefer prefix ++
cppcheck (via Codacy) points out it's better to use prefix ++ on iterators in a for statement.
This commit is contained in:
parent
8f22144e8e
commit
c0689b7924
4 changed files with 4 additions and 4 deletions
|
@ -71,7 +71,7 @@ std::vector<const unit *> unit_filter::all_matches_on_map(const map_location* lo
|
|||
|
||||
unit_const_ptr unit_filter::first_match_on_map() const {
|
||||
const unit_map & units = fc_->get_disp_context().units();
|
||||
for(unit_map::const_iterator u = units.begin(); u != units.end(); u++) {
|
||||
for(unit_map::const_iterator u = units.begin(); u != units.end(); ++u) {
|
||||
if (matches(*u, u->get_location())) {
|
||||
return u.get_shared_ptr();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ std::string name_generator::generate(const std::map<std::string,std::string>& va
|
|||
name_generator_factory::name_generator_factory(const config& config, std::vector<std::string> ids) : name_generators_() {
|
||||
add_name_generator_from_config(config, "", "");
|
||||
|
||||
for (std::vector<std::string>::iterator it = std::begin(ids); it!=std::end(ids); it++) {
|
||||
for (std::vector<std::string>::iterator it = std::begin(ids); it!=std::end(ids); ++it) {
|
||||
std::string id = *it;
|
||||
add_name_generator_from_config(config, id, (id + "_"));
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ void highlighter::last_action_redraw(move_ptr move)
|
|||
{
|
||||
// Note: the planned actions seem to only get removed from the screen when
|
||||
// a redraw is triggered by the mouse cursor moving over them.
|
||||
for (side_actions::iterator iterator = sa.begin(); iterator < sa.end(); iterator++)
|
||||
for (side_actions::iterator iterator = sa.begin(); iterator < sa.end(); ++iterator)
|
||||
{
|
||||
if (iterator->get()->get_unit() == nullptr)
|
||||
sa.remove_action (iterator);
|
||||
|
|
|
@ -65,7 +65,7 @@ unit_const_ptr find_backup_leader(const unit & leader)
|
|||
{
|
||||
assert(leader.can_recruit());
|
||||
assert(resources::gameboard->map().is_keep(leader.get_location()));
|
||||
for (unit_map::const_iterator unit = resources::gameboard->units().begin(); unit != resources::gameboard->units().end(); unit++)
|
||||
for (unit_map::const_iterator unit = resources::gameboard->units().begin(); unit != resources::gameboard->units().end(); ++unit)
|
||||
{
|
||||
if (unit->can_recruit() && unit->id() != leader.id())
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue