Merge lp:~widelands-dev/widelands/bug-1395278-logic3 into lp:widelands
- bug-1395278-logic3
- Merge into trunk
Proposed by
Klaus Halfmann
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7866 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1395278-logic3 | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
1743 lines (+444/-444) 26 files modified
src/game_io/game_cmd_queue_packet.cc (+2/-2) src/game_io/game_loader.cc (+15/-15) src/game_io/game_loader.h (+1/-1) src/game_io/game_saver.cc (+9/-9) src/game_io/game_saver.h (+1/-1) src/logic/game.cc (+2/-2) src/logic/map.cc (+33/-33) src/logic/map_objects/tribes/ship.cc (+3/-3) src/logic/map_objects/tribes/soldier.cc (+4/-4) src/logic/map_revision.cc (+4/-4) src/logic/map_revision.h (+6/-6) src/logic/mapastar.h (+14/-14) src/logic/mapdifferenceregion.cc (+19/-19) src/logic/mapdifferenceregion.h (+9/-9) src/logic/mapfringeregion.cc (+28/-28) src/logic/mapfringeregion.h (+13/-13) src/logic/maphollowregion.cc (+35/-35) src/logic/maphollowregion.h (+8/-8) src/logic/mapregion.h (+21/-21) src/logic/maptriangleregion.cc (+142/-142) src/logic/maptriangleregion.h (+33/-33) src/logic/message_queue.h (+22/-22) src/logic/path.cc (+1/-1) src/logic/player.cc (+2/-2) src/logic/replay.cc (+4/-4) src/map_io/map_version_packet.cc (+13/-13) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1395278-logic3 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Widelands Developers | Pending | ||
Review via email: mp+287827@code.launchpad.net |
Commit message
Refactored remaining member variable names in src/logic.
Description of the change
Did a code review, found pure renaming only,
will continue to play the game from the last review (bug-1395278-logic2) now.
To post a comment you must log in.
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote : | # |
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Thanks for the review :)
This can go in once Travis comes through.
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
@bunnybot merge
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/game_io/game_cmd_queue_packet.cc' |
2 | --- src/game_io/game_cmd_queue_packet.cc 2016-02-15 23:26:42 +0000 |
3 | +++ src/game_io/game_cmd_queue_packet.cc 2016-03-02 18:10:45 +0000 |
4 | @@ -41,7 +41,7 @@ |
5 | if (packet_version == kCurrentPacketVersion) { |
6 | CmdQueue & cmdq = game.cmdqueue(); |
7 | |
8 | - // nothing to be done for m_game |
9 | + // nothing to be done for game_ |
10 | |
11 | // Next serial |
12 | cmdq.nextserial_ = fr.unsigned_32(); |
13 | @@ -86,7 +86,7 @@ |
14 | |
15 | const CmdQueue & cmdq = game.cmdqueue(); |
16 | |
17 | - // nothing to be done for m_game |
18 | + // nothing to be done for game_ |
19 | |
20 | // Next serial |
21 | fw.unsigned_32(cmdq.nextserial_); |
22 | |
23 | === modified file 'src/game_io/game_loader.cc' |
24 | --- src/game_io/game_loader.cc 2016-01-20 20:12:00 +0000 |
25 | +++ src/game_io/game_loader.cc 2016-03-02 18:10:45 +0000 |
26 | @@ -40,7 +40,7 @@ |
27 | namespace Widelands { |
28 | |
29 | GameLoader::GameLoader(const std::string & path, Game & game) : |
30 | - m_fs(*g_fs->make_sub_file_system(path)), m_game(game) |
31 | + m_fs(*g_fs->make_sub_file_system(path)), game_(game) |
32 | {} |
33 | |
34 | |
35 | @@ -53,7 +53,7 @@ |
36 | */ |
37 | int32_t GameLoader::preload_game(GamePreloadPacket & mp) { |
38 | // Load elemental data block |
39 | - mp.read(m_fs, m_game, nullptr); |
40 | + mp.read(m_fs, game_, nullptr); |
41 | |
42 | return 0; |
43 | } |
44 | @@ -65,43 +65,43 @@ |
45 | ScopedTimer timer("GameLoader::load() took %ums"); |
46 | |
47 | log("Game: Reading Preload Data ... "); |
48 | - {GamePreloadPacket p; p.read(m_fs, m_game);} |
49 | + {GamePreloadPacket p; p.read(m_fs, game_);} |
50 | log("took %ums\n", timer.ms_since_last_query()); |
51 | |
52 | log("Game: Reading Game Class Data ... "); |
53 | - {GameClassPacket p; p.read(m_fs, m_game);} |
54 | + {GameClassPacket p; p.read(m_fs, game_);} |
55 | log("took %ums\n", timer.ms_since_last_query()); |
56 | |
57 | log("Game: Reading Map Data ... "); |
58 | - GameMapPacket M; M.read(m_fs, m_game); |
59 | + GameMapPacket M; M.read(m_fs, game_); |
60 | log("Game: Reading Map Data took %ums\n", timer.ms_since_last_query()); |
61 | |
62 | log("Game: Reading Player Info ... "); |
63 | - {GamePlayerInfoPacket p; p.read(m_fs, m_game);} |
64 | + {GamePlayerInfoPacket p; p.read(m_fs, game_);} |
65 | log("Game: Reading Player Info took %ums\n", timer.ms_since_last_query()); |
66 | |
67 | log("Game: Calling read_complete()\n"); |
68 | - M.read_complete(m_game); |
69 | + M.read_complete(game_); |
70 | log("Game: read_complete took: %ums\n", timer.ms_since_last_query()); |
71 | |
72 | MapObjectLoader * const mol = M.get_map_object_loader(); |
73 | |
74 | log("Game: Reading Player Economies Info ... "); |
75 | - {GamePlayerEconomiesPacket p; p.read(m_fs, m_game, mol);} |
76 | + {GamePlayerEconomiesPacket p; p.read(m_fs, game_, mol);} |
77 | log("took %ums\n", timer.ms_since_last_query()); |
78 | |
79 | log("Game: Reading ai persistent data ... "); |
80 | - {GamePlayerAiPersistentPacket p; p.read(m_fs, m_game, mol);} |
81 | + {GamePlayerAiPersistentPacket p; p.read(m_fs, game_, mol);} |
82 | log("took %ums\n", timer.ms_since_last_query()); |
83 | |
84 | log("Game: Reading Command Queue Data ... "); |
85 | - {GameCmdQueuePacket p; p.read(m_fs, m_game, mol);} |
86 | + {GameCmdQueuePacket p; p.read(m_fs, game_, mol);} |
87 | log("took %ums\n", timer.ms_since_last_query()); |
88 | |
89 | // This must be after the command queue has been read. |
90 | log("Game: Parsing messages ... "); |
91 | - PlayerNumber const nr_players = m_game.map().get_nrplayers(); |
92 | - iterate_players_existing_const(p, nr_players, m_game, player) { |
93 | + PlayerNumber const nr_players = game_.map().get_nrplayers(); |
94 | + iterate_players_existing_const(p, nr_players, game_, player) { |
95 | const MessageQueue & messages = player->messages(); |
96 | for (std::pair<MessageId, Message *> temp_message : messages) { |
97 | Message* m = temp_message.second; |
98 | @@ -109,7 +109,7 @@ |
99 | |
100 | // Renew MapObject connections |
101 | if (m->serial() > 0) { |
102 | - MapObject* mo = m_game.objects().get_object(m->serial()); |
103 | + MapObject* mo = game_.objects().get_object(m->serial()); |
104 | mo->removed.connect |
105 | (boost::bind(&Player::message_object_removed, player, m_id)); |
106 | } |
107 | @@ -118,14 +118,14 @@ |
108 | log("took %ums\n", timer.ms_since_last_query()); |
109 | |
110 | // For compatibility hacks only |
111 | - mol->load_finish_game(m_game); |
112 | + mol->load_finish_game(game_); |
113 | |
114 | // Only read and use interactive player data, if we load a singleplayer game. |
115 | // In multiplayer games every client needs to create a new interactive |
116 | // player. |
117 | if (!multiplayer) { |
118 | log("Game: Reading Interactive Player Data ... "); |
119 | - {GameInteractivePlayerPacket p; p.read(m_fs, m_game, mol);} |
120 | + {GameInteractivePlayerPacket p; p.read(m_fs, game_, mol);} |
121 | log("took %ums\n", timer.ms_since_last_query()); |
122 | } |
123 | |
124 | |
125 | === modified file 'src/game_io/game_loader.h' |
126 | --- src/game_io/game_loader.h 2014-09-10 07:57:29 +0000 |
127 | +++ src/game_io/game_loader.h 2016-03-02 18:10:45 +0000 |
128 | @@ -44,7 +44,7 @@ |
129 | |
130 | private: |
131 | FileSystem & m_fs; |
132 | - Game & m_game; |
133 | + Game & game_; |
134 | }; |
135 | |
136 | } |
137 | |
138 | === modified file 'src/game_io/game_saver.cc' |
139 | --- src/game_io/game_saver.cc 2016-01-20 20:12:00 +0000 |
140 | +++ src/game_io/game_saver.cc 2016-03-02 18:10:45 +0000 |
141 | @@ -34,7 +34,7 @@ |
142 | |
143 | namespace Widelands { |
144 | |
145 | -GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), m_game(game) { |
146 | +GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), game_(game) { |
147 | } |
148 | |
149 | |
150 | @@ -47,37 +47,37 @@ |
151 | m_fs.ensure_directory_exists("binary"); |
152 | |
153 | log("Game: Writing Preload Data ... "); |
154 | - {GamePreloadPacket p; p.write(m_fs, m_game, nullptr);} |
155 | + {GamePreloadPacket p; p.write(m_fs, game_, nullptr);} |
156 | log("took %ums\n", timer.ms_since_last_query()); |
157 | |
158 | log("Game: Writing Game Class Data ... "); |
159 | - {GameClassPacket p; p.write(m_fs, m_game, nullptr);} |
160 | + {GameClassPacket p; p.write(m_fs, game_, nullptr);} |
161 | log("took %ums\n", timer.ms_since_last_query()); |
162 | |
163 | log("Game: Writing Player Info ... "); |
164 | - {GamePlayerInfoPacket p; p.write(m_fs, m_game, nullptr);} |
165 | + {GamePlayerInfoPacket p; p.write(m_fs, game_, nullptr);} |
166 | log("took %ums\n", timer.ms_since_last_query()); |
167 | |
168 | log("Game: Writing Map Data!\n"); |
169 | - GameMapPacket M; M.write(m_fs, m_game, nullptr); |
170 | + GameMapPacket M; M.write(m_fs, game_, nullptr); |
171 | log("Game: Writing Map Data took %ums\n", timer.ms_since_last_query()); |
172 | |
173 | MapObjectSaver * const mos = M.get_map_object_saver(); |
174 | |
175 | log("Game: Writing Player Economies Info ... "); |
176 | - {GamePlayerEconomiesPacket p; p.write(m_fs, m_game, mos);} |
177 | + {GamePlayerEconomiesPacket p; p.write(m_fs, game_, mos);} |
178 | log("took %ums\n", timer.ms_since_last_query()); |
179 | |
180 | log("Game: Writing ai persistent data ... "); |
181 | - {GamePlayerAiPersistentPacket p; p.write(m_fs, m_game, mos);} |
182 | + {GamePlayerAiPersistentPacket p; p.write(m_fs, game_, mos);} |
183 | log("took %ums\n", timer.ms_since_last_query()); |
184 | |
185 | log("Game: Writing Command Queue Data ... "); |
186 | - {GameCmdQueuePacket p; p.write(m_fs, m_game, mos);} |
187 | + {GameCmdQueuePacket p; p.write(m_fs, game_, mos);} |
188 | log("took %ums\n", timer.ms_since_last_query()); |
189 | |
190 | log("Game: Writing Interactive Player Data ... "); |
191 | - {GameInteractivePlayerPacket p; p.write(m_fs, m_game, mos);} |
192 | + {GameInteractivePlayerPacket p; p.write(m_fs, game_, mos);} |
193 | log("took %ums\n", timer.ms_since_last_query()); |
194 | } |
195 | |
196 | |
197 | === modified file 'src/game_io/game_saver.h' |
198 | --- src/game_io/game_saver.h 2014-09-10 07:57:29 +0000 |
199 | +++ src/game_io/game_saver.h 2016-03-02 18:10:45 +0000 |
200 | @@ -44,7 +44,7 @@ |
201 | |
202 | private: |
203 | FileSystem & m_fs; |
204 | - Game & m_game; |
205 | + Game & game_; |
206 | }; |
207 | |
208 | } |
209 | |
210 | === modified file 'src/logic/game.cc' |
211 | --- src/logic/game.cc 2016-02-21 18:02:23 +0000 |
212 | +++ src/logic/game.cc 2016-03-02 18:10:45 +0000 |
213 | @@ -89,8 +89,8 @@ |
214 | |
215 | void Game::SyncWrapper::data(void const * const sync_data, size_t const size) { |
216 | #ifdef SYNC_DEBUG |
217 | - uint32_t time = m_game.get_gametime(); |
218 | - log("[sync:%08u t=%6u]", m_counter, time); |
219 | + uint32_t time = game_.get_gametime(); |
220 | + log("[sync:%08u t=%6u]", counter_, time); |
221 | for (size_t i = 0; i < size; ++i) |
222 | log(" %02x", (static_cast<uint8_t const *>(sync_data))[i]); |
223 | log("\n"); |
224 | |
225 | === modified file 'src/logic/map.cc' |
226 | --- src/logic/map.cc 2016-03-02 10:04:54 +0000 |
227 | +++ src/logic/map.cc 2016-03-02 18:10:45 +0000 |
228 | @@ -664,7 +664,7 @@ |
229 | */ |
230 | struct FindBobsCallback { |
231 | FindBobsCallback(std::vector<Bob *> * const list, const FindBob & functor) |
232 | - : m_list(list), m_functor(functor), m_found(0) {} |
233 | + : list_(list), functor_(functor), found_(0) {} |
234 | |
235 | void operator()(const Map &, const FCoords cur) { |
236 | for |
237 | @@ -673,22 +673,22 @@ |
238 | bob = bob->get_next_bob()) |
239 | { |
240 | if |
241 | - (m_list && |
242 | - std::find(m_list->begin(), m_list->end(), bob) != m_list->end()) |
243 | + (list_ && |
244 | + std::find(list_->begin(), list_->end(), bob) != list_->end()) |
245 | continue; |
246 | |
247 | - if (m_functor.accept(bob)) { |
248 | - if (m_list) |
249 | - m_list->push_back(bob); |
250 | + if (functor_.accept(bob)) { |
251 | + if (list_) |
252 | + list_->push_back(bob); |
253 | |
254 | - ++m_found; |
255 | + ++found_; |
256 | } |
257 | } |
258 | } |
259 | |
260 | - std::vector<Bob *> * m_list; |
261 | - const FindBob & m_functor; |
262 | - uint32_t m_found; |
263 | + std::vector<Bob*>* list_; |
264 | + const FindBob& functor_; |
265 | + uint32_t found_; |
266 | }; |
267 | |
268 | |
269 | @@ -711,7 +711,7 @@ |
270 | |
271 | find(area, cb); |
272 | |
273 | - return cb.m_found; |
274 | + return cb.found_; |
275 | } |
276 | |
277 | |
278 | @@ -737,7 +737,7 @@ |
279 | |
280 | find_reachable(area, checkstep, cb); |
281 | |
282 | - return cb.m_found; |
283 | + return cb.found_; |
284 | } |
285 | |
286 | |
287 | @@ -751,7 +751,7 @@ |
288 | struct FindImmovablesCallback { |
289 | FindImmovablesCallback |
290 | (std::vector<ImmovableFound> * const list, const FindImmovable & functor) |
291 | - : m_list(list), m_functor(functor), m_found(0) {} |
292 | + : list_(list), functor_(functor), found_(0) {} |
293 | |
294 | void operator()(const Map &, const FCoords cur) { |
295 | BaseImmovable * const imm = cur.field->get_immovable(); |
296 | @@ -759,21 +759,21 @@ |
297 | if (!imm) |
298 | return; |
299 | |
300 | - if (m_functor.accept(*imm)) { |
301 | - if (m_list) { |
302 | + if (functor_.accept(*imm)) { |
303 | + if (list_) { |
304 | ImmovableFound imf; |
305 | imf.object = imm; |
306 | imf.coords = cur; |
307 | - m_list->push_back(imf); |
308 | + list_->push_back(imf); |
309 | } |
310 | |
311 | - ++m_found; |
312 | + ++found_; |
313 | } |
314 | } |
315 | |
316 | - std::vector<ImmovableFound> * m_list; |
317 | - const FindImmovable & m_functor; |
318 | - uint32_t m_found; |
319 | + std::vector<ImmovableFound>* list_; |
320 | + const FindImmovable& functor_; |
321 | + uint32_t found_; |
322 | }; |
323 | |
324 | |
325 | @@ -794,7 +794,7 @@ |
326 | |
327 | find(area, cb); |
328 | |
329 | - return cb.m_found; |
330 | + return cb.found_; |
331 | } |
332 | |
333 | |
334 | @@ -818,7 +818,7 @@ |
335 | |
336 | find_reachable(area, checkstep, cb); |
337 | |
338 | - return cb.m_found; |
339 | + return cb.found_; |
340 | } |
341 | |
342 | |
343 | @@ -862,20 +862,20 @@ |
344 | struct FindNodesCallback { |
345 | FindNodesCallback |
346 | (std::vector<Coords> * const list, const FindNode & functor) |
347 | - : m_list(list), m_functor(functor), m_found(0) {} |
348 | + : list_(list), functor_(functor), found_(0) {} |
349 | |
350 | void operator()(const Map & map, const FCoords cur) { |
351 | - if (m_functor.accept(map, cur)) { |
352 | - if (m_list) |
353 | - m_list->push_back(cur); |
354 | + if (functor_.accept(map, cur)) { |
355 | + if (list_) |
356 | + list_->push_back(cur); |
357 | |
358 | - ++m_found; |
359 | + ++found_; |
360 | } |
361 | } |
362 | |
363 | - std::vector<Coords> * m_list; |
364 | - const FindNode & m_functor; |
365 | - uint32_t m_found; |
366 | + std::vector<Coords>* list_; |
367 | + const FindNode & functor_; |
368 | + uint32_t found_; |
369 | }; |
370 | |
371 | |
372 | @@ -897,7 +897,7 @@ |
373 | |
374 | find(area, cb); |
375 | |
376 | - return cb.m_found; |
377 | + return cb.found_; |
378 | } |
379 | |
380 | |
381 | @@ -920,7 +920,7 @@ |
382 | |
383 | find_reachable(area, checkstep, cb); |
384 | |
385 | - return cb.m_found; |
386 | + return cb.found_; |
387 | } |
388 | |
389 | |
390 | @@ -1424,7 +1424,7 @@ |
391 | rx = lx + dist; |
392 | |
393 | // Allow for wrap-around |
394 | - // Yes, the second is an else if; see the above if (dist >= m_width) |
395 | + // Yes, the second is an else if; see the above if (dist >= width_) |
396 | if (lx < 0) |
397 | lx += width_; |
398 | else if (rx >= static_cast<int32_t>(width_)) |
399 | |
400 | === modified file 'src/logic/map_objects/tribes/ship.cc' |
401 | --- src/logic/map_objects/tribes/ship.cc 2016-02-21 18:02:23 +0000 |
402 | +++ src/logic/map_objects/tribes/ship.cc 2016-03-02 18:10:45 +0000 |
403 | @@ -748,9 +748,9 @@ |
404 | uint32_t Ship::calculate_sea_route(Game& game, PortDock& pd, Path* finalpath) { |
405 | Map& map = game.map(); |
406 | StepEvalAStar se(pd.get_warehouse()->get_position()); |
407 | - se.m_swim = true; |
408 | - se.m_conservative = false; |
409 | - se.m_estimator_bias = -5 * map.calc_cost(0); |
410 | + se.swim_ = true; |
411 | + se.conservative_ = false; |
412 | + se.estimator_bias_ = -5 * map.calc_cost(0); |
413 | |
414 | MapAStar<StepEvalAStar> astar(map, se); |
415 | |
416 | |
417 | === modified file 'src/logic/map_objects/tribes/soldier.cc' |
418 | --- src/logic/map_objects/tribes/soldier.cc 2016-02-16 13:15:29 +0000 |
419 | +++ src/logic/map_objects/tribes/soldier.cc 2016-03-02 18:10:45 +0000 |
420 | @@ -425,7 +425,7 @@ |
421 | /// Calculates the actual position to draw on from the base node position. |
422 | /// This function takes battling into account. |
423 | /// |
424 | -/// pos is the location, in pixels, of the node m_position (height is already |
425 | +/// pos is the location, in pixels, of the node position_ (height is already |
426 | /// taken into account). |
427 | Point Soldier::calc_drawpos |
428 | (const EditorGameBase & game, const Point pos) const |
429 | @@ -695,13 +695,13 @@ |
430 | } |
431 | |
432 | struct FindNodeOwned { |
433 | - FindNodeOwned(PlayerNumber owner) : m_owner(owner) |
434 | + FindNodeOwned(PlayerNumber owner) : owner_(owner) |
435 | {} |
436 | bool accept(const Map&, const FCoords& coords) const { |
437 | - return (coords.field->get_owned_by() == m_owner); |
438 | + return (coords.field->get_owned_by() == owner_); |
439 | } |
440 | private: |
441 | - PlayerNumber m_owner; |
442 | + PlayerNumber owner_; |
443 | }; |
444 | |
445 | /** |
446 | |
447 | === modified file 'src/logic/map_revision.cc' |
448 | --- src/logic/map_revision.cc 2014-02-22 18:04:02 +0000 |
449 | +++ src/logic/map_revision.cc 2016-03-02 18:10:45 +0000 |
450 | @@ -25,11 +25,11 @@ |
451 | |
452 | |
453 | MapVersion::MapVersion() : |
454 | -m_map_version_major(0), |
455 | -m_map_version_minor(0) |
456 | +map_version_major_(0), |
457 | +map_version_minor_(0) |
458 | { |
459 | - m_map_creator_version = build_id(); |
460 | - m_map_version_timestamp = static_cast<uint32_t>(time(nullptr)); |
461 | + map_creator_version_ = build_id(); |
462 | + map_version_timestamp_ = static_cast<uint32_t>(time(nullptr)); |
463 | } |
464 | |
465 | } |
466 | |
467 | === modified file 'src/logic/map_revision.h' |
468 | --- src/logic/map_revision.h 2014-07-05 16:41:51 +0000 |
469 | +++ src/logic/map_revision.h 2016-03-02 18:10:45 +0000 |
470 | @@ -34,12 +34,12 @@ |
471 | |
472 | struct MapVersion { |
473 | |
474 | - std::string m_map_source_url; |
475 | - std::string m_map_source_release; |
476 | - std::string m_map_creator_version; |
477 | - int32_t m_map_version_major; |
478 | - int32_t m_map_version_minor; |
479 | - uint32_t m_map_version_timestamp; |
480 | + std::string map_source_url_; |
481 | + std::string map_source_release_; |
482 | + std::string map_creator_version_; |
483 | + int32_t map_version_major_; |
484 | + int32_t map_version_minor_; |
485 | + uint32_t map_version_timestamp_; |
486 | |
487 | MapVersion(); |
488 | |
489 | |
490 | === modified file 'src/logic/mapastar.h' |
491 | --- src/logic/mapastar.h 2016-02-15 23:26:42 +0000 |
492 | +++ src/logic/mapastar.h 2016-03-02 18:10:45 +0000 |
493 | @@ -53,37 +53,37 @@ |
494 | |
495 | struct StepEvalAStar { |
496 | StepEvalAStar(Coords target) : |
497 | - m_target(target), |
498 | - m_estimator_bias(0), |
499 | - m_conservative(true), |
500 | - m_swim(false) |
501 | + target_(target), |
502 | + estimator_bias_(0), |
503 | + conservative_(true), |
504 | + swim_(false) |
505 | { |
506 | } |
507 | |
508 | int32_t estimate(Map & map, FCoords pos) const |
509 | { |
510 | - int32_t est = m_estimator_bias; |
511 | - if (m_conservative) |
512 | - est += map.calc_cost_lowerbound(pos, m_target); |
513 | + int32_t est = estimator_bias_; |
514 | + if (conservative_) |
515 | + est += map.calc_cost_lowerbound(pos, target_); |
516 | else |
517 | - est += map.calc_cost_estimate(pos, m_target); |
518 | + est += map.calc_cost_estimate(pos, target_); |
519 | return est; |
520 | } |
521 | |
522 | int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const |
523 | { |
524 | if |
525 | - ((m_swim && !(to.field->nodecaps() & MOVECAPS_SWIM)) || |
526 | - (!m_swim && !(to.field->nodecaps() & MOVECAPS_WALK))) |
527 | + ((swim_ && !(to.field->nodecaps() & MOVECAPS_SWIM)) || |
528 | + (!swim_ && !(to.field->nodecaps() & MOVECAPS_WALK))) |
529 | return -1; |
530 | |
531 | return map.calc_cost(from, dir); |
532 | } |
533 | |
534 | - Coords m_target; |
535 | - int32_t m_estimator_bias; |
536 | - bool m_conservative; |
537 | - bool m_swim; |
538 | + Coords target_; |
539 | + int32_t estimator_bias_; |
540 | + bool conservative_; |
541 | + bool swim_; |
542 | }; |
543 | |
544 | |
545 | |
546 | === modified file 'src/logic/mapdifferenceregion.cc' |
547 | --- src/logic/mapdifferenceregion.cc 2016-01-18 19:35:25 +0000 |
548 | +++ src/logic/mapdifferenceregion.cc 2016-03-02 18:10:45 +0000 |
549 | @@ -25,17 +25,17 @@ |
550 | |
551 | template <> bool MapDifferenceRegion<Area<FCoords> >::advance(const Map & map) |
552 | { |
553 | - assert(1 <= m_direction); |
554 | - assert (m_direction <= 6); |
555 | - if (m_remaining_in_edge) { |
556 | - map.get_neighbour(m_area, m_direction, &m_area); |
557 | - --m_remaining_in_edge; |
558 | + assert(1 <= direction_); |
559 | + assert (direction_ <= 6); |
560 | + if (remaining_in_edge_) { |
561 | + map.get_neighbour(area_, direction_, &area_); |
562 | + --remaining_in_edge_; |
563 | return true; |
564 | } else { |
565 | - if (!m_passed_corner) { |
566 | - m_passed_corner = true; |
567 | - --m_direction; if (!m_direction) m_direction = 6; |
568 | - m_remaining_in_edge = m_area.radius; |
569 | + if (!passed_corner_) { |
570 | + passed_corner_ = true; |
571 | + --direction_; if (!direction_) direction_ = 6; |
572 | + remaining_in_edge_ = area_.radius; |
573 | return advance(map); |
574 | } |
575 | } |
576 | @@ -45,16 +45,16 @@ |
577 | template <> |
578 | void MapDifferenceRegion<Area<FCoords> >::move_to_other_side(const Map & map) |
579 | { |
580 | - assert(1 <= m_direction); |
581 | - assert (m_direction <= 6); |
582 | - assert(m_passed_corner); |
583 | - --m_direction; if (!m_direction) m_direction = 6; |
584 | - Area<FCoords>::RadiusType steps_left = m_area.radius + 1; |
585 | - switch (m_direction) { |
586 | + assert(1 <= direction_); |
587 | + assert (direction_ <= 6); |
588 | + assert(passed_corner_); |
589 | + --direction_; if (!direction_) direction_ = 6; |
590 | + Area<FCoords>::RadiusType steps_left = area_.radius + 1; |
591 | + switch (direction_) { |
592 | #define DIRECTION_CASE(dir, neighbour_function) \ |
593 | case dir: \ |
594 | for (; steps_left; --steps_left) \ |
595 | - map.neighbour_function(m_area, &m_area); \ |
596 | + map.neighbour_function(area_, &area_); \ |
597 | break; \ |
598 | |
599 | DIRECTION_CASE(WALK_NW, get_tln); |
600 | @@ -66,9 +66,9 @@ |
601 | default: |
602 | NEVER_HERE(); |
603 | } |
604 | - --m_direction; if (!m_direction) m_direction = 6; |
605 | - m_remaining_in_edge = m_area.radius; |
606 | - m_passed_corner = false; |
607 | + --direction_; if (!direction_) direction_ = 6; |
608 | + remaining_in_edge_ = area_.radius; |
609 | + passed_corner_ = false; |
610 | } |
611 | |
612 | } |
613 | |
614 | === modified file 'src/logic/mapdifferenceregion.h' |
615 | --- src/logic/mapdifferenceregion.h 2014-09-10 08:55:04 +0000 |
616 | +++ src/logic/mapdifferenceregion.h 2016-03-02 18:10:45 +0000 |
617 | @@ -40,7 +40,7 @@ |
618 | template <typename AreaType = Area<> > struct MapDifferenceRegion { |
619 | MapDifferenceRegion |
620 | (const Map & map, AreaType area, Direction direction) |
621 | - : m_area(area), m_remaining_in_edge(area.radius), m_passed_corner(false) |
622 | + : area_(area), remaining_in_edge_(area.radius), passed_corner_(false) |
623 | { |
624 | assert(1 <= direction); |
625 | assert (direction <= 6); |
626 | @@ -50,7 +50,7 @@ |
627 | #define DIRECTION_CASE(dir, neighbour_function) \ |
628 | case dir: \ |
629 | for (; area.radius; --area.radius) \ |
630 | - map.neighbour_function(m_area, &m_area); \ |
631 | + map.neighbour_function(area_, &area_); \ |
632 | break; \ |
633 | |
634 | DIRECTION_CASE(WALK_NW, get_tln); |
635 | @@ -63,10 +63,10 @@ |
636 | } |
637 | --direction; if (!direction) direction = 6; |
638 | --direction; if (!direction) direction = 6; |
639 | - m_direction = direction; |
640 | + direction_ = direction; |
641 | } |
642 | |
643 | - typename AreaType::CoordsType & location() const {return m_area;} |
644 | + typename AreaType::CoordsType & location() const {return area_;} |
645 | |
646 | /** |
647 | * Moves on to the next location. The return value indicates whether the new |
648 | @@ -80,12 +80,12 @@ |
649 | |
650 | void move_to_other_side(const Map & map); |
651 | |
652 | - typename AreaType::RadiusType radius() const {return m_area.radius;} |
653 | + typename AreaType::RadiusType radius() const {return area_.radius;} |
654 | private: |
655 | - AreaType m_area; |
656 | - typename AreaType::RadiusType m_remaining_in_edge; |
657 | - bool m_passed_corner; |
658 | - Direction m_direction; |
659 | + AreaType area_; |
660 | + typename AreaType::RadiusType remaining_in_edge_; |
661 | + bool passed_corner_; |
662 | + Direction direction_; |
663 | }; |
664 | |
665 | } |
666 | |
667 | === modified file 'src/logic/mapfringeregion.cc' |
668 | --- src/logic/mapfringeregion.cc 2016-01-18 19:35:25 +0000 |
669 | +++ src/logic/mapfringeregion.cc 2016-03-02 18:10:45 +0000 |
670 | @@ -25,56 +25,56 @@ |
671 | |
672 | template <> |
673 | bool MapFringeRegion<Area<FCoords> >::advance(const Map & map) { |
674 | - switch (m_phase) { |
675 | + switch (phase_) { |
676 | case 0: |
677 | - if (m_area.radius) { |
678 | - m_remaining_in_phase = m_area.radius; |
679 | - m_phase = 6; |
680 | + if (area_.radius) { |
681 | + remaining_in_phase_ = area_.radius; |
682 | + phase_ = 6; |
683 | } |
684 | else |
685 | return false; |
686 | /* no break */ |
687 | - case 1: map.get_trn(m_area, &m_area); break; |
688 | - case 2: map.get_tln(m_area, &m_area); break; |
689 | - case 3: map. get_ln(m_area, &m_area); break; |
690 | - case 4: map.get_bln(m_area, &m_area); break; |
691 | - case 5: map.get_brn(m_area, &m_area); break; |
692 | - case 6: map. get_rn(m_area, &m_area); break; |
693 | + case 1: map.get_trn(area_, &area_); break; |
694 | + case 2: map.get_tln(area_, &area_); break; |
695 | + case 3: map. get_ln(area_, &area_); break; |
696 | + case 4: map.get_bln(area_, &area_); break; |
697 | + case 5: map.get_brn(area_, &area_); break; |
698 | + case 6: map. get_rn(area_, &area_); break; |
699 | default: |
700 | NEVER_HERE(); |
701 | } |
702 | - if (--m_remaining_in_phase == 0) { |
703 | - m_remaining_in_phase = m_area.radius; |
704 | - --m_phase; |
705 | + if (--remaining_in_phase_ == 0) { |
706 | + remaining_in_phase_ = area_.radius; |
707 | + --phase_; |
708 | } |
709 | - return m_phase; |
710 | + return phase_; |
711 | } |
712 | |
713 | template <> |
714 | bool MapFringeRegion<Area<> >::advance(const Map & map) { |
715 | - switch (m_phase) { |
716 | + switch (phase_) { |
717 | case 0: |
718 | - if (m_area.radius) { |
719 | - m_remaining_in_phase = m_area.radius; |
720 | - m_phase = 6; |
721 | + if (area_.radius) { |
722 | + remaining_in_phase_ = area_.radius; |
723 | + phase_ = 6; |
724 | } |
725 | else |
726 | return false; |
727 | /* no break */ |
728 | - case 1: map.get_trn(m_area, &m_area); break; |
729 | - case 2: map.get_tln(m_area, &m_area); break; |
730 | - case 3: map. get_ln(m_area, &m_area); break; |
731 | - case 4: map.get_bln(m_area, &m_area); break; |
732 | - case 5: map.get_brn(m_area, &m_area); break; |
733 | - case 6: map. get_rn(m_area, &m_area); break; |
734 | + case 1: map.get_trn(area_, &area_); break; |
735 | + case 2: map.get_tln(area_, &area_); break; |
736 | + case 3: map. get_ln(area_, &area_); break; |
737 | + case 4: map.get_bln(area_, &area_); break; |
738 | + case 5: map.get_brn(area_, &area_); break; |
739 | + case 6: map. get_rn(area_, &area_); break; |
740 | default: |
741 | NEVER_HERE(); |
742 | } |
743 | - if (--m_remaining_in_phase == 0) { |
744 | - m_remaining_in_phase = m_area.radius; |
745 | - --m_phase; |
746 | + if (--remaining_in_phase_ == 0) { |
747 | + remaining_in_phase_ = area_.radius; |
748 | + --phase_; |
749 | } |
750 | - return m_phase; |
751 | + return phase_; |
752 | } |
753 | |
754 | } |
755 | |
756 | === modified file 'src/logic/mapfringeregion.h' |
757 | --- src/logic/mapfringeregion.h 2014-09-10 08:55:04 +0000 |
758 | +++ src/logic/mapfringeregion.h 2016-03-02 18:10:45 +0000 |
759 | @@ -34,16 +34,16 @@ |
760 | */ |
761 | template <typename AreaType = Area<> > struct MapFringeRegion { |
762 | MapFringeRegion(const Map & map, AreaType area) : |
763 | - m_area (area), |
764 | - m_remaining_in_phase(area.radius), |
765 | - m_phase (area.radius ? 6 : 0) |
766 | + area_ (area), |
767 | + remaining_in_phase_(area.radius), |
768 | + phase_ (area.radius ? 6 : 0) |
769 | { |
770 | for (typename AreaType::RadiusType r = area.radius; r; --r) |
771 | - map.get_tln(m_area, &m_area); |
772 | + map.get_tln(area_, &area_); |
773 | } |
774 | |
775 | |
776 | - const typename AreaType::CoordsType & location() const {return m_area;} |
777 | + const typename AreaType::CoordsType & location() const {return area_;} |
778 | |
779 | /** |
780 | * Moves on to the next location. The return value indicates whether the new |
781 | @@ -64,17 +64,17 @@ |
782 | * the region ready to iterate over the next layer of nodes. |
783 | */ |
784 | void extend(const Map & map) { |
785 | - map.get_tln(m_area, &m_area); |
786 | - ++m_area.radius; |
787 | - m_remaining_in_phase = m_area.radius; |
788 | - m_phase = 6; |
789 | + map.get_tln(area_, &area_); |
790 | + ++area_.radius; |
791 | + remaining_in_phase_ = area_.radius; |
792 | + phase_ = 6; |
793 | } |
794 | |
795 | - typename AreaType::RadiusType radius() const {return m_area.radius;} |
796 | + typename AreaType::RadiusType radius() const {return area_.radius;} |
797 | private: |
798 | - AreaType m_area; |
799 | - typename AreaType::RadiusType m_remaining_in_phase; |
800 | - uint8_t m_phase; |
801 | + AreaType area_; |
802 | + typename AreaType::RadiusType remaining_in_phase_; |
803 | + uint8_t phase_; |
804 | }; |
805 | |
806 | } |
807 | |
808 | === modified file 'src/logic/maphollowregion.cc' |
809 | --- src/logic/maphollowregion.cc 2014-07-20 07:45:17 +0000 |
810 | +++ src/logic/maphollowregion.cc 2016-03-02 18:10:45 +0000 |
811 | @@ -24,63 +24,63 @@ |
812 | template <> MapHollowRegion<Area<> >::MapHollowRegion |
813 | (const Map & map, HollowArea<Area<> > const hollow_area) |
814 | : |
815 | -m_hollow_area (hollow_area), |
816 | -m_phase (Top), |
817 | -m_delta_radius(hollow_area.radius - hollow_area.hole_radius), |
818 | -m_row (0), |
819 | -m_rowwidth (hollow_area.radius + 1), |
820 | -m_rowpos (0), |
821 | -m_left (hollow_area) |
822 | +hollow_area_ (hollow_area), |
823 | +phase_ (Top), |
824 | +delta_radius_(hollow_area.radius - hollow_area.hole_radius), |
825 | +row_ (0), |
826 | +rowwidth_ (hollow_area.radius + 1), |
827 | +rowpos_ (0), |
828 | +left_ (hollow_area) |
829 | { |
830 | assert(hollow_area.hole_radius < hollow_area.radius); |
831 | for (uint16_t r = hollow_area.radius; r; --r) |
832 | - map.get_tln(m_hollow_area, &m_hollow_area); |
833 | - m_left = m_hollow_area; |
834 | + map.get_tln(hollow_area_, &hollow_area_); |
835 | + left_ = hollow_area_; |
836 | } |
837 | |
838 | template <> bool MapHollowRegion<Area<> >::advance(const Map & map) { |
839 | - if (m_phase == None) |
840 | + if (phase_ == None) |
841 | return false; |
842 | - ++m_rowpos; |
843 | - if (m_rowpos < m_rowwidth) { |
844 | - map.get_rn(m_hollow_area, &m_hollow_area); |
845 | - if ((m_phase & (Upper|Lower)) && m_rowpos == m_delta_radius) { |
846 | + ++rowpos_; |
847 | + if (rowpos_ < rowwidth_) { |
848 | + map.get_rn(hollow_area_, &hollow_area_); |
849 | + if ((phase_ & (Upper|Lower)) && rowpos_ == delta_radius_) { |
850 | // Jump over the hole. |
851 | - const uint32_t holewidth = m_rowwidth - 2 * m_delta_radius; |
852 | + const uint32_t holewidth = rowwidth_ - 2 * delta_radius_; |
853 | for (uint32_t i = 0; i < holewidth; ++i) |
854 | - map.get_rn(m_hollow_area, &m_hollow_area); |
855 | - m_rowpos += holewidth; |
856 | + map.get_rn(hollow_area_, &hollow_area_); |
857 | + rowpos_ += holewidth; |
858 | } |
859 | } else { |
860 | - ++m_row; |
861 | - if (m_phase == Top && m_row == m_delta_radius) |
862 | - m_phase = Upper; |
863 | + ++row_; |
864 | + if (phase_ == Top && row_ == delta_radius_) |
865 | + phase_ = Upper; |
866 | |
867 | // If we completed the widest, center line, switch into lower mode |
868 | - // There are m_radius+1 lines in the upper "half", because the upper |
869 | + // There are radius_+1 lines in the upper "half", because the upper |
870 | // half includes the center line. |
871 | - else if (m_phase == Upper && m_row > m_hollow_area.radius) { |
872 | - m_row = 1; |
873 | - m_phase = Lower; |
874 | + else if (phase_ == Upper && row_ > hollow_area_.radius) { |
875 | + row_ = 1; |
876 | + phase_ = Lower; |
877 | } |
878 | |
879 | - if (m_phase & (Top|Upper)) { |
880 | - map.get_bln(m_left, &m_hollow_area); |
881 | - ++m_rowwidth; |
882 | + if (phase_ & (Top|Upper)) { |
883 | + map.get_bln(left_, &hollow_area_); |
884 | + ++rowwidth_; |
885 | } else { |
886 | |
887 | - if (m_row > m_hollow_area.radius) { |
888 | - m_phase = None; |
889 | + if (row_ > hollow_area_.radius) { |
890 | + phase_ = None; |
891 | return true; // early out |
892 | - } else if (m_phase == Lower && m_row > m_hollow_area.hole_radius) |
893 | - m_phase = Bottom; |
894 | + } else if (phase_ == Lower && row_ > hollow_area_.hole_radius) |
895 | + phase_ = Bottom; |
896 | |
897 | - map.get_brn(m_left, &m_hollow_area); |
898 | - --m_rowwidth; |
899 | + map.get_brn(left_, &hollow_area_); |
900 | + --rowwidth_; |
901 | } |
902 | |
903 | - m_left = m_hollow_area; |
904 | - m_rowpos = 0; |
905 | + left_ = hollow_area_; |
906 | + rowpos_ = 0; |
907 | } |
908 | |
909 | return true; |
910 | |
911 | === modified file 'src/logic/maphollowregion.h' |
912 | --- src/logic/maphollowregion.h 2014-09-10 08:55:04 +0000 |
913 | +++ src/logic/maphollowregion.h 2016-03-02 18:10:45 +0000 |
914 | @@ -35,7 +35,7 @@ |
915 | MapHollowRegion(const Map & map, const HollowArea<AreaType> hollow_area); |
916 | |
917 | const typename AreaType::CoordsType& location() const { |
918 | - return m_hollow_area; |
919 | + return hollow_area_; |
920 | } |
921 | |
922 | /** |
923 | @@ -64,13 +64,13 @@ |
924 | Bottom = 8, // below the hole |
925 | }; |
926 | |
927 | - HollowArea<AreaType> m_hollow_area; |
928 | - Phase m_phase; |
929 | - const uint32_t m_delta_radius; |
930 | - uint32_t m_row; // # of rows completed in this phase |
931 | - uint32_t m_rowwidth; // # of fields to return per row |
932 | - uint32_t m_rowpos; // # of fields we have returned in this row |
933 | - typename AreaType::CoordsType m_left; // left-most node of current row |
934 | + HollowArea<AreaType> hollow_area_; |
935 | + Phase phase_; |
936 | + const uint32_t delta_radius_; |
937 | + uint32_t row_; // # of rows completed in this phase |
938 | + uint32_t rowwidth_; // # of fields to return per row |
939 | + uint32_t rowpos_; // # of fields we have returned in this row |
940 | + typename AreaType::CoordsType left_; // left-most node of current row |
941 | }; |
942 | |
943 | } |
944 | |
945 | === modified file 'src/logic/mapregion.h' |
946 | --- src/logic/mapregion.h 2014-09-10 08:55:04 +0000 |
947 | +++ src/logic/mapregion.h 2016-03-02 18:10:45 +0000 |
948 | @@ -31,17 +31,17 @@ |
949 | */ |
950 | template <typename AreaType = Area<> > struct MapRegion { |
951 | MapRegion(const Map & map, AreaType area) : |
952 | - m_area (area), |
953 | - m_rowwidth (area.radius + 1), |
954 | - m_remaining_in_row(m_rowwidth), |
955 | - m_remaining_rows (m_rowwidth + area.radius) |
956 | + area_ (area), |
957 | + rowwidth_ (area.radius + 1), |
958 | + remaining_in_row_(rowwidth_), |
959 | + remaining_rows_ (rowwidth_ + area.radius) |
960 | { |
961 | for (typename AreaType::RadiusType r = area.radius; r; --r) |
962 | - map.get_tln(m_area, &m_area); |
963 | - m_left = m_area; |
964 | + map.get_tln(area_, &area_); |
965 | + left_ = area_; |
966 | } |
967 | |
968 | - const typename AreaType::CoordsType & location() const {return m_area;} |
969 | + const typename AreaType::CoordsType & location() const {return area_;} |
970 | |
971 | /// Moves on to the next location. The return value indicates whether the |
972 | /// new location has not yet been reached during this iteration. Note that |
973 | @@ -50,25 +50,25 @@ |
974 | /// while advance keeps returning true. When finally advance returns false, |
975 | /// it means that the iteration is done. |
976 | bool advance(const Map & map) { |
977 | - if (--m_remaining_in_row) |
978 | - map.get_rn(m_area, &m_area); |
979 | - else if (m_area.radius < --m_remaining_rows) { |
980 | - map.get_bln(m_left, &m_area); m_left = m_area; |
981 | - m_remaining_in_row = ++m_rowwidth; |
982 | - } else if (m_remaining_rows) { |
983 | - map.get_brn(m_left, &m_area); m_left = m_area; |
984 | - m_remaining_in_row = --m_rowwidth; |
985 | + if (--remaining_in_row_) |
986 | + map.get_rn(area_, &area_); |
987 | + else if (area_.radius < --remaining_rows_) { |
988 | + map.get_bln(left_, &area_); left_ = area_; |
989 | + remaining_in_row_ = ++rowwidth_; |
990 | + } else if (remaining_rows_) { |
991 | + map.get_brn(left_, &area_); left_ = area_; |
992 | + remaining_in_row_ = --rowwidth_; |
993 | } else return false; |
994 | return true; |
995 | } |
996 | |
997 | - typename AreaType::RadiusType radius() const {return m_area.radius;} |
998 | + typename AreaType::RadiusType radius() const {return area_.radius;} |
999 | private: |
1000 | - AreaType m_area; |
1001 | - typename AreaType::CoordsType m_left; |
1002 | - typename AreaType::RadiusType m_rowwidth; |
1003 | - typename AreaType::RadiusType m_remaining_in_row; |
1004 | - typename AreaType::RadiusType m_remaining_rows; |
1005 | + AreaType area_; |
1006 | + typename AreaType::CoordsType left_; |
1007 | + typename AreaType::RadiusType rowwidth_; |
1008 | + typename AreaType::RadiusType remaining_in_row_; |
1009 | + typename AreaType::RadiusType remaining_rows_; |
1010 | }; |
1011 | |
1012 | } |
1013 | |
1014 | === modified file 'src/logic/maptriangleregion.cc' |
1015 | --- src/logic/maptriangleregion.cc 2016-01-17 08:29:59 +0000 |
1016 | +++ src/logic/maptriangleregion.cc 2016-03-02 18:10:45 +0000 |
1017 | @@ -23,175 +23,175 @@ |
1018 | |
1019 | template <> MapTriangleRegion<>::MapTriangleRegion |
1020 | (const Map & map, Area<TCoords<> > area) |
1021 | -: m_radius_is_odd(area.radius & 1) |
1022 | +: radius_is_odd_(area.radius & 1) |
1023 | { |
1024 | assert(area.t == TCoords<>::R || area.t == TCoords<>::D); |
1025 | const uint16_t radius_plus_1 = area.radius + 1; |
1026 | const uint16_t half_radius_rounded_down = area.radius / 2; |
1027 | - m_row_length = radius_plus_1; |
1028 | + row_length_ = radius_plus_1; |
1029 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); |
1030 | if (area.t == TCoords<>::R) { |
1031 | - m_left = area; |
1032 | + left_ = area; |
1033 | if (area.radius) { |
1034 | - m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1; |
1035 | - m_remaining_rows_in_lower_phase = (area.radius - 1) / 2; |
1036 | - if (m_radius_is_odd) { |
1037 | + remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1; |
1038 | + remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1039 | + if (radius_is_odd_) { |
1040 | map.get_trn(area, &area); |
1041 | - m_phase = Top; |
1042 | - m_row_length = area.radius + 2; |
1043 | - m_remaining_in_row = radius_plus_1 / 2; |
1044 | + phase_ = Top; |
1045 | + row_length_ = area.radius + 2; |
1046 | + remaining_in_row_ = radius_plus_1 / 2; |
1047 | area.t = TCoords<>::D; |
1048 | } else { |
1049 | - m_phase = Upper; |
1050 | - m_remaining_in_row = m_row_length = radius_plus_1; |
1051 | + phase_ = Upper; |
1052 | + remaining_in_row_ = row_length_ = radius_plus_1; |
1053 | area.t = TCoords<>::R; |
1054 | } |
1055 | } else { |
1056 | assert(area.radius == 0); |
1057 | - m_phase = Bottom; |
1058 | - m_remaining_in_row = 0; |
1059 | + phase_ = Bottom; |
1060 | + remaining_in_row_ = 0; |
1061 | area.t = TCoords<>::R; |
1062 | } |
1063 | } else { |
1064 | - m_remaining_rows_in_upper_phase = radius_plus_1 / 2; |
1065 | - m_remaining_rows_in_lower_phase = half_radius_rounded_down; |
1066 | - if (m_radius_is_odd) { |
1067 | + remaining_rows_in_upper_phase_ = radius_plus_1 / 2; |
1068 | + remaining_rows_in_lower_phase_ = half_radius_rounded_down; |
1069 | + if (radius_is_odd_) { |
1070 | map.get_ln(area, &area); |
1071 | - m_left = area; |
1072 | - m_phase = Upper; |
1073 | - m_remaining_in_row = m_row_length = area.radius + 2; |
1074 | + left_ = area; |
1075 | + phase_ = Upper; |
1076 | + remaining_in_row_ = row_length_ = area.radius + 2; |
1077 | area.t = TCoords<>::R; |
1078 | } else { |
1079 | - map.get_bln(area, &m_left); |
1080 | - m_phase = Top; |
1081 | - m_row_length = area.radius + 3; |
1082 | - m_remaining_in_row = half_radius_rounded_down + (0 < area.radius); |
1083 | + map.get_bln(area, &left_); |
1084 | + phase_ = Top; |
1085 | + row_length_ = area.radius + 3; |
1086 | + remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1087 | area.t = TCoords<>::D; |
1088 | } |
1089 | } |
1090 | - m_location = area; |
1091 | + location_ = area; |
1092 | } |
1093 | |
1094 | |
1095 | template <> bool MapTriangleRegion<>::advance(const Map & map) { |
1096 | - assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) |
1097 | - if (m_remaining_in_row == 0) |
1098 | + assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1099 | + if (remaining_in_row_ == 0) |
1100 | return false; |
1101 | - --m_remaining_in_row; |
1102 | - switch (m_phase) { |
1103 | + --remaining_in_row_; |
1104 | + switch (phase_) { |
1105 | case Top: |
1106 | - if (m_remaining_in_row) |
1107 | - map.get_rn(m_location, &m_location); |
1108 | - else if (m_remaining_rows_in_upper_phase) { |
1109 | - m_phase = Upper; |
1110 | - m_remaining_in_row = m_row_length; |
1111 | - assert(m_remaining_in_row); |
1112 | - m_location = TCoords<>(m_left, m_location.t); |
1113 | + if (remaining_in_row_) |
1114 | + map.get_rn(location_, &location_); |
1115 | + else if (remaining_rows_in_upper_phase_) { |
1116 | + phase_ = Upper; |
1117 | + remaining_in_row_ = row_length_; |
1118 | + assert(remaining_in_row_); |
1119 | + location_ = TCoords<>(left_, location_.t); |
1120 | } |
1121 | break; |
1122 | case Upper: |
1123 | - if (m_remaining_in_row) { |
1124 | - if (m_location.t == TCoords<>::D) |
1125 | - m_location.t = TCoords<>::R; |
1126 | + if (remaining_in_row_) { |
1127 | + if (location_.t == TCoords<>::D) |
1128 | + location_.t = TCoords<>::R; |
1129 | else |
1130 | - m_location = TCoords<>(map.r_n(m_location), TCoords<>::D); |
1131 | + location_ = TCoords<>(map.r_n(location_), TCoords<>::D); |
1132 | } else { |
1133 | - if (--m_remaining_rows_in_upper_phase) { |
1134 | - m_row_length += 2; |
1135 | - m_left = map.bl_n(m_left); |
1136 | + if (--remaining_rows_in_upper_phase_) { |
1137 | + row_length_ += 2; |
1138 | + left_ = map.bl_n(left_); |
1139 | } else { |
1140 | - if (m_remaining_rows_in_lower_phase) { |
1141 | - m_phase = Lower; |
1142 | - assert(m_row_length >= 2); |
1143 | - m_row_length -= 2; |
1144 | - } else if (m_location.t == TCoords<>::R) { |
1145 | - m_phase = Bottom; |
1146 | - m_row_length /= 2; |
1147 | + if (remaining_rows_in_lower_phase_) { |
1148 | + phase_ = Lower; |
1149 | + assert(row_length_ >= 2); |
1150 | + row_length_ -= 2; |
1151 | + } else if (location_.t == TCoords<>::R) { |
1152 | + phase_ = Bottom; |
1153 | + row_length_ /= 2; |
1154 | } else return false; |
1155 | - m_left = map.br_n(m_left); |
1156 | + left_ = map.br_n(left_); |
1157 | } |
1158 | - m_remaining_in_row = m_row_length; |
1159 | - m_location = TCoords<>(m_left, m_location.t); |
1160 | + remaining_in_row_ = row_length_; |
1161 | + location_ = TCoords<>(left_, location_.t); |
1162 | } |
1163 | break; |
1164 | case Lower: |
1165 | - if (m_remaining_in_row) { |
1166 | - if (m_location.t == TCoords<>::D) |
1167 | - m_location.t = TCoords<>::R; |
1168 | + if (remaining_in_row_) { |
1169 | + if (location_.t == TCoords<>::D) |
1170 | + location_.t = TCoords<>::R; |
1171 | else |
1172 | - m_location = TCoords<>(map.r_n(m_location), TCoords<>::D); |
1173 | + location_ = TCoords<>(map.r_n(location_), TCoords<>::D); |
1174 | } else { |
1175 | - if (--m_remaining_rows_in_lower_phase) { |
1176 | - assert(m_row_length >= 2); |
1177 | - m_remaining_in_row = m_row_length -= 2; |
1178 | - m_left = map.br_n(m_left); |
1179 | - } |
1180 | - else if (m_location.t == TCoords<>::R) { |
1181 | - m_phase = Bottom; |
1182 | - m_remaining_in_row = m_row_length / 2; |
1183 | - m_left = map.br_n(m_left); |
1184 | - } |
1185 | - m_location = TCoords<>(m_left, m_location.t); |
1186 | + if (--remaining_rows_in_lower_phase_) { |
1187 | + assert(row_length_ >= 2); |
1188 | + remaining_in_row_ = row_length_ -= 2; |
1189 | + left_ = map.br_n(left_); |
1190 | + } |
1191 | + else if (location_.t == TCoords<>::R) { |
1192 | + phase_ = Bottom; |
1193 | + remaining_in_row_ = row_length_ / 2; |
1194 | + left_ = map.br_n(left_); |
1195 | + } |
1196 | + location_ = TCoords<>(left_, location_.t); |
1197 | } |
1198 | break; |
1199 | case Bottom: |
1200 | - if (m_remaining_in_row) |
1201 | - map.get_rn(m_location, &m_location); |
1202 | + if (remaining_in_row_) |
1203 | + map.get_rn(location_, &location_); |
1204 | break; |
1205 | } |
1206 | - assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) |
1207 | + assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1208 | return true; |
1209 | } |
1210 | |
1211 | |
1212 | template <> MapTriangleRegion<TCoords<FCoords> >::MapTriangleRegion |
1213 | (const Map & map, Area<TCoords<FCoords> > area) |
1214 | -: m_radius_is_odd(area.radius & 1) |
1215 | +: radius_is_odd_(area.radius & 1) |
1216 | { |
1217 | assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D); |
1218 | const uint16_t radius_plus_1 = area.radius + 1; |
1219 | const uint16_t half_radius_rounded_down = area.radius / 2; |
1220 | - m_row_length = radius_plus_1; |
1221 | + row_length_ = radius_plus_1; |
1222 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); |
1223 | if (area.t == TCoords<FCoords>::R) { |
1224 | - m_left = area; |
1225 | + left_ = area; |
1226 | if (area.radius) { |
1227 | - m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1; |
1228 | - m_remaining_rows_in_lower_phase = (area.radius - 1) / 2; |
1229 | - if (m_radius_is_odd) { |
1230 | + remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1; |
1231 | + remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1232 | + if (radius_is_odd_) { |
1233 | map.get_trn(area, &area); |
1234 | - m_phase = Top; |
1235 | - m_row_length = area.radius + 2; |
1236 | - m_remaining_in_row = radius_plus_1 / 2; |
1237 | + phase_ = Top; |
1238 | + row_length_ = area.radius + 2; |
1239 | + remaining_in_row_ = radius_plus_1 / 2; |
1240 | area.t = TCoords<FCoords>::D; |
1241 | } else { |
1242 | - m_phase = Upper; |
1243 | - m_remaining_in_row = m_row_length = radius_plus_1; |
1244 | + phase_ = Upper; |
1245 | + remaining_in_row_ = row_length_ = radius_plus_1; |
1246 | area.t = TCoords<FCoords>::R; |
1247 | } |
1248 | } else { |
1249 | - m_phase = Bottom; |
1250 | - m_remaining_in_row = 0; |
1251 | + phase_ = Bottom; |
1252 | + remaining_in_row_ = 0; |
1253 | area.t = TCoords<FCoords>::R; |
1254 | } |
1255 | } else { |
1256 | - m_remaining_rows_in_upper_phase = radius_plus_1 / 2; |
1257 | - m_remaining_rows_in_lower_phase = half_radius_rounded_down; |
1258 | - if (m_radius_is_odd) { |
1259 | + remaining_rows_in_upper_phase_ = radius_plus_1 / 2; |
1260 | + remaining_rows_in_lower_phase_ = half_radius_rounded_down; |
1261 | + if (radius_is_odd_) { |
1262 | map.get_ln(area, &area); |
1263 | - m_left = area; |
1264 | - m_phase = Upper; |
1265 | - m_remaining_in_row = m_row_length = area.radius + 2; |
1266 | + left_ = area; |
1267 | + phase_ = Upper; |
1268 | + remaining_in_row_ = row_length_ = area.radius + 2; |
1269 | area.t = TCoords<FCoords>::R; |
1270 | } else { |
1271 | - map.get_bln(area, &m_left); |
1272 | - m_phase = Top; |
1273 | - m_row_length = area.radius + 3; |
1274 | - m_remaining_in_row = half_radius_rounded_down + (0 < area.radius); |
1275 | + map.get_bln(area, &left_); |
1276 | + phase_ = Top; |
1277 | + row_length_ = area.radius + 3; |
1278 | + remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1279 | area.t = TCoords<FCoords>::D; |
1280 | } |
1281 | } |
1282 | - m_location = area; |
1283 | + location_ = area; |
1284 | } |
1285 | |
1286 | |
1287 | @@ -199,75 +199,75 @@ |
1288 | template <> |
1289 | bool MapTriangleRegion<TCoords<FCoords> >::advance(const Map & map) |
1290 | { |
1291 | - assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) |
1292 | - if (m_remaining_in_row == 0) |
1293 | + assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1294 | + if (remaining_in_row_ == 0) |
1295 | return false; |
1296 | - --m_remaining_in_row; |
1297 | - switch (m_phase) { |
1298 | + --remaining_in_row_; |
1299 | + switch (phase_) { |
1300 | case Top: |
1301 | - if (m_remaining_in_row) |
1302 | - map.get_rn(m_location, &m_location); |
1303 | - else if (m_remaining_rows_in_upper_phase) { |
1304 | - m_phase = Upper; |
1305 | - m_remaining_in_row = m_row_length; |
1306 | - assert(m_remaining_in_row); |
1307 | - m_location = TCoords<FCoords>(m_left, m_location.t); |
1308 | + if (remaining_in_row_) |
1309 | + map.get_rn(location_, &location_); |
1310 | + else if (remaining_rows_in_upper_phase_) { |
1311 | + phase_ = Upper; |
1312 | + remaining_in_row_ = row_length_; |
1313 | + assert(remaining_in_row_); |
1314 | + location_ = TCoords<FCoords>(left_, location_.t); |
1315 | } |
1316 | break; |
1317 | case Upper: |
1318 | - if (m_remaining_in_row) { |
1319 | - if (m_location.t == TCoords<FCoords>::D) |
1320 | - m_location.t = TCoords<FCoords>::R; |
1321 | + if (remaining_in_row_) { |
1322 | + if (location_.t == TCoords<FCoords>::D) |
1323 | + location_.t = TCoords<FCoords>::R; |
1324 | else |
1325 | - m_location = |
1326 | - TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D); |
1327 | + location_ = |
1328 | + TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D); |
1329 | } else { |
1330 | - if (--m_remaining_rows_in_upper_phase) { |
1331 | - m_row_length += 2; |
1332 | - m_left = map.bl_n(m_left); |
1333 | + if (--remaining_rows_in_upper_phase_) { |
1334 | + row_length_ += 2; |
1335 | + left_ = map.bl_n(left_); |
1336 | } else { |
1337 | - if (m_remaining_rows_in_lower_phase) { |
1338 | - m_phase = Lower; |
1339 | - assert(m_row_length >= 2); |
1340 | - m_row_length -= 2; |
1341 | - } else if (m_location.t == TCoords<FCoords>::R) { |
1342 | - m_phase = Bottom; |
1343 | - m_row_length /= 2; |
1344 | + if (remaining_rows_in_lower_phase_) { |
1345 | + phase_ = Lower; |
1346 | + assert(row_length_ >= 2); |
1347 | + row_length_ -= 2; |
1348 | + } else if (location_.t == TCoords<FCoords>::R) { |
1349 | + phase_ = Bottom; |
1350 | + row_length_ /= 2; |
1351 | } else |
1352 | return false; |
1353 | - m_left = map.br_n(m_left); |
1354 | + left_ = map.br_n(left_); |
1355 | } |
1356 | - m_remaining_in_row = m_row_length; |
1357 | - m_location = TCoords<FCoords>(m_left, m_location.t); |
1358 | + remaining_in_row_ = row_length_; |
1359 | + location_ = TCoords<FCoords>(left_, location_.t); |
1360 | } |
1361 | break; |
1362 | case Lower: |
1363 | - if (m_remaining_in_row) { |
1364 | - if (m_location.t == TCoords<FCoords>::D) |
1365 | - m_location.t = TCoords<FCoords>::R; |
1366 | + if (remaining_in_row_) { |
1367 | + if (location_.t == TCoords<FCoords>::D) |
1368 | + location_.t = TCoords<FCoords>::R; |
1369 | else |
1370 | - m_location = |
1371 | - TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D); |
1372 | + location_ = |
1373 | + TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D); |
1374 | } else { |
1375 | - if (--m_remaining_rows_in_lower_phase) { |
1376 | - assert(m_row_length >= 2); |
1377 | - m_remaining_in_row = m_row_length -= 2; |
1378 | - m_left = map.br_n(m_left); |
1379 | - } |
1380 | - else if (m_location.t == TCoords<FCoords>::R) { |
1381 | - m_phase = Bottom; |
1382 | - m_remaining_in_row = m_row_length / 2; |
1383 | - m_left = map.br_n(m_left); |
1384 | - } |
1385 | - m_location = TCoords<FCoords>(m_left, m_location.t); |
1386 | + if (--remaining_rows_in_lower_phase_) { |
1387 | + assert(row_length_ >= 2); |
1388 | + remaining_in_row_ = row_length_ -= 2; |
1389 | + left_ = map.br_n(left_); |
1390 | + } |
1391 | + else if (location_.t == TCoords<FCoords>::R) { |
1392 | + phase_ = Bottom; |
1393 | + remaining_in_row_ = row_length_ / 2; |
1394 | + left_ = map.br_n(left_); |
1395 | + } |
1396 | + location_ = TCoords<FCoords>(left_, location_.t); |
1397 | } |
1398 | break; |
1399 | case Bottom: |
1400 | - if (m_remaining_in_row) |
1401 | - map.get_rn(m_location, &m_location); |
1402 | + if (remaining_in_row_) |
1403 | + map.get_rn(location_, &location_); |
1404 | break; |
1405 | } |
1406 | - assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) |
1407 | + assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1408 | return true; |
1409 | } |
1410 | |
1411 | |
1412 | === modified file 'src/logic/maptriangleregion.h' |
1413 | --- src/logic/maptriangleregion.h 2014-09-10 08:55:04 +0000 |
1414 | +++ src/logic/maptriangleregion.h 2016-03-02 18:10:45 +0000 |
1415 | @@ -65,60 +65,60 @@ |
1416 | }; |
1417 | template <> struct MapTriangleRegion<FCoords> { |
1418 | MapTriangleRegion(const Map & map, const Area<FCoords> area) : |
1419 | - m_area(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1), |
1420 | - m_rowwidth (m_area.radius * 2 + 1), |
1421 | - m_remaining_in_row(m_rowwidth), |
1422 | - m_remaining_rows (m_area.radius * 2) |
1423 | + area_(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1), |
1424 | + rowwidth_ (area_.radius * 2 + 1), |
1425 | + remaining_in_row_(rowwidth_), |
1426 | + remaining_rows_ (area_.radius * 2) |
1427 | { |
1428 | - for (uint8_t r = m_area.radius; r; --r) map.get_tln(m_area, &m_area); |
1429 | - m_left = m_area; |
1430 | + for (uint8_t r = area_.radius; r; --r) map.get_tln(area_, &area_); |
1431 | + left_ = area_; |
1432 | } |
1433 | |
1434 | - const TCoords<FCoords> & location() const {return m_area;} |
1435 | + const TCoords<FCoords> & location() const {return area_;} |
1436 | |
1437 | bool advance(const Map & map) { |
1438 | - if (--m_remaining_in_row) { |
1439 | - if (m_area.t == TCoords<FCoords>::D) |
1440 | - m_area.t = TCoords<FCoords>::R; |
1441 | + if (--remaining_in_row_) { |
1442 | + if (area_.t == TCoords<FCoords>::D) |
1443 | + area_.t = TCoords<FCoords>::R; |
1444 | else { |
1445 | - m_area.t = TCoords<FCoords>::D; |
1446 | - map.get_rn(m_area, &m_area); |
1447 | + area_.t = TCoords<FCoords>::D; |
1448 | + map.get_rn(area_, &area_); |
1449 | } |
1450 | - } else if (m_area.radius < --m_remaining_rows) { |
1451 | - map.get_bln(m_left, &m_area); m_left = m_area; |
1452 | - m_area.t = TCoords<FCoords>::D; |
1453 | - m_remaining_in_row = m_rowwidth += 2; |
1454 | - } else if (m_remaining_rows) { |
1455 | - map.get_brn(m_left, &m_area); m_left = m_area; |
1456 | - m_area.t = TCoords<FCoords>::D; |
1457 | - m_remaining_in_row = m_rowwidth -= 2; |
1458 | + } else if (area_.radius < --remaining_rows_) { |
1459 | + map.get_bln(left_, &area_); left_ = area_; |
1460 | + area_.t = TCoords<FCoords>::D; |
1461 | + remaining_in_row_ = rowwidth_ += 2; |
1462 | + } else if (remaining_rows_) { |
1463 | + map.get_brn(left_, &area_); left_ = area_; |
1464 | + area_.t = TCoords<FCoords>::D; |
1465 | + remaining_in_row_ = rowwidth_ -= 2; |
1466 | } else return false; |
1467 | return true; |
1468 | } |
1469 | |
1470 | private: |
1471 | - Area<TCoords<FCoords> > m_area; |
1472 | - FCoords m_left; |
1473 | - uint16_t m_rowwidth; |
1474 | - uint16_t m_remaining_in_row; |
1475 | - uint16_t m_remaining_rows; |
1476 | + Area<TCoords<FCoords> > area_; |
1477 | + FCoords left_; |
1478 | + uint16_t rowwidth_; |
1479 | + uint16_t remaining_in_row_; |
1480 | + uint16_t remaining_rows_; |
1481 | }; |
1482 | template <typename CoordsType> struct MapTriangleRegion<TCoords<CoordsType> > |
1483 | { |
1484 | MapTriangleRegion(const Map &, Area<TCoords<CoordsType>, uint16_t>); |
1485 | |
1486 | - const TCoords<CoordsType> & location() const {return m_location;} |
1487 | + const TCoords<CoordsType> & location() const {return location_;} |
1488 | |
1489 | bool advance(const Map &); |
1490 | |
1491 | private: |
1492 | - const bool m_radius_is_odd; |
1493 | - enum {Top, Upper, Lower, Bottom} m_phase; |
1494 | - uint16_t m_remaining_rows_in_upper_phase; |
1495 | - uint16_t m_remaining_rows_in_lower_phase; |
1496 | - uint16_t m_row_length, m_remaining_in_row; |
1497 | - CoordsType m_left; |
1498 | - TCoords<CoordsType> m_location; |
1499 | + const bool radius_is_odd_; |
1500 | + enum {Top, Upper, Lower, Bottom} phase_; |
1501 | + uint16_t remaining_rows_in_upper_phase_; |
1502 | + uint16_t remaining_rows_in_lower_phase_; |
1503 | + uint16_t row_length_, remaining_in_row_; |
1504 | + CoordsType left_; |
1505 | + TCoords<CoordsType> location_; |
1506 | }; |
1507 | |
1508 | } |
1509 | |
1510 | === modified file 'src/logic/message_queue.h' |
1511 | --- src/logic/message_queue.h 2014-09-30 07:55:22 +0000 |
1512 | +++ src/logic/message_queue.h 2016-03-02 18:10:45 +0000 |
1513 | @@ -33,9 +33,9 @@ |
1514 | friend class MapPlayersMessagesPacket; |
1515 | |
1516 | MessageQueue() { |
1517 | - m_counts[static_cast<int>(Message::Status::kNew)] = 0; // C++0x: |
1518 | - m_counts[static_cast<int>(Message::Status::kRead)] = 0; // C++0x: |
1519 | - m_counts[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x: |
1520 | + counts_[static_cast<int>(Message::Status::kNew)] = 0; // C++0x: |
1521 | + counts_[static_cast<int>(Message::Status::kRead)] = 0; // C++0x: |
1522 | + counts_[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x: |
1523 | } // C++0x: |
1524 | |
1525 | ~MessageQueue() { |
1526 | @@ -68,7 +68,7 @@ |
1527 | uint32_t nr_messages(Message::Status const status) const { |
1528 | assert_counts(); |
1529 | assert(static_cast<int>(status) < 3); |
1530 | - return m_counts[static_cast<int>(status)]; |
1531 | + return counts_[static_cast<int>(status)]; |
1532 | } |
1533 | |
1534 | /// Adds the message. Takes ownership of the message. Assumes that it has |
1535 | @@ -82,12 +82,12 @@ |
1536 | MessageId add_message(Message & message) { |
1537 | assert_counts(); |
1538 | assert(static_cast<int>(message.status()) < 3); |
1539 | - ++m_counts[static_cast<int>(message.status())]; |
1540 | + ++counts_[static_cast<int>(message.status())]; |
1541 | insert |
1542 | (std::map<MessageId, Message *>::end(), |
1543 | - std::pair<MessageId, Message *>(++m_current_message_id, &message)); |
1544 | + std::pair<MessageId, Message *>(++current_message_id_, &message)); |
1545 | assert_counts(); |
1546 | - return m_current_message_id; |
1547 | + return current_message_id_; |
1548 | } |
1549 | |
1550 | /// Sets the status of the message with the given id, if it exists. |
1551 | @@ -98,9 +98,9 @@ |
1552 | if (it != end()) { |
1553 | Message & message = *it->second; |
1554 | assert(static_cast<int>(it->second->status()) < 3); |
1555 | - assert(m_counts[static_cast<int>(message.status())]); |
1556 | - --m_counts[static_cast<int>(message.status())]; |
1557 | - ++m_counts[static_cast<int>(message.set_status(status))]; |
1558 | + assert(counts_[static_cast<int>(message.status())]); |
1559 | + --counts_[static_cast<int>(message.status())]; |
1560 | + ++counts_[static_cast<int>(message.set_status(status))]; |
1561 | } |
1562 | assert_counts(); |
1563 | } |
1564 | @@ -118,14 +118,14 @@ |
1565 | } |
1566 | Message & message = *it->second; |
1567 | assert(static_cast<int>(message.status()) < 3); |
1568 | - assert(m_counts[static_cast<int>(message.status())]); |
1569 | - --m_counts[static_cast<int>(message.status())]; |
1570 | + assert(counts_[static_cast<int>(message.status())]); |
1571 | + --counts_[static_cast<int>(message.status())]; |
1572 | delete &message; |
1573 | erase(it); |
1574 | assert_counts(); |
1575 | } |
1576 | |
1577 | - MessageId current_message_id() const {return m_current_message_id;} |
1578 | + MessageId current_message_id() const {return current_message_id_;} |
1579 | |
1580 | /// \returns whether all messages with id 1, 2, 3, ..., current_message_id |
1581 | /// exist. This should be the case when messages have been loaded from a map |
1582 | @@ -142,28 +142,28 @@ |
1583 | /// it. |
1584 | void clear() { |
1585 | assert_counts(); |
1586 | - m_current_message_id = MessageId::null(); |
1587 | - m_counts[static_cast<int>(Message::Status::kNew)] = 0; |
1588 | - m_counts[static_cast<int>(Message::Status::kRead)] = 0; |
1589 | - m_counts[static_cast<int>(Message::Status::kArchived)] = 0; |
1590 | + current_message_id_ = MessageId::null(); |
1591 | + counts_[static_cast<int>(Message::Status::kNew)] = 0; |
1592 | + counts_[static_cast<int>(Message::Status::kRead)] = 0; |
1593 | + counts_[static_cast<int>(Message::Status::kArchived)] = 0; |
1594 | std::map<MessageId, Message *>::clear(); |
1595 | assert_counts(); |
1596 | } |
1597 | |
1598 | /// The id of the most recently added message, or null if none has been |
1599 | /// added yet. |
1600 | - MessageId m_current_message_id; |
1601 | + MessageId current_message_id_; |
1602 | |
1603 | /// Number of messages with each status (new, read, deleted). |
1604 | /// Indexed by Message::Status. |
1605 | - uint32_t m_counts[3]; |
1606 | + uint32_t counts_[3]; |
1607 | |
1608 | void assert_counts() const { |
1609 | assert |
1610 | (size() == |
1611 | - m_counts[static_cast<int>(Message::Status::kNew)] + |
1612 | - m_counts[static_cast<int>(Message::Status::kRead)] + |
1613 | - m_counts[static_cast<int>(Message::Status::kArchived)]); |
1614 | + counts_[static_cast<int>(Message::Status::kNew)] + |
1615 | + counts_[static_cast<int>(Message::Status::kRead)] + |
1616 | + counts_[static_cast<int>(Message::Status::kArchived)]); |
1617 | } |
1618 | |
1619 | DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
1620 | |
1621 | === modified file 'src/logic/path.cc' |
1622 | --- src/logic/path.cc 2016-02-16 10:27:23 +0000 |
1623 | +++ src/logic/path.cc 2016-03-02 18:10:45 +0000 |
1624 | @@ -70,7 +70,7 @@ |
1625 | fw.unsigned_8(kCurrentPacketVersion); |
1626 | write_coords_32(&fw, start_); |
1627 | |
1628 | - // Careful: steps are stored in the reverse order in m_path |
1629 | + // Careful: steps are stored in the reverse order in path_ |
1630 | // However, we save them in the forward order, to make loading easier |
1631 | fw.unsigned_32(path_.size()); |
1632 | for (uint32_t i = path_.size(); i > 0; --i) |
1633 | |
1634 | === modified file 'src/logic/player.cc' |
1635 | --- src/logic/player.cc 2016-02-21 20:02:09 +0000 |
1636 | +++ src/logic/player.cc 2016-03-02 18:10:45 +0000 |
1637 | @@ -367,7 +367,7 @@ |
1638 | return add_message(game, m); |
1639 | } |
1640 | |
1641 | -void Player::message_object_removed(MessageId m_id) const |
1642 | +void Player::message_object_removed(MessageId message_id) const |
1643 | { |
1644 | // Send delete command |
1645 | upcast(Game, game, &egbase_); |
1646 | @@ -377,7 +377,7 @@ |
1647 | |
1648 | game->cmdqueue().enqueue |
1649 | (new CmdDeleteMessage |
1650 | - (game->get_gametime(), player_number_, m_id)); |
1651 | + (game->get_gametime(), player_number_, message_id)); |
1652 | } |
1653 | |
1654 | |
1655 | |
1656 | === modified file 'src/logic/replay.cc' |
1657 | --- src/logic/replay.cc 2016-02-16 13:18:59 +0000 |
1658 | +++ src/logic/replay.cc 2016-03-02 18:10:45 +0000 |
1659 | @@ -49,7 +49,7 @@ |
1660 | class CmdReplaySyncRead : public Command { |
1661 | public: |
1662 | CmdReplaySyncRead(const uint32_t init_duetime, const Md5Checksum & hash) |
1663 | - : Command(init_duetime), m_hash(hash) |
1664 | + : Command(init_duetime), hash_(hash) |
1665 | {} |
1666 | |
1667 | QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;} |
1668 | @@ -58,12 +58,12 @@ |
1669 | { |
1670 | const Md5Checksum myhash = game.get_sync_hash(); |
1671 | |
1672 | - if (m_hash != myhash) { |
1673 | + if (hash_ != myhash) { |
1674 | log |
1675 | ("REPLAY: Lost synchronization at time %u\n" |
1676 | "I have: %s\n" |
1677 | "Replay has: %s\n", |
1678 | - duetime(), myhash.str().c_str(), m_hash.str().c_str()); |
1679 | + duetime(), myhash.str().c_str(), hash_.str().c_str()); |
1680 | |
1681 | // In case syncstream logging is on, save it for analysis |
1682 | game.save_syncstream(true); |
1683 | @@ -74,7 +74,7 @@ |
1684 | } |
1685 | |
1686 | private: |
1687 | - Md5Checksum m_hash; |
1688 | + Md5Checksum hash_; |
1689 | }; |
1690 | |
1691 | |
1692 | |
1693 | === modified file 'src/map_io/map_version_packet.cc' |
1694 | --- src/map_io/map_version_packet.cc 2016-02-15 23:26:42 +0000 |
1695 | +++ src/map_io/map_version_packet.cc 2016-03-02 18:10:45 +0000 |
1696 | @@ -44,8 +44,8 @@ |
1697 | try {prof.read("version", nullptr, fs);} catch (...) |
1698 | { |
1699 | Map & map = egbase.map(); |
1700 | - map.map_version_.m_map_version_timestamp = 0; |
1701 | - map.map_version_.m_map_creator_version = "unknown"; |
1702 | + map.map_version_.map_version_timestamp_ = 0; |
1703 | + map.map_version_.map_creator_version_ = "unknown"; |
1704 | return; |
1705 | } |
1706 | |
1707 | @@ -60,13 +60,13 @@ |
1708 | || (packet_version > kCurrentPacketVersion && forward_compatibility <= kCurrentPacketVersion)) |
1709 | { |
1710 | Map & map = egbase.map(); |
1711 | - map.map_version_.m_map_source_url = globv.get_safe_string("map_source_url"); |
1712 | - map.map_version_.m_map_source_release = globv.get_safe_string("map_release"); |
1713 | - map.map_version_.m_map_creator_version = globv.get_safe_string("map_creator_version"); |
1714 | - map.map_version_.m_map_version_major = globv.get_safe_int("map_version_major"); |
1715 | - map.map_version_.m_map_version_minor = globv.get_safe_int("map_version_minor"); |
1716 | + map.map_version_.map_source_url_ = globv.get_safe_string("map_source_url"); |
1717 | + map.map_version_.map_source_release_ = globv.get_safe_string("map_release"); |
1718 | + map.map_version_.map_creator_version_ = globv.get_safe_string("map_creator_version"); |
1719 | + map.map_version_.map_version_major_ = globv.get_safe_int("map_version_major"); |
1720 | + map.map_version_.map_version_minor_ = globv.get_safe_int("map_version_minor"); |
1721 | uint32_t ts = static_cast<uint32_t>(globv.get_safe_int("map_version_timestamp")); |
1722 | - map.map_version_.m_map_version_timestamp = ts; |
1723 | + map.map_version_.map_version_timestamp_ = ts; |
1724 | } else { |
1725 | throw UnhandledVersionError("MapVersionPacket", packet_version, kCurrentPacketVersion); |
1726 | } |
1727 | @@ -116,11 +116,11 @@ |
1728 | // There seems to be a get_safe_natural method, but not corresponding setter. |
1729 | |
1730 | Map & map = egbase.map(); |
1731 | - globs.set_string("map_source_url", map.map_version_.m_map_source_url); |
1732 | - globs.set_string("map_release", map.map_version_.m_map_source_release); |
1733 | - globs.set_string("map_creator_version", map.map_version_.m_map_creator_version); |
1734 | - globs.set_int("map_version_major", map.map_version_.m_map_version_major); |
1735 | - globs.set_int("map_version_minor", 1 + map.map_version_.m_map_version_minor); |
1736 | + globs.set_string("map_source_url", map.map_version_.map_source_url_); |
1737 | + globs.set_string("map_release", map.map_version_.map_source_release_); |
1738 | + globs.set_string("map_creator_version", map.map_version_.map_creator_version_); |
1739 | + globs.set_int("map_version_major", map.map_version_.map_version_major_); |
1740 | + globs.set_int("map_version_minor", 1 + map.map_version_.map_version_minor_); |
1741 | globs.set_int("map_version_timestamp", static_cast<uint32_t>(time(nullptr))); |
1742 | globs.set_int("packet_version", kCurrentPacketVersion); |
1743 | globs.set_int("packet_compatibility", kCurrentPacketVersion); |
Played perhas 30 Minutes had no
issues except an annyoing attacking AI :-)