← Back to team overview

widelands-dev team mailing list archive

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

 

Review: Needs Fixing code

Review.

Diff comments:

> === modified file 'src/game_io/game_player_info_packet.cc'
> --- src/game_io/game_player_info_packet.cc	2016-02-16 10:27:23 +0000
> +++ src/game_io/game_player_info_packet.cc	2016-05-11 06:51:52 +0000
> @@ -72,6 +73,21 @@
>  					player.civil_blds_defeated_ = fr.unsigned_32();
>  				}
>  			}
> +
> +			// Result screen
> +			if (packet_version >= 19) {

Version 19 needs to be excluded here.

> +				PlayersManager* manager = game.player_manager();
> +				const uint8_t no_endstatus = fr.unsigned_8();
> +				for (uint8_t i = 0; i < no_endstatus; ++i) {
> +					PlayerEndStatus status;
> +					status.player = fr.unsigned_8();
> +					status.result = static_cast<PlayerEndResult>(fr.unsigned_8());
> +					status.time = fr.unsigned_32();
> +					status.info = fr.c_string();
> +					manager->set_player_end_status(status);
> +				}
> +			}
> +
>  			game.read_statistics(fr);
>  		} else {
>  			throw UnhandledVersionError("GamePlayerInfoPacket", packet_version, kCurrentPacketVersion);
> 
> === modified file 'src/logic/playersmanager.cc'
> --- src/logic/playersmanager.cc	2016-02-16 10:27:23 +0000
> +++ src/logic/playersmanager.cc	2016-05-11 06:51:52 +0000
> @@ -120,5 +118,16 @@
>  	}
>  }
>  
> +void PlayersManager::set_player_end_status(const PlayerEndStatus& status)
> +{
> +	for (auto& pes : players_end_status_) {
> +		if (pes.player == status.player) {
> +			pes = status;
> +			 return;

Additional space before 'return;'.

> +		}
> +	}
> +	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