← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/command_queue_types into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/command_queue_types into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/command_queue_types/+merge/278824

This is another code cleanup branch. I stumbled upon this huge list of #defines for command IDs and decided to turn it into an enum class. This now has the advantage that we get compiler warnings if there is one of them missing from the switch statement in the associated factory object - some of them were in fact not used there. I also removed a no longer used command ID.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/command_queue_types into lp:widelands.
=== modified file 'src/economy/cmd_call_economy_balance.h'
--- src/economy/cmd_call_economy_balance.h	2015-11-21 10:16:52 +0000
+++ src/economy/cmd_call_economy_balance.h	2015-11-27 14:25:51 +0000
@@ -37,7 +37,7 @@
 
 	void execute (Game &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_CALL_ECONOMY_BALANCE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kCallEconomyBalance;}
 
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;

=== modified file 'src/game_io/game_cmd_queue_packet.cc'
--- src/game_io/game_cmd_queue_packet.cc	2015-11-25 10:41:46 +0000
+++ src/game_io/game_cmd_queue_packet.cc	2015-11-27 14:25:51 +0000
@@ -60,7 +60,7 @@
 				item.serial = fr.unsigned_32();
 
 				GameLogicCommand & cmd =
-					QueueCmdFactory::create_correct_queue_command(packet_id);
+					QueueCmdFactory::create_correct_queue_command(static_cast<QueueCommandTypes>(packet_id));
 				cmd.read(fr, game, *ol);
 
 				item.cmd = &cmd;
@@ -106,7 +106,7 @@
 			if (it.cmd->duetime() == time) {
 				if (upcast(GameLogicCommand, cmd, it.cmd)) {
 					// The id (aka command type)
-					fw.unsigned_16(cmd->id());
+					fw.unsigned_16(static_cast<uint16_t>(cmd->id()));
 
 					// Serial number
 					fw.signed_32(it.category);

=== modified file 'src/logic/cmd_calculate_statistics.h'
--- src/logic/cmd_calculate_statistics.h	2015-11-21 10:16:52 +0000
+++ src/logic/cmd_calculate_statistics.h	2015-11-27 14:25:51 +0000
@@ -35,7 +35,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_CALCULATE_STATISTICS;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kCalculateStatistics;}
 	void execute(Game &) override;
 };
 

=== modified file 'src/logic/cmd_delete_message.h'
--- src/logic/cmd_delete_message.h	2015-11-21 10:16:52 +0000
+++ src/logic/cmd_delete_message.h	2015-11-27 14:25:51 +0000
@@ -42,7 +42,7 @@
 	{}
 
 	void execute (Game & game) override;
-	uint8_t id() const override {return QUEUE_CMD_DELETEMESSAGE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kDeleteMessage;}
 
 private:
 	PlayerNumber player;

=== modified file 'src/logic/cmd_incorporate.h'
--- src/logic/cmd_incorporate.h	2015-11-21 10:16:52 +0000
+++ src/logic/cmd_incorporate.h	2015-11-27 14:25:51 +0000
@@ -36,7 +36,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_INCORPORATE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kIncorporate;}
 
 private:
 	Worker * worker;

=== modified file 'src/logic/cmd_luacoroutine.h'
--- src/logic/cmd_luacoroutine.h	2015-11-21 10:16:52 +0000
+++ src/logic/cmd_luacoroutine.h	2015-11-27 14:25:51 +0000
@@ -40,7 +40,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_LUACOROUTINE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kLuaCoroutine;}
 
 	void execute(Game &) override;
 

=== modified file 'src/logic/cmd_luascript.h'
--- src/logic/cmd_luascript.h	2015-11-21 10:16:52 +0000
+++ src/logic/cmd_luascript.h	2015-11-27 14:25:51 +0000
@@ -36,7 +36,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_LUASCRIPT;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kLuaScript;}
 
 	void execute(Game &) override;
 

=== modified file 'src/logic/cmd_queue.cc'
--- src/logic/cmd_queue.cc	2015-11-25 10:41:46 +0000
+++ src/logic/cmd_queue.cc	2015-11-27 14:25:51 +0000
@@ -118,7 +118,7 @@
 				static uint8_t const tag[] = {0xde, 0xad, 0x00};
 				ss.data(tag, 3); // provide an easy-to-find pattern as debugging aid
 				ss.unsigned_32(c.duetime());
-				ss.unsigned_32(c.id());
+				ss.unsigned_32(static_cast<uint32_t>(c.id()));
 			}
 
 			c.execute (m_game);

=== modified file 'src/logic/cmd_queue.h'
--- src/logic/cmd_queue.h	2015-11-25 10:41:46 +0000
+++ src/logic/cmd_queue.h	2015-11-27 14:25:51 +0000
@@ -89,7 +89,7 @@
 	virtual ~Command ();
 
 	virtual void execute (Game &) = 0;
-	virtual uint8_t id() const = 0;
+	virtual QueueCommandTypes id() const = 0;
 
 	uint32_t duetime() const {return m_duetime;}
 	void set_duetime(uint32_t const t) {m_duetime = t;}

=== modified file 'src/logic/instances.h'
--- src/logic/instances.h	2015-11-24 17:08:24 +0000
+++ src/logic/instances.h	2015-11-27 14:25:51 +0000
@@ -520,7 +520,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_DESTROY_MAPOBJECT;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kDestroyMapObject;}
 
 private:
 	Serial obj_serial;
@@ -535,7 +535,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_ACT;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kAct;}
 
 private:
 	Serial obj_serial;

=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc	2015-11-21 10:16:52 +0000
+++ src/logic/playercommand.cc	2015-11-27 14:25:51 +0000
@@ -1910,11 +1910,6 @@
 {
 }
 
-uint8_t CmdSetStockPolicy::id() const
-{
-	return QUEUE_CMD_SETSTOCKPOLICY;
-}
-
 void CmdSetStockPolicy::execute(Game & game)
 {
 	// Sanitize data that could have come from the network

=== modified file 'src/logic/playercommand.h'
--- src/logic/playercommand.h	2015-11-21 10:16:52 +0000
+++ src/logic/playercommand.h	2015-11-27 14:25:51 +0000
@@ -79,7 +79,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_BULLDOZE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kBulldoze;}
 
 	void execute (Game &) override;
 	void serialize (StreamWrite &) override;
@@ -104,7 +104,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_BUILD;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kBuild;}
 
 	void execute (Game &) override;
 	void serialize (StreamWrite &) override;
@@ -125,7 +125,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_FLAG;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kFlag;}
 
 	void execute (Game &) override;
 	void serialize (StreamWrite &) override;
@@ -145,7 +145,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_BUILDROAD;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kBuildRoad;}
 
 	void execute (Game &) override;
 	void serialize (StreamWrite &) override;
@@ -166,7 +166,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_FLAGACTION;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kFlagAction;}
 
 
 	CmdFlagAction (StreamRead &);
@@ -187,7 +187,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_STOPBUILDING;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kStopBuilding;}
 
 	CmdStartStopBuilding (StreamRead &);
 
@@ -207,7 +207,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kMilitarysiteSetSoldierPreference;}
 
 	CmdMilitarySiteSetSoldierPreference (StreamRead &);
 
@@ -227,7 +227,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_PORT_START_EXPEDITION;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kPortStartExpedition;}
 
 	CmdStartOrCancelExpedition (StreamRead &);
 
@@ -252,7 +252,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_ENHANCEBUILDING;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kEnhanceBuilding;}
 
 	CmdEnhanceBuilding (StreamRead &);
 
@@ -276,7 +276,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_DISMANTLEBUILDING;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kDismantleBuilding;}
 
 	CmdDismantleBuilding (StreamRead &);
 
@@ -299,7 +299,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_EVICTWORKER;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kEvictWorker;}
 
 	CmdEvictWorker (StreamRead &);
 
@@ -320,7 +320,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SHIP_SCOUT;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kShipScout;}
 
 	CmdShipScoutDirection (StreamRead &);
 
@@ -342,7 +342,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SHIP_CONSTRUCT_PORT;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kShipConstructPort;}
 
 	CmdShipConstructPort (StreamRead &);
 
@@ -364,7 +364,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SHIP_EXPLORE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kShipExplore;}
 
 	CmdShipExploreIsland (StreamRead &);
 
@@ -386,7 +386,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SHIP_SINK;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSinkShip;}
 
 	CmdShipSink(StreamRead &);
 
@@ -407,7 +407,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SHIP_CANCELEXPEDITION;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kShipCancelExpedition;}
 
 	CmdShipCancelExpedition(StreamRead &);
 
@@ -436,7 +436,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SETWAREPRIORITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSetWarePriority;}
 
 	CmdSetWarePriority(StreamRead &);
 
@@ -461,7 +461,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SETWAREMAXFILL;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSetWareMaxFill;}
 
 	CmdSetWareMaxFill(StreamRead &);
 
@@ -509,7 +509,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SETWARETARGETQUANTITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSetWareTargetQuantity;}
 
 	CmdSetWareTargetQuantity(StreamRead &);
 
@@ -530,7 +530,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_RESETWARETARGETQUANTITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kResetWareTargetQuantity;}
 
 	CmdResetWareTargetQuantity(StreamRead &);
 
@@ -549,7 +549,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_SETWORKERTARGETQUANTITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSetWorkerTargetQuantity;}
 
 	CmdSetWorkerTargetQuantity(StreamRead &);
 
@@ -570,7 +570,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_RESETWORKERTARGETQUANTITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kResetWorkerTargetQuantity;}
 
 	CmdResetWorkerTargetQuantity(StreamRead &);
 
@@ -593,7 +593,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_CHANGETRAININGOPTIONS;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kChangeTrainingOptions;}
 
 	CmdChangeTrainingOptions (StreamRead &);
 
@@ -620,7 +620,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_DROPSOLDIER;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kDropSoldier;}
 
 	CmdDropSoldier(StreamRead &);
 
@@ -643,7 +643,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_CHANGESOLDIERCAPACITY;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kChangeSoldierCapacity;}
 
 	CmdChangeSoldierCapacity (StreamRead &);
 
@@ -666,7 +666,7 @@
 	void write(FileWrite &, EditorGameBase &, MapObjectSaver  &) override;
 	void read (FileRead  &, EditorGameBase &, MapObjectLoader &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_ENEMYFLAGACTION;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kEnemyFlagAction;}
 
 	CmdEnemyFlagAction (StreamRead &);
 
@@ -704,7 +704,7 @@
 		: PlayerMessageCommand(t, p, i)
 	{}
 
-	uint8_t id() const override {return QUEUE_CMD_MESSAGESETSTATUSREAD;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kMessageSetStatusRead;}
 
 	CmdMessageSetStatusRead(StreamRead & des) : PlayerMessageCommand(des) {}
 
@@ -719,7 +719,7 @@
 		: PlayerMessageCommand(t, p, i)
 	{}
 
-	uint8_t id() const override {return QUEUE_CMD_MESSAGESETSTATUSARCHIVED;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kMessageSetStatusArchived;}
 
 	CmdMessageSetStatusArchived(StreamRead & des) : PlayerMessageCommand(des) {
 	}
@@ -737,7 +737,7 @@
 		 Warehouse & wh, bool isworker, DescriptionIndex ware,
 		 Warehouse::StockPolicy policy);
 
-	uint8_t id() const override;
+	QueueCommandTypes id() const override {return QueueCommandTypes::kSetStockPolicy;}
 
 	void execute(Game & game) override;
 

=== modified file 'src/logic/queue_cmd_factory.cc'
--- src/logic/queue_cmd_factory.cc	2014-09-09 11:23:11 +0000
+++ src/logic/queue_cmd_factory.cc	2015-11-27 14:25:51 +0000
@@ -1,10 +1,10 @@
 /*
- * Copyright (C) 2002-2004, 2008-2010 by the Widelands Development Team
+ * Copyright(C) 2002-2004, 2008-2010 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or(at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,82 +27,90 @@
 #include "logic/cmd_luascript.h"
 #include "logic/instances.h"
 #include "logic/playercommand.h"
-#include "logic/queue_cmd_ids.h"
 
 namespace Widelands {
 
 GameLogicCommand & QueueCmdFactory::create_correct_queue_command
-	(uint32_t const id)
+	(QueueCommandTypes const id)
 {
-	switch (id) {
-	case QUEUE_CMD_BUILD:
-		return *new CmdBuild                     ();
-	case QUEUE_CMD_FLAG:
-		return *new CmdBuildFlag                 ();
-	case QUEUE_CMD_BUILDROAD:
-		return *new CmdBuildRoad                 ();
-	case QUEUE_CMD_FLAGACTION:
-		return *new CmdFlagAction                ();
-	case QUEUE_CMD_STOPBUILDING:
-		return *new CmdStartStopBuilding         ();
-	case QUEUE_CMD_PORT_START_EXPEDITION:
-		return *new CmdStartOrCancelExpedition   ();
-	case QUEUE_CMD_SHIP_CONSTRUCT_PORT:
-		return *new CmdShipConstructPort         ();
-	case QUEUE_CMD_SHIP_SCOUT:
-		return *new CmdShipScoutDirection        ();
-	case QUEUE_CMD_SHIP_EXPLORE:
-		return *new CmdShipExploreIsland         ();
-	case QUEUE_CMD_SHIP_SINK:
-		return *new CmdShipSink                  ();
-	case QUEUE_CMD_SHIP_CANCELEXPEDITION:
-		return *new CmdShipCancelExpedition      ();
-	case QUEUE_CMD_ENHANCEBUILDING:
-		return *new CmdEnhanceBuilding           ();
-	case QUEUE_CMD_BULLDOZE:
-		return *new CmdBulldoze                  ();
-	case QUEUE_CMD_DROPSOLDIER:
-		return *new CmdDropSoldier               ();
-	case QUEUE_CMD_CHANGESOLDIERCAPACITY:
-		return *new CmdChangeSoldierCapacity     ();
-	case QUEUE_CMD_ENEMYFLAGACTION:
-		return *new CmdEnemyFlagAction           ();
-	case QUEUE_CMD_SETWAREPRIORITY:
-		return *new CmdSetWarePriority           ();
-	case QUEUE_CMD_SETWARETARGETQUANTITY:
-		return *new CmdSetWareTargetQuantity     ();
-	case QUEUE_CMD_RESETWARETARGETQUANTITY:
-		return *new CmdResetWareTargetQuantity   ();
-	case QUEUE_CMD_SETWORKERTARGETQUANTITY:
-		return *new CmdSetWorkerTargetQuantity   ();
-	case QUEUE_CMD_RESETWORKERTARGETQUANTITY:
-		return *new CmdResetWorkerTargetQuantity ();
-	case QUEUE_CMD_MESSAGESETSTATUSREAD:
-		return *new CmdMessageSetStatusRead      ();
-	case QUEUE_CMD_MESSAGESETSTATUSARCHIVED:
-		return *new CmdMessageSetStatusArchived  ();
-	case QUEUE_CMD_DESTROY_MAPOBJECT:
-		return *new CmdDestroyMapObject        ();
-	case QUEUE_CMD_ACT:
-		return *new CmdAct                       ();
-	case QUEUE_CMD_INCORPORATE:
-		return *new CmdIncorporate               ();
-	case QUEUE_CMD_LUASCRIPT:
-		return *new CmdLuaScript                 ();
-	case QUEUE_CMD_LUACOROUTINE:
-		return *new CmdLuaCoroutine              ();
-	case QUEUE_CMD_CALCULATE_STATISTICS :
-		return *new CmdCalculateStatistics       ();
-	case QUEUE_CMD_CALL_ECONOMY_BALANCE:
-		return *new CmdCallEconomyBalance      ();
-	case QUEUE_CMD_SETWAREMAXFILL:
-		return *new CmdSetWareMaxFill            ();
-	case QUEUE_CMD_DISMANTLEBUILDING:
-		return *new CmdDismantleBuilding         ();
-	case QUEUE_CMD_EVICTWORKER:
+	switch(id) {
+	case QueueCommandTypes::kBuild:
+		return *new CmdBuild();
+	case QueueCommandTypes::kFlag:
+		return *new CmdBuildFlag();
+	case QueueCommandTypes::kBuildRoad:
+		return *new CmdBuildRoad();
+	case QueueCommandTypes::kFlagAction:
+		return *new CmdFlagAction();
+	case QueueCommandTypes::kStopBuilding:
+		return *new CmdStartStopBuilding();
+	case QueueCommandTypes::kEnhanceBuilding:
+		return *new CmdEnhanceBuilding();
+	case QueueCommandTypes::kBulldoze:
+		return *new CmdBulldoze();
+	case QueueCommandTypes::kChangeTrainingOptions:
+		return *new CmdChangeTrainingOptions();
+	case QueueCommandTypes::kDropSoldier:
+		return *new CmdDropSoldier();
+	case QueueCommandTypes::kChangeSoldierCapacity:
+		return *new CmdChangeSoldierCapacity();
+	case QueueCommandTypes::kEnemyFlagAction:
+		return *new CmdEnemyFlagAction();
+	case QueueCommandTypes::kSetWarePriority:
+		return *new CmdSetWarePriority();
+	case QueueCommandTypes::kSetWareTargetQuantity:
+		return *new CmdSetWareTargetQuantity();
+	case QueueCommandTypes::kResetWareTargetQuantity:
+		return *new CmdResetWareTargetQuantity();
+	case QueueCommandTypes::kSetWorkerTargetQuantity:
+		return *new CmdSetWorkerTargetQuantity();
+	case QueueCommandTypes::kResetWorkerTargetQuantity:
+		return *new CmdResetWorkerTargetQuantity();
+	case QueueCommandTypes::kSetWareMaxFill:
+		return *new CmdSetWareMaxFill();
+	case QueueCommandTypes::kMessageSetStatusRead:
+		return *new CmdMessageSetStatusRead();
+	case QueueCommandTypes::kMessageSetStatusArchived:
+		return *new CmdMessageSetStatusArchived();
+	case QueueCommandTypes::kSetStockPolicy:
+		return *new CmdSetStockPolicy();
+	case QueueCommandTypes::kDismantleBuilding:
+		return *new CmdDismantleBuilding();
+	case QueueCommandTypes::kEvictWorker:
 		return *new CmdEvictWorker();
-	case QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE:
+	case QueueCommandTypes::kMilitarysiteSetSoldierPreference:
 		return *new CmdMilitarySiteSetSoldierPreference();
+	case QueueCommandTypes::kSinkShip:
+		return *new CmdShipSink();
+	case QueueCommandTypes::kShipCancelExpedition:
+		return *new CmdShipCancelExpedition();
+	case QueueCommandTypes::kPortStartExpedition:
+		return *new CmdStartOrCancelExpedition();
+	case QueueCommandTypes::kShipConstructPort:
+		return *new CmdShipConstructPort();
+	case QueueCommandTypes::kShipScout:
+		return *new CmdShipScoutDirection();
+	case QueueCommandTypes::kShipExplore:
+		return *new CmdShipExploreIsland();
+	case QueueCommandTypes::kDestroyMapObject:
+		return *new CmdDestroyMapObject();
+	case QueueCommandTypes::kAct:
+		return *new CmdAct();
+	case QueueCommandTypes::kIncorporate:
+		return *new CmdIncorporate();
+	case QueueCommandTypes::kLuaScript:
+		return *new CmdLuaScript();
+	case QueueCommandTypes::kLuaCoroutine:
+		return *new CmdLuaCoroutine();
+	case QueueCommandTypes::kCalculateStatistics :
+		return *new CmdCalculateStatistics();
+	case QueueCommandTypes::kCallEconomyBalance:
+		return *new CmdCallEconomyBalance();
+	case QueueCommandTypes::kDeleteMessage: // Not a logic command
+	case QueueCommandTypes::kNetCheckSync:
+	case QueueCommandTypes::kReplaySyncWrite:
+	case QueueCommandTypes::kReplaySyncRead:
+	case QueueCommandTypes::kReplayEnd:
 	default:
 		throw wexception("Unknown Queue_Cmd_Id in file: %u", id);
 	}

=== modified file 'src/logic/queue_cmd_factory.h'
--- src/logic/queue_cmd_factory.h	2014-09-09 11:23:11 +0000
+++ src/logic/queue_cmd_factory.h	2015-11-27 14:25:51 +0000
@@ -22,6 +22,8 @@
 
 #include <stdint.h>
 
+#include "logic/queue_cmd_ids.h"
+
 namespace Widelands {
 
 struct GameLogicCommand;
@@ -31,7 +33,7 @@
  * from the queue command file ids
  */
 namespace QueueCmdFactory {
-	GameLogicCommand & create_correct_queue_command(uint32_t id);
+	GameLogicCommand & create_correct_queue_command(Widelands::QueueCommandTypes id);
 }
 
 }

=== modified file 'src/logic/queue_cmd_ids.h'
--- src/logic/queue_cmd_ids.h	2014-09-15 10:17:53 +0000
+++ src/logic/queue_cmd_ids.h	2015-11-27 14:25:51 +0000
@@ -31,62 +31,71 @@
  * writing to files
  */
 
-/* ID zero is reserved and must never be used */
-#define QUEUE_CMD_NONE                   0
-
-/* PLAYER COMMANDS BELOW */
-#define QUEUE_CMD_BUILD                      1
-#define QUEUE_CMD_FLAG                       2
-#define QUEUE_CMD_BUILDROAD                  3
-#define QUEUE_CMD_FLAGACTION                 4
-#define QUEUE_CMD_STOPBUILDING               5
-#define QUEUE_CMD_ENHANCEBUILDING            6
-#define QUEUE_CMD_BULLDOZE                   7
-#define QUEUE_CMD_CHANGETRAININGOPTIONS      8
-#define QUEUE_CMD_DROPSOLDIER                9
-#define QUEUE_CMD_CHANGESOLDIERCAPACITY     10
-#define QUEUE_CMD_ENEMYFLAGACTION           11
-#define QUEUE_CMD_SETWAREPRIORITY           12
-#define QUEUE_CMD_SETWARETARGETQUANTITY     13
-#define QUEUE_CMD_RESETWARETARGETQUANTITY   14
-#define QUEUE_CMD_SETWORKERTARGETQUANTITY   15
-#define QUEUE_CMD_RESETWORKERTARGETQUANTITY 16
-
-#define QUEUE_CMD_CHANGEMILITARYCONFIG      17
-#define QUEUE_CMD_SETWAREMAXFILL            18
-
-#define QUEUE_CMD_MESSAGESETSTATUSREAD      21
-#define QUEUE_CMD_MESSAGESETSTATUSARCHIVED  22
-
-#define QUEUE_CMD_SETSTOCKPOLICY            23
-#define QUEUE_CMD_DISMANTLEBUILDING         24
-
-#define QUEUE_CMD_EVICTWORKER               25
-
-#define QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE   26
-
-#define QUEUE_CMD_SHIP_SINK                121
-#define QUEUE_CMD_SHIP_CANCELEXPEDITION    122
-
-#define QUEUE_CMD_PORT_START_EXPEDITION    123
-#define QUEUE_CMD_SHIP_CONSTRUCT_PORT      124
-#define QUEUE_CMD_SHIP_SCOUT               125
-#define QUEUE_CMD_SHIP_EXPLORE             126
-
-#define QUEUE_CMD_DESTROY_MAPOBJECT        127
-#define QUEUE_CMD_ACT                      128
-// 129 was a command related to old events. removed
-#define QUEUE_CMD_INCORPORATE              130
-#define QUEUE_CMD_LUASCRIPT                131
-#define QUEUE_CMD_LUACOROUTINE             132
-#define QUEUE_CMD_CALCULATE_STATISTICS     133
-
-#define QUEUE_CMD_CALL_ECONOMY_BALANCE     200
-#define QUEUE_CMD_DELETEMESSAGE            201
-
-#define QUEUE_CMD_NETCHECKSYNC             250
-#define QUEUE_CMD_REPLAYSYNCWRITE          251
-#define QUEUE_CMD_REPLAYSYNCREAD           252
-#define QUEUE_CMD_REPLAYEND                253
+namespace Widelands {
+
+enum class QueueCommandTypes {
+
+	/* ID zero is reserved and must never be used */
+	kNone = 0,
+
+	/* PLAYER COMMANDS BELOW */
+	kBuild,
+	kFlag,
+	kBuildRoad,
+	kFlagAction,
+	kStopBuilding,
+	kEnhanceBuilding,
+	kBulldoze,
+
+	kChangeTrainingOptions,
+	kDropSoldier,
+	kChangeSoldierCapacity,
+	kEnemyFlagAction,
+
+	kSetWarePriority,
+	kSetWareTargetQuantity,
+	kResetWareTargetQuantity,
+	kSetWorkerTargetQuantity,
+	kResetWorkerTargetQuantity, // 16
+
+	// 17 was a command related to old events. removed
+
+	kSetWareMaxFill = 18,
+
+	kMessageSetStatusRead = 21,
+	kMessageSetStatusArchived,
+
+	kSetStockPolicy,
+	kDismantleBuilding,
+
+	kEvictWorker,
+
+	kMilitarysiteSetSoldierPreference, // 26
+
+	kSinkShip = 121,
+	kShipCancelExpedition,
+	kPortStartExpedition,
+	kShipConstructPort,
+	kShipScout,
+	kShipExplore,
+
+	kDestroyMapObject,
+	kAct, // 128
+	// 129 was a command related to old events. removed
+	kIncorporate = 130,
+	kLuaScript,
+	kLuaCoroutine,
+	kCalculateStatistics, // 133
+	kCallEconomyBalance = 200,
+
+	kDeleteMessage, // 201
+
+	kNetCheckSync = 250,
+	kReplaySyncWrite,
+	kReplaySyncRead,
+	kReplayEnd // 253
+};
+
+} // namespace Widelands
 
 #endif  // end of include guard: WL_LOGIC_QUEUE_CMD_IDS_H

=== modified file 'src/logic/replay.cc'
--- src/logic/replay.cc	2015-10-24 15:42:37 +0000
+++ src/logic/replay.cc	2015-11-27 14:25:51 +0000
@@ -52,7 +52,7 @@
 		: Command(_duetime), m_hash(hash)
 	{}
 
-	uint8_t id() const override {return QUEUE_CMD_REPLAYSYNCREAD;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;}
 
 	void execute(Game & game) override
 	{
@@ -203,7 +203,7 @@
 public:
 	CmdReplaySyncWrite(const uint32_t _duetime) : Command(_duetime) {}
 
-	uint8_t id() const override {return QUEUE_CMD_REPLAYSYNCWRITE;}
+	QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncWrite;}
 
 	void execute(Game & game) override {
 		if (ReplayWriter * const rw = game.get_replaywriter()) {

=== modified file 'src/logic/replay_game_controller.cc'
--- src/logic/replay_game_controller.cc	2015-11-08 17:31:06 +0000
+++ src/logic/replay_game_controller.cc	2015-11-27 14:25:51 +0000
@@ -113,6 +113,6 @@
 	mmb.run<UI::Panel::Returncodes>();
 }
 
-uint8_t ReplayGameController::CmdReplayEnd::id() const {
-	return QUEUE_CMD_REPLAYEND;
+Widelands::QueueCommandTypes ReplayGameController::CmdReplayEnd::id() const {
+	return Widelands::QueueCommandTypes::kReplayEnd;
 }

=== modified file 'src/logic/replay_game_controller.h'
--- src/logic/replay_game_controller.h	2015-11-21 10:16:52 +0000
+++ src/logic/replay_game_controller.h	2015-11-27 14:25:51 +0000
@@ -48,7 +48,7 @@
 	struct CmdReplayEnd : public Widelands::Command {
 		CmdReplayEnd (uint32_t const _duetime) : Widelands::Command(_duetime) {}
 		virtual void execute (Widelands::Game & game);
-		virtual uint8_t id() const;
+		virtual Widelands::QueueCommandTypes id() const;
 	};
 
 	Widelands::Game & m_game;

=== modified file 'src/network/network.h'
--- src/network/network.h	2015-11-21 10:16:52 +0000
+++ src/network/network.h	2015-11-27 14:25:51 +0000
@@ -49,7 +49,7 @@
 
 	void execute (Widelands::Game &) override;
 
-	uint8_t id() const override {return QUEUE_CMD_NETCHECKSYNC;}
+	Widelands::QueueCommandTypes id() const override {return Widelands::QueueCommandTypes::kNetCheckSync;}
 
 private:
 	SyncCallback * m_callback;


Follow ups