← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/cleanup_playercommand_enums into lp:widelands

 

Addressed code review. Thanks for the review

Diff comments:

> === modified file 'src/logic/playercommand.cc'
> --- src/logic/playercommand.cc	2019-06-23 11:41:17 +0000
> +++ src/logic/playercommand.cc	2019-06-24 22:00:34 +0000
> @@ -226,7 +200,7 @@
>  }
>  
>  void CmdBulldoze::serialize(StreamWrite& ser) {
> -	ser.unsigned_8(PLCMD_BULLDOZE);
> +	write_id(ser);
>  	ser.unsigned_8(sender());

Done - I have replaced

void write_id(StreamWrite& ser);
 
by

void write_id_and_sender(StreamWrite& ser);

>  	ser.unsigned_32(serial);
>  	ser.unsigned_8(recurse);
> @@ -1263,6 +1237,7 @@
>  }
>  
>  void CmdChangeTargetQuantity::serialize(StreamWrite& ser) {
> +	// Does not implement id(), so we don't have any id header to serialize

It's a common superclass, so the subclasses take care of it

>  	ser.unsigned_8(sender());
>  	ser.unsigned_32(economy());
>  	ser.unsigned_8(ware_type());
> 
> === modified file 'src/logic/queue_cmd_ids.h'
> --- src/logic/queue_cmd_ids.h	2019-06-09 10:33:51 +0000
> +++ src/logic/queue_cmd_ids.h	2019-06-24 22:00:34 +0000
> @@ -33,17 +33,21 @@
>  
>  namespace Widelands {
>  
> -enum class QueueCommandTypes {
> +// The command types are used by the QueueCmdFactory, for network serialization
> +// and for savegame compatibility.
> +// DO NOT change the order
> +// TODO(GunChleoc): Whenever we break savegame compatibility, clean this up.
> +enum class QueueCommandTypes : uint8_t {

I have added a comment

>  
>  	/* ID zero is reserved and must never be used */
>  	kNone = 0,
>  
>  	/* PLAYER COMMANDS BELOW */
>  	kBuild,
> -	kFlag,
> +	kBuildFlag,
>  	kBuildRoad,
>  	kFlagAction,
> -	kStopBuilding,
> +	kStartStopBuilding,
>  	kEnhanceBuilding,
>  	kBulldoze,
>  


-- 
https://code.launchpad.net/~widelands-dev/widelands/cleanup_playercommand_enums/+merge/369267
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/cleanup_playercommand_enums into lp:widelands.


References