Fix #2813: wrong chat color after a side is unassigned from a player

Regression from commit 36e9290.

As @gfgtdf pointed out in the bug report, because old_player was a
reference to the shared_ptr, resetting the shared_ptr in sides_ also
changed old_player, and thus 'the player lost his last side' check never
passed.

Thanks to @gfgtdf for figuring out the cause.
This commit is contained in:
Jyrki Vesterinen 2018-07-12 07:30:04 +03:00
parent 505b914804
commit ca90ca35f0

View file

@ -545,7 +545,7 @@ void game::transfer_side_control(const socket_ptr& sock, const simple_wml::node&
}
const simple_wml::string_span& newplayer_name = cfg["player"];
const socket_ptr& old_player = sides_[side_num - 1];
const socket_ptr old_player = sides_[side_num - 1];
const auto oldplayer = player_connections_.find(old_player);
if(oldplayer == player_connections_.end()) {
missing_user(old_player, __func__);