← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1302593-result-screen into lp:widelands

 

Replied to the question in the diff comments.

Diff comments:

> 
> === modified file 'src/logic/playersmanager.cc'
> --- src/logic/playersmanager.cc	2016-02-16 10:27:23 +0000
> +++ src/logic/playersmanager.cc	2016-05-02 11:22:37 +0000
> @@ -120,5 +120,21 @@
>  	}
>  }
>  
> +void PlayersManager::set_player_end_status(const PlayerEndStatus& status)
> +{
> +	bool found = false;
> +	for (auto it = players_end_status_.begin(); it != players_end_status_.end(); ++it) {
> +		PlayerEndStatus pes = *it;
> +		if (pes.player == status.player) {
> +			pes = status;

With iterators:
    *it = status;

Using more modern syntax:
    for (auto & pes : players_end_status_) {
        if (pes.player == status.player) {
            pes = status;
            return;
        }
    }

> +			found = true;
> +			break;
> +		}
> +	}
> +	if (!found) {
> +		players_end_status_.push_back(status);
> +	}
> +}
> +
>  
>  }  // namespace Widelands


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1302593-result-screen/+merge/293521
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1302593-result-screen.


References