Merge lp:~widelands-dev/widelands/command_queue_types into lp:widelands
- command_queue_types
- Merge into trunk
Proposed by
GunChleoc
Status: | Merged |
---|---|
Merged at revision: | 7654 |
Proposed branch: | lp:~widelands-dev/widelands/command_queue_types |
Merge into: | lp:widelands |
Diff against target: |
906 lines (+205/-206) 19 files modified
src/economy/cmd_call_economy_balance.h (+1/-1) src/game_io/game_cmd_queue_packet.cc (+4/-4) src/logic/cmd_calculate_statistics.h (+1/-1) src/logic/cmd_delete_message.h (+1/-1) src/logic/cmd_incorporate.h (+1/-1) src/logic/cmd_luacoroutine.h (+1/-1) src/logic/cmd_luascript.h (+1/-1) src/logic/cmd_queue.cc (+5/-5) src/logic/cmd_queue.h (+7/-22) src/logic/instances.h (+2/-2) src/logic/playercommand.cc (+0/-5) src/logic/playercommand.h (+29/-29) src/logic/queue_cmd_factory.cc (+77/-69) src/logic/queue_cmd_factory.h (+3/-1) src/logic/queue_cmd_ids.h (+66/-57) src/logic/replay.cc (+2/-2) src/logic/replay_game_controller.cc (+2/-2) src/logic/replay_game_controller.h (+1/-1) src/network/network.h (+1/-1) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/command_queue_types |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
TiborB | Approve | ||
Review via email: mp+278824@code.launchpad.net |
Commit message
Description of the change
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.
To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Thanks :)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/economy/cmd_call_economy_balance.h' |
2 | --- src/economy/cmd_call_economy_balance.h 2015-11-21 10:16:52 +0000 |
3 | +++ src/economy/cmd_call_economy_balance.h 2015-11-29 10:12:21 +0000 |
4 | @@ -37,7 +37,7 @@ |
5 | |
6 | void execute (Game &) override; |
7 | |
8 | - uint8_t id() const override {return QUEUE_CMD_CALL_ECONOMY_BALANCE;} |
9 | + QueueCommandTypes id() const override {return QueueCommandTypes::kCallEconomyBalance;} |
10 | |
11 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
12 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
13 | |
14 | === modified file 'src/game_io/game_cmd_queue_packet.cc' |
15 | --- src/game_io/game_cmd_queue_packet.cc 2015-11-25 10:41:46 +0000 |
16 | +++ src/game_io/game_cmd_queue_packet.cc 2015-11-29 10:12:21 +0000 |
17 | @@ -60,12 +60,12 @@ |
18 | item.serial = fr.unsigned_32(); |
19 | |
20 | GameLogicCommand & cmd = |
21 | - QueueCmdFactory::create_correct_queue_command(packet_id); |
22 | + QueueCmdFactory::create_correct_queue_command(static_cast<QueueCommandTypes>(packet_id)); |
23 | cmd.read(fr, game, *ol); |
24 | |
25 | item.cmd = &cmd; |
26 | |
27 | - cmdq.m_cmds[cmd.duetime() % CMD_QUEUE_BUCKET_SIZE].push(item); |
28 | + cmdq.m_cmds[cmd.duetime() % kCommandQueueBucketSize].push(item); |
29 | ++ cmdq.m_ncmds; |
30 | } |
31 | } else { |
32 | @@ -99,14 +99,14 @@ |
33 | |
34 | while (nhandled < cmdq.m_ncmds) { |
35 | // Make a copy, so we can pop stuff |
36 | - std::priority_queue<CmdQueue::CmdItem> p = cmdq.m_cmds[time % CMD_QUEUE_BUCKET_SIZE]; |
37 | + std::priority_queue<CmdQueue::CmdItem> p = cmdq.m_cmds[time % kCommandQueueBucketSize]; |
38 | |
39 | while (!p.empty()) { |
40 | const CmdQueue::CmdItem & it = p.top(); |
41 | if (it.cmd->duetime() == time) { |
42 | if (upcast(GameLogicCommand, cmd, it.cmd)) { |
43 | // The id (aka command type) |
44 | - fw.unsigned_16(cmd->id()); |
45 | + fw.unsigned_16(static_cast<uint16_t>(cmd->id())); |
46 | |
47 | // Serial number |
48 | fw.signed_32(it.category); |
49 | |
50 | === modified file 'src/logic/cmd_calculate_statistics.h' |
51 | --- src/logic/cmd_calculate_statistics.h 2015-11-21 10:16:52 +0000 |
52 | +++ src/logic/cmd_calculate_statistics.h 2015-11-29 10:12:21 +0000 |
53 | @@ -35,7 +35,7 @@ |
54 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
55 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
56 | |
57 | - uint8_t id() const override {return QUEUE_CMD_CALCULATE_STATISTICS;} |
58 | + QueueCommandTypes id() const override {return QueueCommandTypes::kCalculateStatistics;} |
59 | void execute(Game &) override; |
60 | }; |
61 | |
62 | |
63 | === modified file 'src/logic/cmd_delete_message.h' |
64 | --- src/logic/cmd_delete_message.h 2015-11-21 10:16:52 +0000 |
65 | +++ src/logic/cmd_delete_message.h 2015-11-29 10:12:21 +0000 |
66 | @@ -42,7 +42,7 @@ |
67 | {} |
68 | |
69 | void execute (Game & game) override; |
70 | - uint8_t id() const override {return QUEUE_CMD_DELETEMESSAGE;} |
71 | + QueueCommandTypes id() const override {return QueueCommandTypes::kDeleteMessage;} |
72 | |
73 | private: |
74 | PlayerNumber player; |
75 | |
76 | === modified file 'src/logic/cmd_incorporate.h' |
77 | --- src/logic/cmd_incorporate.h 2015-11-21 10:16:52 +0000 |
78 | +++ src/logic/cmd_incorporate.h 2015-11-29 10:12:21 +0000 |
79 | @@ -36,7 +36,7 @@ |
80 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
81 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
82 | |
83 | - uint8_t id() const override {return QUEUE_CMD_INCORPORATE;} |
84 | + QueueCommandTypes id() const override {return QueueCommandTypes::kIncorporate;} |
85 | |
86 | private: |
87 | Worker * worker; |
88 | |
89 | === modified file 'src/logic/cmd_luacoroutine.h' |
90 | --- src/logic/cmd_luacoroutine.h 2015-11-21 10:16:52 +0000 |
91 | +++ src/logic/cmd_luacoroutine.h 2015-11-29 10:12:21 +0000 |
92 | @@ -40,7 +40,7 @@ |
93 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
94 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
95 | |
96 | - uint8_t id() const override {return QUEUE_CMD_LUACOROUTINE;} |
97 | + QueueCommandTypes id() const override {return QueueCommandTypes::kLuaCoroutine;} |
98 | |
99 | void execute(Game &) override; |
100 | |
101 | |
102 | === modified file 'src/logic/cmd_luascript.h' |
103 | --- src/logic/cmd_luascript.h 2015-11-21 10:16:52 +0000 |
104 | +++ src/logic/cmd_luascript.h 2015-11-29 10:12:21 +0000 |
105 | @@ -36,7 +36,7 @@ |
106 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
107 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
108 | |
109 | - uint8_t id() const override {return QUEUE_CMD_LUASCRIPT;} |
110 | + QueueCommandTypes id() const override {return QueueCommandTypes::kLuaScript;} |
111 | |
112 | void execute(Game &) override; |
113 | |
114 | |
115 | === modified file 'src/logic/cmd_queue.cc' |
116 | --- src/logic/cmd_queue.cc 2015-11-25 10:41:46 +0000 |
117 | +++ src/logic/cmd_queue.cc 2015-11-29 10:12:21 +0000 |
118 | @@ -40,7 +40,7 @@ |
119 | m_game(game), |
120 | nextserial(0), |
121 | m_ncmds(0), |
122 | - m_cmds(CMD_QUEUE_BUCKET_SIZE, std::priority_queue<CmdItem>()) {} |
123 | + m_cmds(kCommandQueueBucketSize, std::priority_queue<CmdItem>()) {} |
124 | |
125 | CmdQueue::~CmdQueue() |
126 | { |
127 | @@ -55,7 +55,7 @@ |
128 | // Note: Order of destruction of Items is not guaranteed |
129 | void CmdQueue::flush() { |
130 | uint32_t cbucket = 0; |
131 | - while (m_ncmds && cbucket < CMD_QUEUE_BUCKET_SIZE) { |
132 | + while (m_ncmds && cbucket < kCommandQueueBucketSize) { |
133 | std::priority_queue<CmdItem> & current_cmds = m_cmds[cbucket]; |
134 | |
135 | while (!current_cmds.empty()) { |
136 | @@ -94,7 +94,7 @@ |
137 | ci.serial = 0; |
138 | } |
139 | |
140 | - m_cmds[cmd->duetime() % CMD_QUEUE_BUCKET_SIZE].push(ci); |
141 | + m_cmds[cmd->duetime() % kCommandQueueBucketSize].push(ci); |
142 | ++ m_ncmds; |
143 | } |
144 | |
145 | @@ -102,7 +102,7 @@ |
146 | uint32_t const final = game_time_var + interval; |
147 | |
148 | while (game_time_var < final) { |
149 | - std::priority_queue<CmdItem> & current_cmds = m_cmds[game_time_var % CMD_QUEUE_BUCKET_SIZE]; |
150 | + std::priority_queue<CmdItem> & current_cmds = m_cmds[game_time_var % kCommandQueueBucketSize]; |
151 | |
152 | while (!current_cmds.empty()) { |
153 | Command & c = *current_cmds.top().cmd; |
154 | @@ -118,7 +118,7 @@ |
155 | static uint8_t const tag[] = {0xde, 0xad, 0x00}; |
156 | ss.data(tag, 3); // provide an easy-to-find pattern as debugging aid |
157 | ss.unsigned_32(c.duetime()); |
158 | - ss.unsigned_32(c.id()); |
159 | + ss.unsigned_32(static_cast<uint32_t>(c.id())); |
160 | } |
161 | |
162 | c.execute (m_game); |
163 | |
164 | === modified file 'src/logic/cmd_queue.h' |
165 | --- src/logic/cmd_queue.h 2015-11-25 10:41:46 +0000 |
166 | +++ src/logic/cmd_queue.h 2015-11-29 10:12:21 +0000 |
167 | @@ -35,27 +35,13 @@ |
168 | namespace Widelands { |
169 | |
170 | class EditorGameBase; |
171 | +class Game; |
172 | +class MapObjectLoader; |
173 | struct MapObjectSaver; |
174 | -class MapObjectLoader; |
175 | - |
176 | -// Define here all the possible users |
177 | -#define SENDER_MAPOBJECT 0 |
178 | -#define SENDER_PLAYER1 1 // those are just place holder, a player can send |
179 | -#define SENDER_PLAYER2 2 // commands with it's player number |
180 | -#define SENDER_PLAYER3 3 |
181 | -#define SENDER_PLAYER4 4 |
182 | -#define SENDER_PLAYER5 5 |
183 | -#define SENDER_PLAYER6 6 |
184 | -#define SENDER_PLAYER7 7 |
185 | -#define SENDER_PLAYER8 8 |
186 | -#define SENDER_CMDQUEUE 100 // The Cmdqueue sends itself some action request |
187 | - |
188 | -#define CMD_QUEUE_BUCKET_SIZE 65536 // Make this a power of two, so that % is fast |
189 | - |
190 | -// ---------------------- END OF CMDS ---------------------------------- |
191 | - |
192 | -// |
193 | -// This is finally the command queue. It is fully widelands specific, |
194 | + |
195 | +constexpr uint32_t kCommandQueueBucketSize = 65536; // Make this a power of two, so that % is fast |
196 | + |
197 | +// This is the command queue. It is fully widelands specific, |
198 | // it needs to know nearly all modules. |
199 | // |
200 | // It used to be implemented as a priority_queue sorted by execution_time, |
201 | @@ -72,7 +58,6 @@ |
202 | // The price we pay is that when saving, we also have to traverse till we no |
203 | // longer find any new command to write. This could theoretically take forever |
204 | // but in my tests it was not noticeable. |
205 | -class Game; |
206 | |
207 | /** |
208 | * A command that is supposed to be executed at a certain gametime. |
209 | @@ -89,7 +74,7 @@ |
210 | virtual ~Command (); |
211 | |
212 | virtual void execute (Game &) = 0; |
213 | - virtual uint8_t id() const = 0; |
214 | + virtual QueueCommandTypes id() const = 0; |
215 | |
216 | uint32_t duetime() const {return m_duetime;} |
217 | void set_duetime(uint32_t const t) {m_duetime = t;} |
218 | |
219 | === modified file 'src/logic/instances.h' |
220 | --- src/logic/instances.h 2015-11-24 17:08:24 +0000 |
221 | +++ src/logic/instances.h 2015-11-29 10:12:21 +0000 |
222 | @@ -520,7 +520,7 @@ |
223 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
224 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
225 | |
226 | - uint8_t id() const override {return QUEUE_CMD_DESTROY_MAPOBJECT;} |
227 | + QueueCommandTypes id() const override {return QueueCommandTypes::kDestroyMapObject;} |
228 | |
229 | private: |
230 | Serial obj_serial; |
231 | @@ -535,7 +535,7 @@ |
232 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
233 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
234 | |
235 | - uint8_t id() const override {return QUEUE_CMD_ACT;} |
236 | + QueueCommandTypes id() const override {return QueueCommandTypes::kAct;} |
237 | |
238 | private: |
239 | Serial obj_serial; |
240 | |
241 | === modified file 'src/logic/playercommand.cc' |
242 | --- src/logic/playercommand.cc 2015-11-21 10:16:52 +0000 |
243 | +++ src/logic/playercommand.cc 2015-11-29 10:12:21 +0000 |
244 | @@ -1910,11 +1910,6 @@ |
245 | { |
246 | } |
247 | |
248 | -uint8_t CmdSetStockPolicy::id() const |
249 | -{ |
250 | - return QUEUE_CMD_SETSTOCKPOLICY; |
251 | -} |
252 | - |
253 | void CmdSetStockPolicy::execute(Game & game) |
254 | { |
255 | // Sanitize data that could have come from the network |
256 | |
257 | === modified file 'src/logic/playercommand.h' |
258 | --- src/logic/playercommand.h 2015-11-21 10:16:52 +0000 |
259 | +++ src/logic/playercommand.h 2015-11-29 10:12:21 +0000 |
260 | @@ -79,7 +79,7 @@ |
261 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
262 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
263 | |
264 | - uint8_t id() const override {return QUEUE_CMD_BULLDOZE;} |
265 | + QueueCommandTypes id() const override {return QueueCommandTypes::kBulldoze;} |
266 | |
267 | void execute (Game &) override; |
268 | void serialize (StreamWrite &) override; |
269 | @@ -104,7 +104,7 @@ |
270 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
271 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
272 | |
273 | - uint8_t id() const override {return QUEUE_CMD_BUILD;} |
274 | + QueueCommandTypes id() const override {return QueueCommandTypes::kBuild;} |
275 | |
276 | void execute (Game &) override; |
277 | void serialize (StreamWrite &) override; |
278 | @@ -125,7 +125,7 @@ |
279 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
280 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
281 | |
282 | - uint8_t id() const override {return QUEUE_CMD_FLAG;} |
283 | + QueueCommandTypes id() const override {return QueueCommandTypes::kFlag;} |
284 | |
285 | void execute (Game &) override; |
286 | void serialize (StreamWrite &) override; |
287 | @@ -145,7 +145,7 @@ |
288 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
289 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
290 | |
291 | - uint8_t id() const override {return QUEUE_CMD_BUILDROAD;} |
292 | + QueueCommandTypes id() const override {return QueueCommandTypes::kBuildRoad;} |
293 | |
294 | void execute (Game &) override; |
295 | void serialize (StreamWrite &) override; |
296 | @@ -166,7 +166,7 @@ |
297 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
298 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
299 | |
300 | - uint8_t id() const override {return QUEUE_CMD_FLAGACTION;} |
301 | + QueueCommandTypes id() const override {return QueueCommandTypes::kFlagAction;} |
302 | |
303 | |
304 | CmdFlagAction (StreamRead &); |
305 | @@ -187,7 +187,7 @@ |
306 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
307 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
308 | |
309 | - uint8_t id() const override {return QUEUE_CMD_STOPBUILDING;} |
310 | + QueueCommandTypes id() const override {return QueueCommandTypes::kStopBuilding;} |
311 | |
312 | CmdStartStopBuilding (StreamRead &); |
313 | |
314 | @@ -207,7 +207,7 @@ |
315 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
316 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
317 | |
318 | - uint8_t id() const override {return QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE;} |
319 | + QueueCommandTypes id() const override {return QueueCommandTypes::kMilitarysiteSetSoldierPreference;} |
320 | |
321 | CmdMilitarySiteSetSoldierPreference (StreamRead &); |
322 | |
323 | @@ -227,7 +227,7 @@ |
324 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
325 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
326 | |
327 | - uint8_t id() const override {return QUEUE_CMD_PORT_START_EXPEDITION;} |
328 | + QueueCommandTypes id() const override {return QueueCommandTypes::kPortStartExpedition;} |
329 | |
330 | CmdStartOrCancelExpedition (StreamRead &); |
331 | |
332 | @@ -252,7 +252,7 @@ |
333 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
334 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
335 | |
336 | - uint8_t id() const override {return QUEUE_CMD_ENHANCEBUILDING;} |
337 | + QueueCommandTypes id() const override {return QueueCommandTypes::kEnhanceBuilding;} |
338 | |
339 | CmdEnhanceBuilding (StreamRead &); |
340 | |
341 | @@ -276,7 +276,7 @@ |
342 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
343 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
344 | |
345 | - uint8_t id() const override {return QUEUE_CMD_DISMANTLEBUILDING;} |
346 | + QueueCommandTypes id() const override {return QueueCommandTypes::kDismantleBuilding;} |
347 | |
348 | CmdDismantleBuilding (StreamRead &); |
349 | |
350 | @@ -299,7 +299,7 @@ |
351 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
352 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
353 | |
354 | - uint8_t id() const override {return QUEUE_CMD_EVICTWORKER;} |
355 | + QueueCommandTypes id() const override {return QueueCommandTypes::kEvictWorker;} |
356 | |
357 | CmdEvictWorker (StreamRead &); |
358 | |
359 | @@ -320,7 +320,7 @@ |
360 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
361 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
362 | |
363 | - uint8_t id() const override {return QUEUE_CMD_SHIP_SCOUT;} |
364 | + QueueCommandTypes id() const override {return QueueCommandTypes::kShipScout;} |
365 | |
366 | CmdShipScoutDirection (StreamRead &); |
367 | |
368 | @@ -342,7 +342,7 @@ |
369 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
370 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
371 | |
372 | - uint8_t id() const override {return QUEUE_CMD_SHIP_CONSTRUCT_PORT;} |
373 | + QueueCommandTypes id() const override {return QueueCommandTypes::kShipConstructPort;} |
374 | |
375 | CmdShipConstructPort (StreamRead &); |
376 | |
377 | @@ -364,7 +364,7 @@ |
378 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
379 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
380 | |
381 | - uint8_t id() const override {return QUEUE_CMD_SHIP_EXPLORE;} |
382 | + QueueCommandTypes id() const override {return QueueCommandTypes::kShipExplore;} |
383 | |
384 | CmdShipExploreIsland (StreamRead &); |
385 | |
386 | @@ -386,7 +386,7 @@ |
387 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
388 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
389 | |
390 | - uint8_t id() const override {return QUEUE_CMD_SHIP_SINK;} |
391 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSinkShip;} |
392 | |
393 | CmdShipSink(StreamRead &); |
394 | |
395 | @@ -407,7 +407,7 @@ |
396 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
397 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
398 | |
399 | - uint8_t id() const override {return QUEUE_CMD_SHIP_CANCELEXPEDITION;} |
400 | + QueueCommandTypes id() const override {return QueueCommandTypes::kShipCancelExpedition;} |
401 | |
402 | CmdShipCancelExpedition(StreamRead &); |
403 | |
404 | @@ -436,7 +436,7 @@ |
405 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
406 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
407 | |
408 | - uint8_t id() const override {return QUEUE_CMD_SETWAREPRIORITY;} |
409 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSetWarePriority;} |
410 | |
411 | CmdSetWarePriority(StreamRead &); |
412 | |
413 | @@ -461,7 +461,7 @@ |
414 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
415 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
416 | |
417 | - uint8_t id() const override {return QUEUE_CMD_SETWAREMAXFILL;} |
418 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSetWareMaxFill;} |
419 | |
420 | CmdSetWareMaxFill(StreamRead &); |
421 | |
422 | @@ -509,7 +509,7 @@ |
423 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
424 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
425 | |
426 | - uint8_t id() const override {return QUEUE_CMD_SETWARETARGETQUANTITY;} |
427 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSetWareTargetQuantity;} |
428 | |
429 | CmdSetWareTargetQuantity(StreamRead &); |
430 | |
431 | @@ -530,7 +530,7 @@ |
432 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
433 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
434 | |
435 | - uint8_t id() const override {return QUEUE_CMD_RESETWARETARGETQUANTITY;} |
436 | + QueueCommandTypes id() const override {return QueueCommandTypes::kResetWareTargetQuantity;} |
437 | |
438 | CmdResetWareTargetQuantity(StreamRead &); |
439 | |
440 | @@ -549,7 +549,7 @@ |
441 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
442 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
443 | |
444 | - uint8_t id() const override {return QUEUE_CMD_SETWORKERTARGETQUANTITY;} |
445 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSetWorkerTargetQuantity;} |
446 | |
447 | CmdSetWorkerTargetQuantity(StreamRead &); |
448 | |
449 | @@ -570,7 +570,7 @@ |
450 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
451 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
452 | |
453 | - uint8_t id() const override {return QUEUE_CMD_RESETWORKERTARGETQUANTITY;} |
454 | + QueueCommandTypes id() const override {return QueueCommandTypes::kResetWorkerTargetQuantity;} |
455 | |
456 | CmdResetWorkerTargetQuantity(StreamRead &); |
457 | |
458 | @@ -593,7 +593,7 @@ |
459 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
460 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
461 | |
462 | - uint8_t id() const override {return QUEUE_CMD_CHANGETRAININGOPTIONS;} |
463 | + QueueCommandTypes id() const override {return QueueCommandTypes::kChangeTrainingOptions;} |
464 | |
465 | CmdChangeTrainingOptions (StreamRead &); |
466 | |
467 | @@ -620,7 +620,7 @@ |
468 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
469 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
470 | |
471 | - uint8_t id() const override {return QUEUE_CMD_DROPSOLDIER;} |
472 | + QueueCommandTypes id() const override {return QueueCommandTypes::kDropSoldier;} |
473 | |
474 | CmdDropSoldier(StreamRead &); |
475 | |
476 | @@ -643,7 +643,7 @@ |
477 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
478 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
479 | |
480 | - uint8_t id() const override {return QUEUE_CMD_CHANGESOLDIERCAPACITY;} |
481 | + QueueCommandTypes id() const override {return QueueCommandTypes::kChangeSoldierCapacity;} |
482 | |
483 | CmdChangeSoldierCapacity (StreamRead &); |
484 | |
485 | @@ -666,7 +666,7 @@ |
486 | void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
487 | void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
488 | |
489 | - uint8_t id() const override {return QUEUE_CMD_ENEMYFLAGACTION;} |
490 | + QueueCommandTypes id() const override {return QueueCommandTypes::kEnemyFlagAction;} |
491 | |
492 | CmdEnemyFlagAction (StreamRead &); |
493 | |
494 | @@ -704,7 +704,7 @@ |
495 | : PlayerMessageCommand(t, p, i) |
496 | {} |
497 | |
498 | - uint8_t id() const override {return QUEUE_CMD_MESSAGESETSTATUSREAD;} |
499 | + QueueCommandTypes id() const override {return QueueCommandTypes::kMessageSetStatusRead;} |
500 | |
501 | CmdMessageSetStatusRead(StreamRead & des) : PlayerMessageCommand(des) {} |
502 | |
503 | @@ -719,7 +719,7 @@ |
504 | : PlayerMessageCommand(t, p, i) |
505 | {} |
506 | |
507 | - uint8_t id() const override {return QUEUE_CMD_MESSAGESETSTATUSARCHIVED;} |
508 | + QueueCommandTypes id() const override {return QueueCommandTypes::kMessageSetStatusArchived;} |
509 | |
510 | CmdMessageSetStatusArchived(StreamRead & des) : PlayerMessageCommand(des) { |
511 | } |
512 | @@ -737,7 +737,7 @@ |
513 | Warehouse & wh, bool isworker, DescriptionIndex ware, |
514 | Warehouse::StockPolicy policy); |
515 | |
516 | - uint8_t id() const override; |
517 | + QueueCommandTypes id() const override {return QueueCommandTypes::kSetStockPolicy;} |
518 | |
519 | void execute(Game & game) override; |
520 | |
521 | |
522 | === modified file 'src/logic/queue_cmd_factory.cc' |
523 | --- src/logic/queue_cmd_factory.cc 2014-09-09 11:23:11 +0000 |
524 | +++ src/logic/queue_cmd_factory.cc 2015-11-29 10:12:21 +0000 |
525 | @@ -1,5 +1,5 @@ |
526 | /* |
527 | - * Copyright (C) 2002-2004, 2008-2010 by the Widelands Development Team |
528 | + * Copyright (C) 2002-2004, 2008-2010, 2015 by the Widelands Development Team |
529 | * |
530 | * This program is free software; you can redistribute it and/or |
531 | * modify it under the terms of the GNU General Public License |
532 | @@ -27,82 +27,90 @@ |
533 | #include "logic/cmd_luascript.h" |
534 | #include "logic/instances.h" |
535 | #include "logic/playercommand.h" |
536 | -#include "logic/queue_cmd_ids.h" |
537 | |
538 | namespace Widelands { |
539 | |
540 | GameLogicCommand & QueueCmdFactory::create_correct_queue_command |
541 | - (uint32_t const id) |
542 | + (QueueCommandTypes const id) |
543 | { |
544 | switch (id) { |
545 | - case QUEUE_CMD_BUILD: |
546 | - return *new CmdBuild (); |
547 | - case QUEUE_CMD_FLAG: |
548 | - return *new CmdBuildFlag (); |
549 | - case QUEUE_CMD_BUILDROAD: |
550 | - return *new CmdBuildRoad (); |
551 | - case QUEUE_CMD_FLAGACTION: |
552 | - return *new CmdFlagAction (); |
553 | - case QUEUE_CMD_STOPBUILDING: |
554 | - return *new CmdStartStopBuilding (); |
555 | - case QUEUE_CMD_PORT_START_EXPEDITION: |
556 | - return *new CmdStartOrCancelExpedition (); |
557 | - case QUEUE_CMD_SHIP_CONSTRUCT_PORT: |
558 | - return *new CmdShipConstructPort (); |
559 | - case QUEUE_CMD_SHIP_SCOUT: |
560 | - return *new CmdShipScoutDirection (); |
561 | - case QUEUE_CMD_SHIP_EXPLORE: |
562 | - return *new CmdShipExploreIsland (); |
563 | - case QUEUE_CMD_SHIP_SINK: |
564 | - return *new CmdShipSink (); |
565 | - case QUEUE_CMD_SHIP_CANCELEXPEDITION: |
566 | - return *new CmdShipCancelExpedition (); |
567 | - case QUEUE_CMD_ENHANCEBUILDING: |
568 | - return *new CmdEnhanceBuilding (); |
569 | - case QUEUE_CMD_BULLDOZE: |
570 | - return *new CmdBulldoze (); |
571 | - case QUEUE_CMD_DROPSOLDIER: |
572 | - return *new CmdDropSoldier (); |
573 | - case QUEUE_CMD_CHANGESOLDIERCAPACITY: |
574 | - return *new CmdChangeSoldierCapacity (); |
575 | - case QUEUE_CMD_ENEMYFLAGACTION: |
576 | - return *new CmdEnemyFlagAction (); |
577 | - case QUEUE_CMD_SETWAREPRIORITY: |
578 | - return *new CmdSetWarePriority (); |
579 | - case QUEUE_CMD_SETWARETARGETQUANTITY: |
580 | - return *new CmdSetWareTargetQuantity (); |
581 | - case QUEUE_CMD_RESETWARETARGETQUANTITY: |
582 | - return *new CmdResetWareTargetQuantity (); |
583 | - case QUEUE_CMD_SETWORKERTARGETQUANTITY: |
584 | - return *new CmdSetWorkerTargetQuantity (); |
585 | - case QUEUE_CMD_RESETWORKERTARGETQUANTITY: |
586 | - return *new CmdResetWorkerTargetQuantity (); |
587 | - case QUEUE_CMD_MESSAGESETSTATUSREAD: |
588 | - return *new CmdMessageSetStatusRead (); |
589 | - case QUEUE_CMD_MESSAGESETSTATUSARCHIVED: |
590 | - return *new CmdMessageSetStatusArchived (); |
591 | - case QUEUE_CMD_DESTROY_MAPOBJECT: |
592 | - return *new CmdDestroyMapObject (); |
593 | - case QUEUE_CMD_ACT: |
594 | - return *new CmdAct (); |
595 | - case QUEUE_CMD_INCORPORATE: |
596 | - return *new CmdIncorporate (); |
597 | - case QUEUE_CMD_LUASCRIPT: |
598 | - return *new CmdLuaScript (); |
599 | - case QUEUE_CMD_LUACOROUTINE: |
600 | - return *new CmdLuaCoroutine (); |
601 | - case QUEUE_CMD_CALCULATE_STATISTICS : |
602 | - return *new CmdCalculateStatistics (); |
603 | - case QUEUE_CMD_CALL_ECONOMY_BALANCE: |
604 | - return *new CmdCallEconomyBalance (); |
605 | - case QUEUE_CMD_SETWAREMAXFILL: |
606 | - return *new CmdSetWareMaxFill (); |
607 | - case QUEUE_CMD_DISMANTLEBUILDING: |
608 | - return *new CmdDismantleBuilding (); |
609 | - case QUEUE_CMD_EVICTWORKER: |
610 | + case QueueCommandTypes::kBuild: |
611 | + return *new CmdBuild(); |
612 | + case QueueCommandTypes::kFlag: |
613 | + return *new CmdBuildFlag(); |
614 | + case QueueCommandTypes::kBuildRoad: |
615 | + return *new CmdBuildRoad(); |
616 | + case QueueCommandTypes::kFlagAction: |
617 | + return *new CmdFlagAction(); |
618 | + case QueueCommandTypes::kStopBuilding: |
619 | + return *new CmdStartStopBuilding(); |
620 | + case QueueCommandTypes::kEnhanceBuilding: |
621 | + return *new CmdEnhanceBuilding(); |
622 | + case QueueCommandTypes::kBulldoze: |
623 | + return *new CmdBulldoze(); |
624 | + case QueueCommandTypes::kChangeTrainingOptions: |
625 | + return *new CmdChangeTrainingOptions(); |
626 | + case QueueCommandTypes::kDropSoldier: |
627 | + return *new CmdDropSoldier(); |
628 | + case QueueCommandTypes::kChangeSoldierCapacity: |
629 | + return *new CmdChangeSoldierCapacity(); |
630 | + case QueueCommandTypes::kEnemyFlagAction: |
631 | + return *new CmdEnemyFlagAction(); |
632 | + case QueueCommandTypes::kSetWarePriority: |
633 | + return *new CmdSetWarePriority(); |
634 | + case QueueCommandTypes::kSetWareTargetQuantity: |
635 | + return *new CmdSetWareTargetQuantity(); |
636 | + case QueueCommandTypes::kResetWareTargetQuantity: |
637 | + return *new CmdResetWareTargetQuantity(); |
638 | + case QueueCommandTypes::kSetWorkerTargetQuantity: |
639 | + return *new CmdSetWorkerTargetQuantity(); |
640 | + case QueueCommandTypes::kResetWorkerTargetQuantity: |
641 | + return *new CmdResetWorkerTargetQuantity(); |
642 | + case QueueCommandTypes::kSetWareMaxFill: |
643 | + return *new CmdSetWareMaxFill(); |
644 | + case QueueCommandTypes::kMessageSetStatusRead: |
645 | + return *new CmdMessageSetStatusRead(); |
646 | + case QueueCommandTypes::kMessageSetStatusArchived: |
647 | + return *new CmdMessageSetStatusArchived(); |
648 | + case QueueCommandTypes::kSetStockPolicy: |
649 | + return *new CmdSetStockPolicy(); |
650 | + case QueueCommandTypes::kDismantleBuilding: |
651 | + return *new CmdDismantleBuilding(); |
652 | + case QueueCommandTypes::kEvictWorker: |
653 | return *new CmdEvictWorker(); |
654 | - case QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE: |
655 | + case QueueCommandTypes::kMilitarysiteSetSoldierPreference: |
656 | return *new CmdMilitarySiteSetSoldierPreference(); |
657 | + case QueueCommandTypes::kSinkShip: |
658 | + return *new CmdShipSink(); |
659 | + case QueueCommandTypes::kShipCancelExpedition: |
660 | + return *new CmdShipCancelExpedition(); |
661 | + case QueueCommandTypes::kPortStartExpedition: |
662 | + return *new CmdStartOrCancelExpedition(); |
663 | + case QueueCommandTypes::kShipConstructPort: |
664 | + return *new CmdShipConstructPort(); |
665 | + case QueueCommandTypes::kShipScout: |
666 | + return *new CmdShipScoutDirection(); |
667 | + case QueueCommandTypes::kShipExplore: |
668 | + return *new CmdShipExploreIsland(); |
669 | + case QueueCommandTypes::kDestroyMapObject: |
670 | + return *new CmdDestroyMapObject(); |
671 | + case QueueCommandTypes::kAct: |
672 | + return *new CmdAct(); |
673 | + case QueueCommandTypes::kIncorporate: |
674 | + return *new CmdIncorporate(); |
675 | + case QueueCommandTypes::kLuaScript: |
676 | + return *new CmdLuaScript(); |
677 | + case QueueCommandTypes::kLuaCoroutine: |
678 | + return *new CmdLuaCoroutine(); |
679 | + case QueueCommandTypes::kCalculateStatistics : |
680 | + return *new CmdCalculateStatistics(); |
681 | + case QueueCommandTypes::kCallEconomyBalance: |
682 | + return *new CmdCallEconomyBalance(); |
683 | + case QueueCommandTypes::kDeleteMessage: // Not a logic command |
684 | + case QueueCommandTypes::kNetCheckSync: |
685 | + case QueueCommandTypes::kReplaySyncWrite: |
686 | + case QueueCommandTypes::kReplaySyncRead: |
687 | + case QueueCommandTypes::kReplayEnd: |
688 | default: |
689 | throw wexception("Unknown Queue_Cmd_Id in file: %u", id); |
690 | } |
691 | |
692 | === modified file 'src/logic/queue_cmd_factory.h' |
693 | --- src/logic/queue_cmd_factory.h 2014-09-09 11:23:11 +0000 |
694 | +++ src/logic/queue_cmd_factory.h 2015-11-29 10:12:21 +0000 |
695 | @@ -22,6 +22,8 @@ |
696 | |
697 | #include <stdint.h> |
698 | |
699 | +#include "logic/queue_cmd_ids.h" |
700 | + |
701 | namespace Widelands { |
702 | |
703 | struct GameLogicCommand; |
704 | @@ -31,7 +33,7 @@ |
705 | * from the queue command file ids |
706 | */ |
707 | namespace QueueCmdFactory { |
708 | - GameLogicCommand & create_correct_queue_command(uint32_t id); |
709 | + GameLogicCommand & create_correct_queue_command(Widelands::QueueCommandTypes id); |
710 | } |
711 | |
712 | } |
713 | |
714 | === modified file 'src/logic/queue_cmd_ids.h' |
715 | --- src/logic/queue_cmd_ids.h 2014-09-15 10:17:53 +0000 |
716 | +++ src/logic/queue_cmd_ids.h 2015-11-29 10:12:21 +0000 |
717 | @@ -31,62 +31,71 @@ |
718 | * writing to files |
719 | */ |
720 | |
721 | -/* ID zero is reserved and must never be used */ |
722 | -#define QUEUE_CMD_NONE 0 |
723 | - |
724 | -/* PLAYER COMMANDS BELOW */ |
725 | -#define QUEUE_CMD_BUILD 1 |
726 | -#define QUEUE_CMD_FLAG 2 |
727 | -#define QUEUE_CMD_BUILDROAD 3 |
728 | -#define QUEUE_CMD_FLAGACTION 4 |
729 | -#define QUEUE_CMD_STOPBUILDING 5 |
730 | -#define QUEUE_CMD_ENHANCEBUILDING 6 |
731 | -#define QUEUE_CMD_BULLDOZE 7 |
732 | -#define QUEUE_CMD_CHANGETRAININGOPTIONS 8 |
733 | -#define QUEUE_CMD_DROPSOLDIER 9 |
734 | -#define QUEUE_CMD_CHANGESOLDIERCAPACITY 10 |
735 | -#define QUEUE_CMD_ENEMYFLAGACTION 11 |
736 | -#define QUEUE_CMD_SETWAREPRIORITY 12 |
737 | -#define QUEUE_CMD_SETWARETARGETQUANTITY 13 |
738 | -#define QUEUE_CMD_RESETWARETARGETQUANTITY 14 |
739 | -#define QUEUE_CMD_SETWORKERTARGETQUANTITY 15 |
740 | -#define QUEUE_CMD_RESETWORKERTARGETQUANTITY 16 |
741 | - |
742 | -#define QUEUE_CMD_CHANGEMILITARYCONFIG 17 |
743 | -#define QUEUE_CMD_SETWAREMAXFILL 18 |
744 | - |
745 | -#define QUEUE_CMD_MESSAGESETSTATUSREAD 21 |
746 | -#define QUEUE_CMD_MESSAGESETSTATUSARCHIVED 22 |
747 | - |
748 | -#define QUEUE_CMD_SETSTOCKPOLICY 23 |
749 | -#define QUEUE_CMD_DISMANTLEBUILDING 24 |
750 | - |
751 | -#define QUEUE_CMD_EVICTWORKER 25 |
752 | - |
753 | -#define QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE 26 |
754 | - |
755 | -#define QUEUE_CMD_SHIP_SINK 121 |
756 | -#define QUEUE_CMD_SHIP_CANCELEXPEDITION 122 |
757 | - |
758 | -#define QUEUE_CMD_PORT_START_EXPEDITION 123 |
759 | -#define QUEUE_CMD_SHIP_CONSTRUCT_PORT 124 |
760 | -#define QUEUE_CMD_SHIP_SCOUT 125 |
761 | -#define QUEUE_CMD_SHIP_EXPLORE 126 |
762 | - |
763 | -#define QUEUE_CMD_DESTROY_MAPOBJECT 127 |
764 | -#define QUEUE_CMD_ACT 128 |
765 | -// 129 was a command related to old events. removed |
766 | -#define QUEUE_CMD_INCORPORATE 130 |
767 | -#define QUEUE_CMD_LUASCRIPT 131 |
768 | -#define QUEUE_CMD_LUACOROUTINE 132 |
769 | -#define QUEUE_CMD_CALCULATE_STATISTICS 133 |
770 | - |
771 | -#define QUEUE_CMD_CALL_ECONOMY_BALANCE 200 |
772 | -#define QUEUE_CMD_DELETEMESSAGE 201 |
773 | - |
774 | -#define QUEUE_CMD_NETCHECKSYNC 250 |
775 | -#define QUEUE_CMD_REPLAYSYNCWRITE 251 |
776 | -#define QUEUE_CMD_REPLAYSYNCREAD 252 |
777 | -#define QUEUE_CMD_REPLAYEND 253 |
778 | +namespace Widelands { |
779 | + |
780 | +enum class QueueCommandTypes { |
781 | + |
782 | + /* ID zero is reserved and must never be used */ |
783 | + kNone = 0, |
784 | + |
785 | + /* PLAYER COMMANDS BELOW */ |
786 | + kBuild, |
787 | + kFlag, |
788 | + kBuildRoad, |
789 | + kFlagAction, |
790 | + kStopBuilding, |
791 | + kEnhanceBuilding, |
792 | + kBulldoze, |
793 | + |
794 | + kChangeTrainingOptions, |
795 | + kDropSoldier, |
796 | + kChangeSoldierCapacity, |
797 | + kEnemyFlagAction, |
798 | + |
799 | + kSetWarePriority, |
800 | + kSetWareTargetQuantity, |
801 | + kResetWareTargetQuantity, |
802 | + kSetWorkerTargetQuantity, |
803 | + kResetWorkerTargetQuantity, // 16 |
804 | + |
805 | + // 17 was a command related to old events. removed |
806 | + |
807 | + kSetWareMaxFill = 18, |
808 | + |
809 | + kMessageSetStatusRead = 21, |
810 | + kMessageSetStatusArchived, |
811 | + |
812 | + kSetStockPolicy, |
813 | + kDismantleBuilding, |
814 | + |
815 | + kEvictWorker, |
816 | + |
817 | + kMilitarysiteSetSoldierPreference, // 26 |
818 | + |
819 | + kSinkShip = 121, |
820 | + kShipCancelExpedition, |
821 | + kPortStartExpedition, |
822 | + kShipConstructPort, |
823 | + kShipScout, |
824 | + kShipExplore, |
825 | + |
826 | + kDestroyMapObject, |
827 | + kAct, // 128 |
828 | + // 129 was a command related to old events. removed |
829 | + kIncorporate = 130, |
830 | + kLuaScript, |
831 | + kLuaCoroutine, |
832 | + kCalculateStatistics, // 133 |
833 | + kCallEconomyBalance = 200, |
834 | + |
835 | + kDeleteMessage, // 201 |
836 | + |
837 | + kNetCheckSync = 250, |
838 | + kReplaySyncWrite, |
839 | + kReplaySyncRead, |
840 | + kReplayEnd // 253 |
841 | +}; |
842 | + |
843 | +} // namespace Widelands |
844 | |
845 | #endif // end of include guard: WL_LOGIC_QUEUE_CMD_IDS_H |
846 | |
847 | === modified file 'src/logic/replay.cc' |
848 | --- src/logic/replay.cc 2015-10-24 15:42:37 +0000 |
849 | +++ src/logic/replay.cc 2015-11-29 10:12:21 +0000 |
850 | @@ -52,7 +52,7 @@ |
851 | : Command(_duetime), m_hash(hash) |
852 | {} |
853 | |
854 | - uint8_t id() const override {return QUEUE_CMD_REPLAYSYNCREAD;} |
855 | + QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;} |
856 | |
857 | void execute(Game & game) override |
858 | { |
859 | @@ -203,7 +203,7 @@ |
860 | public: |
861 | CmdReplaySyncWrite(const uint32_t _duetime) : Command(_duetime) {} |
862 | |
863 | - uint8_t id() const override {return QUEUE_CMD_REPLAYSYNCWRITE;} |
864 | + QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncWrite;} |
865 | |
866 | void execute(Game & game) override { |
867 | if (ReplayWriter * const rw = game.get_replaywriter()) { |
868 | |
869 | === modified file 'src/logic/replay_game_controller.cc' |
870 | --- src/logic/replay_game_controller.cc 2015-11-08 17:31:06 +0000 |
871 | +++ src/logic/replay_game_controller.cc 2015-11-29 10:12:21 +0000 |
872 | @@ -113,6 +113,6 @@ |
873 | mmb.run<UI::Panel::Returncodes>(); |
874 | } |
875 | |
876 | -uint8_t ReplayGameController::CmdReplayEnd::id() const { |
877 | - return QUEUE_CMD_REPLAYEND; |
878 | +Widelands::QueueCommandTypes ReplayGameController::CmdReplayEnd::id() const { |
879 | + return Widelands::QueueCommandTypes::kReplayEnd; |
880 | } |
881 | |
882 | === modified file 'src/logic/replay_game_controller.h' |
883 | --- src/logic/replay_game_controller.h 2015-11-21 10:16:52 +0000 |
884 | +++ src/logic/replay_game_controller.h 2015-11-29 10:12:21 +0000 |
885 | @@ -48,7 +48,7 @@ |
886 | struct CmdReplayEnd : public Widelands::Command { |
887 | CmdReplayEnd (uint32_t const _duetime) : Widelands::Command(_duetime) {} |
888 | virtual void execute (Widelands::Game & game); |
889 | - virtual uint8_t id() const; |
890 | + virtual Widelands::QueueCommandTypes id() const; |
891 | }; |
892 | |
893 | Widelands::Game & m_game; |
894 | |
895 | === modified file 'src/network/network.h' |
896 | --- src/network/network.h 2015-11-21 10:16:52 +0000 |
897 | +++ src/network/network.h 2015-11-29 10:12:21 +0000 |
898 | @@ -49,7 +49,7 @@ |
899 | |
900 | void execute (Widelands::Game &) override; |
901 | |
902 | - uint8_t id() const override {return QUEUE_CMD_NETCHECKSYNC;} |
903 | + Widelands::QueueCommandTypes id() const override {return Widelands::QueueCommandTypes::kNetCheckSync;} |
904 | |
905 | private: |
906 | SyncCallback * m_callback; |
can go as well