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 | 41 | if (packet_version == kCurrentPacketVersion) { | 41 | if (packet_version == kCurrentPacketVersion) { |
6 | 42 | CmdQueue & cmdq = game.cmdqueue(); | 42 | CmdQueue & cmdq = game.cmdqueue(); |
7 | 43 | 43 | ||
9 | 44 | // nothing to be done for m_game | 44 | // nothing to be done for game_ |
10 | 45 | 45 | ||
11 | 46 | // Next serial | 46 | // Next serial |
12 | 47 | cmdq.nextserial_ = fr.unsigned_32(); | 47 | cmdq.nextserial_ = fr.unsigned_32(); |
13 | @@ -86,7 +86,7 @@ | |||
14 | 86 | 86 | ||
15 | 87 | const CmdQueue & cmdq = game.cmdqueue(); | 87 | const CmdQueue & cmdq = game.cmdqueue(); |
16 | 88 | 88 | ||
18 | 89 | // nothing to be done for m_game | 89 | // nothing to be done for game_ |
19 | 90 | 90 | ||
20 | 91 | // Next serial | 91 | // Next serial |
21 | 92 | fw.unsigned_32(cmdq.nextserial_); | 92 | fw.unsigned_32(cmdq.nextserial_); |
22 | 93 | 93 | ||
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 | 40 | namespace Widelands { | 40 | namespace Widelands { |
28 | 41 | 41 | ||
29 | 42 | GameLoader::GameLoader(const std::string & path, Game & game) : | 42 | GameLoader::GameLoader(const std::string & path, Game & game) : |
31 | 43 | m_fs(*g_fs->make_sub_file_system(path)), m_game(game) | 43 | m_fs(*g_fs->make_sub_file_system(path)), game_(game) |
32 | 44 | {} | 44 | {} |
33 | 45 | 45 | ||
34 | 46 | 46 | ||
35 | @@ -53,7 +53,7 @@ | |||
36 | 53 | */ | 53 | */ |
37 | 54 | int32_t GameLoader::preload_game(GamePreloadPacket & mp) { | 54 | int32_t GameLoader::preload_game(GamePreloadPacket & mp) { |
38 | 55 | // Load elemental data block | 55 | // Load elemental data block |
40 | 56 | mp.read(m_fs, m_game, nullptr); | 56 | mp.read(m_fs, game_, nullptr); |
41 | 57 | 57 | ||
42 | 58 | return 0; | 58 | return 0; |
43 | 59 | } | 59 | } |
44 | @@ -65,43 +65,43 @@ | |||
45 | 65 | ScopedTimer timer("GameLoader::load() took %ums"); | 65 | ScopedTimer timer("GameLoader::load() took %ums"); |
46 | 66 | 66 | ||
47 | 67 | log("Game: Reading Preload Data ... "); | 67 | log("Game: Reading Preload Data ... "); |
49 | 68 | {GamePreloadPacket p; p.read(m_fs, m_game);} | 68 | {GamePreloadPacket p; p.read(m_fs, game_);} |
50 | 69 | log("took %ums\n", timer.ms_since_last_query()); | 69 | log("took %ums\n", timer.ms_since_last_query()); |
51 | 70 | 70 | ||
52 | 71 | log("Game: Reading Game Class Data ... "); | 71 | log("Game: Reading Game Class Data ... "); |
54 | 72 | {GameClassPacket p; p.read(m_fs, m_game);} | 72 | {GameClassPacket p; p.read(m_fs, game_);} |
55 | 73 | log("took %ums\n", timer.ms_since_last_query()); | 73 | log("took %ums\n", timer.ms_since_last_query()); |
56 | 74 | 74 | ||
57 | 75 | log("Game: Reading Map Data ... "); | 75 | log("Game: Reading Map Data ... "); |
59 | 76 | GameMapPacket M; M.read(m_fs, m_game); | 76 | GameMapPacket M; M.read(m_fs, game_); |
60 | 77 | log("Game: Reading Map Data took %ums\n", timer.ms_since_last_query()); | 77 | log("Game: Reading Map Data took %ums\n", timer.ms_since_last_query()); |
61 | 78 | 78 | ||
62 | 79 | log("Game: Reading Player Info ... "); | 79 | log("Game: Reading Player Info ... "); |
64 | 80 | {GamePlayerInfoPacket p; p.read(m_fs, m_game);} | 80 | {GamePlayerInfoPacket p; p.read(m_fs, game_);} |
65 | 81 | log("Game: Reading Player Info took %ums\n", timer.ms_since_last_query()); | 81 | log("Game: Reading Player Info took %ums\n", timer.ms_since_last_query()); |
66 | 82 | 82 | ||
67 | 83 | log("Game: Calling read_complete()\n"); | 83 | log("Game: Calling read_complete()\n"); |
69 | 84 | M.read_complete(m_game); | 84 | M.read_complete(game_); |
70 | 85 | log("Game: read_complete took: %ums\n", timer.ms_since_last_query()); | 85 | log("Game: read_complete took: %ums\n", timer.ms_since_last_query()); |
71 | 86 | 86 | ||
72 | 87 | MapObjectLoader * const mol = M.get_map_object_loader(); | 87 | MapObjectLoader * const mol = M.get_map_object_loader(); |
73 | 88 | 88 | ||
74 | 89 | log("Game: Reading Player Economies Info ... "); | 89 | log("Game: Reading Player Economies Info ... "); |
76 | 90 | {GamePlayerEconomiesPacket p; p.read(m_fs, m_game, mol);} | 90 | {GamePlayerEconomiesPacket p; p.read(m_fs, game_, mol);} |
77 | 91 | log("took %ums\n", timer.ms_since_last_query()); | 91 | log("took %ums\n", timer.ms_since_last_query()); |
78 | 92 | 92 | ||
79 | 93 | log("Game: Reading ai persistent data ... "); | 93 | log("Game: Reading ai persistent data ... "); |
81 | 94 | {GamePlayerAiPersistentPacket p; p.read(m_fs, m_game, mol);} | 94 | {GamePlayerAiPersistentPacket p; p.read(m_fs, game_, mol);} |
82 | 95 | log("took %ums\n", timer.ms_since_last_query()); | 95 | log("took %ums\n", timer.ms_since_last_query()); |
83 | 96 | 96 | ||
84 | 97 | log("Game: Reading Command Queue Data ... "); | 97 | log("Game: Reading Command Queue Data ... "); |
86 | 98 | {GameCmdQueuePacket p; p.read(m_fs, m_game, mol);} | 98 | {GameCmdQueuePacket p; p.read(m_fs, game_, mol);} |
87 | 99 | log("took %ums\n", timer.ms_since_last_query()); | 99 | log("took %ums\n", timer.ms_since_last_query()); |
88 | 100 | 100 | ||
89 | 101 | // This must be after the command queue has been read. | 101 | // This must be after the command queue has been read. |
90 | 102 | log("Game: Parsing messages ... "); | 102 | log("Game: Parsing messages ... "); |
93 | 103 | PlayerNumber const nr_players = m_game.map().get_nrplayers(); | 103 | PlayerNumber const nr_players = game_.map().get_nrplayers(); |
94 | 104 | iterate_players_existing_const(p, nr_players, m_game, player) { | 104 | iterate_players_existing_const(p, nr_players, game_, player) { |
95 | 105 | const MessageQueue & messages = player->messages(); | 105 | const MessageQueue & messages = player->messages(); |
96 | 106 | for (std::pair<MessageId, Message *> temp_message : messages) { | 106 | for (std::pair<MessageId, Message *> temp_message : messages) { |
97 | 107 | Message* m = temp_message.second; | 107 | Message* m = temp_message.second; |
98 | @@ -109,7 +109,7 @@ | |||
99 | 109 | 109 | ||
100 | 110 | // Renew MapObject connections | 110 | // Renew MapObject connections |
101 | 111 | if (m->serial() > 0) { | 111 | if (m->serial() > 0) { |
103 | 112 | MapObject* mo = m_game.objects().get_object(m->serial()); | 112 | MapObject* mo = game_.objects().get_object(m->serial()); |
104 | 113 | mo->removed.connect | 113 | mo->removed.connect |
105 | 114 | (boost::bind(&Player::message_object_removed, player, m_id)); | 114 | (boost::bind(&Player::message_object_removed, player, m_id)); |
106 | 115 | } | 115 | } |
107 | @@ -118,14 +118,14 @@ | |||
108 | 118 | log("took %ums\n", timer.ms_since_last_query()); | 118 | log("took %ums\n", timer.ms_since_last_query()); |
109 | 119 | 119 | ||
110 | 120 | // For compatibility hacks only | 120 | // For compatibility hacks only |
112 | 121 | mol->load_finish_game(m_game); | 121 | mol->load_finish_game(game_); |
113 | 122 | 122 | ||
114 | 123 | // Only read and use interactive player data, if we load a singleplayer game. | 123 | // Only read and use interactive player data, if we load a singleplayer game. |
115 | 124 | // In multiplayer games every client needs to create a new interactive | 124 | // In multiplayer games every client needs to create a new interactive |
116 | 125 | // player. | 125 | // player. |
117 | 126 | if (!multiplayer) { | 126 | if (!multiplayer) { |
118 | 127 | log("Game: Reading Interactive Player Data ... "); | 127 | log("Game: Reading Interactive Player Data ... "); |
120 | 128 | {GameInteractivePlayerPacket p; p.read(m_fs, m_game, mol);} | 128 | {GameInteractivePlayerPacket p; p.read(m_fs, game_, mol);} |
121 | 129 | log("took %ums\n", timer.ms_since_last_query()); | 129 | log("took %ums\n", timer.ms_since_last_query()); |
122 | 130 | } | 130 | } |
123 | 131 | 131 | ||
124 | 132 | 132 | ||
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 | 44 | 44 | ||
130 | 45 | private: | 45 | private: |
131 | 46 | FileSystem & m_fs; | 46 | FileSystem & m_fs; |
133 | 47 | Game & m_game; | 47 | Game & game_; |
134 | 48 | }; | 48 | }; |
135 | 49 | 49 | ||
136 | 50 | } | 50 | } |
137 | 51 | 51 | ||
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 | 34 | 34 | ||
143 | 35 | namespace Widelands { | 35 | namespace Widelands { |
144 | 36 | 36 | ||
146 | 37 | GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), m_game(game) { | 37 | GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), game_(game) { |
147 | 38 | } | 38 | } |
148 | 39 | 39 | ||
149 | 40 | 40 | ||
150 | @@ -47,37 +47,37 @@ | |||
151 | 47 | m_fs.ensure_directory_exists("binary"); | 47 | m_fs.ensure_directory_exists("binary"); |
152 | 48 | 48 | ||
153 | 49 | log("Game: Writing Preload Data ... "); | 49 | log("Game: Writing Preload Data ... "); |
155 | 50 | {GamePreloadPacket p; p.write(m_fs, m_game, nullptr);} | 50 | {GamePreloadPacket p; p.write(m_fs, game_, nullptr);} |
156 | 51 | log("took %ums\n", timer.ms_since_last_query()); | 51 | log("took %ums\n", timer.ms_since_last_query()); |
157 | 52 | 52 | ||
158 | 53 | log("Game: Writing Game Class Data ... "); | 53 | log("Game: Writing Game Class Data ... "); |
160 | 54 | {GameClassPacket p; p.write(m_fs, m_game, nullptr);} | 54 | {GameClassPacket p; p.write(m_fs, game_, nullptr);} |
161 | 55 | log("took %ums\n", timer.ms_since_last_query()); | 55 | log("took %ums\n", timer.ms_since_last_query()); |
162 | 56 | 56 | ||
163 | 57 | log("Game: Writing Player Info ... "); | 57 | log("Game: Writing Player Info ... "); |
165 | 58 | {GamePlayerInfoPacket p; p.write(m_fs, m_game, nullptr);} | 58 | {GamePlayerInfoPacket p; p.write(m_fs, game_, nullptr);} |
166 | 59 | log("took %ums\n", timer.ms_since_last_query()); | 59 | log("took %ums\n", timer.ms_since_last_query()); |
167 | 60 | 60 | ||
168 | 61 | log("Game: Writing Map Data!\n"); | 61 | log("Game: Writing Map Data!\n"); |
170 | 62 | GameMapPacket M; M.write(m_fs, m_game, nullptr); | 62 | GameMapPacket M; M.write(m_fs, game_, nullptr); |
171 | 63 | log("Game: Writing Map Data took %ums\n", timer.ms_since_last_query()); | 63 | log("Game: Writing Map Data took %ums\n", timer.ms_since_last_query()); |
172 | 64 | 64 | ||
173 | 65 | MapObjectSaver * const mos = M.get_map_object_saver(); | 65 | MapObjectSaver * const mos = M.get_map_object_saver(); |
174 | 66 | 66 | ||
175 | 67 | log("Game: Writing Player Economies Info ... "); | 67 | log("Game: Writing Player Economies Info ... "); |
177 | 68 | {GamePlayerEconomiesPacket p; p.write(m_fs, m_game, mos);} | 68 | {GamePlayerEconomiesPacket p; p.write(m_fs, game_, mos);} |
178 | 69 | log("took %ums\n", timer.ms_since_last_query()); | 69 | log("took %ums\n", timer.ms_since_last_query()); |
179 | 70 | 70 | ||
180 | 71 | log("Game: Writing ai persistent data ... "); | 71 | log("Game: Writing ai persistent data ... "); |
182 | 72 | {GamePlayerAiPersistentPacket p; p.write(m_fs, m_game, mos);} | 72 | {GamePlayerAiPersistentPacket p; p.write(m_fs, game_, mos);} |
183 | 73 | log("took %ums\n", timer.ms_since_last_query()); | 73 | log("took %ums\n", timer.ms_since_last_query()); |
184 | 74 | 74 | ||
185 | 75 | log("Game: Writing Command Queue Data ... "); | 75 | log("Game: Writing Command Queue Data ... "); |
187 | 76 | {GameCmdQueuePacket p; p.write(m_fs, m_game, mos);} | 76 | {GameCmdQueuePacket p; p.write(m_fs, game_, mos);} |
188 | 77 | log("took %ums\n", timer.ms_since_last_query()); | 77 | log("took %ums\n", timer.ms_since_last_query()); |
189 | 78 | 78 | ||
190 | 79 | log("Game: Writing Interactive Player Data ... "); | 79 | log("Game: Writing Interactive Player Data ... "); |
192 | 80 | {GameInteractivePlayerPacket p; p.write(m_fs, m_game, mos);} | 80 | {GameInteractivePlayerPacket p; p.write(m_fs, game_, mos);} |
193 | 81 | log("took %ums\n", timer.ms_since_last_query()); | 81 | log("took %ums\n", timer.ms_since_last_query()); |
194 | 82 | } | 82 | } |
195 | 83 | 83 | ||
196 | 84 | 84 | ||
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 | 44 | 44 | ||
202 | 45 | private: | 45 | private: |
203 | 46 | FileSystem & m_fs; | 46 | FileSystem & m_fs; |
205 | 47 | Game & m_game; | 47 | Game & game_; |
206 | 48 | }; | 48 | }; |
207 | 49 | 49 | ||
208 | 50 | } | 50 | } |
209 | 51 | 51 | ||
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 | 89 | 89 | ||
215 | 90 | void Game::SyncWrapper::data(void const * const sync_data, size_t const size) { | 90 | void Game::SyncWrapper::data(void const * const sync_data, size_t const size) { |
216 | 91 | #ifdef SYNC_DEBUG | 91 | #ifdef SYNC_DEBUG |
219 | 92 | uint32_t time = m_game.get_gametime(); | 92 | uint32_t time = game_.get_gametime(); |
220 | 93 | log("[sync:%08u t=%6u]", m_counter, time); | 93 | log("[sync:%08u t=%6u]", counter_, time); |
221 | 94 | for (size_t i = 0; i < size; ++i) | 94 | for (size_t i = 0; i < size; ++i) |
222 | 95 | log(" %02x", (static_cast<uint8_t const *>(sync_data))[i]); | 95 | log(" %02x", (static_cast<uint8_t const *>(sync_data))[i]); |
223 | 96 | log("\n"); | 96 | log("\n"); |
224 | 97 | 97 | ||
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 | 664 | */ | 664 | */ |
230 | 665 | struct FindBobsCallback { | 665 | struct FindBobsCallback { |
231 | 666 | FindBobsCallback(std::vector<Bob *> * const list, const FindBob & functor) | 666 | FindBobsCallback(std::vector<Bob *> * const list, const FindBob & functor) |
233 | 667 | : m_list(list), m_functor(functor), m_found(0) {} | 667 | : list_(list), functor_(functor), found_(0) {} |
234 | 668 | 668 | ||
235 | 669 | void operator()(const Map &, const FCoords cur) { | 669 | void operator()(const Map &, const FCoords cur) { |
236 | 670 | for | 670 | for |
237 | @@ -673,22 +673,22 @@ | |||
238 | 673 | bob = bob->get_next_bob()) | 673 | bob = bob->get_next_bob()) |
239 | 674 | { | 674 | { |
240 | 675 | if | 675 | if |
243 | 676 | (m_list && | 676 | (list_ && |
244 | 677 | std::find(m_list->begin(), m_list->end(), bob) != m_list->end()) | 677 | std::find(list_->begin(), list_->end(), bob) != list_->end()) |
245 | 678 | continue; | 678 | continue; |
246 | 679 | 679 | ||
250 | 680 | if (m_functor.accept(bob)) { | 680 | if (functor_.accept(bob)) { |
251 | 681 | if (m_list) | 681 | if (list_) |
252 | 682 | m_list->push_back(bob); | 682 | list_->push_back(bob); |
253 | 683 | 683 | ||
255 | 684 | ++m_found; | 684 | ++found_; |
256 | 685 | } | 685 | } |
257 | 686 | } | 686 | } |
258 | 687 | } | 687 | } |
259 | 688 | 688 | ||
263 | 689 | std::vector<Bob *> * m_list; | 689 | std::vector<Bob*>* list_; |
264 | 690 | const FindBob & m_functor; | 690 | const FindBob& functor_; |
265 | 691 | uint32_t m_found; | 691 | uint32_t found_; |
266 | 692 | }; | 692 | }; |
267 | 693 | 693 | ||
268 | 694 | 694 | ||
269 | @@ -711,7 +711,7 @@ | |||
270 | 711 | 711 | ||
271 | 712 | find(area, cb); | 712 | find(area, cb); |
272 | 713 | 713 | ||
274 | 714 | return cb.m_found; | 714 | return cb.found_; |
275 | 715 | } | 715 | } |
276 | 716 | 716 | ||
277 | 717 | 717 | ||
278 | @@ -737,7 +737,7 @@ | |||
279 | 737 | 737 | ||
280 | 738 | find_reachable(area, checkstep, cb); | 738 | find_reachable(area, checkstep, cb); |
281 | 739 | 739 | ||
283 | 740 | return cb.m_found; | 740 | return cb.found_; |
284 | 741 | } | 741 | } |
285 | 742 | 742 | ||
286 | 743 | 743 | ||
287 | @@ -751,7 +751,7 @@ | |||
288 | 751 | struct FindImmovablesCallback { | 751 | struct FindImmovablesCallback { |
289 | 752 | FindImmovablesCallback | 752 | FindImmovablesCallback |
290 | 753 | (std::vector<ImmovableFound> * const list, const FindImmovable & functor) | 753 | (std::vector<ImmovableFound> * const list, const FindImmovable & functor) |
292 | 754 | : m_list(list), m_functor(functor), m_found(0) {} | 754 | : list_(list), functor_(functor), found_(0) {} |
293 | 755 | 755 | ||
294 | 756 | void operator()(const Map &, const FCoords cur) { | 756 | void operator()(const Map &, const FCoords cur) { |
295 | 757 | BaseImmovable * const imm = cur.field->get_immovable(); | 757 | BaseImmovable * const imm = cur.field->get_immovable(); |
296 | @@ -759,21 +759,21 @@ | |||
297 | 759 | if (!imm) | 759 | if (!imm) |
298 | 760 | return; | 760 | return; |
299 | 761 | 761 | ||
302 | 762 | if (m_functor.accept(*imm)) { | 762 | if (functor_.accept(*imm)) { |
303 | 763 | if (m_list) { | 763 | if (list_) { |
304 | 764 | ImmovableFound imf; | 764 | ImmovableFound imf; |
305 | 765 | imf.object = imm; | 765 | imf.object = imm; |
306 | 766 | imf.coords = cur; | 766 | imf.coords = cur; |
308 | 767 | m_list->push_back(imf); | 767 | list_->push_back(imf); |
309 | 768 | } | 768 | } |
310 | 769 | 769 | ||
312 | 770 | ++m_found; | 770 | ++found_; |
313 | 771 | } | 771 | } |
314 | 772 | } | 772 | } |
315 | 773 | 773 | ||
319 | 774 | std::vector<ImmovableFound> * m_list; | 774 | std::vector<ImmovableFound>* list_; |
320 | 775 | const FindImmovable & m_functor; | 775 | const FindImmovable& functor_; |
321 | 776 | uint32_t m_found; | 776 | uint32_t found_; |
322 | 777 | }; | 777 | }; |
323 | 778 | 778 | ||
324 | 779 | 779 | ||
325 | @@ -794,7 +794,7 @@ | |||
326 | 794 | 794 | ||
327 | 795 | find(area, cb); | 795 | find(area, cb); |
328 | 796 | 796 | ||
330 | 797 | return cb.m_found; | 797 | return cb.found_; |
331 | 798 | } | 798 | } |
332 | 799 | 799 | ||
333 | 800 | 800 | ||
334 | @@ -818,7 +818,7 @@ | |||
335 | 818 | 818 | ||
336 | 819 | find_reachable(area, checkstep, cb); | 819 | find_reachable(area, checkstep, cb); |
337 | 820 | 820 | ||
339 | 821 | return cb.m_found; | 821 | return cb.found_; |
340 | 822 | } | 822 | } |
341 | 823 | 823 | ||
342 | 824 | 824 | ||
343 | @@ -862,20 +862,20 @@ | |||
344 | 862 | struct FindNodesCallback { | 862 | struct FindNodesCallback { |
345 | 863 | FindNodesCallback | 863 | FindNodesCallback |
346 | 864 | (std::vector<Coords> * const list, const FindNode & functor) | 864 | (std::vector<Coords> * const list, const FindNode & functor) |
348 | 865 | : m_list(list), m_functor(functor), m_found(0) {} | 865 | : list_(list), functor_(functor), found_(0) {} |
349 | 866 | 866 | ||
350 | 867 | void operator()(const Map & map, const FCoords cur) { | 867 | void operator()(const Map & map, const FCoords cur) { |
354 | 868 | if (m_functor.accept(map, cur)) { | 868 | if (functor_.accept(map, cur)) { |
355 | 869 | if (m_list) | 869 | if (list_) |
356 | 870 | m_list->push_back(cur); | 870 | list_->push_back(cur); |
357 | 871 | 871 | ||
359 | 872 | ++m_found; | 872 | ++found_; |
360 | 873 | } | 873 | } |
361 | 874 | } | 874 | } |
362 | 875 | 875 | ||
366 | 876 | std::vector<Coords> * m_list; | 876 | std::vector<Coords>* list_; |
367 | 877 | const FindNode & m_functor; | 877 | const FindNode & functor_; |
368 | 878 | uint32_t m_found; | 878 | uint32_t found_; |
369 | 879 | }; | 879 | }; |
370 | 880 | 880 | ||
371 | 881 | 881 | ||
372 | @@ -897,7 +897,7 @@ | |||
373 | 897 | 897 | ||
374 | 898 | find(area, cb); | 898 | find(area, cb); |
375 | 899 | 899 | ||
377 | 900 | return cb.m_found; | 900 | return cb.found_; |
378 | 901 | } | 901 | } |
379 | 902 | 902 | ||
380 | 903 | 903 | ||
381 | @@ -920,7 +920,7 @@ | |||
382 | 920 | 920 | ||
383 | 921 | find_reachable(area, checkstep, cb); | 921 | find_reachable(area, checkstep, cb); |
384 | 922 | 922 | ||
386 | 923 | return cb.m_found; | 923 | return cb.found_; |
387 | 924 | } | 924 | } |
388 | 925 | 925 | ||
389 | 926 | 926 | ||
390 | @@ -1424,7 +1424,7 @@ | |||
391 | 1424 | rx = lx + dist; | 1424 | rx = lx + dist; |
392 | 1425 | 1425 | ||
393 | 1426 | // Allow for wrap-around | 1426 | // Allow for wrap-around |
395 | 1427 | // Yes, the second is an else if; see the above if (dist >= m_width) | 1427 | // Yes, the second is an else if; see the above if (dist >= width_) |
396 | 1428 | if (lx < 0) | 1428 | if (lx < 0) |
397 | 1429 | lx += width_; | 1429 | lx += width_; |
398 | 1430 | else if (rx >= static_cast<int32_t>(width_)) | 1430 | else if (rx >= static_cast<int32_t>(width_)) |
399 | 1431 | 1431 | ||
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 | 748 | uint32_t Ship::calculate_sea_route(Game& game, PortDock& pd, Path* finalpath) { | 748 | uint32_t Ship::calculate_sea_route(Game& game, PortDock& pd, Path* finalpath) { |
405 | 749 | Map& map = game.map(); | 749 | Map& map = game.map(); |
406 | 750 | StepEvalAStar se(pd.get_warehouse()->get_position()); | 750 | StepEvalAStar se(pd.get_warehouse()->get_position()); |
410 | 751 | se.m_swim = true; | 751 | se.swim_ = true; |
411 | 752 | se.m_conservative = false; | 752 | se.conservative_ = false; |
412 | 753 | se.m_estimator_bias = -5 * map.calc_cost(0); | 753 | se.estimator_bias_ = -5 * map.calc_cost(0); |
413 | 754 | 754 | ||
414 | 755 | MapAStar<StepEvalAStar> astar(map, se); | 755 | MapAStar<StepEvalAStar> astar(map, se); |
415 | 756 | 756 | ||
416 | 757 | 757 | ||
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 | 425 | /// Calculates the actual position to draw on from the base node position. | 425 | /// Calculates the actual position to draw on from the base node position. |
422 | 426 | /// This function takes battling into account. | 426 | /// This function takes battling into account. |
423 | 427 | /// | 427 | /// |
425 | 428 | /// pos is the location, in pixels, of the node m_position (height is already | 428 | /// pos is the location, in pixels, of the node position_ (height is already |
426 | 429 | /// taken into account). | 429 | /// taken into account). |
427 | 430 | Point Soldier::calc_drawpos | 430 | Point Soldier::calc_drawpos |
428 | 431 | (const EditorGameBase & game, const Point pos) const | 431 | (const EditorGameBase & game, const Point pos) const |
429 | @@ -695,13 +695,13 @@ | |||
430 | 695 | } | 695 | } |
431 | 696 | 696 | ||
432 | 697 | struct FindNodeOwned { | 697 | struct FindNodeOwned { |
434 | 698 | FindNodeOwned(PlayerNumber owner) : m_owner(owner) | 698 | FindNodeOwned(PlayerNumber owner) : owner_(owner) |
435 | 699 | {} | 699 | {} |
436 | 700 | bool accept(const Map&, const FCoords& coords) const { | 700 | bool accept(const Map&, const FCoords& coords) const { |
438 | 701 | return (coords.field->get_owned_by() == m_owner); | 701 | return (coords.field->get_owned_by() == owner_); |
439 | 702 | } | 702 | } |
440 | 703 | private: | 703 | private: |
442 | 704 | PlayerNumber m_owner; | 704 | PlayerNumber owner_; |
443 | 705 | }; | 705 | }; |
444 | 706 | 706 | ||
445 | 707 | /** | 707 | /** |
446 | 708 | 708 | ||
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 | 25 | 25 | ||
452 | 26 | 26 | ||
453 | 27 | MapVersion::MapVersion() : | 27 | MapVersion::MapVersion() : |
456 | 28 | m_map_version_major(0), | 28 | map_version_major_(0), |
457 | 29 | m_map_version_minor(0) | 29 | map_version_minor_(0) |
458 | 30 | { | 30 | { |
461 | 31 | m_map_creator_version = build_id(); | 31 | map_creator_version_ = build_id(); |
462 | 32 | m_map_version_timestamp = static_cast<uint32_t>(time(nullptr)); | 32 | map_version_timestamp_ = static_cast<uint32_t>(time(nullptr)); |
463 | 33 | } | 33 | } |
464 | 34 | 34 | ||
465 | 35 | } | 35 | } |
466 | 36 | 36 | ||
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 | 34 | 34 | ||
472 | 35 | struct MapVersion { | 35 | struct MapVersion { |
473 | 36 | 36 | ||
480 | 37 | std::string m_map_source_url; | 37 | std::string map_source_url_; |
481 | 38 | std::string m_map_source_release; | 38 | std::string map_source_release_; |
482 | 39 | std::string m_map_creator_version; | 39 | std::string map_creator_version_; |
483 | 40 | int32_t m_map_version_major; | 40 | int32_t map_version_major_; |
484 | 41 | int32_t m_map_version_minor; | 41 | int32_t map_version_minor_; |
485 | 42 | uint32_t m_map_version_timestamp; | 42 | uint32_t map_version_timestamp_; |
486 | 43 | 43 | ||
487 | 44 | MapVersion(); | 44 | MapVersion(); |
488 | 45 | 45 | ||
489 | 46 | 46 | ||
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 | 53 | 53 | ||
495 | 54 | struct StepEvalAStar { | 54 | struct StepEvalAStar { |
496 | 55 | StepEvalAStar(Coords target) : | 55 | StepEvalAStar(Coords target) : |
501 | 56 | m_target(target), | 56 | target_(target), |
502 | 57 | m_estimator_bias(0), | 57 | estimator_bias_(0), |
503 | 58 | m_conservative(true), | 58 | conservative_(true), |
504 | 59 | m_swim(false) | 59 | swim_(false) |
505 | 60 | { | 60 | { |
506 | 61 | } | 61 | } |
507 | 62 | 62 | ||
508 | 63 | int32_t estimate(Map & map, FCoords pos) const | 63 | int32_t estimate(Map & map, FCoords pos) const |
509 | 64 | { | 64 | { |
513 | 65 | int32_t est = m_estimator_bias; | 65 | int32_t est = estimator_bias_; |
514 | 66 | if (m_conservative) | 66 | if (conservative_) |
515 | 67 | est += map.calc_cost_lowerbound(pos, m_target); | 67 | est += map.calc_cost_lowerbound(pos, target_); |
516 | 68 | else | 68 | else |
518 | 69 | est += map.calc_cost_estimate(pos, m_target); | 69 | est += map.calc_cost_estimate(pos, target_); |
519 | 70 | return est; | 70 | return est; |
520 | 71 | } | 71 | } |
521 | 72 | 72 | ||
522 | 73 | int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const | 73 | int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const |
523 | 74 | { | 74 | { |
524 | 75 | if | 75 | if |
527 | 76 | ((m_swim && !(to.field->nodecaps() & MOVECAPS_SWIM)) || | 76 | ((swim_ && !(to.field->nodecaps() & MOVECAPS_SWIM)) || |
528 | 77 | (!m_swim && !(to.field->nodecaps() & MOVECAPS_WALK))) | 77 | (!swim_ && !(to.field->nodecaps() & MOVECAPS_WALK))) |
529 | 78 | return -1; | 78 | return -1; |
530 | 79 | 79 | ||
531 | 80 | return map.calc_cost(from, dir); | 80 | return map.calc_cost(from, dir); |
532 | 81 | } | 81 | } |
533 | 82 | 82 | ||
538 | 83 | Coords m_target; | 83 | Coords target_; |
539 | 84 | int32_t m_estimator_bias; | 84 | int32_t estimator_bias_; |
540 | 85 | bool m_conservative; | 85 | bool conservative_; |
541 | 86 | bool m_swim; | 86 | bool swim_; |
542 | 87 | }; | 87 | }; |
543 | 88 | 88 | ||
544 | 89 | 89 | ||
545 | 90 | 90 | ||
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 | 25 | 25 | ||
551 | 26 | template <> bool MapDifferenceRegion<Area<FCoords> >::advance(const Map & map) | 26 | template <> bool MapDifferenceRegion<Area<FCoords> >::advance(const Map & map) |
552 | 27 | { | 27 | { |
558 | 28 | assert(1 <= m_direction); | 28 | assert(1 <= direction_); |
559 | 29 | assert (m_direction <= 6); | 29 | assert (direction_ <= 6); |
560 | 30 | if (m_remaining_in_edge) { | 30 | if (remaining_in_edge_) { |
561 | 31 | map.get_neighbour(m_area, m_direction, &m_area); | 31 | map.get_neighbour(area_, direction_, &area_); |
562 | 32 | --m_remaining_in_edge; | 32 | --remaining_in_edge_; |
563 | 33 | return true; | 33 | return true; |
564 | 34 | } else { | 34 | } else { |
569 | 35 | if (!m_passed_corner) { | 35 | if (!passed_corner_) { |
570 | 36 | m_passed_corner = true; | 36 | passed_corner_ = true; |
571 | 37 | --m_direction; if (!m_direction) m_direction = 6; | 37 | --direction_; if (!direction_) direction_ = 6; |
572 | 38 | m_remaining_in_edge = m_area.radius; | 38 | remaining_in_edge_ = area_.radius; |
573 | 39 | return advance(map); | 39 | return advance(map); |
574 | 40 | } | 40 | } |
575 | 41 | } | 41 | } |
576 | @@ -45,16 +45,16 @@ | |||
577 | 45 | template <> | 45 | template <> |
578 | 46 | void MapDifferenceRegion<Area<FCoords> >::move_to_other_side(const Map & map) | 46 | void MapDifferenceRegion<Area<FCoords> >::move_to_other_side(const Map & map) |
579 | 47 | { | 47 | { |
586 | 48 | assert(1 <= m_direction); | 48 | assert(1 <= direction_); |
587 | 49 | assert (m_direction <= 6); | 49 | assert (direction_ <= 6); |
588 | 50 | assert(m_passed_corner); | 50 | assert(passed_corner_); |
589 | 51 | --m_direction; if (!m_direction) m_direction = 6; | 51 | --direction_; if (!direction_) direction_ = 6; |
590 | 52 | Area<FCoords>::RadiusType steps_left = m_area.radius + 1; | 52 | Area<FCoords>::RadiusType steps_left = area_.radius + 1; |
591 | 53 | switch (m_direction) { | 53 | switch (direction_) { |
592 | 54 | #define DIRECTION_CASE(dir, neighbour_function) \ | 54 | #define DIRECTION_CASE(dir, neighbour_function) \ |
593 | 55 | case dir: \ | 55 | case dir: \ |
594 | 56 | for (; steps_left; --steps_left) \ | 56 | for (; steps_left; --steps_left) \ |
596 | 57 | map.neighbour_function(m_area, &m_area); \ | 57 | map.neighbour_function(area_, &area_); \ |
597 | 58 | break; \ | 58 | break; \ |
598 | 59 | 59 | ||
599 | 60 | DIRECTION_CASE(WALK_NW, get_tln); | 60 | DIRECTION_CASE(WALK_NW, get_tln); |
600 | @@ -66,9 +66,9 @@ | |||
601 | 66 | default: | 66 | default: |
602 | 67 | NEVER_HERE(); | 67 | NEVER_HERE(); |
603 | 68 | } | 68 | } |
607 | 69 | --m_direction; if (!m_direction) m_direction = 6; | 69 | --direction_; if (!direction_) direction_ = 6; |
608 | 70 | m_remaining_in_edge = m_area.radius; | 70 | remaining_in_edge_ = area_.radius; |
609 | 71 | m_passed_corner = false; | 71 | passed_corner_ = false; |
610 | 72 | } | 72 | } |
611 | 73 | 73 | ||
612 | 74 | } | 74 | } |
613 | 75 | 75 | ||
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 | 40 | template <typename AreaType = Area<> > struct MapDifferenceRegion { | 40 | template <typename AreaType = Area<> > struct MapDifferenceRegion { |
619 | 41 | MapDifferenceRegion | 41 | MapDifferenceRegion |
620 | 42 | (const Map & map, AreaType area, Direction direction) | 42 | (const Map & map, AreaType area, Direction direction) |
622 | 43 | : m_area(area), m_remaining_in_edge(area.radius), m_passed_corner(false) | 43 | : area_(area), remaining_in_edge_(area.radius), passed_corner_(false) |
623 | 44 | { | 44 | { |
624 | 45 | assert(1 <= direction); | 45 | assert(1 <= direction); |
625 | 46 | assert (direction <= 6); | 46 | assert (direction <= 6); |
626 | @@ -50,7 +50,7 @@ | |||
627 | 50 | #define DIRECTION_CASE(dir, neighbour_function) \ | 50 | #define DIRECTION_CASE(dir, neighbour_function) \ |
628 | 51 | case dir: \ | 51 | case dir: \ |
629 | 52 | for (; area.radius; --area.radius) \ | 52 | for (; area.radius; --area.radius) \ |
631 | 53 | map.neighbour_function(m_area, &m_area); \ | 53 | map.neighbour_function(area_, &area_); \ |
632 | 54 | break; \ | 54 | break; \ |
633 | 55 | 55 | ||
634 | 56 | DIRECTION_CASE(WALK_NW, get_tln); | 56 | DIRECTION_CASE(WALK_NW, get_tln); |
635 | @@ -63,10 +63,10 @@ | |||
636 | 63 | } | 63 | } |
637 | 64 | --direction; if (!direction) direction = 6; | 64 | --direction; if (!direction) direction = 6; |
638 | 65 | --direction; if (!direction) direction = 6; | 65 | --direction; if (!direction) direction = 6; |
640 | 66 | m_direction = direction; | 66 | direction_ = direction; |
641 | 67 | } | 67 | } |
642 | 68 | 68 | ||
644 | 69 | typename AreaType::CoordsType & location() const {return m_area;} | 69 | typename AreaType::CoordsType & location() const {return area_;} |
645 | 70 | 70 | ||
646 | 71 | /** | 71 | /** |
647 | 72 | * Moves on to the next location. The return value indicates whether the new | 72 | * Moves on to the next location. The return value indicates whether the new |
648 | @@ -80,12 +80,12 @@ | |||
649 | 80 | 80 | ||
650 | 81 | void move_to_other_side(const Map & map); | 81 | void move_to_other_side(const Map & map); |
651 | 82 | 82 | ||
653 | 83 | typename AreaType::RadiusType radius() const {return m_area.radius;} | 83 | typename AreaType::RadiusType radius() const {return area_.radius;} |
654 | 84 | private: | 84 | private: |
659 | 85 | AreaType m_area; | 85 | AreaType area_; |
660 | 86 | typename AreaType::RadiusType m_remaining_in_edge; | 86 | typename AreaType::RadiusType remaining_in_edge_; |
661 | 87 | bool m_passed_corner; | 87 | bool passed_corner_; |
662 | 88 | Direction m_direction; | 88 | Direction direction_; |
663 | 89 | }; | 89 | }; |
664 | 90 | 90 | ||
665 | 91 | } | 91 | } |
666 | 92 | 92 | ||
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 | 25 | 25 | ||
672 | 26 | template <> | 26 | template <> |
673 | 27 | bool MapFringeRegion<Area<FCoords> >::advance(const Map & map) { | 27 | bool MapFringeRegion<Area<FCoords> >::advance(const Map & map) { |
675 | 28 | switch (m_phase) { | 28 | switch (phase_) { |
676 | 29 | case 0: | 29 | case 0: |
680 | 30 | if (m_area.radius) { | 30 | if (area_.radius) { |
681 | 31 | m_remaining_in_phase = m_area.radius; | 31 | remaining_in_phase_ = area_.radius; |
682 | 32 | m_phase = 6; | 32 | phase_ = 6; |
683 | 33 | } | 33 | } |
684 | 34 | else | 34 | else |
685 | 35 | return false; | 35 | return false; |
686 | 36 | /* no break */ | 36 | /* no break */ |
693 | 37 | case 1: map.get_trn(m_area, &m_area); break; | 37 | case 1: map.get_trn(area_, &area_); break; |
694 | 38 | case 2: map.get_tln(m_area, &m_area); break; | 38 | case 2: map.get_tln(area_, &area_); break; |
695 | 39 | case 3: map. get_ln(m_area, &m_area); break; | 39 | case 3: map. get_ln(area_, &area_); break; |
696 | 40 | case 4: map.get_bln(m_area, &m_area); break; | 40 | case 4: map.get_bln(area_, &area_); break; |
697 | 41 | case 5: map.get_brn(m_area, &m_area); break; | 41 | case 5: map.get_brn(area_, &area_); break; |
698 | 42 | case 6: map. get_rn(m_area, &m_area); break; | 42 | case 6: map. get_rn(area_, &area_); break; |
699 | 43 | default: | 43 | default: |
700 | 44 | NEVER_HERE(); | 44 | NEVER_HERE(); |
701 | 45 | } | 45 | } |
705 | 46 | if (--m_remaining_in_phase == 0) { | 46 | if (--remaining_in_phase_ == 0) { |
706 | 47 | m_remaining_in_phase = m_area.radius; | 47 | remaining_in_phase_ = area_.radius; |
707 | 48 | --m_phase; | 48 | --phase_; |
708 | 49 | } | 49 | } |
710 | 50 | return m_phase; | 50 | return phase_; |
711 | 51 | } | 51 | } |
712 | 52 | 52 | ||
713 | 53 | template <> | 53 | template <> |
714 | 54 | bool MapFringeRegion<Area<> >::advance(const Map & map) { | 54 | bool MapFringeRegion<Area<> >::advance(const Map & map) { |
716 | 55 | switch (m_phase) { | 55 | switch (phase_) { |
717 | 56 | case 0: | 56 | case 0: |
721 | 57 | if (m_area.radius) { | 57 | if (area_.radius) { |
722 | 58 | m_remaining_in_phase = m_area.radius; | 58 | remaining_in_phase_ = area_.radius; |
723 | 59 | m_phase = 6; | 59 | phase_ = 6; |
724 | 60 | } | 60 | } |
725 | 61 | else | 61 | else |
726 | 62 | return false; | 62 | return false; |
727 | 63 | /* no break */ | 63 | /* no break */ |
734 | 64 | case 1: map.get_trn(m_area, &m_area); break; | 64 | case 1: map.get_trn(area_, &area_); break; |
735 | 65 | case 2: map.get_tln(m_area, &m_area); break; | 65 | case 2: map.get_tln(area_, &area_); break; |
736 | 66 | case 3: map. get_ln(m_area, &m_area); break; | 66 | case 3: map. get_ln(area_, &area_); break; |
737 | 67 | case 4: map.get_bln(m_area, &m_area); break; | 67 | case 4: map.get_bln(area_, &area_); break; |
738 | 68 | case 5: map.get_brn(m_area, &m_area); break; | 68 | case 5: map.get_brn(area_, &area_); break; |
739 | 69 | case 6: map. get_rn(m_area, &m_area); break; | 69 | case 6: map. get_rn(area_, &area_); break; |
740 | 70 | default: | 70 | default: |
741 | 71 | NEVER_HERE(); | 71 | NEVER_HERE(); |
742 | 72 | } | 72 | } |
746 | 73 | if (--m_remaining_in_phase == 0) { | 73 | if (--remaining_in_phase_ == 0) { |
747 | 74 | m_remaining_in_phase = m_area.radius; | 74 | remaining_in_phase_ = area_.radius; |
748 | 75 | --m_phase; | 75 | --phase_; |
749 | 76 | } | 76 | } |
751 | 77 | return m_phase; | 77 | return phase_; |
752 | 78 | } | 78 | } |
753 | 79 | 79 | ||
754 | 80 | } | 80 | } |
755 | 81 | 81 | ||
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 | 34 | */ | 34 | */ |
761 | 35 | template <typename AreaType = Area<> > struct MapFringeRegion { | 35 | template <typename AreaType = Area<> > struct MapFringeRegion { |
762 | 36 | MapFringeRegion(const Map & map, AreaType area) : | 36 | MapFringeRegion(const Map & map, AreaType area) : |
766 | 37 | m_area (area), | 37 | area_ (area), |
767 | 38 | m_remaining_in_phase(area.radius), | 38 | remaining_in_phase_(area.radius), |
768 | 39 | m_phase (area.radius ? 6 : 0) | 39 | phase_ (area.radius ? 6 : 0) |
769 | 40 | { | 40 | { |
770 | 41 | for (typename AreaType::RadiusType r = area.radius; r; --r) | 41 | for (typename AreaType::RadiusType r = area.radius; r; --r) |
772 | 42 | map.get_tln(m_area, &m_area); | 42 | map.get_tln(area_, &area_); |
773 | 43 | } | 43 | } |
774 | 44 | 44 | ||
775 | 45 | 45 | ||
777 | 46 | const typename AreaType::CoordsType & location() const {return m_area;} | 46 | const typename AreaType::CoordsType & location() const {return area_;} |
778 | 47 | 47 | ||
779 | 48 | /** | 48 | /** |
780 | 49 | * Moves on to the next location. The return value indicates whether the new | 49 | * Moves on to the next location. The return value indicates whether the new |
781 | @@ -64,17 +64,17 @@ | |||
782 | 64 | * the region ready to iterate over the next layer of nodes. | 64 | * the region ready to iterate over the next layer of nodes. |
783 | 65 | */ | 65 | */ |
784 | 66 | void extend(const Map & map) { | 66 | void extend(const Map & map) { |
789 | 67 | map.get_tln(m_area, &m_area); | 67 | map.get_tln(area_, &area_); |
790 | 68 | ++m_area.radius; | 68 | ++area_.radius; |
791 | 69 | m_remaining_in_phase = m_area.radius; | 69 | remaining_in_phase_ = area_.radius; |
792 | 70 | m_phase = 6; | 70 | phase_ = 6; |
793 | 71 | } | 71 | } |
794 | 72 | 72 | ||
796 | 73 | typename AreaType::RadiusType radius() const {return m_area.radius;} | 73 | typename AreaType::RadiusType radius() const {return area_.radius;} |
797 | 74 | private: | 74 | private: |
801 | 75 | AreaType m_area; | 75 | AreaType area_; |
802 | 76 | typename AreaType::RadiusType m_remaining_in_phase; | 76 | typename AreaType::RadiusType remaining_in_phase_; |
803 | 77 | uint8_t m_phase; | 77 | uint8_t phase_; |
804 | 78 | }; | 78 | }; |
805 | 79 | 79 | ||
806 | 80 | } | 80 | } |
807 | 81 | 81 | ||
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 | 24 | template <> MapHollowRegion<Area<> >::MapHollowRegion | 24 | template <> MapHollowRegion<Area<> >::MapHollowRegion |
813 | 25 | (const Map & map, HollowArea<Area<> > const hollow_area) | 25 | (const Map & map, HollowArea<Area<> > const hollow_area) |
814 | 26 | : | 26 | : |
822 | 27 | m_hollow_area (hollow_area), | 27 | hollow_area_ (hollow_area), |
823 | 28 | m_phase (Top), | 28 | phase_ (Top), |
824 | 29 | m_delta_radius(hollow_area.radius - hollow_area.hole_radius), | 29 | delta_radius_(hollow_area.radius - hollow_area.hole_radius), |
825 | 30 | m_row (0), | 30 | row_ (0), |
826 | 31 | m_rowwidth (hollow_area.radius + 1), | 31 | rowwidth_ (hollow_area.radius + 1), |
827 | 32 | m_rowpos (0), | 32 | rowpos_ (0), |
828 | 33 | m_left (hollow_area) | 33 | left_ (hollow_area) |
829 | 34 | { | 34 | { |
830 | 35 | assert(hollow_area.hole_radius < hollow_area.radius); | 35 | assert(hollow_area.hole_radius < hollow_area.radius); |
831 | 36 | for (uint16_t r = hollow_area.radius; r; --r) | 36 | for (uint16_t r = hollow_area.radius; r; --r) |
834 | 37 | map.get_tln(m_hollow_area, &m_hollow_area); | 37 | map.get_tln(hollow_area_, &hollow_area_); |
835 | 38 | m_left = m_hollow_area; | 38 | left_ = hollow_area_; |
836 | 39 | } | 39 | } |
837 | 40 | 40 | ||
838 | 41 | template <> bool MapHollowRegion<Area<> >::advance(const Map & map) { | 41 | template <> bool MapHollowRegion<Area<> >::advance(const Map & map) { |
840 | 42 | if (m_phase == None) | 42 | if (phase_ == None) |
841 | 43 | return false; | 43 | return false; |
846 | 44 | ++m_rowpos; | 44 | ++rowpos_; |
847 | 45 | if (m_rowpos < m_rowwidth) { | 45 | if (rowpos_ < rowwidth_) { |
848 | 46 | map.get_rn(m_hollow_area, &m_hollow_area); | 46 | map.get_rn(hollow_area_, &hollow_area_); |
849 | 47 | if ((m_phase & (Upper|Lower)) && m_rowpos == m_delta_radius) { | 47 | if ((phase_ & (Upper|Lower)) && rowpos_ == delta_radius_) { |
850 | 48 | // Jump over the hole. | 48 | // Jump over the hole. |
852 | 49 | const uint32_t holewidth = m_rowwidth - 2 * m_delta_radius; | 49 | const uint32_t holewidth = rowwidth_ - 2 * delta_radius_; |
853 | 50 | for (uint32_t i = 0; i < holewidth; ++i) | 50 | for (uint32_t i = 0; i < holewidth; ++i) |
856 | 51 | map.get_rn(m_hollow_area, &m_hollow_area); | 51 | map.get_rn(hollow_area_, &hollow_area_); |
857 | 52 | m_rowpos += holewidth; | 52 | rowpos_ += holewidth; |
858 | 53 | } | 53 | } |
859 | 54 | } else { | 54 | } else { |
863 | 55 | ++m_row; | 55 | ++row_; |
864 | 56 | if (m_phase == Top && m_row == m_delta_radius) | 56 | if (phase_ == Top && row_ == delta_radius_) |
865 | 57 | m_phase = Upper; | 57 | phase_ = Upper; |
866 | 58 | 58 | ||
867 | 59 | // If we completed the widest, center line, switch into lower mode | 59 | // If we completed the widest, center line, switch into lower mode |
869 | 60 | // There are m_radius+1 lines in the upper "half", because the upper | 60 | // There are radius_+1 lines in the upper "half", because the upper |
870 | 61 | // half includes the center line. | 61 | // half includes the center line. |
874 | 62 | else if (m_phase == Upper && m_row > m_hollow_area.radius) { | 62 | else if (phase_ == Upper && row_ > hollow_area_.radius) { |
875 | 63 | m_row = 1; | 63 | row_ = 1; |
876 | 64 | m_phase = Lower; | 64 | phase_ = Lower; |
877 | 65 | } | 65 | } |
878 | 66 | 66 | ||
882 | 67 | if (m_phase & (Top|Upper)) { | 67 | if (phase_ & (Top|Upper)) { |
883 | 68 | map.get_bln(m_left, &m_hollow_area); | 68 | map.get_bln(left_, &hollow_area_); |
884 | 69 | ++m_rowwidth; | 69 | ++rowwidth_; |
885 | 70 | } else { | 70 | } else { |
886 | 71 | 71 | ||
889 | 72 | if (m_row > m_hollow_area.radius) { | 72 | if (row_ > hollow_area_.radius) { |
890 | 73 | m_phase = None; | 73 | phase_ = None; |
891 | 74 | return true; // early out | 74 | return true; // early out |
894 | 75 | } else if (m_phase == Lower && m_row > m_hollow_area.hole_radius) | 75 | } else if (phase_ == Lower && row_ > hollow_area_.hole_radius) |
895 | 76 | m_phase = Bottom; | 76 | phase_ = Bottom; |
896 | 77 | 77 | ||
899 | 78 | map.get_brn(m_left, &m_hollow_area); | 78 | map.get_brn(left_, &hollow_area_); |
900 | 79 | --m_rowwidth; | 79 | --rowwidth_; |
901 | 80 | } | 80 | } |
902 | 81 | 81 | ||
905 | 82 | m_left = m_hollow_area; | 82 | left_ = hollow_area_; |
906 | 83 | m_rowpos = 0; | 83 | rowpos_ = 0; |
907 | 84 | } | 84 | } |
908 | 85 | 85 | ||
909 | 86 | return true; | 86 | return true; |
910 | 87 | 87 | ||
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 | 35 | MapHollowRegion(const Map & map, const HollowArea<AreaType> hollow_area); | 35 | MapHollowRegion(const Map & map, const HollowArea<AreaType> hollow_area); |
916 | 36 | 36 | ||
917 | 37 | const typename AreaType::CoordsType& location() const { | 37 | const typename AreaType::CoordsType& location() const { |
919 | 38 | return m_hollow_area; | 38 | return hollow_area_; |
920 | 39 | } | 39 | } |
921 | 40 | 40 | ||
922 | 41 | /** | 41 | /** |
923 | @@ -64,13 +64,13 @@ | |||
924 | 64 | Bottom = 8, // below the hole | 64 | Bottom = 8, // below the hole |
925 | 65 | }; | 65 | }; |
926 | 66 | 66 | ||
934 | 67 | HollowArea<AreaType> m_hollow_area; | 67 | HollowArea<AreaType> hollow_area_; |
935 | 68 | Phase m_phase; | 68 | Phase phase_; |
936 | 69 | const uint32_t m_delta_radius; | 69 | const uint32_t delta_radius_; |
937 | 70 | uint32_t m_row; // # of rows completed in this phase | 70 | uint32_t row_; // # of rows completed in this phase |
938 | 71 | uint32_t m_rowwidth; // # of fields to return per row | 71 | uint32_t rowwidth_; // # of fields to return per row |
939 | 72 | uint32_t m_rowpos; // # of fields we have returned in this row | 72 | uint32_t rowpos_; // # of fields we have returned in this row |
940 | 73 | typename AreaType::CoordsType m_left; // left-most node of current row | 73 | typename AreaType::CoordsType left_; // left-most node of current row |
941 | 74 | }; | 74 | }; |
942 | 75 | 75 | ||
943 | 76 | } | 76 | } |
944 | 77 | 77 | ||
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 | 31 | */ | 31 | */ |
950 | 32 | template <typename AreaType = Area<> > struct MapRegion { | 32 | template <typename AreaType = Area<> > struct MapRegion { |
951 | 33 | MapRegion(const Map & map, AreaType area) : | 33 | MapRegion(const Map & map, AreaType area) : |
956 | 34 | m_area (area), | 34 | area_ (area), |
957 | 35 | m_rowwidth (area.radius + 1), | 35 | rowwidth_ (area.radius + 1), |
958 | 36 | m_remaining_in_row(m_rowwidth), | 36 | remaining_in_row_(rowwidth_), |
959 | 37 | m_remaining_rows (m_rowwidth + area.radius) | 37 | remaining_rows_ (rowwidth_ + area.radius) |
960 | 38 | { | 38 | { |
961 | 39 | for (typename AreaType::RadiusType r = area.radius; r; --r) | 39 | for (typename AreaType::RadiusType r = area.radius; r; --r) |
964 | 40 | map.get_tln(m_area, &m_area); | 40 | map.get_tln(area_, &area_); |
965 | 41 | m_left = m_area; | 41 | left_ = area_; |
966 | 42 | } | 42 | } |
967 | 43 | 43 | ||
969 | 44 | const typename AreaType::CoordsType & location() const {return m_area;} | 44 | const typename AreaType::CoordsType & location() const {return area_;} |
970 | 45 | 45 | ||
971 | 46 | /// Moves on to the next location. The return value indicates whether the | 46 | /// Moves on to the next location. The return value indicates whether the |
972 | 47 | /// new location has not yet been reached during this iteration. Note that | 47 | /// new location has not yet been reached during this iteration. Note that |
973 | @@ -50,25 +50,25 @@ | |||
974 | 50 | /// while advance keeps returning true. When finally advance returns false, | 50 | /// while advance keeps returning true. When finally advance returns false, |
975 | 51 | /// it means that the iteration is done. | 51 | /// it means that the iteration is done. |
976 | 52 | bool advance(const Map & map) { | 52 | bool advance(const Map & map) { |
985 | 53 | if (--m_remaining_in_row) | 53 | if (--remaining_in_row_) |
986 | 54 | map.get_rn(m_area, &m_area); | 54 | map.get_rn(area_, &area_); |
987 | 55 | else if (m_area.radius < --m_remaining_rows) { | 55 | else if (area_.radius < --remaining_rows_) { |
988 | 56 | map.get_bln(m_left, &m_area); m_left = m_area; | 56 | map.get_bln(left_, &area_); left_ = area_; |
989 | 57 | m_remaining_in_row = ++m_rowwidth; | 57 | remaining_in_row_ = ++rowwidth_; |
990 | 58 | } else if (m_remaining_rows) { | 58 | } else if (remaining_rows_) { |
991 | 59 | map.get_brn(m_left, &m_area); m_left = m_area; | 59 | map.get_brn(left_, &area_); left_ = area_; |
992 | 60 | m_remaining_in_row = --m_rowwidth; | 60 | remaining_in_row_ = --rowwidth_; |
993 | 61 | } else return false; | 61 | } else return false; |
994 | 62 | return true; | 62 | return true; |
995 | 63 | } | 63 | } |
996 | 64 | 64 | ||
998 | 65 | typename AreaType::RadiusType radius() const {return m_area.radius;} | 65 | typename AreaType::RadiusType radius() const {return area_.radius;} |
999 | 66 | private: | 66 | private: |
1005 | 67 | AreaType m_area; | 67 | AreaType area_; |
1006 | 68 | typename AreaType::CoordsType m_left; | 68 | typename AreaType::CoordsType left_; |
1007 | 69 | typename AreaType::RadiusType m_rowwidth; | 69 | typename AreaType::RadiusType rowwidth_; |
1008 | 70 | typename AreaType::RadiusType m_remaining_in_row; | 70 | typename AreaType::RadiusType remaining_in_row_; |
1009 | 71 | typename AreaType::RadiusType m_remaining_rows; | 71 | typename AreaType::RadiusType remaining_rows_; |
1010 | 72 | }; | 72 | }; |
1011 | 73 | 73 | ||
1012 | 74 | } | 74 | } |
1013 | 75 | 75 | ||
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 | 23 | 23 | ||
1019 | 24 | template <> MapTriangleRegion<>::MapTriangleRegion | 24 | template <> MapTriangleRegion<>::MapTriangleRegion |
1020 | 25 | (const Map & map, Area<TCoords<> > area) | 25 | (const Map & map, Area<TCoords<> > area) |
1022 | 26 | : m_radius_is_odd(area.radius & 1) | 26 | : radius_is_odd_(area.radius & 1) |
1023 | 27 | { | 27 | { |
1024 | 28 | assert(area.t == TCoords<>::R || area.t == TCoords<>::D); | 28 | assert(area.t == TCoords<>::R || area.t == TCoords<>::D); |
1025 | 29 | const uint16_t radius_plus_1 = area.radius + 1; | 29 | const uint16_t radius_plus_1 = area.radius + 1; |
1026 | 30 | const uint16_t half_radius_rounded_down = area.radius / 2; | 30 | const uint16_t half_radius_rounded_down = area.radius / 2; |
1028 | 31 | m_row_length = radius_plus_1; | 31 | row_length_ = radius_plus_1; |
1029 | 32 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); | 32 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); |
1030 | 33 | if (area.t == TCoords<>::R) { | 33 | if (area.t == TCoords<>::R) { |
1032 | 34 | m_left = area; | 34 | left_ = area; |
1033 | 35 | if (area.radius) { | 35 | if (area.radius) { |
1037 | 36 | m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1; | 36 | remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1; |
1038 | 37 | m_remaining_rows_in_lower_phase = (area.radius - 1) / 2; | 37 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1039 | 38 | if (m_radius_is_odd) { | 38 | if (radius_is_odd_) { |
1040 | 39 | map.get_trn(area, &area); | 39 | map.get_trn(area, &area); |
1044 | 40 | m_phase = Top; | 40 | phase_ = Top; |
1045 | 41 | m_row_length = area.radius + 2; | 41 | row_length_ = area.radius + 2; |
1046 | 42 | m_remaining_in_row = radius_plus_1 / 2; | 42 | remaining_in_row_ = radius_plus_1 / 2; |
1047 | 43 | area.t = TCoords<>::D; | 43 | area.t = TCoords<>::D; |
1048 | 44 | } else { | 44 | } else { |
1051 | 45 | m_phase = Upper; | 45 | phase_ = Upper; |
1052 | 46 | m_remaining_in_row = m_row_length = radius_plus_1; | 46 | remaining_in_row_ = row_length_ = radius_plus_1; |
1053 | 47 | area.t = TCoords<>::R; | 47 | area.t = TCoords<>::R; |
1054 | 48 | } | 48 | } |
1055 | 49 | } else { | 49 | } else { |
1056 | 50 | assert(area.radius == 0); | 50 | assert(area.radius == 0); |
1059 | 51 | m_phase = Bottom; | 51 | phase_ = Bottom; |
1060 | 52 | m_remaining_in_row = 0; | 52 | remaining_in_row_ = 0; |
1061 | 53 | area.t = TCoords<>::R; | 53 | area.t = TCoords<>::R; |
1062 | 54 | } | 54 | } |
1063 | 55 | } else { | 55 | } else { |
1067 | 56 | m_remaining_rows_in_upper_phase = radius_plus_1 / 2; | 56 | remaining_rows_in_upper_phase_ = radius_plus_1 / 2; |
1068 | 57 | m_remaining_rows_in_lower_phase = half_radius_rounded_down; | 57 | remaining_rows_in_lower_phase_ = half_radius_rounded_down; |
1069 | 58 | if (m_radius_is_odd) { | 58 | if (radius_is_odd_) { |
1070 | 59 | map.get_ln(area, &area); | 59 | map.get_ln(area, &area); |
1074 | 60 | m_left = area; | 60 | left_ = area; |
1075 | 61 | m_phase = Upper; | 61 | phase_ = Upper; |
1076 | 62 | m_remaining_in_row = m_row_length = area.radius + 2; | 62 | remaining_in_row_ = row_length_ = area.radius + 2; |
1077 | 63 | area.t = TCoords<>::R; | 63 | area.t = TCoords<>::R; |
1078 | 64 | } else { | 64 | } else { |
1083 | 65 | map.get_bln(area, &m_left); | 65 | map.get_bln(area, &left_); |
1084 | 66 | m_phase = Top; | 66 | phase_ = Top; |
1085 | 67 | m_row_length = area.radius + 3; | 67 | row_length_ = area.radius + 3; |
1086 | 68 | m_remaining_in_row = half_radius_rounded_down + (0 < area.radius); | 68 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1087 | 69 | area.t = TCoords<>::D; | 69 | area.t = TCoords<>::D; |
1088 | 70 | } | 70 | } |
1089 | 71 | } | 71 | } |
1091 | 72 | m_location = area; | 72 | location_ = area; |
1092 | 73 | } | 73 | } |
1093 | 74 | 74 | ||
1094 | 75 | 75 | ||
1095 | 76 | template <> bool MapTriangleRegion<>::advance(const Map & map) { | 76 | template <> bool MapTriangleRegion<>::advance(const Map & map) { |
1098 | 77 | assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) | 77 | assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1099 | 78 | if (m_remaining_in_row == 0) | 78 | if (remaining_in_row_ == 0) |
1100 | 79 | return false; | 79 | return false; |
1103 | 80 | --m_remaining_in_row; | 80 | --remaining_in_row_; |
1104 | 81 | switch (m_phase) { | 81 | switch (phase_) { |
1105 | 82 | case Top: | 82 | case Top: |
1113 | 83 | if (m_remaining_in_row) | 83 | if (remaining_in_row_) |
1114 | 84 | map.get_rn(m_location, &m_location); | 84 | map.get_rn(location_, &location_); |
1115 | 85 | else if (m_remaining_rows_in_upper_phase) { | 85 | else if (remaining_rows_in_upper_phase_) { |
1116 | 86 | m_phase = Upper; | 86 | phase_ = Upper; |
1117 | 87 | m_remaining_in_row = m_row_length; | 87 | remaining_in_row_ = row_length_; |
1118 | 88 | assert(m_remaining_in_row); | 88 | assert(remaining_in_row_); |
1119 | 89 | m_location = TCoords<>(m_left, m_location.t); | 89 | location_ = TCoords<>(left_, location_.t); |
1120 | 90 | } | 90 | } |
1121 | 91 | break; | 91 | break; |
1122 | 92 | case Upper: | 92 | case Upper: |
1126 | 93 | if (m_remaining_in_row) { | 93 | if (remaining_in_row_) { |
1127 | 94 | if (m_location.t == TCoords<>::D) | 94 | if (location_.t == TCoords<>::D) |
1128 | 95 | m_location.t = TCoords<>::R; | 95 | location_.t = TCoords<>::R; |
1129 | 96 | else | 96 | else |
1131 | 97 | m_location = TCoords<>(map.r_n(m_location), TCoords<>::D); | 97 | location_ = TCoords<>(map.r_n(location_), TCoords<>::D); |
1132 | 98 | } else { | 98 | } else { |
1136 | 99 | if (--m_remaining_rows_in_upper_phase) { | 99 | if (--remaining_rows_in_upper_phase_) { |
1137 | 100 | m_row_length += 2; | 100 | row_length_ += 2; |
1138 | 101 | m_left = map.bl_n(m_left); | 101 | left_ = map.bl_n(left_); |
1139 | 102 | } else { | 102 | } else { |
1147 | 103 | if (m_remaining_rows_in_lower_phase) { | 103 | if (remaining_rows_in_lower_phase_) { |
1148 | 104 | m_phase = Lower; | 104 | phase_ = Lower; |
1149 | 105 | assert(m_row_length >= 2); | 105 | assert(row_length_ >= 2); |
1150 | 106 | m_row_length -= 2; | 106 | row_length_ -= 2; |
1151 | 107 | } else if (m_location.t == TCoords<>::R) { | 107 | } else if (location_.t == TCoords<>::R) { |
1152 | 108 | m_phase = Bottom; | 108 | phase_ = Bottom; |
1153 | 109 | m_row_length /= 2; | 109 | row_length_ /= 2; |
1154 | 110 | } else return false; | 110 | } else return false; |
1156 | 111 | m_left = map.br_n(m_left); | 111 | left_ = map.br_n(left_); |
1157 | 112 | } | 112 | } |
1160 | 113 | m_remaining_in_row = m_row_length; | 113 | remaining_in_row_ = row_length_; |
1161 | 114 | m_location = TCoords<>(m_left, m_location.t); | 114 | location_ = TCoords<>(left_, location_.t); |
1162 | 115 | } | 115 | } |
1163 | 116 | break; | 116 | break; |
1164 | 117 | case Lower: | 117 | case Lower: |
1168 | 118 | if (m_remaining_in_row) { | 118 | if (remaining_in_row_) { |
1169 | 119 | if (m_location.t == TCoords<>::D) | 119 | if (location_.t == TCoords<>::D) |
1170 | 120 | m_location.t = TCoords<>::R; | 120 | location_.t = TCoords<>::R; |
1171 | 121 | else | 121 | else |
1173 | 122 | m_location = TCoords<>(map.r_n(m_location), TCoords<>::D); | 122 | location_ = TCoords<>(map.r_n(location_), TCoords<>::D); |
1174 | 123 | } else { | 123 | } else { |
1186 | 124 | if (--m_remaining_rows_in_lower_phase) { | 124 | if (--remaining_rows_in_lower_phase_) { |
1187 | 125 | assert(m_row_length >= 2); | 125 | assert(row_length_ >= 2); |
1188 | 126 | m_remaining_in_row = m_row_length -= 2; | 126 | remaining_in_row_ = row_length_ -= 2; |
1189 | 127 | m_left = map.br_n(m_left); | 127 | left_ = map.br_n(left_); |
1190 | 128 | } | 128 | } |
1191 | 129 | else if (m_location.t == TCoords<>::R) { | 129 | else if (location_.t == TCoords<>::R) { |
1192 | 130 | m_phase = Bottom; | 130 | phase_ = Bottom; |
1193 | 131 | m_remaining_in_row = m_row_length / 2; | 131 | remaining_in_row_ = row_length_ / 2; |
1194 | 132 | m_left = map.br_n(m_left); | 132 | left_ = map.br_n(left_); |
1195 | 133 | } | 133 | } |
1196 | 134 | m_location = TCoords<>(m_left, m_location.t); | 134 | location_ = TCoords<>(left_, location_.t); |
1197 | 135 | } | 135 | } |
1198 | 136 | break; | 136 | break; |
1199 | 137 | case Bottom: | 137 | case Bottom: |
1202 | 138 | if (m_remaining_in_row) | 138 | if (remaining_in_row_) |
1203 | 139 | map.get_rn(m_location, &m_location); | 139 | map.get_rn(location_, &location_); |
1204 | 140 | break; | 140 | break; |
1205 | 141 | } | 141 | } |
1207 | 142 | assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) | 142 | assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1208 | 143 | return true; | 143 | return true; |
1209 | 144 | } | 144 | } |
1210 | 145 | 145 | ||
1211 | 146 | 146 | ||
1212 | 147 | template <> MapTriangleRegion<TCoords<FCoords> >::MapTriangleRegion | 147 | template <> MapTriangleRegion<TCoords<FCoords> >::MapTriangleRegion |
1213 | 148 | (const Map & map, Area<TCoords<FCoords> > area) | 148 | (const Map & map, Area<TCoords<FCoords> > area) |
1215 | 149 | : m_radius_is_odd(area.radius & 1) | 149 | : radius_is_odd_(area.radius & 1) |
1216 | 150 | { | 150 | { |
1217 | 151 | assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D); | 151 | assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D); |
1218 | 152 | const uint16_t radius_plus_1 = area.radius + 1; | 152 | const uint16_t radius_plus_1 = area.radius + 1; |
1219 | 153 | const uint16_t half_radius_rounded_down = area.radius / 2; | 153 | const uint16_t half_radius_rounded_down = area.radius / 2; |
1221 | 154 | m_row_length = radius_plus_1; | 154 | row_length_ = radius_plus_1; |
1222 | 155 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); | 155 | for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area); |
1223 | 156 | if (area.t == TCoords<FCoords>::R) { | 156 | if (area.t == TCoords<FCoords>::R) { |
1225 | 157 | m_left = area; | 157 | left_ = area; |
1226 | 158 | if (area.radius) { | 158 | if (area.radius) { |
1230 | 159 | m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1; | 159 | remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1; |
1231 | 160 | m_remaining_rows_in_lower_phase = (area.radius - 1) / 2; | 160 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1232 | 161 | if (m_radius_is_odd) { | 161 | if (radius_is_odd_) { |
1233 | 162 | map.get_trn(area, &area); | 162 | map.get_trn(area, &area); |
1237 | 163 | m_phase = Top; | 163 | phase_ = Top; |
1238 | 164 | m_row_length = area.radius + 2; | 164 | row_length_ = area.radius + 2; |
1239 | 165 | m_remaining_in_row = radius_plus_1 / 2; | 165 | remaining_in_row_ = radius_plus_1 / 2; |
1240 | 166 | area.t = TCoords<FCoords>::D; | 166 | area.t = TCoords<FCoords>::D; |
1241 | 167 | } else { | 167 | } else { |
1244 | 168 | m_phase = Upper; | 168 | phase_ = Upper; |
1245 | 169 | m_remaining_in_row = m_row_length = radius_plus_1; | 169 | remaining_in_row_ = row_length_ = radius_plus_1; |
1246 | 170 | area.t = TCoords<FCoords>::R; | 170 | area.t = TCoords<FCoords>::R; |
1247 | 171 | } | 171 | } |
1248 | 172 | } else { | 172 | } else { |
1251 | 173 | m_phase = Bottom; | 173 | phase_ = Bottom; |
1252 | 174 | m_remaining_in_row = 0; | 174 | remaining_in_row_ = 0; |
1253 | 175 | area.t = TCoords<FCoords>::R; | 175 | area.t = TCoords<FCoords>::R; |
1254 | 176 | } | 176 | } |
1255 | 177 | } else { | 177 | } else { |
1259 | 178 | m_remaining_rows_in_upper_phase = radius_plus_1 / 2; | 178 | remaining_rows_in_upper_phase_ = radius_plus_1 / 2; |
1260 | 179 | m_remaining_rows_in_lower_phase = half_radius_rounded_down; | 179 | remaining_rows_in_lower_phase_ = half_radius_rounded_down; |
1261 | 180 | if (m_radius_is_odd) { | 180 | if (radius_is_odd_) { |
1262 | 181 | map.get_ln(area, &area); | 181 | map.get_ln(area, &area); |
1266 | 182 | m_left = area; | 182 | left_ = area; |
1267 | 183 | m_phase = Upper; | 183 | phase_ = Upper; |
1268 | 184 | m_remaining_in_row = m_row_length = area.radius + 2; | 184 | remaining_in_row_ = row_length_ = area.radius + 2; |
1269 | 185 | area.t = TCoords<FCoords>::R; | 185 | area.t = TCoords<FCoords>::R; |
1270 | 186 | } else { | 186 | } else { |
1275 | 187 | map.get_bln(area, &m_left); | 187 | map.get_bln(area, &left_); |
1276 | 188 | m_phase = Top; | 188 | phase_ = Top; |
1277 | 189 | m_row_length = area.radius + 3; | 189 | row_length_ = area.radius + 3; |
1278 | 190 | m_remaining_in_row = half_radius_rounded_down + (0 < area.radius); | 190 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1279 | 191 | area.t = TCoords<FCoords>::D; | 191 | area.t = TCoords<FCoords>::D; |
1280 | 192 | } | 192 | } |
1281 | 193 | } | 193 | } |
1283 | 194 | m_location = area; | 194 | location_ = area; |
1284 | 195 | } | 195 | } |
1285 | 196 | 196 | ||
1286 | 197 | 197 | ||
1287 | @@ -199,75 +199,75 @@ | |||
1288 | 199 | template <> | 199 | template <> |
1289 | 200 | bool MapTriangleRegion<TCoords<FCoords> >::advance(const Map & map) | 200 | bool MapTriangleRegion<TCoords<FCoords> >::advance(const Map & map) |
1290 | 201 | { | 201 | { |
1293 | 202 | assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) | 202 | assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1294 | 203 | if (m_remaining_in_row == 0) | 203 | if (remaining_in_row_ == 0) |
1295 | 204 | return false; | 204 | return false; |
1298 | 205 | --m_remaining_in_row; | 205 | --remaining_in_row_; |
1299 | 206 | switch (m_phase) { | 206 | switch (phase_) { |
1300 | 207 | case Top: | 207 | case Top: |
1308 | 208 | if (m_remaining_in_row) | 208 | if (remaining_in_row_) |
1309 | 209 | map.get_rn(m_location, &m_location); | 209 | map.get_rn(location_, &location_); |
1310 | 210 | else if (m_remaining_rows_in_upper_phase) { | 210 | else if (remaining_rows_in_upper_phase_) { |
1311 | 211 | m_phase = Upper; | 211 | phase_ = Upper; |
1312 | 212 | m_remaining_in_row = m_row_length; | 212 | remaining_in_row_ = row_length_; |
1313 | 213 | assert(m_remaining_in_row); | 213 | assert(remaining_in_row_); |
1314 | 214 | m_location = TCoords<FCoords>(m_left, m_location.t); | 214 | location_ = TCoords<FCoords>(left_, location_.t); |
1315 | 215 | } | 215 | } |
1316 | 216 | break; | 216 | break; |
1317 | 217 | case Upper: | 217 | case Upper: |
1321 | 218 | if (m_remaining_in_row) { | 218 | if (remaining_in_row_) { |
1322 | 219 | if (m_location.t == TCoords<FCoords>::D) | 219 | if (location_.t == TCoords<FCoords>::D) |
1323 | 220 | m_location.t = TCoords<FCoords>::R; | 220 | location_.t = TCoords<FCoords>::R; |
1324 | 221 | else | 221 | else |
1327 | 222 | m_location = | 222 | location_ = |
1328 | 223 | TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D); | 223 | TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D); |
1329 | 224 | } else { | 224 | } else { |
1333 | 225 | if (--m_remaining_rows_in_upper_phase) { | 225 | if (--remaining_rows_in_upper_phase_) { |
1334 | 226 | m_row_length += 2; | 226 | row_length_ += 2; |
1335 | 227 | m_left = map.bl_n(m_left); | 227 | left_ = map.bl_n(left_); |
1336 | 228 | } else { | 228 | } else { |
1344 | 229 | if (m_remaining_rows_in_lower_phase) { | 229 | if (remaining_rows_in_lower_phase_) { |
1345 | 230 | m_phase = Lower; | 230 | phase_ = Lower; |
1346 | 231 | assert(m_row_length >= 2); | 231 | assert(row_length_ >= 2); |
1347 | 232 | m_row_length -= 2; | 232 | row_length_ -= 2; |
1348 | 233 | } else if (m_location.t == TCoords<FCoords>::R) { | 233 | } else if (location_.t == TCoords<FCoords>::R) { |
1349 | 234 | m_phase = Bottom; | 234 | phase_ = Bottom; |
1350 | 235 | m_row_length /= 2; | 235 | row_length_ /= 2; |
1351 | 236 | } else | 236 | } else |
1352 | 237 | return false; | 237 | return false; |
1354 | 238 | m_left = map.br_n(m_left); | 238 | left_ = map.br_n(left_); |
1355 | 239 | } | 239 | } |
1358 | 240 | m_remaining_in_row = m_row_length; | 240 | remaining_in_row_ = row_length_; |
1359 | 241 | m_location = TCoords<FCoords>(m_left, m_location.t); | 241 | location_ = TCoords<FCoords>(left_, location_.t); |
1360 | 242 | } | 242 | } |
1361 | 243 | break; | 243 | break; |
1362 | 244 | case Lower: | 244 | case Lower: |
1366 | 245 | if (m_remaining_in_row) { | 245 | if (remaining_in_row_) { |
1367 | 246 | if (m_location.t == TCoords<FCoords>::D) | 246 | if (location_.t == TCoords<FCoords>::D) |
1368 | 247 | m_location.t = TCoords<FCoords>::R; | 247 | location_.t = TCoords<FCoords>::R; |
1369 | 248 | else | 248 | else |
1372 | 249 | m_location = | 249 | location_ = |
1373 | 250 | TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D); | 250 | TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D); |
1374 | 251 | } else { | 251 | } else { |
1386 | 252 | if (--m_remaining_rows_in_lower_phase) { | 252 | if (--remaining_rows_in_lower_phase_) { |
1387 | 253 | assert(m_row_length >= 2); | 253 | assert(row_length_ >= 2); |
1388 | 254 | m_remaining_in_row = m_row_length -= 2; | 254 | remaining_in_row_ = row_length_ -= 2; |
1389 | 255 | m_left = map.br_n(m_left); | 255 | left_ = map.br_n(left_); |
1390 | 256 | } | 256 | } |
1391 | 257 | else if (m_location.t == TCoords<FCoords>::R) { | 257 | else if (location_.t == TCoords<FCoords>::R) { |
1392 | 258 | m_phase = Bottom; | 258 | phase_ = Bottom; |
1393 | 259 | m_remaining_in_row = m_row_length / 2; | 259 | remaining_in_row_ = row_length_ / 2; |
1394 | 260 | m_left = map.br_n(m_left); | 260 | left_ = map.br_n(left_); |
1395 | 261 | } | 261 | } |
1396 | 262 | m_location = TCoords<FCoords>(m_left, m_location.t); | 262 | location_ = TCoords<FCoords>(left_, location_.t); |
1397 | 263 | } | 263 | } |
1398 | 264 | break; | 264 | break; |
1399 | 265 | case Bottom: | 265 | case Bottom: |
1402 | 266 | if (m_remaining_in_row) | 266 | if (remaining_in_row_) |
1403 | 267 | map.get_rn(m_location, &m_location); | 267 | map.get_rn(location_, &location_); |
1404 | 268 | break; | 268 | break; |
1405 | 269 | } | 269 | } |
1407 | 270 | assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow) | 270 | assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow) |
1408 | 271 | return true; | 271 | return true; |
1409 | 272 | } | 272 | } |
1410 | 273 | 273 | ||
1411 | 274 | 274 | ||
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 | 65 | }; | 65 | }; |
1417 | 66 | template <> struct MapTriangleRegion<FCoords> { | 66 | template <> struct MapTriangleRegion<FCoords> { |
1418 | 67 | MapTriangleRegion(const Map & map, const Area<FCoords> area) : | 67 | MapTriangleRegion(const Map & map, const Area<FCoords> area) : |
1423 | 68 | m_area(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1), | 68 | area_(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1), |
1424 | 69 | m_rowwidth (m_area.radius * 2 + 1), | 69 | rowwidth_ (area_.radius * 2 + 1), |
1425 | 70 | m_remaining_in_row(m_rowwidth), | 70 | remaining_in_row_(rowwidth_), |
1426 | 71 | m_remaining_rows (m_area.radius * 2) | 71 | remaining_rows_ (area_.radius * 2) |
1427 | 72 | { | 72 | { |
1430 | 73 | for (uint8_t r = m_area.radius; r; --r) map.get_tln(m_area, &m_area); | 73 | for (uint8_t r = area_.radius; r; --r) map.get_tln(area_, &area_); |
1431 | 74 | m_left = m_area; | 74 | left_ = area_; |
1432 | 75 | } | 75 | } |
1433 | 76 | 76 | ||
1435 | 77 | const TCoords<FCoords> & location() const {return m_area;} | 77 | const TCoords<FCoords> & location() const {return area_;} |
1436 | 78 | 78 | ||
1437 | 79 | bool advance(const Map & map) { | 79 | bool advance(const Map & map) { |
1441 | 80 | if (--m_remaining_in_row) { | 80 | if (--remaining_in_row_) { |
1442 | 81 | if (m_area.t == TCoords<FCoords>::D) | 81 | if (area_.t == TCoords<FCoords>::D) |
1443 | 82 | m_area.t = TCoords<FCoords>::R; | 82 | area_.t = TCoords<FCoords>::R; |
1444 | 83 | else { | 83 | else { |
1447 | 84 | m_area.t = TCoords<FCoords>::D; | 84 | area_.t = TCoords<FCoords>::D; |
1448 | 85 | map.get_rn(m_area, &m_area); | 85 | map.get_rn(area_, &area_); |
1449 | 86 | } | 86 | } |
1458 | 87 | } else if (m_area.radius < --m_remaining_rows) { | 87 | } else if (area_.radius < --remaining_rows_) { |
1459 | 88 | map.get_bln(m_left, &m_area); m_left = m_area; | 88 | map.get_bln(left_, &area_); left_ = area_; |
1460 | 89 | m_area.t = TCoords<FCoords>::D; | 89 | area_.t = TCoords<FCoords>::D; |
1461 | 90 | m_remaining_in_row = m_rowwidth += 2; | 90 | remaining_in_row_ = rowwidth_ += 2; |
1462 | 91 | } else if (m_remaining_rows) { | 91 | } else if (remaining_rows_) { |
1463 | 92 | map.get_brn(m_left, &m_area); m_left = m_area; | 92 | map.get_brn(left_, &area_); left_ = area_; |
1464 | 93 | m_area.t = TCoords<FCoords>::D; | 93 | area_.t = TCoords<FCoords>::D; |
1465 | 94 | m_remaining_in_row = m_rowwidth -= 2; | 94 | remaining_in_row_ = rowwidth_ -= 2; |
1466 | 95 | } else return false; | 95 | } else return false; |
1467 | 96 | return true; | 96 | return true; |
1468 | 97 | } | 97 | } |
1469 | 98 | 98 | ||
1470 | 99 | private: | 99 | private: |
1476 | 100 | Area<TCoords<FCoords> > m_area; | 100 | Area<TCoords<FCoords> > area_; |
1477 | 101 | FCoords m_left; | 101 | FCoords left_; |
1478 | 102 | uint16_t m_rowwidth; | 102 | uint16_t rowwidth_; |
1479 | 103 | uint16_t m_remaining_in_row; | 103 | uint16_t remaining_in_row_; |
1480 | 104 | uint16_t m_remaining_rows; | 104 | uint16_t remaining_rows_; |
1481 | 105 | }; | 105 | }; |
1482 | 106 | template <typename CoordsType> struct MapTriangleRegion<TCoords<CoordsType> > | 106 | template <typename CoordsType> struct MapTriangleRegion<TCoords<CoordsType> > |
1483 | 107 | { | 107 | { |
1484 | 108 | MapTriangleRegion(const Map &, Area<TCoords<CoordsType>, uint16_t>); | 108 | MapTriangleRegion(const Map &, Area<TCoords<CoordsType>, uint16_t>); |
1485 | 109 | 109 | ||
1487 | 110 | const TCoords<CoordsType> & location() const {return m_location;} | 110 | const TCoords<CoordsType> & location() const {return location_;} |
1488 | 111 | 111 | ||
1489 | 112 | bool advance(const Map &); | 112 | bool advance(const Map &); |
1490 | 113 | 113 | ||
1491 | 114 | private: | 114 | private: |
1499 | 115 | const bool m_radius_is_odd; | 115 | const bool radius_is_odd_; |
1500 | 116 | enum {Top, Upper, Lower, Bottom} m_phase; | 116 | enum {Top, Upper, Lower, Bottom} phase_; |
1501 | 117 | uint16_t m_remaining_rows_in_upper_phase; | 117 | uint16_t remaining_rows_in_upper_phase_; |
1502 | 118 | uint16_t m_remaining_rows_in_lower_phase; | 118 | uint16_t remaining_rows_in_lower_phase_; |
1503 | 119 | uint16_t m_row_length, m_remaining_in_row; | 119 | uint16_t row_length_, remaining_in_row_; |
1504 | 120 | CoordsType m_left; | 120 | CoordsType left_; |
1505 | 121 | TCoords<CoordsType> m_location; | 121 | TCoords<CoordsType> location_; |
1506 | 122 | }; | 122 | }; |
1507 | 123 | 123 | ||
1508 | 124 | } | 124 | } |
1509 | 125 | 125 | ||
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 | 33 | friend class MapPlayersMessagesPacket; | 33 | friend class MapPlayersMessagesPacket; |
1515 | 34 | 34 | ||
1516 | 35 | MessageQueue() { | 35 | MessageQueue() { |
1520 | 36 | m_counts[static_cast<int>(Message::Status::kNew)] = 0; // C++0x: | 36 | counts_[static_cast<int>(Message::Status::kNew)] = 0; // C++0x: |
1521 | 37 | m_counts[static_cast<int>(Message::Status::kRead)] = 0; // C++0x: | 37 | counts_[static_cast<int>(Message::Status::kRead)] = 0; // C++0x: |
1522 | 38 | m_counts[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x: | 38 | counts_[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x: |
1523 | 39 | } // C++0x: | 39 | } // C++0x: |
1524 | 40 | 40 | ||
1525 | 41 | ~MessageQueue() { | 41 | ~MessageQueue() { |
1526 | @@ -68,7 +68,7 @@ | |||
1527 | 68 | uint32_t nr_messages(Message::Status const status) const { | 68 | uint32_t nr_messages(Message::Status const status) const { |
1528 | 69 | assert_counts(); | 69 | assert_counts(); |
1529 | 70 | assert(static_cast<int>(status) < 3); | 70 | assert(static_cast<int>(status) < 3); |
1531 | 71 | return m_counts[static_cast<int>(status)]; | 71 | return counts_[static_cast<int>(status)]; |
1532 | 72 | } | 72 | } |
1533 | 73 | 73 | ||
1534 | 74 | /// Adds the message. Takes ownership of the message. Assumes that it has | 74 | /// Adds the message. Takes ownership of the message. Assumes that it has |
1535 | @@ -82,12 +82,12 @@ | |||
1536 | 82 | MessageId add_message(Message & message) { | 82 | MessageId add_message(Message & message) { |
1537 | 83 | assert_counts(); | 83 | assert_counts(); |
1538 | 84 | assert(static_cast<int>(message.status()) < 3); | 84 | assert(static_cast<int>(message.status()) < 3); |
1540 | 85 | ++m_counts[static_cast<int>(message.status())]; | 85 | ++counts_[static_cast<int>(message.status())]; |
1541 | 86 | insert | 86 | insert |
1542 | 87 | (std::map<MessageId, Message *>::end(), | 87 | (std::map<MessageId, Message *>::end(), |
1544 | 88 | std::pair<MessageId, Message *>(++m_current_message_id, &message)); | 88 | std::pair<MessageId, Message *>(++current_message_id_, &message)); |
1545 | 89 | assert_counts(); | 89 | assert_counts(); |
1547 | 90 | return m_current_message_id; | 90 | return current_message_id_; |
1548 | 91 | } | 91 | } |
1549 | 92 | 92 | ||
1550 | 93 | /// Sets the status of the message with the given id, if it exists. | 93 | /// Sets the status of the message with the given id, if it exists. |
1551 | @@ -98,9 +98,9 @@ | |||
1552 | 98 | if (it != end()) { | 98 | if (it != end()) { |
1553 | 99 | Message & message = *it->second; | 99 | Message & message = *it->second; |
1554 | 100 | assert(static_cast<int>(it->second->status()) < 3); | 100 | assert(static_cast<int>(it->second->status()) < 3); |
1558 | 101 | assert(m_counts[static_cast<int>(message.status())]); | 101 | assert(counts_[static_cast<int>(message.status())]); |
1559 | 102 | --m_counts[static_cast<int>(message.status())]; | 102 | --counts_[static_cast<int>(message.status())]; |
1560 | 103 | ++m_counts[static_cast<int>(message.set_status(status))]; | 103 | ++counts_[static_cast<int>(message.set_status(status))]; |
1561 | 104 | } | 104 | } |
1562 | 105 | assert_counts(); | 105 | assert_counts(); |
1563 | 106 | } | 106 | } |
1564 | @@ -118,14 +118,14 @@ | |||
1565 | 118 | } | 118 | } |
1566 | 119 | Message & message = *it->second; | 119 | Message & message = *it->second; |
1567 | 120 | assert(static_cast<int>(message.status()) < 3); | 120 | assert(static_cast<int>(message.status()) < 3); |
1570 | 121 | assert(m_counts[static_cast<int>(message.status())]); | 121 | assert(counts_[static_cast<int>(message.status())]); |
1571 | 122 | --m_counts[static_cast<int>(message.status())]; | 122 | --counts_[static_cast<int>(message.status())]; |
1572 | 123 | delete &message; | 123 | delete &message; |
1573 | 124 | erase(it); | 124 | erase(it); |
1574 | 125 | assert_counts(); | 125 | assert_counts(); |
1575 | 126 | } | 126 | } |
1576 | 127 | 127 | ||
1578 | 128 | MessageId current_message_id() const {return m_current_message_id;} | 128 | MessageId current_message_id() const {return current_message_id_;} |
1579 | 129 | 129 | ||
1580 | 130 | /// \returns whether all messages with id 1, 2, 3, ..., current_message_id | 130 | /// \returns whether all messages with id 1, 2, 3, ..., current_message_id |
1581 | 131 | /// exist. This should be the case when messages have been loaded from a map | 131 | /// exist. This should be the case when messages have been loaded from a map |
1582 | @@ -142,28 +142,28 @@ | |||
1583 | 142 | /// it. | 142 | /// it. |
1584 | 143 | void clear() { | 143 | void clear() { |
1585 | 144 | assert_counts(); | 144 | assert_counts(); |
1590 | 145 | m_current_message_id = MessageId::null(); | 145 | current_message_id_ = MessageId::null(); |
1591 | 146 | m_counts[static_cast<int>(Message::Status::kNew)] = 0; | 146 | counts_[static_cast<int>(Message::Status::kNew)] = 0; |
1592 | 147 | m_counts[static_cast<int>(Message::Status::kRead)] = 0; | 147 | counts_[static_cast<int>(Message::Status::kRead)] = 0; |
1593 | 148 | m_counts[static_cast<int>(Message::Status::kArchived)] = 0; | 148 | counts_[static_cast<int>(Message::Status::kArchived)] = 0; |
1594 | 149 | std::map<MessageId, Message *>::clear(); | 149 | std::map<MessageId, Message *>::clear(); |
1595 | 150 | assert_counts(); | 150 | assert_counts(); |
1596 | 151 | } | 151 | } |
1597 | 152 | 152 | ||
1598 | 153 | /// The id of the most recently added message, or null if none has been | 153 | /// The id of the most recently added message, or null if none has been |
1599 | 154 | /// added yet. | 154 | /// added yet. |
1601 | 155 | MessageId m_current_message_id; | 155 | MessageId current_message_id_; |
1602 | 156 | 156 | ||
1603 | 157 | /// Number of messages with each status (new, read, deleted). | 157 | /// Number of messages with each status (new, read, deleted). |
1604 | 158 | /// Indexed by Message::Status. | 158 | /// Indexed by Message::Status. |
1606 | 159 | uint32_t m_counts[3]; | 159 | uint32_t counts_[3]; |
1607 | 160 | 160 | ||
1608 | 161 | void assert_counts() const { | 161 | void assert_counts() const { |
1609 | 162 | assert | 162 | assert |
1610 | 163 | (size() == | 163 | (size() == |
1614 | 164 | m_counts[static_cast<int>(Message::Status::kNew)] + | 164 | counts_[static_cast<int>(Message::Status::kNew)] + |
1615 | 165 | m_counts[static_cast<int>(Message::Status::kRead)] + | 165 | counts_[static_cast<int>(Message::Status::kRead)] + |
1616 | 166 | m_counts[static_cast<int>(Message::Status::kArchived)]); | 166 | counts_[static_cast<int>(Message::Status::kArchived)]); |
1617 | 167 | } | 167 | } |
1618 | 168 | 168 | ||
1619 | 169 | DISALLOW_COPY_AND_ASSIGN(MessageQueue); | 169 | DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
1620 | 170 | 170 | ||
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 | 70 | fw.unsigned_8(kCurrentPacketVersion); | 70 | fw.unsigned_8(kCurrentPacketVersion); |
1626 | 71 | write_coords_32(&fw, start_); | 71 | write_coords_32(&fw, start_); |
1627 | 72 | 72 | ||
1629 | 73 | // Careful: steps are stored in the reverse order in m_path | 73 | // Careful: steps are stored in the reverse order in path_ |
1630 | 74 | // However, we save them in the forward order, to make loading easier | 74 | // However, we save them in the forward order, to make loading easier |
1631 | 75 | fw.unsigned_32(path_.size()); | 75 | fw.unsigned_32(path_.size()); |
1632 | 76 | for (uint32_t i = path_.size(); i > 0; --i) | 76 | for (uint32_t i = path_.size(); i > 0; --i) |
1633 | 77 | 77 | ||
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 | 367 | return add_message(game, m); | 367 | return add_message(game, m); |
1639 | 368 | } | 368 | } |
1640 | 369 | 369 | ||
1642 | 370 | void Player::message_object_removed(MessageId m_id) const | 370 | void Player::message_object_removed(MessageId message_id) const |
1643 | 371 | { | 371 | { |
1644 | 372 | // Send delete command | 372 | // Send delete command |
1645 | 373 | upcast(Game, game, &egbase_); | 373 | upcast(Game, game, &egbase_); |
1646 | @@ -377,7 +377,7 @@ | |||
1647 | 377 | 377 | ||
1648 | 378 | game->cmdqueue().enqueue | 378 | game->cmdqueue().enqueue |
1649 | 379 | (new CmdDeleteMessage | 379 | (new CmdDeleteMessage |
1651 | 380 | (game->get_gametime(), player_number_, m_id)); | 380 | (game->get_gametime(), player_number_, message_id)); |
1652 | 381 | } | 381 | } |
1653 | 382 | 382 | ||
1654 | 383 | 383 | ||
1655 | 384 | 384 | ||
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 | 49 | class CmdReplaySyncRead : public Command { | 49 | class CmdReplaySyncRead : public Command { |
1661 | 50 | public: | 50 | public: |
1662 | 51 | CmdReplaySyncRead(const uint32_t init_duetime, const Md5Checksum & hash) | 51 | CmdReplaySyncRead(const uint32_t init_duetime, const Md5Checksum & hash) |
1664 | 52 | : Command(init_duetime), m_hash(hash) | 52 | : Command(init_duetime), hash_(hash) |
1665 | 53 | {} | 53 | {} |
1666 | 54 | 54 | ||
1667 | 55 | QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;} | 55 | QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;} |
1668 | @@ -58,12 +58,12 @@ | |||
1669 | 58 | { | 58 | { |
1670 | 59 | const Md5Checksum myhash = game.get_sync_hash(); | 59 | const Md5Checksum myhash = game.get_sync_hash(); |
1671 | 60 | 60 | ||
1673 | 61 | if (m_hash != myhash) { | 61 | if (hash_ != myhash) { |
1674 | 62 | log | 62 | log |
1675 | 63 | ("REPLAY: Lost synchronization at time %u\n" | 63 | ("REPLAY: Lost synchronization at time %u\n" |
1676 | 64 | "I have: %s\n" | 64 | "I have: %s\n" |
1677 | 65 | "Replay has: %s\n", | 65 | "Replay has: %s\n", |
1679 | 66 | duetime(), myhash.str().c_str(), m_hash.str().c_str()); | 66 | duetime(), myhash.str().c_str(), hash_.str().c_str()); |
1680 | 67 | 67 | ||
1681 | 68 | // In case syncstream logging is on, save it for analysis | 68 | // In case syncstream logging is on, save it for analysis |
1682 | 69 | game.save_syncstream(true); | 69 | game.save_syncstream(true); |
1683 | @@ -74,7 +74,7 @@ | |||
1684 | 74 | } | 74 | } |
1685 | 75 | 75 | ||
1686 | 76 | private: | 76 | private: |
1688 | 77 | Md5Checksum m_hash; | 77 | Md5Checksum hash_; |
1689 | 78 | }; | 78 | }; |
1690 | 79 | 79 | ||
1691 | 80 | 80 | ||
1692 | 81 | 81 | ||
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 | 44 | try {prof.read("version", nullptr, fs);} catch (...) | 44 | try {prof.read("version", nullptr, fs);} catch (...) |
1698 | 45 | { | 45 | { |
1699 | 46 | Map & map = egbase.map(); | 46 | Map & map = egbase.map(); |
1702 | 47 | map.map_version_.m_map_version_timestamp = 0; | 47 | map.map_version_.map_version_timestamp_ = 0; |
1703 | 48 | map.map_version_.m_map_creator_version = "unknown"; | 48 | map.map_version_.map_creator_version_ = "unknown"; |
1704 | 49 | return; | 49 | return; |
1705 | 50 | } | 50 | } |
1706 | 51 | 51 | ||
1707 | @@ -60,13 +60,13 @@ | |||
1708 | 60 | || (packet_version > kCurrentPacketVersion && forward_compatibility <= kCurrentPacketVersion)) | 60 | || (packet_version > kCurrentPacketVersion && forward_compatibility <= kCurrentPacketVersion)) |
1709 | 61 | { | 61 | { |
1710 | 62 | Map & map = egbase.map(); | 62 | Map & map = egbase.map(); |
1716 | 63 | map.map_version_.m_map_source_url = globv.get_safe_string("map_source_url"); | 63 | map.map_version_.map_source_url_ = globv.get_safe_string("map_source_url"); |
1717 | 64 | map.map_version_.m_map_source_release = globv.get_safe_string("map_release"); | 64 | map.map_version_.map_source_release_ = globv.get_safe_string("map_release"); |
1718 | 65 | map.map_version_.m_map_creator_version = globv.get_safe_string("map_creator_version"); | 65 | map.map_version_.map_creator_version_ = globv.get_safe_string("map_creator_version"); |
1719 | 66 | map.map_version_.m_map_version_major = globv.get_safe_int("map_version_major"); | 66 | map.map_version_.map_version_major_ = globv.get_safe_int("map_version_major"); |
1720 | 67 | map.map_version_.m_map_version_minor = globv.get_safe_int("map_version_minor"); | 67 | map.map_version_.map_version_minor_ = globv.get_safe_int("map_version_minor"); |
1721 | 68 | uint32_t ts = static_cast<uint32_t>(globv.get_safe_int("map_version_timestamp")); | 68 | uint32_t ts = static_cast<uint32_t>(globv.get_safe_int("map_version_timestamp")); |
1723 | 69 | map.map_version_.m_map_version_timestamp = ts; | 69 | map.map_version_.map_version_timestamp_ = ts; |
1724 | 70 | } else { | 70 | } else { |
1725 | 71 | throw UnhandledVersionError("MapVersionPacket", packet_version, kCurrentPacketVersion); | 71 | throw UnhandledVersionError("MapVersionPacket", packet_version, kCurrentPacketVersion); |
1726 | 72 | } | 72 | } |
1727 | @@ -116,11 +116,11 @@ | |||
1728 | 116 | // There seems to be a get_safe_natural method, but not corresponding setter. | 116 | // There seems to be a get_safe_natural method, but not corresponding setter. |
1729 | 117 | 117 | ||
1730 | 118 | Map & map = egbase.map(); | 118 | Map & map = egbase.map(); |
1736 | 119 | globs.set_string("map_source_url", map.map_version_.m_map_source_url); | 119 | globs.set_string("map_source_url", map.map_version_.map_source_url_); |
1737 | 120 | globs.set_string("map_release", map.map_version_.m_map_source_release); | 120 | globs.set_string("map_release", map.map_version_.map_source_release_); |
1738 | 121 | globs.set_string("map_creator_version", map.map_version_.m_map_creator_version); | 121 | globs.set_string("map_creator_version", map.map_version_.map_creator_version_); |
1739 | 122 | globs.set_int("map_version_major", map.map_version_.m_map_version_major); | 122 | globs.set_int("map_version_major", map.map_version_.map_version_major_); |
1740 | 123 | globs.set_int("map_version_minor", 1 + map.map_version_.m_map_version_minor); | 123 | globs.set_int("map_version_minor", 1 + map.map_version_.map_version_minor_); |
1741 | 124 | globs.set_int("map_version_timestamp", static_cast<uint32_t>(time(nullptr))); | 124 | globs.set_int("map_version_timestamp", static_cast<uint32_t>(time(nullptr))); |
1742 | 125 | globs.set_int("packet_version", kCurrentPacketVersion); | 125 | globs.set_int("packet_version", kCurrentPacketVersion); |
1743 | 126 | globs.set_int("packet_compatibility", kCurrentPacketVersion); | 126 | globs.set_int("packet_compatibility", kCurrentPacketVersion); |
Played perhas 30 Minutes had no
issues except an annyoing attacking AI :-)