Merge lp:~widelands-dev/widelands/bug-1395278-tribes-a-p into lp:widelands
- bug-1395278-tribes-a-p
- Merge into trunk
Proposed by
GunChleoc
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7809 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1395278-tribes-a-p | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
3668 lines (+724/-724) 29 files modified
src/ai/defaultai.cc (+1/-1) src/graphic/animation.cc (+6/-6) src/graphic/diranimations.h (+4/-4) src/logic/map_objects/tribes/battle.cc (+99/-99) src/logic/map_objects/tribes/battle.h (+11/-11) src/logic/map_objects/tribes/building.cc (+116/-116) src/logic/map_objects/tribes/building.h (+50/-50) src/logic/map_objects/tribes/carrier.cc (+23/-23) src/logic/map_objects/tribes/carrier.h (+2/-2) src/logic/map_objects/tribes/constructionsite.cc (+62/-62) src/logic/map_objects/tribes/constructionsite.h (+5/-5) src/logic/map_objects/tribes/dismantlesite.cc (+27/-27) src/logic/map_objects/tribes/militarysite.cc (+114/-114) src/logic/map_objects/tribes/militarysite.h (+26/-26) src/logic/map_objects/tribes/partially_finished_building.cc (+29/-29) src/logic/map_objects/tribes/partially_finished_building.h (+12/-12) src/logic/map_objects/tribes/production_program.cc (+4/-4) src/logic/map_objects/tribes/productionsite.cc (+1/-1) src/logic/map_objects/tribes/warehouse.cc (+4/-4) src/logic/player.cc (+5/-5) src/logic/player.h (+1/-1) src/map_io/map_building_packet.cc (+2/-2) src/map_io/map_buildingdata_packet.cc (+86/-86) src/scripting/lua_map.cc (+1/-1) src/wui/building_ui.cc (+13/-13) src/wui/buildingwindow.cc (+4/-4) src/wui/fieldaction.cc (+1/-1) src/wui/soldiercapacitycontrol.cc (+5/-5) src/wui/soldierlist.cc (+10/-10) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1395278-tribes-a-p | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | code | Approve | |
Review via email:
|
Commit message
Fixed member variable names in src/logic/
Description of the change
Fixed member variable names in src/logic/
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
bunnybot (widelandsofficial) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
SirVer (sirver) wrote : | # |
lgtm.
@bunnybot merge
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/ai/defaultai.cc' | |||
2 | --- src/ai/defaultai.cc 2016-02-03 10:01:08 +0000 | |||
3 | +++ src/ai/defaultai.cc 2016-02-08 18:17:36 +0000 | |||
4 | @@ -3114,7 +3114,7 @@ | |||
5 | 3114 | 3114 | ||
6 | 3115 | // Get max radius of recursive workarea | 3115 | // Get max radius of recursive workarea |
7 | 3116 | WorkareaInfo::size_type radius = 0; | 3116 | WorkareaInfo::size_type radius = 0; |
9 | 3117 | const WorkareaInfo& workarea_info = site.bo->desc->m_workarea_info; | 3117 | const WorkareaInfo& workarea_info = site.bo->desc->workarea_info_; |
10 | 3118 | for (const std::pair<uint32_t, std::set<std::string>>& temp_info : workarea_info) { | 3118 | for (const std::pair<uint32_t, std::set<std::string>>& temp_info : workarea_info) { |
11 | 3119 | if (radius < temp_info.first) { | 3119 | if (radius < temp_info.first) { |
12 | 3120 | radius = temp_info.first; | 3120 | radius = temp_info.first; |
13 | 3121 | 3121 | ||
14 | === modified file 'src/graphic/animation.cc' | |||
15 | --- src/graphic/animation.cc 2016-01-28 05:24:34 +0000 | |||
16 | +++ src/graphic/animation.cc 2016-02-08 18:17:36 +0000 | |||
17 | @@ -299,12 +299,12 @@ | |||
18 | 299 | uint32_t dir5, | 299 | uint32_t dir5, |
19 | 300 | uint32_t dir6) | 300 | uint32_t dir6) |
20 | 301 | { | 301 | { |
27 | 302 | m_animations[0] = dir1; | 302 | animations_[0] = dir1; |
28 | 303 | m_animations[1] = dir2; | 303 | animations_[1] = dir2; |
29 | 304 | m_animations[2] = dir3; | 304 | animations_[2] = dir3; |
30 | 305 | m_animations[3] = dir4; | 305 | animations_[3] = dir4; |
31 | 306 | m_animations[4] = dir5; | 306 | animations_[4] = dir5; |
32 | 307 | m_animations[5] = dir6; | 307 | animations_[5] = dir6; |
33 | 308 | } | 308 | } |
34 | 309 | 309 | ||
35 | 310 | /* | 310 | /* |
36 | 311 | 311 | ||
37 | === modified file 'src/graphic/diranimations.h' | |||
38 | --- src/graphic/diranimations.h 2016-01-17 19:54:32 +0000 | |||
39 | +++ src/graphic/diranimations.h 2016-02-08 18:17:36 +0000 | |||
40 | @@ -33,20 +33,20 @@ | |||
41 | 33 | uint32_t dir4 = 0, uint32_t dir5 = 0, uint32_t dir6 = 0); | 33 | uint32_t dir4 = 0, uint32_t dir5 = 0, uint32_t dir6 = 0); |
42 | 34 | 34 | ||
43 | 35 | uint32_t get_animation(Widelands::Direction const dir) const { | 35 | uint32_t get_animation(Widelands::Direction const dir) const { |
45 | 36 | return m_animations[dir - 1]; | 36 | return animations_[dir - 1]; |
46 | 37 | } | 37 | } |
47 | 38 | void set_animation(const Widelands::Direction dir, const uint32_t anim) { | 38 | void set_animation(const Widelands::Direction dir, const uint32_t anim) { |
49 | 39 | m_animations[dir - 1] = anim; | 39 | animations_[dir - 1] = anim; |
50 | 40 | } | 40 | } |
51 | 41 | 41 | ||
52 | 42 | static DirAnimations null() { | 42 | static DirAnimations null() { |
53 | 43 | return DirAnimations(0); // Since real animation IDs are positive, this is safe | 43 | return DirAnimations(0); // Since real animation IDs are positive, this is safe |
54 | 44 | } | 44 | } |
55 | 45 | 45 | ||
57 | 46 | operator bool() const {return m_animations[0];} | 46 | operator bool() const {return animations_[0];} |
58 | 47 | 47 | ||
59 | 48 | private: | 48 | private: |
61 | 49 | uint32_t m_animations[6]; | 49 | uint32_t animations_[6]; |
62 | 50 | }; | 50 | }; |
63 | 51 | 51 | ||
64 | 52 | #endif // end of include guard: WL_GRAPHIC_DIRANIMATIONS_H | 52 | #endif // end of include guard: WL_GRAPHIC_DIRANIMATIONS_H |
65 | 53 | 53 | ||
66 | === modified file 'src/logic/map_objects/tribes/battle.cc' | |||
67 | --- src/logic/map_objects/tribes/battle.cc 2015-11-28 22:29:26 +0000 | |||
68 | +++ src/logic/map_objects/tribes/battle.cc 2016-02-08 18:17:36 +0000 | |||
69 | @@ -45,22 +45,22 @@ | |||
70 | 45 | Battle::Battle () | 45 | Battle::Battle () |
71 | 46 | : | 46 | : |
72 | 47 | MapObject(&g_battle_descr), | 47 | MapObject(&g_battle_descr), |
80 | 48 | m_first(nullptr), | 48 | first_(nullptr), |
81 | 49 | m_second(nullptr), | 49 | second_(nullptr), |
82 | 50 | m_creationtime(0), | 50 | creationtime_(0), |
83 | 51 | m_readyflags(0), | 51 | readyflags_(0), |
84 | 52 | m_damage(0), | 52 | damage_(0), |
85 | 53 | m_first_strikes(true), | 53 | first_strikes_(true), |
86 | 54 | m_last_attack_hits(false) | 54 | last_attack_hits_(false) |
87 | 55 | {} | 55 | {} |
88 | 56 | 56 | ||
89 | 57 | Battle::Battle(Game & game, Soldier & First, Soldier & Second) : | 57 | Battle::Battle(Game & game, Soldier & First, Soldier & Second) : |
90 | 58 | MapObject (&g_battle_descr), | 58 | MapObject (&g_battle_descr), |
96 | 59 | m_first (&First), | 59 | first_ (&First), |
97 | 60 | m_second (&Second), | 60 | second_ (&Second), |
98 | 61 | m_readyflags (0), | 61 | readyflags_ (0), |
99 | 62 | m_damage (0), | 62 | damage_ (0), |
100 | 63 | m_first_strikes(true) | 63 | first_strikes_(true) |
101 | 64 | { | 64 | { |
102 | 65 | assert(First.get_owner() != Second.get_owner()); | 65 | assert(First.get_owner() != Second.get_owner()); |
103 | 66 | { | 66 | { |
104 | @@ -81,30 +81,30 @@ | |||
105 | 81 | { | 81 | { |
106 | 82 | MapObject::init(egbase); | 82 | MapObject::init(egbase); |
107 | 83 | 83 | ||
109 | 84 | m_creationtime = egbase.get_gametime(); | 84 | creationtime_ = egbase.get_gametime(); |
110 | 85 | 85 | ||
111 | 86 | Game& game = dynamic_cast<Game&>(egbase); | 86 | Game& game = dynamic_cast<Game&>(egbase); |
112 | 87 | 87 | ||
121 | 88 | if (Battle* battle = m_first ->get_battle()) { | 88 | if (Battle* battle = first_ ->get_battle()) { |
122 | 89 | battle->cancel(game, *m_first); | 89 | battle->cancel(game, *first_); |
123 | 90 | } | 90 | } |
124 | 91 | m_first->set_battle(game, this); | 91 | first_->set_battle(game, this); |
125 | 92 | if (Battle* battle = m_second->get_battle()) { | 92 | if (Battle* battle = second_->get_battle()) { |
126 | 93 | battle->cancel(game, *m_second); | 93 | battle->cancel(game, *second_); |
127 | 94 | } | 94 | } |
128 | 95 | m_second->set_battle(game, this); | 95 | second_->set_battle(game, this); |
129 | 96 | } | 96 | } |
130 | 97 | 97 | ||
131 | 98 | 98 | ||
132 | 99 | void Battle::cleanup (EditorGameBase & egbase) | 99 | void Battle::cleanup (EditorGameBase & egbase) |
133 | 100 | { | 100 | { |
137 | 101 | if (m_first) { | 101 | if (first_) { |
138 | 102 | m_first ->set_battle(dynamic_cast<Game&>(egbase), nullptr); | 102 | first_ ->set_battle(dynamic_cast<Game&>(egbase), nullptr); |
139 | 103 | m_first = nullptr; | 103 | first_ = nullptr; |
140 | 104 | } | 104 | } |
144 | 105 | if (m_second) { | 105 | if (second_) { |
145 | 106 | m_second->set_battle(dynamic_cast<Game&>(egbase), nullptr); | 106 | second_->set_battle(dynamic_cast<Game&>(egbase), nullptr); |
146 | 107 | m_second = nullptr; | 107 | second_ = nullptr; |
147 | 108 | } | 108 | } |
148 | 109 | 109 | ||
149 | 110 | MapObject::cleanup(egbase); | 110 | MapObject::cleanup(egbase); |
150 | @@ -116,11 +116,11 @@ | |||
151 | 116 | */ | 116 | */ |
152 | 117 | void Battle::cancel(Game & game, Soldier & soldier) | 117 | void Battle::cancel(Game & game, Soldier & soldier) |
153 | 118 | { | 118 | { |
156 | 119 | if (&soldier == m_first) { | 119 | if (&soldier == first_) { |
157 | 120 | m_first = nullptr; | 120 | first_ = nullptr; |
158 | 121 | soldier.set_battle(game, nullptr); | 121 | soldier.set_battle(game, nullptr); |
161 | 122 | } else if (&soldier == m_second) { | 122 | } else if (&soldier == second_) { |
162 | 123 | m_second = nullptr; | 123 | second_ = nullptr; |
163 | 124 | soldier.set_battle(game, nullptr); | 124 | soldier.set_battle(game, nullptr); |
164 | 125 | } else | 125 | } else |
165 | 126 | return; | 126 | return; |
166 | @@ -131,17 +131,17 @@ | |||
167 | 131 | 131 | ||
168 | 132 | bool Battle::locked(Game & game) | 132 | bool Battle::locked(Game & game) |
169 | 133 | { | 133 | { |
171 | 134 | if (!m_first || !m_second) | 134 | if (!first_ || !second_) |
172 | 135 | return false; | 135 | return false; |
174 | 136 | if (game.get_gametime() - m_creationtime < 1000) | 136 | if (game.get_gametime() - creationtime_ < 1000) |
175 | 137 | return true; // don't change battles around willy-nilly | 137 | return true; // don't change battles around willy-nilly |
177 | 138 | return m_first->get_position() == m_second->get_position(); | 138 | return first_->get_position() == second_->get_position(); |
178 | 139 | } | 139 | } |
179 | 140 | 140 | ||
180 | 141 | Soldier * Battle::opponent(Soldier& soldier) | 141 | Soldier * Battle::opponent(Soldier& soldier) |
181 | 142 | { | 142 | { |
184 | 143 | assert(m_first == &soldier || m_second == &soldier); | 143 | assert(first_ == &soldier || second_ == &soldier); |
185 | 144 | Soldier* other_soldier = m_first == &soldier ? m_second : m_first; | 144 | Soldier* other_soldier = first_ == &soldier ? second_ : first_; |
186 | 145 | return other_soldier; | 145 | return other_soldier; |
187 | 146 | } | 146 | } |
188 | 147 | 147 | ||
189 | @@ -153,35 +153,35 @@ | |||
190 | 153 | void Battle::get_battle_work(Game & game, Soldier & soldier) | 153 | void Battle::get_battle_work(Game & game, Soldier & soldier) |
191 | 154 | { | 154 | { |
192 | 155 | // Identify what soldier is calling the routine | 155 | // Identify what soldier is calling the routine |
194 | 156 | uint8_t const this_soldier_is = &soldier == m_first ? 1 : 2; | 156 | uint8_t const this_soldier_is = &soldier == first_ ? 1 : 2; |
195 | 157 | 157 | ||
197 | 158 | assert(m_first->get_battle() == this || m_second->get_battle() == this); | 158 | assert(first_->get_battle() == this || second_->get_battle() == this); |
198 | 159 | 159 | ||
199 | 160 | // Created this four 'states' of the battle: | 160 | // Created this four 'states' of the battle: |
200 | 161 | // *First time entered, one enters : | 161 | // *First time entered, one enters : |
202 | 162 | // oneReadyToFight, mark m_readyflags as he is ready to fight | 162 | // oneReadyToFight, mark readyflags_ as he is ready to fight |
203 | 163 | // *Next time, the opponent enters: | 163 | // *Next time, the opponent enters: |
205 | 164 | // bothReadyToFight, mark m_readyflags as 3 (round fighted) | 164 | // bothReadyToFight, mark readyflags_ as 3 (round fighted) |
206 | 165 | // *Next time, the first enters again: | 165 | // *Next time, the first enters again: |
208 | 166 | // roundFought, reset m_readyflags | 166 | // roundFought, reset readyflags_ |
209 | 167 | // *Opponent not on field yet, so one enters : | 167 | // *Opponent not on field yet, so one enters : |
210 | 168 | // waitingForOpponent, if others are false | 168 | // waitingForOpponent, if others are false |
211 | 169 | 169 | ||
215 | 170 | bool const oneReadyToFight = (m_readyflags == 0); | 170 | bool const oneReadyToFight = (readyflags_ == 0); |
216 | 171 | bool const roundFought = (m_readyflags == 3); | 171 | bool const roundFought = (readyflags_ == 3); |
217 | 172 | bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) && | 172 | bool const bothReadyToFight = ((this_soldier_is | readyflags_) == 3) && |
218 | 173 | (!roundFought); | 173 | (!roundFought); |
219 | 174 | bool const waitingForOpponent = !(oneReadyToFight || roundFought || bothReadyToFight); | 174 | bool const waitingForOpponent = !(oneReadyToFight || roundFought || bothReadyToFight); |
220 | 175 | std::string what_anim; | 175 | std::string what_anim; |
221 | 176 | 176 | ||
222 | 177 | // Apply pending damage | 177 | // Apply pending damage |
224 | 178 | if (m_damage && oneReadyToFight) { | 178 | if (damage_ && oneReadyToFight) { |
225 | 179 | // Current attacker is last defender, so damage goes to current attacker | 179 | // Current attacker is last defender, so damage goes to current attacker |
228 | 180 | if (m_first_strikes) | 180 | if (first_strikes_) |
229 | 181 | m_first ->damage(m_damage); | 181 | first_ ->damage(damage_); |
230 | 182 | else | 182 | else |
233 | 183 | m_second->damage(m_damage); | 183 | second_->damage(damage_); |
234 | 184 | m_damage = 0; | 184 | damage_ = 0; |
235 | 185 | } | 185 | } |
236 | 186 | 186 | ||
237 | 187 | if (soldier.get_current_hitpoints() < 1) { | 187 | if (soldier.get_current_hitpoints() < 1) { |
238 | @@ -194,15 +194,15 @@ | |||
239 | 194 | return schedule_destroy(game); | 194 | return schedule_destroy(game); |
240 | 195 | } | 195 | } |
241 | 196 | 196 | ||
243 | 197 | if (!m_first || !m_second) | 197 | if (!first_ || !second_) |
244 | 198 | return soldier.skip_act(); | 198 | return soldier.skip_act(); |
245 | 199 | 199 | ||
246 | 200 | // Here is a timeout to prevent battle freezes | 200 | // Here is a timeout to prevent battle freezes |
248 | 201 | if (waitingForOpponent && (game.get_gametime() - m_creationtime) > 90 * 1000) { | 201 | if (waitingForOpponent && (game.get_gametime() - creationtime_) > 90 * 1000) { |
249 | 202 | molog("[battle] soldier %u waiting for opponent %u too long (%5d sec), cancelling battle...\n", | 202 | molog("[battle] soldier %u waiting for opponent %u too long (%5d sec), cancelling battle...\n", |
250 | 203 | soldier.serial(), | 203 | soldier.serial(), |
251 | 204 | opponent(soldier)->serial(), | 204 | opponent(soldier)->serial(), |
253 | 205 | (game.get_gametime() - m_creationtime) / 1000); | 205 | (game.get_gametime() - creationtime_) / 1000); |
254 | 206 | cancel(game, soldier); | 206 | cancel(game, soldier); |
255 | 207 | return; | 207 | return; |
256 | 208 | } | 208 | } |
257 | @@ -220,9 +220,9 @@ | |||
258 | 220 | // | 220 | // |
259 | 221 | if (oneReadyToFight) { | 221 | if (oneReadyToFight) { |
260 | 222 | // My opponent is not ready to battle. Idle until he wakes me up. | 222 | // My opponent is not ready to battle. Idle until he wakes me up. |
264 | 223 | assert(m_readyflags == 0); | 223 | assert(readyflags_ == 0); |
265 | 224 | m_readyflags = this_soldier_is; | 224 | readyflags_ = this_soldier_is; |
266 | 225 | assert(m_readyflags == this_soldier_is); | 225 | assert(readyflags_ == this_soldier_is); |
267 | 226 | 226 | ||
268 | 227 | what_anim = this_soldier_is == 1 ? | 227 | what_anim = this_soldier_is == 1 ? |
269 | 228 | "evade_success_e" : | 228 | "evade_success_e" : |
270 | @@ -236,12 +236,12 @@ | |||
271 | 236 | // Time for one of us to hurt the other. Which one is on turn is decided | 236 | // Time for one of us to hurt the other. Which one is on turn is decided |
272 | 237 | // by calculate_round. | 237 | // by calculate_round. |
273 | 238 | assert | 238 | assert |
276 | 239 | ((m_readyflags == 1 && this_soldier_is == 2) || | 239 | ((readyflags_ == 1 && this_soldier_is == 2) || |
277 | 240 | (m_readyflags == 2 && this_soldier_is == 1)); | 240 | (readyflags_ == 2 && this_soldier_is == 1)); |
278 | 241 | 241 | ||
279 | 242 | // Both are now ready, mark flags, so our opponent can get new animation | 242 | // Both are now ready, mark flags, so our opponent can get new animation |
282 | 243 | m_readyflags = 3; | 243 | readyflags_ = 3; |
283 | 244 | assert(m_readyflags == 3); | 244 | assert(readyflags_ == 3); |
284 | 245 | 245 | ||
285 | 246 | // Resolve combat turn | 246 | // Resolve combat turn |
286 | 247 | calculate_round(game); | 247 | calculate_round(game); |
287 | @@ -253,23 +253,23 @@ | |||
288 | 253 | if (roundFought) { | 253 | if (roundFought) { |
289 | 254 | // Both of us were already ready. That means that we already fought and | 254 | // Both of us were already ready. That means that we already fought and |
290 | 255 | // it is time to wait until both become ready. | 255 | // it is time to wait until both become ready. |
292 | 256 | m_readyflags = 0; | 256 | readyflags_ = 0; |
293 | 257 | } | 257 | } |
294 | 258 | 258 | ||
298 | 259 | // The function calculate_round inverts value of m_first_strikes, so | 259 | // The function calculate_round inverts value of first_strikes_, so |
299 | 260 | // attacker will be the m_first when m_first_strikes = false and | 260 | // attacker will be the first_ when first_strikes_ = false and |
300 | 261 | // attacker will be m_second when m_first_strikes = true | 261 | // attacker will be second_ when first_strikes_ = true |
301 | 262 | molog | 262 | molog |
302 | 263 | ("[battle] (%u) vs (%u) is %d, first strikes %d, last hit %d\n", | 263 | ("[battle] (%u) vs (%u) is %d, first strikes %d, last hit %d\n", |
303 | 264 | soldier.serial(), | 264 | soldier.serial(), |
304 | 265 | opponent(soldier)->serial(), | 265 | opponent(soldier)->serial(), |
305 | 266 | this_soldier_is, | 266 | this_soldier_is, |
308 | 267 | m_first_strikes, | 267 | first_strikes_, |
309 | 268 | m_last_attack_hits); | 268 | last_attack_hits_); |
310 | 269 | 269 | ||
311 | 270 | if (this_soldier_is == 1) { | 270 | if (this_soldier_is == 1) { |
314 | 271 | if (m_first_strikes) { | 271 | if (first_strikes_) { |
315 | 272 | if (m_last_attack_hits) { | 272 | if (last_attack_hits_) { |
316 | 273 | what_anim = "evade_failure_e"; | 273 | what_anim = "evade_failure_e"; |
317 | 274 | } | 274 | } |
318 | 275 | else { | 275 | else { |
319 | @@ -277,7 +277,7 @@ | |||
320 | 277 | } | 277 | } |
321 | 278 | } | 278 | } |
322 | 279 | else { | 279 | else { |
324 | 280 | if (m_last_attack_hits) { | 280 | if (last_attack_hits_) { |
325 | 281 | what_anim = "attack_success_e"; | 281 | what_anim = "attack_success_e"; |
326 | 282 | } | 282 | } |
327 | 283 | else { | 283 | else { |
328 | @@ -285,8 +285,8 @@ | |||
329 | 285 | } | 285 | } |
330 | 286 | } | 286 | } |
331 | 287 | } else { | 287 | } else { |
334 | 288 | if (m_first_strikes) { | 288 | if (first_strikes_) { |
335 | 289 | if (m_last_attack_hits) { | 289 | if (last_attack_hits_) { |
336 | 290 | what_anim = "attack_success_w"; | 290 | what_anim = "attack_success_w"; |
337 | 291 | } | 291 | } |
338 | 292 | else { | 292 | else { |
339 | @@ -294,7 +294,7 @@ | |||
340 | 294 | } | 294 | } |
341 | 295 | } | 295 | } |
342 | 296 | else { | 296 | else { |
344 | 297 | if (m_last_attack_hits) { | 297 | if (last_attack_hits_) { |
345 | 298 | what_anim = "evade_failure_w"; | 298 | what_anim = "evade_failure_w"; |
346 | 299 | } | 299 | } |
347 | 300 | else { | 300 | else { |
348 | @@ -312,25 +312,25 @@ | |||
349 | 312 | 312 | ||
350 | 313 | void Battle::calculate_round(Game & game) | 313 | void Battle::calculate_round(Game & game) |
351 | 314 | { | 314 | { |
353 | 315 | assert(!m_damage); | 315 | assert(!damage_); |
354 | 316 | 316 | ||
355 | 317 | Soldier * attacker; | 317 | Soldier * attacker; |
356 | 318 | Soldier * defender; | 318 | Soldier * defender; |
357 | 319 | 319 | ||
361 | 320 | if (m_first_strikes) { | 320 | if (first_strikes_) { |
362 | 321 | attacker = m_first; | 321 | attacker = first_; |
363 | 322 | defender = m_second; | 322 | defender = second_; |
364 | 323 | } else { | 323 | } else { |
367 | 324 | attacker = m_second; | 324 | attacker = second_; |
368 | 325 | defender = m_first; | 325 | defender = first_; |
369 | 326 | } | 326 | } |
370 | 327 | 327 | ||
372 | 328 | m_first_strikes = !m_first_strikes; | 328 | first_strikes_ = !first_strikes_; |
373 | 329 | 329 | ||
374 | 330 | uint32_t const hit = game.logic_rand() % 100; | 330 | uint32_t const hit = game.logic_rand() % 100; |
375 | 331 | if (hit > defender->get_evade()) { | 331 | if (hit > defender->get_evade()) { |
376 | 332 | // Attacker hits! | 332 | // Attacker hits! |
378 | 333 | m_last_attack_hits = true; | 333 | last_attack_hits_ = true; |
379 | 334 | 334 | ||
380 | 335 | assert(attacker->get_min_attack() <= attacker->get_max_attack()); | 335 | assert(attacker->get_min_attack() <= attacker->get_max_attack()); |
381 | 336 | uint32_t const attack = | 336 | uint32_t const attack = |
382 | @@ -338,11 +338,11 @@ | |||
383 | 338 | (game.logic_rand() | 338 | (game.logic_rand() |
384 | 339 | % | 339 | % |
385 | 340 | (1 + attacker->get_max_attack() - attacker->get_min_attack())); | 340 | (1 + attacker->get_max_attack() - attacker->get_min_attack())); |
387 | 341 | m_damage = attack - (attack * defender->get_defense()) / 100; | 341 | damage_ = attack - (attack * defender->get_defense()) / 100; |
388 | 342 | } | 342 | } |
389 | 343 | else { | 343 | else { |
390 | 344 | // Defender evaded | 344 | // Defender evaded |
392 | 345 | m_last_attack_hits = false; | 345 | last_attack_hits_ = false; |
393 | 346 | } | 346 | } |
394 | 347 | } | 347 | } |
395 | 348 | 348 | ||
396 | @@ -363,12 +363,12 @@ | |||
397 | 363 | 363 | ||
398 | 364 | Battle & battle = get<Battle>(); | 364 | Battle & battle = get<Battle>(); |
399 | 365 | 365 | ||
406 | 366 | battle.m_creationtime = fr.signed_32(); | 366 | battle.creationtime_ = fr.signed_32(); |
407 | 367 | battle.m_readyflags = fr.unsigned_8(); | 367 | battle.readyflags_ = fr.unsigned_8(); |
408 | 368 | battle.m_first_strikes = fr.unsigned_8(); | 368 | battle.first_strikes_ = fr.unsigned_8(); |
409 | 369 | battle.m_damage = fr.unsigned_32(); | 369 | battle.damage_ = fr.unsigned_32(); |
410 | 370 | m_first = fr.unsigned_32(); | 370 | first_ = fr.unsigned_32(); |
411 | 371 | m_second = fr.unsigned_32(); | 371 | second_ = fr.unsigned_32(); |
412 | 372 | } | 372 | } |
413 | 373 | 373 | ||
414 | 374 | void Battle::Loader::load_pointers() | 374 | void Battle::Loader::load_pointers() |
415 | @@ -376,17 +376,17 @@ | |||
416 | 376 | Battle & battle = get<Battle>(); | 376 | Battle & battle = get<Battle>(); |
417 | 377 | try { | 377 | try { |
418 | 378 | MapObject::Loader::load_pointers(); | 378 | MapObject::Loader::load_pointers(); |
420 | 379 | if (m_first) | 379 | if (first_) |
421 | 380 | try { | 380 | try { |
423 | 381 | battle.m_first = &mol().get<Soldier>(m_first); | 381 | battle.first_ = &mol().get<Soldier>(first_); |
424 | 382 | } catch (const WException & e) { | 382 | } catch (const WException & e) { |
426 | 383 | throw wexception("soldier 1 (%u): %s", m_first, e.what()); | 383 | throw wexception("soldier 1 (%u): %s", first_, e.what()); |
427 | 384 | } | 384 | } |
429 | 385 | if (m_second) | 385 | if (second_) |
430 | 386 | try { | 386 | try { |
432 | 387 | battle.m_second = &mol().get<Soldier>(m_second); | 387 | battle.second_ = &mol().get<Soldier>(second_); |
433 | 388 | } catch (const WException & e) { | 388 | } catch (const WException & e) { |
435 | 389 | throw wexception("soldier 2 (%u): %s", m_second, e.what()); | 389 | throw wexception("soldier 2 (%u): %s", second_, e.what()); |
436 | 390 | } | 390 | } |
437 | 391 | } catch (const WException & e) { | 391 | } catch (const WException & e) { |
438 | 392 | throw wexception("battle: %s", e.what()); | 392 | throw wexception("battle: %s", e.what()); |
439 | @@ -401,14 +401,14 @@ | |||
440 | 401 | 401 | ||
441 | 402 | MapObject::save(egbase, mos, fw); | 402 | MapObject::save(egbase, mos, fw); |
442 | 403 | 403 | ||
447 | 404 | fw.signed_32(m_creationtime); | 404 | fw.signed_32(creationtime_); |
448 | 405 | fw.unsigned_8(m_readyflags); | 405 | fw.unsigned_8(readyflags_); |
449 | 406 | fw.unsigned_8(m_first_strikes); | 406 | fw.unsigned_8(first_strikes_); |
450 | 407 | fw.unsigned_32(m_damage); | 407 | fw.unsigned_32(damage_); |
451 | 408 | 408 | ||
452 | 409 | // And now, the serials of the soldiers ! | 409 | // And now, the serials of the soldiers ! |
455 | 410 | fw.unsigned_32(m_first ? mos.get_object_file_index(*m_first) : 0); | 410 | fw.unsigned_32(first_ ? mos.get_object_file_index(*first_) : 0); |
456 | 411 | fw.unsigned_32(m_second ? mos.get_object_file_index(*m_second) : 0); | 411 | fw.unsigned_32(second_ ? mos.get_object_file_index(*second_) : 0); |
457 | 412 | } | 412 | } |
458 | 413 | 413 | ||
459 | 414 | 414 | ||
460 | 415 | 415 | ||
461 | === modified file 'src/logic/map_objects/tribes/battle.h' | |||
462 | --- src/logic/map_objects/tribes/battle.h 2015-11-29 09:43:15 +0000 | |||
463 | +++ src/logic/map_objects/tribes/battle.h 2016-02-08 18:17:36 +0000 | |||
464 | @@ -66,8 +66,8 @@ | |||
465 | 66 | bool locked(Game &); | 66 | bool locked(Game &); |
466 | 67 | 67 | ||
467 | 68 | // The two soldiers involved in this fight. | 68 | // The two soldiers involved in this fight. |
470 | 69 | Soldier * first() {return m_first;} | 69 | Soldier * first() {return first_;} |
471 | 70 | Soldier * second() {return m_second;} | 70 | Soldier * second() {return second_;} |
472 | 71 | 71 | ||
473 | 72 | // Returns the other soldier involved in this battle. CHECKs that the given | 72 | // Returns the other soldier involved in this battle. CHECKs that the given |
474 | 73 | // soldier is participating in this battle. Can return nullptr, but I have | 73 | // soldier is participating in this battle. Can return nullptr, but I have |
475 | @@ -83,41 +83,41 @@ | |||
476 | 83 | virtual void load(FileRead &); | 83 | virtual void load(FileRead &); |
477 | 84 | void load_pointers() override; | 84 | void load_pointers() override; |
478 | 85 | 85 | ||
481 | 86 | Serial m_first; | 86 | Serial first_; |
482 | 87 | Serial m_second; | 87 | Serial second_; |
483 | 88 | }; | 88 | }; |
484 | 89 | 89 | ||
485 | 90 | void calculate_round(Game &); | 90 | void calculate_round(Game &); |
486 | 91 | 91 | ||
489 | 92 | Soldier * m_first; | 92 | Soldier * first_; |
490 | 93 | Soldier * m_second; | 93 | Soldier * second_; |
491 | 94 | 94 | ||
492 | 95 | /** | 95 | /** |
493 | 96 | * Gametime when the battle was created. | 96 | * Gametime when the battle was created. |
494 | 97 | */ | 97 | */ |
496 | 98 | int32_t m_creationtime; | 98 | int32_t creationtime_; |
497 | 99 | 99 | ||
498 | 100 | /** | 100 | /** |
499 | 101 | * 1 if only the first soldier is ready, 2 if only the second soldier | 101 | * 1 if only the first soldier is ready, 2 if only the second soldier |
500 | 102 | * is ready, 3 if both are ready. | 102 | * is ready, 3 if both are ready. |
501 | 103 | */ | 103 | */ |
503 | 104 | uint8_t m_readyflags; | 104 | uint8_t readyflags_; |
504 | 105 | 105 | ||
505 | 106 | /** | 106 | /** |
506 | 107 | * Damage pending to apply. Damage is applied at end of round so animations | 107 | * Damage pending to apply. Damage is applied at end of round so animations |
507 | 108 | * can show current action. | 108 | * can show current action. |
508 | 109 | */ | 109 | */ |
510 | 110 | uint32_t m_damage; | 110 | uint32_t damage_; |
511 | 111 | 111 | ||
512 | 112 | /** | 112 | /** |
513 | 113 | * \c true if the first soldier is the next to strike. | 113 | * \c true if the first soldier is the next to strike. |
514 | 114 | */ | 114 | */ |
516 | 115 | bool m_first_strikes; | 115 | bool first_strikes_; |
517 | 116 | 116 | ||
518 | 117 | /** | 117 | /** |
519 | 118 | * \c true if the last turn attacker damaged his opponent | 118 | * \c true if the last turn attacker damaged his opponent |
520 | 119 | */ | 119 | */ |
522 | 120 | bool m_last_attack_hits; | 120 | bool last_attack_hits_; |
523 | 121 | }; | 121 | }; |
524 | 122 | 122 | ||
525 | 123 | } | 123 | } |
526 | 124 | 124 | ||
527 | === modified file 'src/logic/map_objects/tribes/building.cc' | |||
528 | --- src/logic/map_objects/tribes/building.cc 2016-02-07 09:30:20 +0000 | |||
529 | +++ src/logic/map_objects/tribes/building.cc 2016-02-08 18:17:36 +0000 | |||
530 | @@ -60,15 +60,15 @@ | |||
531 | 60 | : | 60 | : |
532 | 61 | MapObjectDescr(_type, table.get_string("name"), init_descname, table), | 61 | MapObjectDescr(_type, table.get_string("name"), init_descname, table), |
533 | 62 | egbase_ (egbase), | 62 | egbase_ (egbase), |
543 | 63 | m_buildable (false), | 63 | buildable_ (false), |
544 | 64 | m_size (BaseImmovable::SMALL), | 64 | size_ (BaseImmovable::SMALL), |
545 | 65 | m_mine (false), | 65 | mine_ (false), |
546 | 66 | m_port (false), | 66 | port_ (false), |
547 | 67 | m_enhancement (INVALID_INDEX), | 67 | enhancement_ (INVALID_INDEX), |
548 | 68 | m_enhanced_from (INVALID_INDEX), | 68 | enhanced_from_ (INVALID_INDEX), |
549 | 69 | m_enhanced_building(false), | 69 | enhanced_building_(false), |
550 | 70 | m_hints (table.get_table("aihints")), | 70 | hints_ (table.get_table("aihints")), |
551 | 71 | m_vision_range (0) | 71 | vision_range_ (0) |
552 | 72 | { | 72 | { |
553 | 73 | if (!is_animation_known("idle")) { | 73 | if (!is_animation_known("idle")) { |
554 | 74 | throw GameDataError("Building %s has no idle animation", table.get_string("name").c_str()); | 74 | throw GameDataError("Building %s has no idle animation", table.get_string("name").c_str()); |
555 | @@ -84,17 +84,17 @@ | |||
556 | 84 | try { | 84 | try { |
557 | 85 | const std::string size = table.get_string("size"); | 85 | const std::string size = table.get_string("size"); |
558 | 86 | if (boost::iequals(size, "small")) { | 86 | if (boost::iequals(size, "small")) { |
560 | 87 | m_size = BaseImmovable::SMALL; | 87 | size_ = BaseImmovable::SMALL; |
561 | 88 | } else if (boost::iequals(size, "medium")) { | 88 | } else if (boost::iequals(size, "medium")) { |
563 | 89 | m_size = BaseImmovable::MEDIUM; | 89 | size_ = BaseImmovable::MEDIUM; |
564 | 90 | } else if (boost::iequals(size, "big")) { | 90 | } else if (boost::iequals(size, "big")) { |
566 | 91 | m_size = BaseImmovable::BIG; | 91 | size_ = BaseImmovable::BIG; |
567 | 92 | } else if (boost::iequals(size, "mine")) { | 92 | } else if (boost::iequals(size, "mine")) { |
570 | 93 | m_size = BaseImmovable::SMALL; | 93 | size_ = BaseImmovable::SMALL; |
571 | 94 | m_mine = true; | 94 | mine_ = true; |
572 | 95 | } else if (boost::iequals(size, "port")) { | 95 | } else if (boost::iequals(size, "port")) { |
575 | 96 | m_size = BaseImmovable::BIG; | 96 | size_ = BaseImmovable::BIG; |
576 | 97 | m_port = true; | 97 | port_ = true; |
577 | 98 | } else { | 98 | } else { |
578 | 99 | throw GameDataError | 99 | throw GameDataError |
579 | 100 | ("expected %s but found \"%s\"", | 100 | ("expected %s but found \"%s\"", |
580 | @@ -106,7 +106,7 @@ | |||
581 | 106 | } | 106 | } |
582 | 107 | 107 | ||
583 | 108 | // Parse build options | 108 | // Parse build options |
585 | 109 | m_destructible = table.has_key("destructible") ? table.get_bool("destructible") : true; | 109 | destructible_ = table.has_key("destructible") ? table.get_bool("destructible") : true; |
586 | 110 | 110 | ||
587 | 111 | if (table.has_key("enhancement")) { | 111 | if (table.has_key("enhancement")) { |
588 | 112 | const std::string enh = table.get_string("enhancement"); | 112 | const std::string enh = table.get_string("enhancement"); |
589 | @@ -116,14 +116,14 @@ | |||
590 | 116 | } | 116 | } |
591 | 117 | DescriptionIndex const en_i = egbase_.tribes().building_index(enh); | 117 | DescriptionIndex const en_i = egbase_.tribes().building_index(enh); |
592 | 118 | if (egbase_.tribes().building_exists(en_i)) { | 118 | if (egbase_.tribes().building_exists(en_i)) { |
594 | 119 | m_enhancement = en_i; | 119 | enhancement_ = en_i; |
595 | 120 | 120 | ||
596 | 121 | // Merge the enhancements workarea info into this building's | 121 | // Merge the enhancements workarea info into this building's |
597 | 122 | // workarea info. | 122 | // workarea info. |
598 | 123 | const BuildingDescr * tmp_enhancement = egbase_.tribes().get_building_descr(en_i); | 123 | const BuildingDescr * tmp_enhancement = egbase_.tribes().get_building_descr(en_i); |
600 | 124 | for (std::pair<uint32_t, std::set<std::string>> area : tmp_enhancement->m_workarea_info) | 124 | for (std::pair<uint32_t, std::set<std::string>> area : tmp_enhancement->workarea_info_) |
601 | 125 | { | 125 | { |
603 | 126 | std::set<std::string> & strs = m_workarea_info[area.first]; | 126 | std::set<std::string> & strs = workarea_info_[area.first]; |
604 | 127 | for (std::string str : area.second) | 127 | for (std::string str : area.second) |
605 | 128 | strs.insert(str); | 128 | strs.insert(str); |
606 | 129 | } | 129 | } |
607 | @@ -135,10 +135,10 @@ | |||
608 | 135 | } | 135 | } |
609 | 136 | 136 | ||
610 | 137 | if (table.has_key("buildcost")) { | 137 | if (table.has_key("buildcost")) { |
612 | 138 | m_buildable = true; | 138 | buildable_ = true; |
613 | 139 | try { | 139 | try { |
616 | 140 | m_buildcost = Buildcost(table.get_table("buildcost"), egbase_.tribes()); | 140 | buildcost_ = Buildcost(table.get_table("buildcost"), egbase_.tribes()); |
617 | 141 | m_return_dismantle = Buildcost(table.get_table("return_on_dismantle"), egbase_.tribes()); | 141 | return_dismantle_ = Buildcost(table.get_table("return_on_dismantle"), egbase_.tribes()); |
618 | 142 | } catch (const WException & e) { | 142 | } catch (const WException & e) { |
619 | 143 | throw wexception | 143 | throw wexception |
620 | 144 | ("A buildable building must define \"buildcost\" and \"return_on_dismantle\": %s", | 144 | ("A buildable building must define \"buildcost\" and \"return_on_dismantle\": %s", |
621 | @@ -146,10 +146,10 @@ | |||
622 | 146 | } | 146 | } |
623 | 147 | } | 147 | } |
624 | 148 | if (table.has_key("enhancement_cost")) { | 148 | if (table.has_key("enhancement_cost")) { |
626 | 149 | m_enhanced_building = true; | 149 | enhanced_building_ = true; |
627 | 150 | try { | 150 | try { |
630 | 151 | m_enhance_cost = Buildcost(table.get_table("enhancement_cost"), egbase_.tribes()); | 151 | enhance_cost_ = Buildcost(table.get_table("enhancement_cost"), egbase_.tribes()); |
631 | 152 | m_return_enhanced = Buildcost(table.get_table("return_on_dismantle_on_enhanced"), egbase_.tribes()); | 152 | return_enhanced_ = Buildcost(table.get_table("return_on_dismantle_on_enhanced"), egbase_.tribes()); |
632 | 153 | } catch (const WException & e) { | 153 | } catch (const WException & e) { |
633 | 154 | throw wexception | 154 | throw wexception |
634 | 155 | ("An enhanced building must define \"enhancement_cost\"" | 155 | ("An enhanced building must define \"enhancement_cost\"" |
635 | @@ -159,10 +159,10 @@ | |||
636 | 159 | 159 | ||
637 | 160 | helptext_script_ = table.get_string("helptext_script"); | 160 | helptext_script_ = table.get_string("helptext_script"); |
638 | 161 | 161 | ||
640 | 162 | m_needs_seafaring = table.has_key("needs_seafaring") ? table.get_bool("needs_seafaring") : false; | 162 | needs_seafaring_ = table.has_key("needs_seafaring") ? table.get_bool("needs_seafaring") : false; |
641 | 163 | 163 | ||
642 | 164 | if (table.has_key("vision_range")) { | 164 | if (table.has_key("vision_range")) { |
644 | 165 | m_vision_range = table.get_int("vision_range"); | 165 | vision_range_ = table.get_int("vision_range"); |
645 | 166 | } | 166 | } |
646 | 167 | } | 167 | } |
647 | 168 | 168 | ||
648 | @@ -177,10 +177,10 @@ | |||
649 | 177 | const | 177 | const |
650 | 178 | { | 178 | { |
651 | 179 | Building & b = construct ? create_constructionsite() : create_object(); | 179 | Building & b = construct ? create_constructionsite() : create_object(); |
653 | 180 | b.m_position = pos; | 180 | b.position_ = pos; |
654 | 181 | b.set_owner(&owner); | 181 | b.set_owner(&owner); |
655 | 182 | for (DescriptionIndex idx : former_buildings) { | 182 | for (DescriptionIndex idx : former_buildings) { |
657 | 183 | b.m_old_buildings.push_back(idx); | 183 | b.old_buildings_.push_back(idx); |
658 | 184 | } | 184 | } |
659 | 185 | if (loading) { | 185 | if (loading) { |
660 | 186 | b.Building::init(egbase); | 186 | b.Building::init(egbase); |
661 | @@ -192,7 +192,7 @@ | |||
662 | 192 | 192 | ||
663 | 193 | 193 | ||
664 | 194 | int32_t BuildingDescr::suitability(const Map &, FCoords const fc) const { | 194 | int32_t BuildingDescr::suitability(const Map &, FCoords const fc) const { |
666 | 195 | return m_size <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK); | 195 | return size_ <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK); |
667 | 196 | } | 196 | } |
668 | 197 | 197 | ||
669 | 198 | /** | 198 | /** |
670 | @@ -212,7 +212,7 @@ | |||
671 | 212 | */ | 212 | */ |
672 | 213 | uint32_t BuildingDescr::vision_range() const | 213 | uint32_t BuildingDescr::vision_range() const |
673 | 214 | { | 214 | { |
675 | 215 | return m_vision_range ? m_vision_range : get_conquers() + 4; | 215 | return vision_range_ ? vision_range_ : get_conquers() + 4; |
676 | 216 | } | 216 | } |
677 | 217 | 217 | ||
678 | 218 | 218 | ||
679 | @@ -244,18 +244,18 @@ | |||
680 | 244 | 244 | ||
681 | 245 | Building::Building(const BuildingDescr & building_descr) : | 245 | Building::Building(const BuildingDescr & building_descr) : |
682 | 246 | PlayerImmovable(building_descr), | 246 | PlayerImmovable(building_descr), |
690 | 247 | m_optionswindow(nullptr), | 247 | optionswindow_(nullptr), |
691 | 248 | m_flag (nullptr), | 248 | flag_ (nullptr), |
692 | 249 | m_anim(0), | 249 | anim_(0), |
693 | 250 | m_animstart(0), | 250 | animstart_(0), |
694 | 251 | m_leave_time(0), | 251 | leave_time_(0), |
695 | 252 | m_defeating_player(0), | 252 | defeating_player_(0), |
696 | 253 | m_seeing(false) | 253 | seeing_(false) |
697 | 254 | {} | 254 | {} |
698 | 255 | 255 | ||
699 | 256 | Building::~Building() | 256 | Building::~Building() |
700 | 257 | { | 257 | { |
702 | 258 | if (m_optionswindow) | 258 | if (optionswindow_) |
703 | 259 | hide_options(); | 259 | hide_options(); |
704 | 260 | } | 260 | } |
705 | 261 | 261 | ||
706 | @@ -294,9 +294,9 @@ | |||
707 | 294 | return false; | 294 | return false; |
708 | 295 | }; | 295 | }; |
709 | 296 | 296 | ||
713 | 297 | m_leave_queue.erase( | 297 | leave_queue_.erase( |
714 | 298 | std::remove_if(m_leave_queue.begin(), m_leave_queue.end(), should_be_deleted), | 298 | std::remove_if(leave_queue_.begin(), leave_queue_.end(), should_be_deleted), |
715 | 299 | m_leave_queue.end()); | 299 | leave_queue_.end()); |
716 | 300 | } | 300 | } |
717 | 301 | 301 | ||
718 | 302 | int32_t Building::get_size() const {return descr().get_size();} | 302 | int32_t Building::get_size() const {return descr().get_size();} |
719 | @@ -305,7 +305,7 @@ | |||
720 | 305 | 305 | ||
721 | 306 | Flag & Building::base_flag() | 306 | Flag & Building::base_flag() |
722 | 307 | { | 307 | { |
724 | 308 | return *m_flag; | 308 | return *flag_; |
725 | 309 | } | 309 | } |
726 | 310 | 310 | ||
727 | 311 | 311 | ||
728 | @@ -331,8 +331,8 @@ | |||
729 | 331 | 331 | ||
730 | 332 | void Building::start_animation(EditorGameBase & egbase, uint32_t const anim) | 332 | void Building::start_animation(EditorGameBase & egbase, uint32_t const anim) |
731 | 333 | { | 333 | { |
734 | 334 | m_anim = anim; | 334 | anim_ = anim; |
735 | 335 | m_animstart = egbase.get_gametime(); | 335 | animstart_ = egbase.get_gametime(); |
736 | 336 | } | 336 | } |
737 | 337 | 337 | ||
738 | 338 | /* | 338 | /* |
739 | @@ -349,29 +349,29 @@ | |||
740 | 349 | Map & map = egbase.map(); | 349 | Map & map = egbase.map(); |
741 | 350 | Coords neighb; | 350 | Coords neighb; |
742 | 351 | 351 | ||
744 | 352 | set_position(egbase, m_position); | 352 | set_position(egbase, position_); |
745 | 353 | 353 | ||
746 | 354 | if (get_size() == BIG) { | 354 | if (get_size() == BIG) { |
754 | 355 | map.get_ln(m_position, &neighb); | 355 | map.get_ln(position_, &neighb); |
755 | 356 | set_position(egbase, neighb); | 356 | set_position(egbase, neighb); |
756 | 357 | 357 | ||
757 | 358 | map.get_tln(m_position, &neighb); | 358 | map.get_tln(position_, &neighb); |
758 | 359 | set_position(egbase, neighb); | 359 | set_position(egbase, neighb); |
759 | 360 | 360 | ||
760 | 361 | map.get_trn(m_position, &neighb); | 361 | map.get_trn(position_, &neighb); |
761 | 362 | set_position(egbase, neighb); | 362 | set_position(egbase, neighb); |
762 | 363 | } | 363 | } |
763 | 364 | 364 | ||
764 | 365 | // Make sure the flag is there | 365 | // Make sure the flag is there |
765 | 366 | 366 | ||
766 | 367 | 367 | ||
768 | 368 | map.get_brn(m_position, &neighb); | 368 | map.get_brn(position_, &neighb); |
769 | 369 | { | 369 | { |
770 | 370 | Flag * flag = dynamic_cast<Flag *>(map.get_immovable(neighb)); | 370 | Flag * flag = dynamic_cast<Flag *>(map.get_immovable(neighb)); |
771 | 371 | if (!flag) | 371 | if (!flag) |
772 | 372 | flag = | 372 | flag = |
773 | 373 | new Flag (egbase, owner(), neighb); | 373 | new Flag (egbase, owner(), neighb); |
775 | 374 | m_flag = flag; | 374 | flag_ = flag; |
776 | 375 | flag->attach_building(egbase, *this); | 375 | flag->attach_building(egbase, *this); |
777 | 376 | } | 376 | } |
778 | 377 | 377 | ||
779 | @@ -381,14 +381,14 @@ | |||
780 | 381 | else | 381 | else |
781 | 382 | start_animation(egbase, descr().get_animation("idle")); | 382 | start_animation(egbase, descr().get_animation("idle")); |
782 | 383 | 383 | ||
784 | 384 | m_leave_time = egbase.get_gametime(); | 384 | leave_time_ = egbase.get_gametime(); |
785 | 385 | } | 385 | } |
786 | 386 | 386 | ||
787 | 387 | 387 | ||
788 | 388 | void Building::cleanup(EditorGameBase & egbase) | 388 | void Building::cleanup(EditorGameBase & egbase) |
789 | 389 | { | 389 | { |
792 | 390 | if (m_defeating_player) { | 390 | if (defeating_player_) { |
793 | 391 | Player & defeating_player = egbase.player(m_defeating_player); | 391 | Player & defeating_player = egbase.player(defeating_player_); |
794 | 392 | if (descr().get_conquers()) { | 392 | if (descr().get_conquers()) { |
795 | 393 | owner() .count_msite_lost (); | 393 | owner() .count_msite_lost (); |
796 | 394 | defeating_player.count_msite_defeated (); | 394 | defeating_player.count_msite_defeated (); |
797 | @@ -399,22 +399,22 @@ | |||
798 | 399 | } | 399 | } |
799 | 400 | 400 | ||
800 | 401 | // Remove from flag | 401 | // Remove from flag |
802 | 402 | m_flag->detach_building(egbase); | 402 | flag_->detach_building(egbase); |
803 | 403 | 403 | ||
804 | 404 | // Unset the building | 404 | // Unset the building |
806 | 405 | unset_position(egbase, m_position); | 405 | unset_position(egbase, position_); |
807 | 406 | 406 | ||
808 | 407 | if (get_size() == BIG) { | 407 | if (get_size() == BIG) { |
809 | 408 | Map & map = egbase.map(); | 408 | Map & map = egbase.map(); |
810 | 409 | Coords neighb; | 409 | Coords neighb; |
811 | 410 | 410 | ||
819 | 411 | map.get_ln(m_position, &neighb); | 411 | map.get_ln(position_, &neighb); |
820 | 412 | unset_position(egbase, neighb); | 412 | unset_position(egbase, neighb); |
821 | 413 | 413 | ||
822 | 414 | map.get_tln(m_position, &neighb); | 414 | map.get_tln(position_, &neighb); |
823 | 415 | unset_position(egbase, neighb); | 415 | unset_position(egbase, neighb); |
824 | 416 | 416 | ||
825 | 417 | map.get_trn(m_position, &neighb); | 417 | map.get_trn(position_, &neighb); |
826 | 418 | unset_position(egbase, neighb); | 418 | unset_position(egbase, neighb); |
827 | 419 | } | 419 | } |
828 | 420 | 420 | ||
829 | @@ -447,18 +447,18 @@ | |||
830 | 447 | { | 447 | { |
831 | 448 | PositionList rv; | 448 | PositionList rv; |
832 | 449 | 449 | ||
834 | 450 | rv.push_back(m_position); | 450 | rv.push_back(position_); |
835 | 451 | if (get_size() == BIG) { | 451 | if (get_size() == BIG) { |
836 | 452 | Map & map = egbase.map(); | 452 | Map & map = egbase.map(); |
837 | 453 | Coords neighb; | 453 | Coords neighb; |
838 | 454 | 454 | ||
846 | 455 | map.get_ln(m_position, &neighb); | 455 | map.get_ln(position_, &neighb); |
847 | 456 | rv.push_back(neighb); | 456 | rv.push_back(neighb); |
848 | 457 | 457 | ||
849 | 458 | map.get_tln(m_position, &neighb); | 458 | map.get_tln(position_, &neighb); |
850 | 459 | rv.push_back(neighb); | 459 | rv.push_back(neighb); |
851 | 460 | 460 | ||
852 | 461 | map.get_trn(m_position, &neighb); | 461 | map.get_trn(position_, &neighb); |
853 | 462 | rv.push_back(neighb); | 462 | rv.push_back(neighb); |
854 | 463 | } | 463 | } |
855 | 464 | return rv; | 464 | return rv; |
856 | @@ -474,7 +474,7 @@ | |||
857 | 474 | void Building::destroy(EditorGameBase & egbase) | 474 | void Building::destroy(EditorGameBase & egbase) |
858 | 475 | { | 475 | { |
859 | 476 | const bool fire = burn_on_destroy(); | 476 | const bool fire = burn_on_destroy(); |
861 | 477 | const Coords pos = m_position; | 477 | const Coords pos = position_; |
862 | 478 | PlayerImmovable::destroy(egbase); | 478 | PlayerImmovable::destroy(egbase); |
863 | 479 | // We are deleted. Only use stack variables beyond this point | 479 | // We are deleted. Only use stack variables beyond this point |
864 | 480 | if (fire) | 480 | if (fire) |
865 | @@ -541,24 +541,24 @@ | |||
866 | 541 | */ | 541 | */ |
867 | 542 | bool Building::leave_check_and_wait(Game & game, Worker & w) | 542 | bool Building::leave_check_and_wait(Game & game, Worker & w) |
868 | 543 | { | 543 | { |
871 | 544 | if (&w == m_leave_allow.get(game)) { | 544 | if (&w == leave_allow_.get(game)) { |
872 | 545 | m_leave_allow = nullptr; | 545 | leave_allow_ = nullptr; |
873 | 546 | return true; | 546 | return true; |
874 | 547 | } | 547 | } |
875 | 548 | 548 | ||
876 | 549 | // Check time and queue | 549 | // Check time and queue |
877 | 550 | uint32_t const time = game.get_gametime(); | 550 | uint32_t const time = game.get_gametime(); |
878 | 551 | 551 | ||
882 | 552 | if (m_leave_queue.empty()) { | 552 | if (leave_queue_.empty()) { |
883 | 553 | if (m_leave_time <= time) { | 553 | if (leave_time_ <= time) { |
884 | 554 | m_leave_time = time + BUILDING_LEAVE_INTERVAL; | 554 | leave_time_ = time + BUILDING_LEAVE_INTERVAL; |
885 | 555 | return true; | 555 | return true; |
886 | 556 | } | 556 | } |
887 | 557 | 557 | ||
889 | 558 | schedule_act(game, m_leave_time - time); | 558 | schedule_act(game, leave_time_ - time); |
890 | 559 | } | 559 | } |
891 | 560 | 560 | ||
893 | 561 | m_leave_queue.push_back(&w); | 561 | leave_queue_.push_back(&w); |
894 | 562 | return false; | 562 | return false; |
895 | 563 | } | 563 | } |
896 | 564 | 564 | ||
897 | @@ -574,10 +574,10 @@ | |||
898 | 574 | void Building::leave_skip(Game &, Worker & w) | 574 | void Building::leave_skip(Game &, Worker & w) |
899 | 575 | { | 575 | { |
900 | 576 | LeaveQueue::iterator const it = | 576 | LeaveQueue::iterator const it = |
902 | 577 | std::find(m_leave_queue.begin(), m_leave_queue.end(), &w); | 577 | std::find(leave_queue_.begin(), leave_queue_.end(), &w); |
903 | 578 | 578 | ||
906 | 579 | if (it != m_leave_queue.end()) | 579 | if (it != leave_queue_.end()) |
907 | 580 | m_leave_queue.erase(it); | 580 | leave_queue_.erase(it); |
908 | 581 | } | 581 | } |
909 | 582 | 582 | ||
910 | 583 | 583 | ||
911 | @@ -590,31 +590,31 @@ | |||
912 | 590 | { | 590 | { |
913 | 591 | uint32_t const time = game.get_gametime(); | 591 | uint32_t const time = game.get_gametime(); |
914 | 592 | 592 | ||
916 | 593 | if (m_leave_time <= time) { | 593 | if (leave_time_ <= time) { |
917 | 594 | bool wakeup = false; | 594 | bool wakeup = false; |
918 | 595 | 595 | ||
919 | 596 | // Wake up one worker | 596 | // Wake up one worker |
922 | 597 | while (!m_leave_queue.empty()) { | 597 | while (!leave_queue_.empty()) { |
923 | 598 | upcast(Worker, worker, m_leave_queue[0].get(game)); | 598 | upcast(Worker, worker, leave_queue_[0].get(game)); |
924 | 599 | 599 | ||
926 | 600 | m_leave_queue.erase(m_leave_queue.begin()); | 600 | leave_queue_.erase(leave_queue_.begin()); |
927 | 601 | 601 | ||
928 | 602 | if (worker) { | 602 | if (worker) { |
930 | 603 | m_leave_allow = worker; | 603 | leave_allow_ = worker; |
931 | 604 | 604 | ||
932 | 605 | if (worker->wakeup_leave_building(game, *this)) { | 605 | if (worker->wakeup_leave_building(game, *this)) { |
934 | 606 | m_leave_time = time + BUILDING_LEAVE_INTERVAL; | 606 | leave_time_ = time + BUILDING_LEAVE_INTERVAL; |
935 | 607 | wakeup = true; | 607 | wakeup = true; |
936 | 608 | break; | 608 | break; |
937 | 609 | } | 609 | } |
938 | 610 | } | 610 | } |
939 | 611 | } | 611 | } |
940 | 612 | 612 | ||
943 | 613 | if (!m_leave_queue.empty()) | 613 | if (!leave_queue_.empty()) |
944 | 614 | schedule_act(game, m_leave_time - time); | 614 | schedule_act(game, leave_time_ - time); |
945 | 615 | 615 | ||
946 | 616 | if (!wakeup) | 616 | if (!wakeup) |
948 | 617 | m_leave_time = time; // make sure leave_time doesn't get too far behind | 617 | leave_time_ = time; // make sure leave_time doesn't get too far behind |
949 | 618 | } | 618 | } |
950 | 619 | 619 | ||
951 | 620 | PlayerImmovable::act(game, data); | 620 | PlayerImmovable::act(game, data); |
952 | @@ -647,9 +647,9 @@ | |||
953 | 647 | void Building::draw | 647 | void Building::draw |
954 | 648 | (const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos) | 648 | (const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos) |
955 | 649 | { | 649 | { |
957 | 650 | if (coords == m_position) { // draw big buildings only once | 650 | if (coords == position_) { // draw big buildings only once |
958 | 651 | dst.blit_animation( | 651 | dst.blit_animation( |
960 | 652 | pos, m_anim, game.get_gametime() - m_animstart, get_owner()->get_playercolor()); | 652 | pos, anim_, game.get_gametime() - animstart_, get_owner()->get_playercolor()); |
961 | 653 | 653 | ||
962 | 654 | // door animation? | 654 | // door animation? |
963 | 655 | 655 | ||
964 | @@ -699,8 +699,8 @@ | |||
965 | 699 | // if priority is defined for specific ware, | 699 | // if priority is defined for specific ware, |
966 | 700 | // combine base priority and ware priority | 700 | // combine base priority and ware priority |
967 | 701 | std::map<DescriptionIndex, int32_t>::const_iterator it = | 701 | std::map<DescriptionIndex, int32_t>::const_iterator it = |
970 | 702 | m_ware_priorities.find(ware_index); | 702 | ware_priorities_.find(ware_index); |
971 | 703 | if (it != m_ware_priorities.end()) | 703 | if (it != ware_priorities_.end()) |
972 | 704 | priority = adjust | 704 | priority = adjust |
973 | 705 | ? (priority * it->second / DEFAULT_PRIORITY) | 705 | ? (priority * it->second / DEFAULT_PRIORITY) |
974 | 706 | : it->second; | 706 | : it->second; |
975 | @@ -716,11 +716,11 @@ | |||
976 | 716 | void Building::collect_priorities | 716 | void Building::collect_priorities |
977 | 717 | (std::map<int32_t, std::map<DescriptionIndex, int32_t> > & p) const | 717 | (std::map<int32_t, std::map<DescriptionIndex, int32_t> > & p) const |
978 | 718 | { | 718 | { |
980 | 719 | if (m_ware_priorities.empty()) | 719 | if (ware_priorities_.empty()) |
981 | 720 | return; | 720 | return; |
982 | 721 | std::map<DescriptionIndex, int32_t> & ware_priorities = p[wwWARE]; | 721 | std::map<DescriptionIndex, int32_t> & ware_priorities = p[wwWARE]; |
983 | 722 | std::map<DescriptionIndex, int32_t>::const_iterator it; | 722 | std::map<DescriptionIndex, int32_t>::const_iterator it; |
985 | 723 | for (it = m_ware_priorities.begin(); it != m_ware_priorities.end(); ++it) { | 723 | for (it = ware_priorities_.begin(); it != ware_priorities_.end(); ++it) { |
986 | 724 | if (it->second == DEFAULT_PRIORITY) | 724 | if (it->second == DEFAULT_PRIORITY) |
987 | 725 | continue; | 725 | continue; |
988 | 726 | ware_priorities[it->first] = it->second; | 726 | ware_priorities[it->first] = it->second; |
989 | @@ -736,7 +736,7 @@ | |||
990 | 736 | int32_t const new_priority) | 736 | int32_t const new_priority) |
991 | 737 | { | 737 | { |
992 | 738 | if (type == wwWARE) { | 738 | if (type == wwWARE) { |
994 | 739 | m_ware_priorities[ware_index] = new_priority; | 739 | ware_priorities_[ware_index] = new_priority; |
995 | 740 | } | 740 | } |
996 | 741 | } | 741 | } |
997 | 742 | 742 | ||
998 | @@ -744,21 +744,21 @@ | |||
999 | 744 | void Building::log_general_info(const EditorGameBase & egbase) { | 744 | void Building::log_general_info(const EditorGameBase & egbase) { |
1000 | 745 | PlayerImmovable::log_general_info(egbase); | 745 | PlayerImmovable::log_general_info(egbase); |
1001 | 746 | 746 | ||
1004 | 747 | molog("m_position: (%i, %i)\n", m_position.x, m_position.y); | 747 | molog("position: (%i, %i)\n", position_.x, position_.y); |
1005 | 748 | molog("m_flag: %p\n", m_flag); | 748 | molog("flag: %p\n", flag_); |
1006 | 749 | molog | 749 | molog |
1007 | 750 | ("* position: (%i, %i)\n", | 750 | ("* position: (%i, %i)\n", |
1014 | 751 | m_flag->get_position().x, m_flag->get_position().y); | 751 | flag_->get_position().x, flag_->get_position().y); |
1015 | 752 | 752 | ||
1016 | 753 | molog("m_anim: %s\n", descr().get_animation_name(m_anim).c_str()); | 753 | molog("anim: %s\n", descr().get_animation_name(anim_).c_str()); |
1017 | 754 | molog("m_animstart: %i\n", m_animstart); | 754 | molog("animstart: %i\n", animstart_); |
1018 | 755 | 755 | ||
1019 | 756 | molog("m_leave_time: %i\n", m_leave_time); | 756 | molog("leave_time: %i\n", leave_time_); |
1020 | 757 | 757 | ||
1021 | 758 | molog | 758 | molog |
1025 | 759 | ("m_leave_queue.size(): %lu\n", | 759 | ("leave_queue.size(): %lu\n", |
1026 | 760 | static_cast<long unsigned int>(m_leave_queue.size())); | 760 | static_cast<long unsigned int>(leave_queue_.size())); |
1027 | 761 | molog("m_leave_allow.get(): %p\n", m_leave_allow.get(egbase)); | 761 | molog("leave_allow.get(): %p\n", leave_allow_.get(egbase)); |
1028 | 762 | } | 762 | } |
1029 | 763 | 763 | ||
1030 | 764 | 764 | ||
1031 | @@ -788,7 +788,7 @@ | |||
1032 | 788 | */ | 788 | */ |
1033 | 789 | void Building::set_seeing(bool see) | 789 | void Building::set_seeing(bool see) |
1034 | 790 | { | 790 | { |
1036 | 791 | if (see == m_seeing) | 791 | if (see == seeing_) |
1037 | 792 | return; | 792 | return; |
1038 | 793 | 793 | ||
1039 | 794 | Player & player = owner(); | 794 | Player & player = owner(); |
1040 | @@ -801,7 +801,7 @@ | |||
1041 | 801 | player.unsee_area | 801 | player.unsee_area |
1042 | 802 | (Area<FCoords>(map.get_fcoords(get_position()), descr().vision_range())); | 802 | (Area<FCoords>(map.get_fcoords(get_position()), descr().vision_range())); |
1043 | 803 | 803 | ||
1045 | 804 | m_seeing = see; | 804 | seeing_ = see; |
1046 | 805 | } | 805 | } |
1047 | 806 | 806 | ||
1048 | 807 | /** | 807 | /** |
1049 | 808 | 808 | ||
1050 | === modified file 'src/logic/map_objects/tribes/building.h' | |||
1051 | --- src/logic/map_objects/tribes/building.h 2016-02-02 12:47:45 +0000 | |||
1052 | +++ src/logic/map_objects/tribes/building.h 2016-02-08 18:17:36 +0000 | |||
1053 | @@ -66,43 +66,43 @@ | |||
1054 | 66 | const LuaTable& t, const EditorGameBase& egbase); | 66 | const LuaTable& t, const EditorGameBase& egbase); |
1055 | 67 | ~BuildingDescr() override {} | 67 | ~BuildingDescr() override {} |
1056 | 68 | 68 | ||
1060 | 69 | bool is_buildable () const {return m_buildable;} | 69 | bool is_buildable () const {return buildable_;} |
1061 | 70 | bool is_destructible() const {return m_destructible;} | 70 | bool is_destructible() const {return destructible_;} |
1062 | 71 | bool is_enhanced () const {return m_enhanced_building;} | 71 | bool is_enhanced () const {return enhanced_building_;} |
1063 | 72 | 72 | ||
1064 | 73 | /** | 73 | /** |
1065 | 74 | * The build cost for direct construction | 74 | * The build cost for direct construction |
1066 | 75 | */ | 75 | */ |
1068 | 76 | const Buildcost & buildcost() const {return m_buildcost;} | 76 | const Buildcost & buildcost() const {return buildcost_;} |
1069 | 77 | 77 | ||
1070 | 78 | /** | 78 | /** |
1071 | 79 | * Returned wares for dismantling | 79 | * Returned wares for dismantling |
1072 | 80 | */ | 80 | */ |
1074 | 81 | const Buildcost & returned_wares() const {return m_return_dismantle;} | 81 | const Buildcost & returned_wares() const {return return_dismantle_;} |
1075 | 82 | 82 | ||
1076 | 83 | /** | 83 | /** |
1077 | 84 | * The build cost for enhancing a previous building | 84 | * The build cost for enhancing a previous building |
1078 | 85 | */ | 85 | */ |
1080 | 86 | const Buildcost & enhancement_cost() const {return m_enhance_cost;} | 86 | const Buildcost & enhancement_cost() const {return enhance_cost_;} |
1081 | 87 | 87 | ||
1082 | 88 | /** | 88 | /** |
1083 | 89 | * The returned wares for a enhaced building | 89 | * The returned wares for a enhaced building |
1084 | 90 | */ | 90 | */ |
1086 | 91 | const Buildcost & returned_wares_enhanced() const {return m_return_enhanced;} | 91 | const Buildcost & returned_wares_enhanced() const {return return_enhanced_;} |
1087 | 92 | 92 | ||
1088 | 93 | std::string helptext_script() const {return helptext_script_;} | 93 | std::string helptext_script() const {return helptext_script_;} |
1093 | 94 | int32_t get_size() const {return m_size;} | 94 | int32_t get_size() const {return size_;} |
1094 | 95 | bool get_ismine() const {return m_mine;} | 95 | bool get_ismine() const {return mine_;} |
1095 | 96 | bool get_isport() const {return m_port;} | 96 | bool get_isport() const {return port_;} |
1096 | 97 | bool needs_seafaring() const {return m_needs_seafaring;} | 97 | bool needs_seafaring() const {return needs_seafaring_;} |
1097 | 98 | 98 | ||
1098 | 99 | // Returns the enhancement this building can become or | 99 | // Returns the enhancement this building can become or |
1099 | 100 | // INVALID_INDEX if it cannot be enhanced. | 100 | // INVALID_INDEX if it cannot be enhanced. |
1101 | 101 | const DescriptionIndex & enhancement() const {return m_enhancement;} | 101 | const DescriptionIndex & enhancement() const {return enhancement_;} |
1102 | 102 | // Returns the building from which this building can be enhanced or | 102 | // Returns the building from which this building can be enhanced or |
1103 | 103 | // INVALID_INDEX if it cannot be built as an enhanced building. | 103 | // INVALID_INDEX if it cannot be built as an enhanced building. |
1106 | 104 | const DescriptionIndex& enhanced_from() const {return m_enhanced_from;} | 104 | const DescriptionIndex& enhanced_from() const {return enhanced_from_;} |
1107 | 105 | void set_enhanced_from(const DescriptionIndex& index) {m_enhanced_from = index;} | 105 | void set_enhanced_from(const DescriptionIndex& index) {enhanced_from_ = index;} |
1108 | 106 | 106 | ||
1109 | 107 | /// Create a building of this type in the game. Calls init, which does | 107 | /// Create a building of this type in the game. Calls init, which does |
1110 | 108 | /// different things for different types of buildings (such as conquering | 108 | /// different things for different types of buildings (such as conquering |
1111 | @@ -123,10 +123,10 @@ | |||
1112 | 123 | virtual uint32_t get_conquers() const; | 123 | virtual uint32_t get_conquers() const; |
1113 | 124 | virtual uint32_t vision_range() const; | 124 | virtual uint32_t vision_range() const; |
1114 | 125 | 125 | ||
1116 | 126 | WorkareaInfo m_workarea_info; | 126 | WorkareaInfo workarea_info_; |
1117 | 127 | 127 | ||
1118 | 128 | virtual int32_t suitability(const Map &, FCoords) const; | 128 | virtual int32_t suitability(const Map &, FCoords) const; |
1120 | 129 | const BuildingHints & hints() const {return m_hints;} | 129 | const BuildingHints & hints() const {return hints_;} |
1121 | 130 | 130 | ||
1122 | 131 | protected: | 131 | protected: |
1123 | 132 | virtual Building & create_object() const = 0; | 132 | virtual Building & create_object() const = 0; |
1124 | @@ -134,24 +134,24 @@ | |||
1125 | 134 | 134 | ||
1126 | 135 | private: | 135 | private: |
1127 | 136 | const EditorGameBase& egbase_; | 136 | const EditorGameBase& egbase_; |
1134 | 137 | bool m_buildable; // the player can build this himself | 137 | bool buildable_; // the player can build this himself |
1135 | 138 | bool m_destructible; // the player can destruct this himself | 138 | bool destructible_; // the player can destruct this himself |
1136 | 139 | Buildcost m_buildcost; | 139 | Buildcost buildcost_; |
1137 | 140 | Buildcost m_return_dismantle; // Returned wares on dismantle | 140 | Buildcost return_dismantle_; // Returned wares on dismantle |
1138 | 141 | Buildcost m_enhance_cost; // cost for enhancing | 141 | Buildcost enhance_cost_; // cost for enhancing |
1139 | 142 | Buildcost m_return_enhanced; // Returned ware for dismantling an enhanced building | 142 | Buildcost return_enhanced_; // Returned ware for dismantling an enhanced building |
1140 | 143 | std::string helptext_script_; // The path and filename to the building's helptext script | 143 | std::string helptext_script_; // The path and filename to the building's helptext script |
1149 | 144 | int32_t m_size; // size of the building | 144 | int32_t size_; // size of the building |
1150 | 145 | bool m_mine; | 145 | bool mine_; |
1151 | 146 | bool m_port; | 146 | bool port_; |
1152 | 147 | bool m_needs_seafaring; // This building should only be built on seafaring maps. | 147 | bool needs_seafaring_; // This building should only be built on seafaring maps. |
1153 | 148 | DescriptionIndex m_enhancement; | 148 | DescriptionIndex enhancement_; |
1154 | 149 | DescriptionIndex m_enhanced_from; // The building this building was enhanced from, or INVALID_INDEX | 149 | DescriptionIndex enhanced_from_; // The building this building was enhanced from, or INVALID_INDEX |
1155 | 150 | bool m_enhanced_building; // if it is one, it is bulldozable | 150 | bool enhanced_building_; // if it is one, it is bulldozable |
1156 | 151 | BuildingHints m_hints; // hints (knowledge) for computer players | 151 | BuildingHints hints_; // hints (knowledge) for computer players |
1157 | 152 | 152 | ||
1158 | 153 | // for migration, 0 is the default, meaning get_conquers() + 4 | 153 | // for migration, 0 is the default, meaning get_conquers() + 4 |
1160 | 154 | uint32_t m_vision_range; | 154 | uint32_t vision_range_; |
1161 | 155 | DISALLOW_COPY_AND_ASSIGN(BuildingDescr); | 155 | DISALLOW_COPY_AND_ASSIGN(BuildingDescr); |
1162 | 156 | }; | 156 | }; |
1163 | 157 | 157 | ||
1164 | @@ -190,7 +190,7 @@ | |||
1165 | 190 | Flag & base_flag() override; | 190 | Flag & base_flag() override; |
1166 | 191 | virtual uint32_t get_playercaps() const; | 191 | virtual uint32_t get_playercaps() const; |
1167 | 192 | 192 | ||
1169 | 193 | virtual Coords get_position() const {return m_position;} | 193 | virtual Coords get_position() const {return position_;} |
1170 | 194 | PositionList get_positions (const EditorGameBase &) const override; | 194 | PositionList get_positions (const EditorGameBase &) const override; |
1171 | 195 | 195 | ||
1172 | 196 | std::string info_string(const InfoStringFormat& format); | 196 | std::string info_string(const InfoStringFormat& format); |
1173 | @@ -198,8 +198,8 @@ | |||
1174 | 198 | // Return the overlay string that is displayed on the map view when enabled | 198 | // Return the overlay string that is displayed on the map view when enabled |
1175 | 199 | // by the player. | 199 | // by the player. |
1176 | 200 | const std::string& update_and_get_statistics_string() { | 200 | const std::string& update_and_get_statistics_string() { |
1179 | 201 | update_statistics_string(&m_statistics_string); | 201 | update_statistics_string(&statistics_string_); |
1180 | 202 | return m_statistics_string; | 202 | return statistics_string_; |
1181 | 203 | } | 203 | } |
1182 | 204 | 204 | ||
1183 | 205 | /// \returns the queue for a ware type or \throws WException. | 205 | /// \returns the queue for a ware type or \throws WException. |
1184 | @@ -238,7 +238,7 @@ | |||
1185 | 238 | * be the one being dismantled. | 238 | * be the one being dismantled. |
1186 | 239 | */ | 239 | */ |
1187 | 240 | const FormerBuildings get_former_buildings() { | 240 | const FormerBuildings get_former_buildings() { |
1189 | 241 | return m_old_buildings; | 241 | return old_buildings_; |
1190 | 242 | } | 242 | } |
1191 | 243 | 243 | ||
1192 | 244 | void log_general_info(const EditorGameBase &) override; | 244 | void log_general_info(const EditorGameBase &) override; |
1193 | @@ -249,7 +249,7 @@ | |||
1194 | 249 | 249 | ||
1195 | 250 | /// Stores the PlayerNumber of the player who has defeated this building. | 250 | /// Stores the PlayerNumber of the player who has defeated this building. |
1196 | 251 | void set_defeating_player(PlayerNumber const player_number) { | 251 | void set_defeating_player(PlayerNumber const player_number) { |
1198 | 252 | m_defeating_player = player_number; | 252 | defeating_player_ = player_number; |
1199 | 253 | } | 253 | } |
1200 | 254 | 254 | ||
1201 | 255 | void add_worker(Worker &) override; | 255 | void add_worker(Worker &) override; |
1202 | @@ -287,35 +287,35 @@ | |||
1203 | 287 | 287 | ||
1204 | 288 | void set_seeing(bool see); | 288 | void set_seeing(bool see); |
1205 | 289 | 289 | ||
1209 | 290 | UI::Window * m_optionswindow; | 290 | UI::Window * optionswindow_; |
1210 | 291 | Coords m_position; | 291 | Coords position_; |
1211 | 292 | Flag * m_flag; | 292 | Flag * flag_; |
1212 | 293 | 293 | ||
1215 | 294 | uint32_t m_anim; | 294 | uint32_t anim_; |
1216 | 295 | int32_t m_animstart; | 295 | int32_t animstart_; |
1217 | 296 | 296 | ||
1218 | 297 | using LeaveQueue = std::vector<OPtr<Worker>>; | 297 | using LeaveQueue = std::vector<OPtr<Worker>>; |
1222 | 298 | LeaveQueue m_leave_queue; // FIFO queue of workers leaving the building | 298 | LeaveQueue leave_queue_; // FIFO queue of workers leaving the building |
1223 | 299 | uint32_t m_leave_time; // when to wake the next one from leave queue | 299 | uint32_t leave_time_; // when to wake the next one from leave queue |
1224 | 300 | ObjectPointer m_leave_allow; // worker that is allowed to leave now | 300 | ObjectPointer leave_allow_; // worker that is allowed to leave now |
1225 | 301 | 301 | ||
1226 | 302 | // The player who has defeated this building. | 302 | // The player who has defeated this building. |
1228 | 303 | PlayerNumber m_defeating_player; | 303 | PlayerNumber defeating_player_; |
1229 | 304 | 304 | ||
1232 | 305 | int32_t m_priority; // base priority | 305 | int32_t priority_; // base priority |
1233 | 306 | std::map<DescriptionIndex, int32_t> m_ware_priorities; | 306 | std::map<DescriptionIndex, int32_t> ware_priorities_; |
1234 | 307 | 307 | ||
1235 | 308 | /// Whether we see our vision_range area based on workers in the building | 308 | /// Whether we see our vision_range area based on workers in the building |
1237 | 309 | bool m_seeing; | 309 | bool seeing_; |
1238 | 310 | 310 | ||
1239 | 311 | // Signals connected for the option window | 311 | // Signals connected for the option window |
1240 | 312 | std::vector<boost::signals2::connection> options_window_connections; | 312 | std::vector<boost::signals2::connection> options_window_connections; |
1241 | 313 | 313 | ||
1242 | 314 | // The former buildings names, with the current one in last position. | 314 | // The former buildings names, with the current one in last position. |
1244 | 315 | FormerBuildings m_old_buildings; | 315 | FormerBuildings old_buildings_; |
1245 | 316 | 316 | ||
1246 | 317 | private: | 317 | private: |
1248 | 318 | std::string m_statistics_string; | 318 | std::string statistics_string_; |
1249 | 319 | }; | 319 | }; |
1250 | 320 | 320 | ||
1251 | 321 | } | 321 | } |
1252 | 322 | 322 | ||
1253 | === modified file 'src/logic/map_objects/tribes/carrier.cc' | |||
1254 | --- src/logic/map_objects/tribes/carrier.cc 2015-11-28 22:29:26 +0000 | |||
1255 | +++ src/logic/map_objects/tribes/carrier.cc 2016-02-08 18:17:36 +0000 | |||
1256 | @@ -53,7 +53,7 @@ | |||
1257 | 53 | 53 | ||
1258 | 54 | top_state().ivar1 = 0; | 54 | top_state().ivar1 = 0; |
1259 | 55 | 55 | ||
1261 | 56 | m_promised_pickup_to = NOONE; | 56 | promised_pickup_to_ = NOONE; |
1262 | 57 | } | 57 | } |
1263 | 58 | 58 | ||
1264 | 59 | 59 | ||
1265 | @@ -85,13 +85,13 @@ | |||
1266 | 85 | } | 85 | } |
1267 | 86 | 86 | ||
1268 | 87 | // Check for pending wares | 87 | // Check for pending wares |
1270 | 88 | if (m_promised_pickup_to == NOONE) | 88 | if (promised_pickup_to_ == NOONE) |
1271 | 89 | find_pending_ware(game); | 89 | find_pending_ware(game); |
1272 | 90 | 90 | ||
1274 | 91 | if (m_promised_pickup_to != NOONE) { | 91 | if (promised_pickup_to_ != NOONE) { |
1275 | 92 | if (state.ivar1) { | 92 | if (state.ivar1) { |
1276 | 93 | state.ivar1 = 0; | 93 | state.ivar1 = 0; |
1278 | 94 | return start_task_transport(game, m_promised_pickup_to); | 94 | return start_task_transport(game, promised_pickup_to_); |
1279 | 95 | } else { | 95 | } else { |
1280 | 96 | // Short delay before we move to pick up | 96 | // Short delay before we move to pick up |
1281 | 97 | state.ivar1 = 1; | 97 | state.ivar1 = 1; |
1282 | @@ -126,10 +126,10 @@ | |||
1283 | 126 | */ | 126 | */ |
1284 | 127 | void Carrier::road_pop(Game & game, State & /* state */) | 127 | void Carrier::road_pop(Game & game, State & /* state */) |
1285 | 128 | { | 128 | { |
1287 | 129 | if (m_promised_pickup_to != NOONE && get_location(game)) { | 129 | if (promised_pickup_to_ != NOONE && get_location(game)) { |
1288 | 130 | Road & road = dynamic_cast<Road&>(*get_location(game)); | 130 | Road & road = dynamic_cast<Road&>(*get_location(game)); |
1291 | 131 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to)); | 131 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(promised_pickup_to_)); |
1292 | 132 | Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to ^ 1)); | 132 | Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(promised_pickup_to_ ^ 1)); |
1293 | 133 | 133 | ||
1294 | 134 | flag.cancel_pickup(game, otherflag); | 134 | flag.cancel_pickup(game, otherflag); |
1295 | 135 | } | 135 | } |
1296 | @@ -274,7 +274,7 @@ | |||
1297 | 274 | int32_t const ivar1 = state.ivar1; | 274 | int32_t const ivar1 = state.ivar1; |
1298 | 275 | if (!start_task_walktoflag(game, ivar1)) { | 275 | if (!start_task_walktoflag(game, ivar1)) { |
1299 | 276 | 276 | ||
1301 | 277 | m_promised_pickup_to = NOONE; | 277 | promised_pickup_to_ = NOONE; |
1302 | 278 | 278 | ||
1303 | 279 | Road & road = dynamic_cast<Road&>(*get_location(game)); | 279 | Road & road = dynamic_cast<Road&>(*get_location(game)); |
1304 | 280 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(ivar1)); | 280 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(ivar1)); |
1305 | @@ -307,7 +307,7 @@ | |||
1306 | 307 | Road & road = dynamic_cast<Road&>(*get_location(game)); | 307 | Road & road = dynamic_cast<Road&>(*get_location(game)); |
1307 | 308 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1)); | 308 | Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1)); |
1308 | 309 | 309 | ||
1310 | 310 | if (m_promised_pickup_to == (state.ivar1 ^ 1)) { | 310 | if (promised_pickup_to_ == (state.ivar1 ^ 1)) { |
1311 | 311 | // If there's an ware we acked, we can drop ours even if the flag is | 311 | // If there's an ware we acked, we can drop ours even if the flag is |
1312 | 312 | // flooded | 312 | // flooded |
1313 | 313 | other = | 313 | other = |
1314 | @@ -319,13 +319,13 @@ | |||
1315 | 319 | ("[Carrier]: strange: acked ware from busy flag no longer " | 319 | ("[Carrier]: strange: acked ware from busy flag no longer " |
1316 | 320 | "present.\n"); | 320 | "present.\n"); |
1317 | 321 | 321 | ||
1319 | 322 | m_promised_pickup_to = NOONE; | 322 | promised_pickup_to_ = NOONE; |
1320 | 323 | set_animation(game, descr().get_animation("idle")); | 323 | set_animation(game, descr().get_animation("idle")); |
1321 | 324 | return schedule_act(game, 20); | 324 | return schedule_act(game, 20); |
1322 | 325 | } | 325 | } |
1323 | 326 | 326 | ||
1326 | 327 | state.ivar1 = m_promised_pickup_to; | 327 | state.ivar1 = promised_pickup_to_; |
1327 | 328 | m_promised_pickup_to = NOONE; | 328 | promised_pickup_to_ = NOONE; |
1328 | 329 | } | 329 | } |
1329 | 330 | 330 | ||
1330 | 331 | // Drop our ware | 331 | // Drop our ware |
1331 | @@ -382,7 +382,7 @@ | |||
1332 | 382 | Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(state.ivar1)); | 382 | Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(state.ivar1)); |
1333 | 383 | 383 | ||
1334 | 384 | 384 | ||
1336 | 385 | if (m_promised_pickup_to == (state.ivar1 ^ 1)) { | 385 | if (promised_pickup_to_ == (state.ivar1 ^ 1)) { |
1337 | 386 | // All is well, we already acked an ware that we can pick up | 386 | // All is well, we already acked an ware that we can pick up |
1338 | 387 | // from this flag | 387 | // from this flag |
1339 | 388 | return false; | 388 | return false; |
1340 | @@ -392,7 +392,7 @@ | |||
1341 | 392 | ("MO(%u): transport: overload exchange: flag %u is fucked up", | 392 | ("MO(%u): transport: overload exchange: flag %u is fucked up", |
1342 | 393 | serial(), flag.serial()); | 393 | serial(), flag.serial()); |
1343 | 394 | 394 | ||
1345 | 395 | m_promised_pickup_to = state.ivar1 ^ 1; | 395 | promised_pickup_to_ = state.ivar1 ^ 1; |
1346 | 396 | return false; | 396 | return false; |
1347 | 397 | } else if (!start_task_walktoflag(game, state.ivar1 ^ 1, true)) | 397 | } else if (!start_task_walktoflag(game, state.ivar1 ^ 1, true)) |
1348 | 398 | start_task_waitforcapacity(game, flag); // wait one node away | 398 | start_task_waitforcapacity(game, flag); // wait one node away |
1349 | @@ -411,7 +411,7 @@ | |||
1350 | 411 | State & state = top_state(); | 411 | State & state = top_state(); |
1351 | 412 | 412 | ||
1352 | 413 | // Check if we've already acked something | 413 | // Check if we've already acked something |
1354 | 414 | if (m_promised_pickup_to != NOONE) | 414 | if (promised_pickup_to_ != NOONE) |
1355 | 415 | return false; | 415 | return false; |
1356 | 416 | 416 | ||
1357 | 417 | // If we are currently in a transport. | 417 | // If we are currently in a transport. |
1358 | @@ -438,7 +438,7 @@ | |||
1359 | 438 | return false; | 438 | return false; |
1360 | 439 | 439 | ||
1361 | 440 | // Ack it if we haven't | 440 | // Ack it if we haven't |
1363 | 441 | m_promised_pickup_to = flag; | 441 | promised_pickup_to_ = flag; |
1364 | 442 | 442 | ||
1365 | 443 | if (state.task == &taskRoad) | 443 | if (state.task == &taskRoad) |
1366 | 444 | send_signal(game, "ware"); | 444 | send_signal(game, "ware"); |
1367 | @@ -450,7 +450,7 @@ | |||
1368 | 450 | 450 | ||
1369 | 451 | 451 | ||
1370 | 452 | /** | 452 | /** |
1372 | 453 | * Find a pending ware on one of the road's flags, ack it and set m_promised_pickup_to | 453 | * Find a pending ware on one of the road's flags, ack it and set promised_pickup_to_ |
1373 | 454 | * accordingly. | 454 | * accordingly. |
1374 | 455 | */ | 455 | */ |
1375 | 456 | void Carrier::find_pending_ware(Game & game) | 456 | void Carrier::find_pending_ware(Game & game) |
1376 | @@ -458,7 +458,7 @@ | |||
1377 | 458 | Road & road = dynamic_cast<Road&>(*get_location(game)); | 458 | Road & road = dynamic_cast<Road&>(*get_location(game)); |
1378 | 459 | uint32_t havewarebits = 0; | 459 | uint32_t havewarebits = 0; |
1379 | 460 | 460 | ||
1381 | 461 | assert(m_promised_pickup_to == NOONE); | 461 | assert(promised_pickup_to_ == NOONE); |
1382 | 462 | 462 | ||
1383 | 463 | if (road.get_flag(Road::FlagStart).has_pending_ware | 463 | if (road.get_flag(Road::FlagStart).has_pending_ware |
1384 | 464 | (game, road.get_flag(Road::FlagEnd))) { | 464 | (game, road.get_flag(Road::FlagEnd))) { |
1385 | @@ -477,7 +477,7 @@ | |||
1386 | 477 | 477 | ||
1387 | 478 | // Ack our decision | 478 | // Ack our decision |
1388 | 479 | if (havewarebits == 1) { | 479 | if (havewarebits == 1) { |
1390 | 480 | m_promised_pickup_to = START_FLAG; | 480 | promised_pickup_to_ = START_FLAG; |
1391 | 481 | if | 481 | if |
1392 | 482 | (! | 482 | (! |
1393 | 483 | road.get_flag(Road::FlagStart).ack_pickup | 483 | road.get_flag(Road::FlagStart).ack_pickup |
1394 | @@ -486,7 +486,7 @@ | |||
1395 | 486 | ("Carrier::find_pending_ware: start flag is messed up"); | 486 | ("Carrier::find_pending_ware: start flag is messed up"); |
1396 | 487 | 487 | ||
1397 | 488 | } else if (havewarebits == 2) { | 488 | } else if (havewarebits == 2) { |
1399 | 489 | m_promised_pickup_to = END_FLAG; | 489 | promised_pickup_to_ = END_FLAG; |
1400 | 490 | if | 490 | if |
1401 | 491 | (! | 491 | (! |
1402 | 492 | road.get_flag(Road::FlagEnd).ack_pickup | 492 | road.get_flag(Road::FlagEnd).ack_pickup |
1403 | @@ -575,7 +575,7 @@ | |||
1404 | 575 | 575 | ||
1405 | 576 | Worker::log_general_info(egbase); | 576 | Worker::log_general_info(egbase); |
1406 | 577 | 577 | ||
1408 | 578 | molog("m_promised_pickup_to = %i\n", m_promised_pickup_to); | 578 | molog("promised_pickup_to = %i\n", promised_pickup_to_); |
1409 | 579 | } | 579 | } |
1410 | 580 | 580 | ||
1411 | 581 | /* | 581 | /* |
1412 | @@ -601,7 +601,7 @@ | |||
1413 | 601 | uint8_t packet_version = fr.unsigned_8(); | 601 | uint8_t packet_version = fr.unsigned_8(); |
1414 | 602 | if (packet_version == kCurrentPacketVersion) { | 602 | if (packet_version == kCurrentPacketVersion) { |
1415 | 603 | Carrier & carrier = get<Carrier>(); | 603 | Carrier & carrier = get<Carrier>(); |
1417 | 604 | carrier.m_promised_pickup_to = fr.signed_32(); | 604 | carrier.promised_pickup_to_ = fr.signed_32(); |
1418 | 605 | } else { | 605 | } else { |
1419 | 606 | throw UnhandledVersionError("Carrier", packet_version, kCurrentPacketVersion); | 606 | throw UnhandledVersionError("Carrier", packet_version, kCurrentPacketVersion); |
1420 | 607 | } | 607 | } |
1421 | @@ -628,7 +628,7 @@ | |||
1422 | 628 | Worker::do_save(egbase, mos, fw); | 628 | Worker::do_save(egbase, mos, fw); |
1423 | 629 | 629 | ||
1424 | 630 | fw.unsigned_8(kCurrentPacketVersion); | 630 | fw.unsigned_8(kCurrentPacketVersion); |
1426 | 631 | fw.signed_32(m_promised_pickup_to); | 631 | fw.signed_32(promised_pickup_to_); |
1427 | 632 | } | 632 | } |
1428 | 633 | 633 | ||
1429 | 634 | /** | 634 | /** |
1430 | 635 | 635 | ||
1431 | === modified file 'src/logic/map_objects/tribes/carrier.h' | |||
1432 | --- src/logic/map_objects/tribes/carrier.h 2016-01-31 15:31:00 +0000 | |||
1433 | +++ src/logic/map_objects/tribes/carrier.h 2016-02-08 18:17:36 +0000 | |||
1434 | @@ -48,7 +48,7 @@ | |||
1435 | 48 | MO_DESCR(CarrierDescr) | 48 | MO_DESCR(CarrierDescr) |
1436 | 49 | 49 | ||
1437 | 50 | Carrier(const CarrierDescr & carrier_descr) | 50 | Carrier(const CarrierDescr & carrier_descr) |
1439 | 51 | : Worker(carrier_descr), m_promised_pickup_to(NOONE) | 51 | : Worker(carrier_descr), promised_pickup_to_(NOONE) |
1440 | 52 | {} | 52 | {} |
1441 | 53 | virtual ~Carrier() {} | 53 | virtual ~Carrier() {} |
1442 | 54 | 54 | ||
1443 | @@ -86,7 +86,7 @@ | |||
1444 | 86 | static const int32_t NOONE = -1; | 86 | static const int32_t NOONE = -1; |
1445 | 87 | static const int32_t START_FLAG = 0; | 87 | static const int32_t START_FLAG = 0; |
1446 | 88 | static const int32_t END_FLAG = 1; | 88 | static const int32_t END_FLAG = 1; |
1448 | 89 | int32_t m_promised_pickup_to; | 89 | int32_t promised_pickup_to_; |
1449 | 90 | 90 | ||
1450 | 91 | // saving and loading | 91 | // saving and loading |
1451 | 92 | protected: | 92 | protected: |
1452 | 93 | 93 | ||
1453 | === modified file 'src/logic/map_objects/tribes/constructionsite.cc' | |||
1454 | --- src/logic/map_objects/tribes/constructionsite.cc 2016-01-17 19:54:32 +0000 | |||
1455 | +++ src/logic/map_objects/tribes/constructionsite.cc 2016-02-08 18:17:36 +0000 | |||
1456 | @@ -65,8 +65,8 @@ | |||
1457 | 65 | 65 | ||
1458 | 66 | ConstructionSite::ConstructionSite(const ConstructionSiteDescr & cs_descr) : | 66 | ConstructionSite::ConstructionSite(const ConstructionSiteDescr & cs_descr) : |
1459 | 67 | PartiallyFinishedBuilding (cs_descr), | 67 | PartiallyFinishedBuilding (cs_descr), |
1462 | 68 | m_fetchfromflag (0), | 68 | fetchfromflag_ (0), |
1463 | 69 | m_builder_idle (false) | 69 | builder_idle_ (false) |
1464 | 70 | {} | 70 | {} |
1465 | 71 | 71 | ||
1466 | 72 | 72 | ||
1467 | @@ -83,14 +83,14 @@ | |||
1468 | 83 | ======= | 83 | ======= |
1469 | 84 | */ | 84 | */ |
1470 | 85 | WaresQueue & ConstructionSite::waresqueue(DescriptionIndex const wi) { | 85 | WaresQueue & ConstructionSite::waresqueue(DescriptionIndex const wi) { |
1472 | 86 | for (WaresQueue * ware : m_wares) { | 86 | for (WaresQueue * ware : wares_) { |
1473 | 87 | if (ware->get_ware() == wi) { | 87 | if (ware->get_ware() == wi) { |
1474 | 88 | return *ware; | 88 | return *ware; |
1475 | 89 | } | 89 | } |
1476 | 90 | } | 90 | } |
1477 | 91 | throw wexception | 91 | throw wexception |
1478 | 92 | ("%s (%u) (building %s) has no WaresQueue for %u", | 92 | ("%s (%u) (building %s) has no WaresQueue for %u", |
1480 | 93 | descr().name().c_str(), serial(), m_building->name().c_str(), wi); | 93 | descr().name().c_str(), serial(), building_->name().c_str(), wi); |
1481 | 94 | } | 94 | } |
1482 | 95 | 95 | ||
1483 | 96 | 96 | ||
1484 | @@ -102,7 +102,7 @@ | |||
1485 | 102 | void ConstructionSite::set_building(const BuildingDescr & building_descr) { | 102 | void ConstructionSite::set_building(const BuildingDescr & building_descr) { |
1486 | 103 | PartiallyFinishedBuilding::set_building(building_descr); | 103 | PartiallyFinishedBuilding::set_building(building_descr); |
1487 | 104 | 104 | ||
1489 | 105 | m_info.becomes = &building_descr; | 105 | info_.becomes = &building_descr; |
1490 | 106 | } | 106 | } |
1491 | 107 | 107 | ||
1492 | 108 | /* | 108 | /* |
1493 | @@ -115,31 +115,31 @@ | |||
1494 | 115 | PartiallyFinishedBuilding::init(egbase); | 115 | PartiallyFinishedBuilding::init(egbase); |
1495 | 116 | 116 | ||
1496 | 117 | const std::map<DescriptionIndex, uint8_t> * buildcost; | 117 | const std::map<DescriptionIndex, uint8_t> * buildcost; |
1498 | 118 | if (!m_old_buildings.empty()) { | 118 | if (!old_buildings_.empty()) { |
1499 | 119 | // Enhancement | 119 | // Enhancement |
1501 | 120 | DescriptionIndex was_index = m_old_buildings.back(); | 120 | DescriptionIndex was_index = old_buildings_.back(); |
1502 | 121 | const BuildingDescr* was_descr = owner().tribe().get_building_descr(was_index); | 121 | const BuildingDescr* was_descr = owner().tribe().get_building_descr(was_index); |
1505 | 122 | m_info.was = was_descr; | 122 | info_.was = was_descr; |
1506 | 123 | buildcost = &m_building->enhancement_cost(); | 123 | buildcost = &building_->enhancement_cost(); |
1507 | 124 | } else { | 124 | } else { |
1509 | 125 | buildcost = &m_building->buildcost(); | 125 | buildcost = &building_->buildcost(); |
1510 | 126 | } | 126 | } |
1511 | 127 | 127 | ||
1512 | 128 | // TODO(unknown): figure out whether planing is necessary | 128 | // TODO(unknown): figure out whether planing is necessary |
1513 | 129 | 129 | ||
1514 | 130 | // initialize the wares queues | 130 | // initialize the wares queues |
1515 | 131 | size_t const buildcost_size = buildcost->size(); | 131 | size_t const buildcost_size = buildcost->size(); |
1517 | 132 | m_wares.resize(buildcost_size); | 132 | wares_.resize(buildcost_size); |
1518 | 133 | std::map<DescriptionIndex, uint8_t>::const_iterator it = buildcost->begin(); | 133 | std::map<DescriptionIndex, uint8_t>::const_iterator it = buildcost->begin(); |
1519 | 134 | 134 | ||
1520 | 135 | for (size_t i = 0; i < buildcost_size; ++i, ++it) { | 135 | for (size_t i = 0; i < buildcost_size; ++i, ++it) { |
1521 | 136 | WaresQueue & wq = | 136 | WaresQueue & wq = |
1523 | 137 | *(m_wares[i] = new WaresQueue(*this, it->first, it->second)); | 137 | *(wares_[i] = new WaresQueue(*this, it->first, it->second)); |
1524 | 138 | 138 | ||
1525 | 139 | wq.set_callback(ConstructionSite::wares_queue_callback, this); | 139 | wq.set_callback(ConstructionSite::wares_queue_callback, this); |
1526 | 140 | wq.set_consume_interval(CONSTRUCTIONSITE_STEP_TIME); | 140 | wq.set_consume_interval(CONSTRUCTIONSITE_STEP_TIME); |
1527 | 141 | 141 | ||
1529 | 142 | m_work_steps += it->second; | 142 | work_steps_ += it->second; |
1530 | 143 | } | 143 | } |
1531 | 144 | } | 144 | } |
1532 | 145 | 145 | ||
1533 | @@ -154,19 +154,19 @@ | |||
1534 | 154 | { | 154 | { |
1535 | 155 | PartiallyFinishedBuilding::cleanup(egbase); | 155 | PartiallyFinishedBuilding::cleanup(egbase); |
1536 | 156 | 156 | ||
1538 | 157 | if (m_work_steps <= m_work_completed) { | 157 | if (work_steps_ <= work_completed_) { |
1539 | 158 | // Put the real building in place | 158 | // Put the real building in place |
1542 | 159 | DescriptionIndex becomes_idx = owner().tribe().building_index(m_building->name()); | 159 | DescriptionIndex becomes_idx = owner().tribe().building_index(building_->name()); |
1543 | 160 | m_old_buildings.push_back(becomes_idx); | 160 | old_buildings_.push_back(becomes_idx); |
1544 | 161 | Building & b = | 161 | Building & b = |
1547 | 162 | m_building->create(egbase, owner(), m_position, false, false, m_old_buildings); | 162 | building_->create(egbase, owner(), position_, false, false, old_buildings_); |
1548 | 163 | if (Worker * const builder = m_builder.get(egbase)) { | 163 | if (Worker * const builder = builder_.get(egbase)) { |
1549 | 164 | builder->reset_tasks(dynamic_cast<Game&>(egbase)); | 164 | builder->reset_tasks(dynamic_cast<Game&>(egbase)); |
1550 | 165 | builder->set_location(&b); | 165 | builder->set_location(&b); |
1551 | 166 | } | 166 | } |
1552 | 167 | // Open the new building window if needed | 167 | // Open the new building window if needed |
1555 | 168 | if (m_optionswindow) { | 168 | if (optionswindow_) { |
1556 | 169 | Point window_position = m_optionswindow->get_pos(); | 169 | Point window_position = optionswindow_->get_pos(); |
1557 | 170 | hide_options(); | 170 | hide_options(); |
1558 | 171 | InteractiveGameBase & igbase = | 171 | InteractiveGameBase & igbase = |
1559 | 172 | dynamic_cast<InteractiveGameBase&>(*egbase.get_ibase()); | 172 | dynamic_cast<InteractiveGameBase&>(*egbase.get_ibase()); |
1560 | @@ -183,10 +183,10 @@ | |||
1561 | 183 | */ | 183 | */ |
1562 | 184 | bool ConstructionSite::burn_on_destroy() | 184 | bool ConstructionSite::burn_on_destroy() |
1563 | 185 | { | 185 | { |
1565 | 186 | if (m_work_completed >= m_work_steps) | 186 | if (work_completed_ >= work_steps_) |
1566 | 187 | return false; // completed, so don't burn | 187 | return false; // completed, so don't burn |
1567 | 188 | 188 | ||
1569 | 189 | return m_work_completed || !m_old_buildings.empty(); | 189 | return work_completed_ || !old_buildings_.empty(); |
1570 | 190 | } | 190 | } |
1571 | 191 | 191 | ||
1572 | 192 | /* | 192 | /* |
1573 | @@ -196,9 +196,9 @@ | |||
1574 | 196 | */ | 196 | */ |
1575 | 197 | bool ConstructionSite::fetch_from_flag(Game & game) | 197 | bool ConstructionSite::fetch_from_flag(Game & game) |
1576 | 198 | { | 198 | { |
1578 | 199 | ++m_fetchfromflag; | 199 | ++fetchfromflag_; |
1579 | 200 | 200 | ||
1581 | 201 | if (Worker * const builder = m_builder.get(game)) | 201 | if (Worker * const builder = builder_.get(game)) |
1582 | 202 | builder->update_task_buildingwork(game); | 202 | builder->update_task_buildingwork(game); |
1583 | 203 | 203 | ||
1584 | 204 | return true; | 204 | return true; |
1585 | @@ -211,7 +211,7 @@ | |||
1586 | 211 | =============== | 211 | =============== |
1587 | 212 | */ | 212 | */ |
1588 | 213 | bool ConstructionSite::get_building_work(Game & game, Worker & worker, bool) { | 213 | bool ConstructionSite::get_building_work(Game & game, Worker & worker, bool) { |
1590 | 214 | if (&worker != m_builder.get(game)) { | 214 | if (&worker != builder_.get(game)) { |
1591 | 215 | // Not our construction worker; e.g. a miner leaving a mine | 215 | // Not our construction worker; e.g. a miner leaving a mine |
1592 | 216 | // that is supposed to be enhanced. Make him return to a warehouse | 216 | // that is supposed to be enhanced. Make him return to a warehouse |
1593 | 217 | worker.pop_task(game); | 217 | worker.pop_task(game); |
1594 | @@ -219,40 +219,40 @@ | |||
1595 | 219 | return true; | 219 | return true; |
1596 | 220 | } | 220 | } |
1597 | 221 | 221 | ||
1599 | 222 | if (!m_work_steps) // Happens for building without buildcost. | 222 | if (!work_steps_) // Happens for building without buildcost. |
1600 | 223 | schedule_destroy(game); // Complete the building immediately. | 223 | schedule_destroy(game); // Complete the building immediately. |
1601 | 224 | 224 | ||
1602 | 225 | // Check if one step has completed | 225 | // Check if one step has completed |
1605 | 226 | if (m_working) { | 226 | if (working_) { |
1606 | 227 | if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) < 0) { | 227 | if (static_cast<int32_t>(game.get_gametime() - work_steptime_) < 0) { |
1607 | 228 | worker.start_task_idle | 228 | worker.start_task_idle |
1608 | 229 | (game, | 229 | (game, |
1609 | 230 | worker.descr().get_animation("work"), | 230 | worker.descr().get_animation("work"), |
1612 | 231 | m_work_steptime - game.get_gametime()); | 231 | work_steptime_ - game.get_gametime()); |
1613 | 232 | m_builder_idle = false; | 232 | builder_idle_ = false; |
1614 | 233 | return true; | 233 | return true; |
1615 | 234 | } else { | 234 | } else { |
1616 | 235 | //TODO(fweber): cause "construction sounds" to be played - | 235 | //TODO(fweber): cause "construction sounds" to be played - |
1617 | 236 | //perhaps dependent on kind of construction? | 236 | //perhaps dependent on kind of construction? |
1618 | 237 | 237 | ||
1621 | 238 | ++m_work_completed; | 238 | ++work_completed_; |
1622 | 239 | if (m_work_completed >= m_work_steps) | 239 | if (work_completed_ >= work_steps_) |
1623 | 240 | schedule_destroy(game); | 240 | schedule_destroy(game); |
1624 | 241 | 241 | ||
1626 | 242 | m_working = false; | 242 | working_ = false; |
1627 | 243 | } | 243 | } |
1628 | 244 | } | 244 | } |
1629 | 245 | 245 | ||
1630 | 246 | // Fetch wares from flag | 246 | // Fetch wares from flag |
1634 | 247 | if (m_fetchfromflag) { | 247 | if (fetchfromflag_) { |
1635 | 248 | --m_fetchfromflag; | 248 | --fetchfromflag_; |
1636 | 249 | m_builder_idle = false; | 249 | builder_idle_ = false; |
1637 | 250 | worker.start_task_fetchfromflag(game); | 250 | worker.start_task_fetchfromflag(game); |
1638 | 251 | return true; | 251 | return true; |
1639 | 252 | } | 252 | } |
1640 | 253 | 253 | ||
1641 | 254 | // Drop all the wares that are too much out to the flag. | 254 | // Drop all the wares that are too much out to the flag. |
1643 | 255 | for (WaresQueue * iqueue: m_wares) { | 255 | for (WaresQueue * iqueue: wares_) { |
1644 | 256 | WaresQueue * queue = iqueue; | 256 | WaresQueue * queue = iqueue; |
1645 | 257 | if (queue->get_filled() > queue->get_max_fill()) { | 257 | if (queue->get_filled() > queue->get_max_fill()) { |
1646 | 258 | queue->set_filled(queue->get_filled() - 1); | 258 | queue->set_filled(queue->get_filled() - 1); |
1647 | @@ -265,10 +265,10 @@ | |||
1648 | 265 | } | 265 | } |
1649 | 266 | 266 | ||
1650 | 267 | // Check if we've got wares to consume | 267 | // Check if we've got wares to consume |
1652 | 268 | if (m_work_completed < m_work_steps) | 268 | if (work_completed_ < work_steps_) |
1653 | 269 | { | 269 | { |
1656 | 270 | for (uint32_t i = 0; i < m_wares.size(); ++i) { | 270 | for (uint32_t i = 0; i < wares_.size(); ++i) { |
1657 | 271 | WaresQueue & wq = *m_wares[i]; | 271 | WaresQueue & wq = *wares_[i]; |
1658 | 272 | 272 | ||
1659 | 273 | if (!wq.get_filled()) | 273 | if (!wq.get_filled()) |
1660 | 274 | continue; | 274 | continue; |
1661 | @@ -279,19 +279,19 @@ | |||
1662 | 279 | //update consumption statistic | 279 | //update consumption statistic |
1663 | 280 | owner().ware_consumed(wq.get_ware(), 1); | 280 | owner().ware_consumed(wq.get_ware(), 1); |
1664 | 281 | 281 | ||
1667 | 282 | m_working = true; | 282 | working_ = true; |
1668 | 283 | m_work_steptime = game.get_gametime() + CONSTRUCTIONSITE_STEP_TIME; | 283 | work_steptime_ = game.get_gametime() + CONSTRUCTIONSITE_STEP_TIME; |
1669 | 284 | 284 | ||
1670 | 285 | worker.start_task_idle | 285 | worker.start_task_idle |
1671 | 286 | (game, worker.descr().get_animation("work"), CONSTRUCTIONSITE_STEP_TIME); | 286 | (game, worker.descr().get_animation("work"), CONSTRUCTIONSITE_STEP_TIME); |
1673 | 287 | m_builder_idle = false; | 287 | builder_idle_ = false; |
1674 | 288 | return true; | 288 | return true; |
1675 | 289 | } | 289 | } |
1676 | 290 | } | 290 | } |
1677 | 291 | // The only work we have got for you, is to run around to look cute ;) | 291 | // The only work we have got for you, is to run around to look cute ;) |
1679 | 292 | if (!m_builder_idle) { | 292 | if (!builder_idle_) { |
1680 | 293 | worker.set_animation(game, worker.descr().get_animation("idle")); | 293 | worker.set_animation(game, worker.descr().get_animation("idle")); |
1682 | 294 | m_builder_idle = true; | 294 | builder_idle_ = true; |
1683 | 295 | } | 295 | } |
1684 | 296 | worker.schedule_act(game, 2000); | 296 | worker.schedule_act(game, 2000); |
1685 | 297 | return true; | 297 | return true; |
1686 | @@ -308,8 +308,8 @@ | |||
1687 | 308 | { | 308 | { |
1688 | 309 | ConstructionSite & cs = *static_cast<ConstructionSite *>(data); | 309 | ConstructionSite & cs = *static_cast<ConstructionSite *>(data); |
1689 | 310 | 310 | ||
1692 | 311 | if (!cs.m_working) | 311 | if (!cs.working_) |
1693 | 312 | if (Worker * const builder = cs.m_builder.get(game)) | 312 | if (Worker * const builder = cs.builder_.get(game)) |
1694 | 313 | builder->update_task_buildingwork(game); | 313 | builder->update_task_buildingwork(game); |
1695 | 314 | } | 314 | } |
1696 | 315 | 315 | ||
1697 | @@ -323,27 +323,27 @@ | |||
1698 | 323 | (const EditorGameBase & game, RenderTarget & dst, const FCoords& coords, const Point& pos) | 323 | (const EditorGameBase & game, RenderTarget & dst, const FCoords& coords, const Point& pos) |
1699 | 324 | { | 324 | { |
1700 | 325 | const uint32_t gametime = game.get_gametime(); | 325 | const uint32_t gametime = game.get_gametime(); |
1702 | 326 | uint32_t tanim = gametime - m_animstart; | 326 | uint32_t tanim = gametime - animstart_; |
1703 | 327 | 327 | ||
1705 | 328 | if (coords != m_position) | 328 | if (coords != position_) |
1706 | 329 | return; // draw big buildings only once | 329 | return; // draw big buildings only once |
1707 | 330 | 330 | ||
1708 | 331 | // Draw the construction site marker | 331 | // Draw the construction site marker |
1709 | 332 | const RGBColor& player_color = get_owner()->get_playercolor(); | 332 | const RGBColor& player_color = get_owner()->get_playercolor(); |
1711 | 333 | dst.blit_animation(pos, m_anim, tanim, player_color); | 333 | dst.blit_animation(pos, anim_, tanim, player_color); |
1712 | 334 | 334 | ||
1713 | 335 | // Draw the partially finished building | 335 | // Draw the partially finished building |
1714 | 336 | 336 | ||
1715 | 337 | static_assert(0 <= CONSTRUCTIONSITE_STEP_TIME, "assert(0 <= CONSTRUCTIONSITE_STEP_TIME) failed."); | 337 | static_assert(0 <= CONSTRUCTIONSITE_STEP_TIME, "assert(0 <= CONSTRUCTIONSITE_STEP_TIME) failed."); |
1718 | 338 | m_info.totaltime = CONSTRUCTIONSITE_STEP_TIME * m_work_steps; | 338 | info_.totaltime = CONSTRUCTIONSITE_STEP_TIME * work_steps_; |
1719 | 339 | m_info.completedtime = CONSTRUCTIONSITE_STEP_TIME * m_work_completed; | 339 | info_.completedtime = CONSTRUCTIONSITE_STEP_TIME * work_completed_; |
1720 | 340 | 340 | ||
1722 | 341 | if (m_working) { | 341 | if (working_) { |
1723 | 342 | assert | 342 | assert |
1725 | 343 | (m_work_steptime | 343 | (work_steptime_ |
1726 | 344 | <= | 344 | <= |
1729 | 345 | m_info.completedtime + CONSTRUCTIONSITE_STEP_TIME + gametime); | 345 | info_.completedtime + CONSTRUCTIONSITE_STEP_TIME + gametime); |
1730 | 346 | m_info.completedtime += CONSTRUCTIONSITE_STEP_TIME + gametime - m_work_steptime; | 346 | info_.completedtime += CONSTRUCTIONSITE_STEP_TIME + gametime - work_steptime_; |
1731 | 347 | } | 347 | } |
1732 | 348 | 348 | ||
1733 | 349 | uint32_t anim_idx; | 349 | uint32_t anim_idx; |
1734 | @@ -359,16 +359,16 @@ | |||
1735 | 359 | } | 359 | } |
1736 | 360 | const Animation& anim = g_gr->animations().get_animation(anim_idx); | 360 | const Animation& anim = g_gr->animations().get_animation(anim_idx); |
1737 | 361 | const size_t nr_frames = anim.nr_frames(); | 361 | const size_t nr_frames = anim.nr_frames(); |
1739 | 362 | cur_frame = m_info.totaltime ? m_info.completedtime * nr_frames / m_info.totaltime : 0; | 362 | cur_frame = info_.totaltime ? info_.completedtime * nr_frames / info_.totaltime : 0; |
1740 | 363 | // Redefine tanim | 363 | // Redefine tanim |
1741 | 364 | tanim = cur_frame * FRAME_LENGTH; | 364 | tanim = cur_frame * FRAME_LENGTH; |
1742 | 365 | 365 | ||
1743 | 366 | const uint16_t w = anim.width(); | 366 | const uint16_t w = anim.width(); |
1744 | 367 | const uint16_t h = anim.height(); | 367 | const uint16_t h = anim.height(); |
1745 | 368 | 368 | ||
1749 | 369 | uint32_t lines = h * m_info.completedtime * nr_frames; | 369 | uint32_t lines = h * info_.completedtime * nr_frames; |
1750 | 370 | if (m_info.totaltime) | 370 | if (info_.totaltime) |
1751 | 371 | lines /= m_info.totaltime; | 371 | lines /= info_.totaltime; |
1752 | 372 | assert(h * cur_frame <= lines); | 372 | assert(h * cur_frame <= lines); |
1753 | 373 | lines -= h * cur_frame; // This won't work if pictures have various sizes. | 373 | lines -= h * cur_frame; // This won't work if pictures have various sizes. |
1754 | 374 | 374 | ||
1755 | @@ -376,8 +376,8 @@ | |||
1756 | 376 | // draw the prev pic from top to where next image will be drawing | 376 | // draw the prev pic from top to where next image will be drawing |
1757 | 377 | dst.blit_animation(pos, anim_idx, tanim - FRAME_LENGTH, player_color, | 377 | dst.blit_animation(pos, anim_idx, tanim - FRAME_LENGTH, player_color, |
1758 | 378 | Rect(Point(0, 0), w, h - lines)); | 378 | Rect(Point(0, 0), w, h - lines)); |
1761 | 379 | } else if (!m_old_buildings.empty()) { | 379 | } else if (!old_buildings_.empty()) { |
1762 | 380 | DescriptionIndex prev_idx = m_old_buildings.back(); | 380 | DescriptionIndex prev_idx = old_buildings_.back(); |
1763 | 381 | const BuildingDescr* prev_building = owner().tribe().get_building_descr(prev_idx); | 381 | const BuildingDescr* prev_building = owner().tribe().get_building_descr(prev_idx); |
1764 | 382 | // Is the first picture but there was another building here before, | 382 | // Is the first picture but there was another building here before, |
1765 | 383 | // get its most fitting picture and draw it instead. | 383 | // get its most fitting picture and draw it instead. |
1766 | 384 | 384 | ||
1767 | === modified file 'src/logic/map_objects/tribes/constructionsite.h' | |||
1768 | --- src/logic/map_objects/tribes/constructionsite.h 2016-01-31 15:31:00 +0000 | |||
1769 | +++ src/logic/map_objects/tribes/constructionsite.h 2016-02-08 18:17:36 +0000 | |||
1770 | @@ -80,12 +80,12 @@ | |||
1771 | 80 | public: | 80 | public: |
1772 | 81 | ConstructionSite(const ConstructionSiteDescr & descr); | 81 | ConstructionSite(const ConstructionSiteDescr & descr); |
1773 | 82 | 82 | ||
1775 | 83 | const ConstructionsiteInformation & get_info() {return m_info;} | 83 | const ConstructionsiteInformation & get_info() {return info_;} |
1776 | 84 | 84 | ||
1777 | 85 | WaresQueue & waresqueue(DescriptionIndex) override; | 85 | WaresQueue & waresqueue(DescriptionIndex) override; |
1778 | 86 | 86 | ||
1779 | 87 | void set_building(const BuildingDescr &) override; | 87 | void set_building(const BuildingDescr &) override; |
1781 | 88 | const BuildingDescr & building() const {return *m_building;} | 88 | const BuildingDescr & building() const {return *building_;} |
1782 | 89 | 89 | ||
1783 | 90 | void init (EditorGameBase &) override; | 90 | void init (EditorGameBase &) override; |
1784 | 91 | void cleanup(EditorGameBase &) override; | 91 | void cleanup(EditorGameBase &) override; |
1785 | @@ -107,10 +107,10 @@ | |||
1786 | 107 | void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override; | 107 | void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override; |
1787 | 108 | 108 | ||
1788 | 109 | private: | 109 | private: |
1790 | 110 | int32_t m_fetchfromflag; // # of wares to fetch from flag | 110 | int32_t fetchfromflag_; // # of wares to fetch from flag |
1791 | 111 | 111 | ||
1794 | 112 | bool m_builder_idle; // used to determine whether the builder is idle | 112 | bool builder_idle_; // used to determine whether the builder is idle |
1795 | 113 | ConstructionsiteInformation m_info; // asked for by player point of view for the gameview | 113 | ConstructionsiteInformation info_; // asked for by player point of view for the gameview |
1796 | 114 | }; | 114 | }; |
1797 | 115 | 115 | ||
1798 | 116 | } | 116 | } |
1799 | 117 | 117 | ||
1800 | === modified file 'src/logic/map_objects/tribes/dismantlesite.cc' | |||
1801 | --- src/logic/map_objects/tribes/dismantlesite.cc 2016-01-17 19:54:32 +0000 | |||
1802 | +++ src/logic/map_objects/tribes/dismantlesite.cc 2016-02-08 18:17:36 +0000 | |||
1803 | @@ -68,14 +68,14 @@ | |||
1804 | 68 | : | 68 | : |
1805 | 69 | PartiallyFinishedBuilding(gdescr) | 69 | PartiallyFinishedBuilding(gdescr) |
1806 | 70 | { | 70 | { |
1808 | 71 | m_position = c; | 71 | position_ = c; |
1809 | 72 | set_owner(&plr); | 72 | set_owner(&plr); |
1810 | 73 | 73 | ||
1811 | 74 | assert(!former_buildings.empty()); | 74 | assert(!former_buildings.empty()); |
1812 | 75 | for (DescriptionIndex former_idx : former_buildings) { | 75 | for (DescriptionIndex former_idx : former_buildings) { |
1814 | 76 | m_old_buildings.push_back(former_idx); | 76 | old_buildings_.push_back(former_idx); |
1815 | 77 | } | 77 | } |
1817 | 78 | const BuildingDescr* cur_descr = owner().tribe().get_building_descr(m_old_buildings.back()); | 78 | const BuildingDescr* cur_descr = owner().tribe().get_building_descr(old_buildings_.back()); |
1818 | 79 | set_building(*cur_descr); | 79 | set_building(*cur_descr); |
1819 | 80 | 80 | ||
1820 | 81 | if (loading) { | 81 | if (loading) { |
1821 | @@ -109,14 +109,14 @@ | |||
1822 | 109 | count_returned_wares(this, wares); | 109 | count_returned_wares(this, wares); |
1823 | 110 | 110 | ||
1824 | 111 | std::map<DescriptionIndex, uint8_t>::const_iterator it = wares.begin(); | 111 | std::map<DescriptionIndex, uint8_t>::const_iterator it = wares.begin(); |
1826 | 112 | m_wares.resize(wares.size()); | 112 | wares_.resize(wares.size()); |
1827 | 113 | 113 | ||
1828 | 114 | for (size_t i = 0; i < wares.size(); ++i, ++it) { | 114 | for (size_t i = 0; i < wares.size(); ++i, ++it) { |
1829 | 115 | WaresQueue & wq = | 115 | WaresQueue & wq = |
1831 | 116 | *(m_wares[i] = new WaresQueue(*this, it->first, it->second)); | 116 | *(wares_[i] = new WaresQueue(*this, it->first, it->second)); |
1832 | 117 | 117 | ||
1833 | 118 | wq.set_filled(it->second); | 118 | wq.set_filled(it->second); |
1835 | 119 | m_work_steps += it->second; | 119 | work_steps_ += it->second; |
1836 | 120 | } | 120 | } |
1837 | 121 | } | 121 | } |
1838 | 122 | 122 | ||
1839 | @@ -154,7 +154,7 @@ | |||
1840 | 154 | */ | 154 | */ |
1841 | 155 | bool DismantleSite::burn_on_destroy() | 155 | bool DismantleSite::burn_on_destroy() |
1842 | 156 | { | 156 | { |
1844 | 157 | if (m_work_completed >= m_work_steps) | 157 | if (work_completed_ >= work_steps_) |
1845 | 158 | return false; // completed, so don't burn | 158 | return false; // completed, so don't burn |
1846 | 159 | 159 | ||
1847 | 160 | return true; | 160 | return true; |
1848 | @@ -166,7 +166,7 @@ | |||
1849 | 166 | =============== | 166 | =============== |
1850 | 167 | */ | 167 | */ |
1851 | 168 | bool DismantleSite::get_building_work(Game & game, Worker & worker, bool) { | 168 | bool DismantleSite::get_building_work(Game & game, Worker & worker, bool) { |
1853 | 169 | if (&worker != m_builder.get(game)) { | 169 | if (&worker != builder_.get(game)) { |
1854 | 170 | // Not our construction worker; e.g. a miner leaving a mine | 170 | // Not our construction worker; e.g. a miner leaving a mine |
1855 | 171 | // that is supposed to be enhanced. Make him return to a warehouse | 171 | // that is supposed to be enhanced. Make him return to a warehouse |
1856 | 172 | worker.pop_task(game); | 172 | worker.pop_task(game); |
1857 | @@ -174,15 +174,15 @@ | |||
1858 | 174 | return true; | 174 | return true; |
1859 | 175 | } | 175 | } |
1860 | 176 | 176 | ||
1862 | 177 | if (!m_work_steps) // Happens for building without buildcost. | 177 | if (!work_steps_) // Happens for building without buildcost. |
1863 | 178 | schedule_destroy(game); // Complete the building immediately. | 178 | schedule_destroy(game); // Complete the building immediately. |
1864 | 179 | 179 | ||
1865 | 180 | // Check if one step has completed | 180 | // Check if one step has completed |
1868 | 181 | if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 && m_working) { | 181 | if (static_cast<int32_t>(game.get_gametime() - work_steptime_) >= 0 && working_) { |
1869 | 182 | ++m_work_completed; | 182 | ++work_completed_; |
1870 | 183 | 183 | ||
1873 | 184 | for (uint32_t i = 0; i < m_wares.size(); ++i) { | 184 | for (uint32_t i = 0; i < wares_.size(); ++i) { |
1874 | 185 | WaresQueue & wq = *m_wares[i]; | 185 | WaresQueue & wq = *wares_[i]; |
1875 | 186 | 186 | ||
1876 | 187 | if (!wq.get_filled()) | 187 | if (!wq.get_filled()) |
1877 | 188 | continue; | 188 | continue; |
1878 | @@ -198,12 +198,12 @@ | |||
1879 | 198 | ware.init(game); | 198 | ware.init(game); |
1880 | 199 | worker.start_task_dropoff(game, ware); | 199 | worker.start_task_dropoff(game, ware); |
1881 | 200 | 200 | ||
1883 | 201 | m_working = false; | 201 | working_ = false; |
1884 | 202 | return true; | 202 | return true; |
1885 | 203 | } | 203 | } |
1886 | 204 | } | 204 | } |
1887 | 205 | 205 | ||
1889 | 206 | if (m_work_completed >= m_work_steps) { | 206 | if (work_completed_ >= work_steps_) { |
1890 | 207 | schedule_destroy(game); | 207 | schedule_destroy(game); |
1891 | 208 | 208 | ||
1892 | 209 | worker.pop_task(game); | 209 | worker.pop_task(game); |
1893 | @@ -214,12 +214,12 @@ | |||
1894 | 214 | worker.descr().get_right_walk_anims(false), | 214 | worker.descr().get_right_walk_anims(false), |
1895 | 215 | true); | 215 | true); |
1896 | 216 | worker.set_location(nullptr); | 216 | worker.set_location(nullptr); |
1899 | 217 | } else if (!m_working) { | 217 | } else if (!working_) { |
1900 | 218 | m_work_steptime = game.get_gametime() + DISMANTLESITE_STEP_TIME; | 218 | work_steptime_ = game.get_gametime() + DISMANTLESITE_STEP_TIME; |
1901 | 219 | worker.start_task_idle | 219 | worker.start_task_idle |
1902 | 220 | (game, worker.descr().get_animation("work"), DISMANTLESITE_STEP_TIME); | 220 | (game, worker.descr().get_animation("work"), DISMANTLESITE_STEP_TIME); |
1903 | 221 | 221 | ||
1905 | 222 | m_working = true; | 222 | working_ = true; |
1906 | 223 | } | 223 | } |
1907 | 224 | return true; | 224 | return true; |
1908 | 225 | } | 225 | } |
1909 | @@ -233,29 +233,29 @@ | |||
1910 | 233 | (const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos) | 233 | (const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos) |
1911 | 234 | { | 234 | { |
1912 | 235 | const uint32_t gametime = game.get_gametime(); | 235 | const uint32_t gametime = game.get_gametime(); |
1914 | 236 | uint32_t tanim = gametime - m_animstart; | 236 | uint32_t tanim = gametime - animstart_; |
1915 | 237 | 237 | ||
1917 | 238 | if (coords != m_position) | 238 | if (coords != position_) |
1918 | 239 | return; // draw big buildings only once | 239 | return; // draw big buildings only once |
1919 | 240 | 240 | ||
1920 | 241 | const RGBColor& player_color = get_owner()->get_playercolor(); | 241 | const RGBColor& player_color = get_owner()->get_playercolor(); |
1921 | 242 | 242 | ||
1922 | 243 | // Draw the construction site marker | 243 | // Draw the construction site marker |
1924 | 244 | dst.blit_animation(pos, m_anim, tanim, player_color); | 244 | dst.blit_animation(pos, anim_, tanim, player_color); |
1925 | 245 | 245 | ||
1926 | 246 | // Draw the partially dismantled building | 246 | // Draw the partially dismantled building |
1927 | 247 | static_assert(0 <= DISMANTLESITE_STEP_TIME, "assert(0 <= DISMANTLESITE_STEP_TIME) failed."); | 247 | static_assert(0 <= DISMANTLESITE_STEP_TIME, "assert(0 <= DISMANTLESITE_STEP_TIME) failed."); |
1930 | 248 | uint32_t total_time = DISMANTLESITE_STEP_TIME * m_work_steps; | 248 | uint32_t total_time = DISMANTLESITE_STEP_TIME * work_steps_; |
1931 | 249 | uint32_t completed_time = DISMANTLESITE_STEP_TIME * m_work_completed; | 249 | uint32_t completed_time = DISMANTLESITE_STEP_TIME * work_completed_; |
1932 | 250 | 250 | ||
1935 | 251 | if (m_working) | 251 | if (working_) |
1936 | 252 | completed_time += DISMANTLESITE_STEP_TIME + gametime - m_work_steptime; | 252 | completed_time += DISMANTLESITE_STEP_TIME + gametime - work_steptime_; |
1937 | 253 | 253 | ||
1938 | 254 | uint32_t anim_idx; | 254 | uint32_t anim_idx; |
1939 | 255 | try { | 255 | try { |
1941 | 256 | anim_idx = m_building->get_animation("unoccupied"); | 256 | anim_idx = building_->get_animation("unoccupied"); |
1942 | 257 | } catch (MapObjectDescr::AnimationNonexistent &) { | 257 | } catch (MapObjectDescr::AnimationNonexistent &) { |
1944 | 258 | anim_idx = m_building->get_animation("idle"); | 258 | anim_idx = building_->get_animation("idle"); |
1945 | 259 | } | 259 | } |
1946 | 260 | const Animation& anim = g_gr->animations().get_animation(anim_idx); | 260 | const Animation& anim = g_gr->animations().get_animation(anim_idx); |
1947 | 261 | const uint16_t w = anim.width(); | 261 | const uint16_t w = anim.width(); |
1948 | 262 | 262 | ||
1949 | === modified file 'src/logic/map_objects/tribes/militarysite.cc' | |||
1950 | --- src/logic/map_objects/tribes/militarysite.cc 2016-01-31 15:31:00 +0000 | |||
1951 | +++ src/logic/map_objects/tribes/militarysite.cc 2016-02-08 18:17:36 +0000 | |||
1952 | @@ -48,26 +48,26 @@ | |||
1953 | 48 | : | 48 | : |
1954 | 49 | BuildingDescr | 49 | BuildingDescr |
1955 | 50 | (init_descname, MapObjectType::MILITARYSITE, table, egbase), | 50 | (init_descname, MapObjectType::MILITARYSITE, table, egbase), |
1959 | 51 | m_conquer_radius (0), | 51 | conquer_radius_ (0), |
1960 | 52 | m_num_soldiers (0), | 52 | num_soldiers_ (0), |
1961 | 53 | m_heal_per_second (0) | 53 | heal_per_second_ (0) |
1962 | 54 | { | 54 | { |
1963 | 55 | i18n::Textdomain td("tribes"); | 55 | i18n::Textdomain td("tribes"); |
1964 | 56 | 56 | ||
1968 | 57 | m_conquer_radius = table.get_int("conquers"); | 57 | conquer_radius_ = table.get_int("conquers"); |
1969 | 58 | m_num_soldiers = table.get_int("max_soldiers"); | 58 | num_soldiers_ = table.get_int("max_soldiers"); |
1970 | 59 | m_heal_per_second = table.get_int("heal_per_second"); | 59 | heal_per_second_ = table.get_int("heal_per_second"); |
1971 | 60 | 60 | ||
1975 | 61 | if (m_conquer_radius > 0) | 61 | if (conquer_radius_ > 0) |
1976 | 62 | m_workarea_info[m_conquer_radius].insert(descname() + " conquer"); | 62 | workarea_info_[conquer_radius_].insert(descname() + " conquer"); |
1977 | 63 | m_prefers_heroes_at_start = table.get_bool("prefer_heroes"); | 63 | prefers_heroes_at_start_ = table.get_bool("prefer_heroes"); |
1978 | 64 | 64 | ||
1979 | 65 | std::unique_ptr<LuaTable> items_table = table.get_table("messages"); | 65 | std::unique_ptr<LuaTable> items_table = table.get_table("messages"); |
1985 | 66 | m_occupied_str = _(items_table->get_string("occupied")); | 66 | occupied_str_ = _(items_table->get_string("occupied")); |
1986 | 67 | m_aggressor_str = _(items_table->get_string("aggressor")); | 67 | aggressor_str_ = _(items_table->get_string("aggressor")); |
1987 | 68 | m_attack_str = _(items_table->get_string("attack")); | 68 | attack_str_ = _(items_table->get_string("attack")); |
1988 | 69 | m_defeated_enemy_str = _(items_table->get_string("defeated_enemy")); | 69 | defeated_enemy_str_ = _(items_table->get_string("defeated_enemy")); |
1989 | 70 | m_defeated_you_str = _(items_table->get_string("defeated_you")); | 70 | defeated_you_str_ = _(items_table->get_string("defeated_you")); |
1990 | 71 | } | 71 | } |
1991 | 72 | 72 | ||
1992 | 73 | /** | 73 | /** |
1993 | @@ -90,21 +90,21 @@ | |||
1994 | 90 | 90 | ||
1995 | 91 | MilitarySite::MilitarySite(const MilitarySiteDescr & ms_descr) : | 91 | MilitarySite::MilitarySite(const MilitarySiteDescr & ms_descr) : |
1996 | 92 | Building(ms_descr), | 92 | Building(ms_descr), |
2003 | 93 | m_didconquer (false), | 93 | didconquer_ (false), |
2004 | 94 | m_capacity (ms_descr.get_max_number_of_soldiers()), | 94 | capacity_ (ms_descr.get_max_number_of_soldiers()), |
2005 | 95 | m_nexthealtime(0), | 95 | nexthealtime_(0), |
2006 | 96 | m_soldier_preference(ms_descr.m_prefers_heroes_at_start ? kPrefersHeroes : kPrefersRookies), | 96 | soldier_preference_(ms_descr.prefers_heroes_at_start_ ? kPrefersHeroes : kPrefersRookies), |
2007 | 97 | m_soldier_upgrade_try(false), | 97 | soldier_upgrade_try_(false), |
2008 | 98 | m_doing_upgrade_request(false) | 98 | doing_upgrade_request_(false) |
2009 | 99 | { | 99 | { |
2011 | 100 | m_next_swap_soldiers_time = 0; | 100 | next_swap_soldiers_time_ = 0; |
2012 | 101 | } | 101 | } |
2013 | 102 | 102 | ||
2014 | 103 | 103 | ||
2015 | 104 | MilitarySite::~MilitarySite() | 104 | MilitarySite::~MilitarySite() |
2016 | 105 | { | 105 | { |
2019 | 106 | assert(!m_normal_soldier_request); | 106 | assert(!normal_soldier_request_); |
2020 | 107 | assert(!m_upgrade_soldier_request); | 107 | assert(!upgrade_soldier_request_); |
2021 | 108 | } | 108 | } |
2022 | 109 | 109 | ||
2023 | 110 | 110 | ||
2024 | @@ -120,25 +120,25 @@ | |||
2025 | 120 | uint32_t stationed = stationed_soldiers().size(); | 120 | uint32_t stationed = stationed_soldiers().size(); |
2026 | 121 | 121 | ||
2027 | 122 | if (present == stationed) { | 122 | if (present == stationed) { |
2029 | 123 | if (m_capacity > stationed) { | 123 | if (capacity_ > stationed) { |
2030 | 124 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ | 124 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ |
2031 | 125 | /** TRANSLATORS: %2% is the maximum number of soldier slots in the building */ | 125 | /** TRANSLATORS: %2% is the maximum number of soldier slots in the building */ |
2032 | 126 | *s += (boost::format(ngettext("%1% soldier (+%2%)", | 126 | *s += (boost::format(ngettext("%1% soldier (+%2%)", |
2033 | 127 | "%1% soldiers (+%2%)", | 127 | "%1% soldiers (+%2%)", |
2034 | 128 | stationed)) | 128 | stationed)) |
2036 | 129 | % stationed % (m_capacity - stationed)).str(); | 129 | % stationed % (capacity_ - stationed)).str(); |
2037 | 130 | } else { | 130 | } else { |
2038 | 131 | *s += (boost::format(ngettext("%u soldier", "%u soldiers", stationed)) | 131 | *s += (boost::format(ngettext("%u soldier", "%u soldiers", stationed)) |
2039 | 132 | % stationed).str(); | 132 | % stationed).str(); |
2040 | 133 | } | 133 | } |
2041 | 134 | } else { | 134 | } else { |
2043 | 135 | if (m_capacity > stationed) { | 135 | if (capacity_ > stationed) { |
2044 | 136 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ | 136 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ |
2045 | 137 | /** TRANSLATORS: %2% are currently open soldier slots in the building */ | 137 | /** TRANSLATORS: %2% are currently open soldier slots in the building */ |
2046 | 138 | /** TRANSLATORS: %3% is the maximum number of soldier slots in the building */ | 138 | /** TRANSLATORS: %3% is the maximum number of soldier slots in the building */ |
2047 | 139 | *s = | 139 | *s = |
2048 | 140 | (boost::format(ngettext("%1%(+%2%) soldier (+%3%)", "%1%(+%2%) soldiers (+%3%)", stationed)) | 140 | (boost::format(ngettext("%1%(+%2%) soldier (+%3%)", "%1%(+%2%) soldiers (+%3%)", stationed)) |
2050 | 141 | % present % (stationed - present) % (m_capacity - stationed)).str(); | 141 | % present % (stationed - present) % (capacity_ - stationed)).str(); |
2051 | 142 | } else { | 142 | } else { |
2052 | 143 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ | 143 | /** TRANSLATORS: %1% is the number of soldiers the plural refers to */ |
2053 | 144 | /** TRANSLATORS: %2% are currently open soldier slots in the building */ | 144 | /** TRANSLATORS: %2% are currently open soldier slots in the building */ |
2054 | @@ -166,7 +166,7 @@ | |||
2055 | 166 | update_soldier_request(); | 166 | update_soldier_request(); |
2056 | 167 | 167 | ||
2057 | 168 | // schedule the first healing | 168 | // schedule the first healing |
2059 | 169 | m_nexthealtime = egbase.get_gametime() + 1000; | 169 | nexthealtime_ = egbase.get_gametime() + 1000; |
2060 | 170 | if (game) | 170 | if (game) |
2061 | 171 | schedule_act(*game, 1000); | 171 | schedule_act(*game, 1000); |
2062 | 172 | } | 172 | } |
2063 | @@ -182,10 +182,10 @@ | |||
2064 | 182 | { | 182 | { |
2065 | 183 | Building::set_economy(e); | 183 | Building::set_economy(e); |
2066 | 184 | 184 | ||
2071 | 185 | if (m_normal_soldier_request && e) | 185 | if (normal_soldier_request_ && e) |
2072 | 186 | m_normal_soldier_request->set_economy(e); | 186 | normal_soldier_request_->set_economy(e); |
2073 | 187 | if (m_upgrade_soldier_request && e) | 187 | if (upgrade_soldier_request_ && e) |
2074 | 188 | m_upgrade_soldier_request->set_economy(e); | 188 | upgrade_soldier_request_->set_economy(e); |
2075 | 189 | } | 189 | } |
2076 | 190 | 190 | ||
2077 | 191 | /** | 191 | /** |
2078 | @@ -196,25 +196,25 @@ | |||
2079 | 196 | void MilitarySite::cleanup(EditorGameBase & egbase) | 196 | void MilitarySite::cleanup(EditorGameBase & egbase) |
2080 | 197 | { | 197 | { |
2081 | 198 | // unconquer land | 198 | // unconquer land |
2083 | 199 | if (m_didconquer) | 199 | if (didconquer_) |
2084 | 200 | egbase.unconquer_area | 200 | egbase.unconquer_area |
2085 | 201 | (PlayerArea<Area<FCoords> > | 201 | (PlayerArea<Area<FCoords> > |
2086 | 202 | (owner().player_number(), | 202 | (owner().player_number(), |
2087 | 203 | Area<FCoords> | 203 | Area<FCoords> |
2088 | 204 | (egbase.map().get_fcoords(get_position()), descr().get_conquers())), | 204 | (egbase.map().get_fcoords(get_position()), descr().get_conquers())), |
2090 | 205 | m_defeating_player); | 205 | defeating_player_); |
2091 | 206 | 206 | ||
2092 | 207 | Building::cleanup(egbase); | 207 | Building::cleanup(egbase); |
2093 | 208 | 208 | ||
2094 | 209 | // Evict soldiers to get rid of requests | 209 | // Evict soldiers to get rid of requests |
2096 | 210 | while (m_capacity > 0) { | 210 | while (capacity_ > 0) { |
2097 | 211 | update_soldier_request(); | 211 | update_soldier_request(); |
2099 | 212 | --m_capacity; | 212 | --capacity_; |
2100 | 213 | } | 213 | } |
2101 | 214 | update_soldier_request(); | 214 | update_soldier_request(); |
2102 | 215 | 215 | ||
2105 | 216 | m_normal_soldier_request.reset(); | 216 | normal_soldier_request_.reset(); |
2106 | 217 | m_upgrade_soldier_request.reset(); | 217 | upgrade_soldier_request_.reset(); |
2107 | 218 | } | 218 | } |
2108 | 219 | 219 | ||
2109 | 220 | 220 | ||
2110 | @@ -246,7 +246,7 @@ | |||
2111 | 246 | return incorporate_upgraded_soldier(egbase, s) ? 0 : -1; | 246 | return incorporate_upgraded_soldier(egbase, s) ? 0 : -1; |
2112 | 247 | } | 247 | } |
2113 | 248 | 248 | ||
2115 | 249 | if (!m_didconquer) { | 249 | if (!didconquer_) { |
2116 | 250 | conquer_area(egbase); | 250 | conquer_area(egbase); |
2117 | 251 | // Building is now occupied - idle animation should be played | 251 | // Building is now occupied - idle animation should be played |
2118 | 252 | start_animation(egbase, descr().get_animation("idle")); | 252 | start_animation(egbase, descr().get_animation("idle")); |
2119 | @@ -258,7 +258,7 @@ | |||
2120 | 258 | descr().descname(), | 258 | descr().descname(), |
2121 | 259 | descr().icon_filename(), | 259 | descr().icon_filename(), |
2122 | 260 | descr().descname(), | 260 | descr().descname(), |
2124 | 261 | descr().m_occupied_str, | 261 | descr().occupied_str_, |
2125 | 262 | true); | 262 | true); |
2126 | 263 | } | 263 | } |
2127 | 264 | } | 264 | } |
2128 | @@ -285,7 +285,7 @@ | |||
2129 | 285 | MilitarySite::find_least_suited_soldier() | 285 | MilitarySite::find_least_suited_soldier() |
2130 | 286 | { | 286 | { |
2131 | 287 | const std::vector<Soldier *> present = present_soldiers(); | 287 | const std::vector<Soldier *> present = present_soldiers(); |
2133 | 288 | const int32_t multiplier = kPrefersHeroes == m_soldier_preference ? -1 : 1; | 288 | const int32_t multiplier = kPrefersHeroes == soldier_preference_ ? -1 : 1; |
2134 | 289 | int worst_soldier_level = INT_MIN; | 289 | int worst_soldier_level = INT_MIN; |
2135 | 290 | Soldier * worst_soldier = nullptr; | 290 | Soldier * worst_soldier = nullptr; |
2136 | 291 | for (Soldier* sld : present) { | 291 | for (Soldier* sld : present) { |
2137 | @@ -329,12 +329,12 @@ | |||
2138 | 329 | { | 329 | { |
2139 | 330 | int32_t old_level = kickoutCandidate->get_level(atrTotal); | 330 | int32_t old_level = kickoutCandidate->get_level(atrTotal); |
2140 | 331 | int32_t new_level = newguy->get_level(atrTotal); | 331 | int32_t new_level = newguy->get_level(atrTotal); |
2142 | 332 | if (kPrefersHeroes == m_soldier_preference && old_level >= new_level) | 332 | if (kPrefersHeroes == soldier_preference_ && old_level >= new_level) |
2143 | 333 | { | 333 | { |
2144 | 334 | return false; | 334 | return false; |
2145 | 335 | } | 335 | } |
2146 | 336 | else | 336 | else |
2148 | 337 | if (kPrefersRookies == m_soldier_preference && old_level <= new_level) | 337 | if (kPrefersRookies == soldier_preference_ && old_level <= new_level) |
2149 | 338 | { | 338 | { |
2150 | 339 | return false; | 339 | return false; |
2151 | 340 | } | 340 | } |
2152 | @@ -361,7 +361,7 @@ | |||
2153 | 361 | MilitarySite::incorporate_upgraded_soldier(EditorGameBase & egbase, Soldier & s) | 361 | MilitarySite::incorporate_upgraded_soldier(EditorGameBase & egbase, Soldier & s) |
2154 | 362 | { | 362 | { |
2155 | 363 | // Call to drop_least routine has side effects: it tries to drop a soldier. Order is important! | 363 | // Call to drop_least routine has side effects: it tries to drop a soldier. Order is important! |
2157 | 364 | if (stationed_soldiers().size() < m_capacity || drop_least_suited_soldier(true, &s)) | 364 | if (stationed_soldiers().size() < capacity_ || drop_least_suited_soldier(true, &s)) |
2158 | 365 | { | 365 | { |
2159 | 366 | Game & game = dynamic_cast<Game&>(egbase); | 366 | Game & game = dynamic_cast<Game&>(egbase); |
2160 | 367 | s.set_location(this); | 367 | s.set_location(this); |
2161 | @@ -400,25 +400,25 @@ | |||
2162 | 400 | std::vector<Soldier *> present = present_soldiers(); | 400 | std::vector<Soldier *> present = present_soldiers(); |
2163 | 401 | uint32_t const stationed = stationed_soldiers().size(); | 401 | uint32_t const stationed = stationed_soldiers().size(); |
2164 | 402 | 402 | ||
2168 | 403 | if (stationed < m_capacity) { | 403 | if (stationed < capacity_) { |
2169 | 404 | if (!m_normal_soldier_request) { | 404 | if (!normal_soldier_request_) { |
2170 | 405 | m_normal_soldier_request.reset | 405 | normal_soldier_request_.reset |
2171 | 406 | (new Request | 406 | (new Request |
2172 | 407 | (*this, | 407 | (*this, |
2173 | 408 | owner().tribe().soldier(), | 408 | owner().tribe().soldier(), |
2174 | 409 | MilitarySite::request_soldier_callback, | 409 | MilitarySite::request_soldier_callback, |
2175 | 410 | wwWORKER)); | 410 | wwWORKER)); |
2177 | 411 | m_normal_soldier_request->set_requirements (m_soldier_requirements); | 411 | normal_soldier_request_->set_requirements (soldier_requirements_); |
2178 | 412 | } | 412 | } |
2179 | 413 | 413 | ||
2181 | 414 | m_normal_soldier_request->set_count(m_capacity - stationed); | 414 | normal_soldier_request_->set_count(capacity_ - stationed); |
2182 | 415 | } else { | 415 | } else { |
2184 | 416 | m_normal_soldier_request.reset(); | 416 | normal_soldier_request_.reset(); |
2185 | 417 | } | 417 | } |
2186 | 418 | 418 | ||
2188 | 419 | if (m_capacity < present.size()) { | 419 | if (capacity_ < present.size()) { |
2189 | 420 | Game & game = dynamic_cast<Game&>(owner().egbase()); | 420 | Game & game = dynamic_cast<Game&>(owner().egbase()); |
2191 | 421 | for (uint32_t i = 0; i < present.size() - m_capacity; ++i) { | 421 | for (uint32_t i = 0; i < present.size() - capacity_; ++i) { |
2192 | 422 | Soldier & soldier = *present[i]; | 422 | Soldier & soldier = *present[i]; |
2193 | 423 | soldier.reset_tasks(game); | 423 | soldier.reset_tasks(game); |
2194 | 424 | soldier.start_task_leavebuilding(game, true); | 424 | soldier.start_task_leavebuilding(game, true); |
2195 | @@ -440,17 +440,17 @@ | |||
2196 | 440 | void MilitarySite::update_upgrade_soldier_request() | 440 | void MilitarySite::update_upgrade_soldier_request() |
2197 | 441 | { | 441 | { |
2198 | 442 | bool reqch = update_upgrade_requirements(); | 442 | bool reqch = update_upgrade_requirements(); |
2200 | 443 | if (!m_soldier_upgrade_try) | 443 | if (!soldier_upgrade_try_) |
2201 | 444 | return; | 444 | return; |
2202 | 445 | 445 | ||
2203 | 446 | bool do_rebuild_request = reqch; | 446 | bool do_rebuild_request = reqch; |
2204 | 447 | 447 | ||
2206 | 448 | if (m_upgrade_soldier_request) | 448 | if (upgrade_soldier_request_) |
2207 | 449 | { | 449 | { |
2209 | 450 | if (!m_upgrade_soldier_request->is_open()) | 450 | if (!upgrade_soldier_request_->is_open()) |
2210 | 451 | // If a replacement is already walking this way, let's not change our minds. | 451 | // If a replacement is already walking this way, let's not change our minds. |
2211 | 452 | do_rebuild_request = false; | 452 | do_rebuild_request = false; |
2213 | 453 | if (0 == m_upgrade_soldier_request->get_count()) | 453 | if (0 == upgrade_soldier_request_->get_count()) |
2214 | 454 | do_rebuild_request = true; | 454 | do_rebuild_request = true; |
2215 | 455 | } | 455 | } |
2216 | 456 | else | 456 | else |
2217 | @@ -458,15 +458,15 @@ | |||
2218 | 458 | 458 | ||
2219 | 459 | if (do_rebuild_request) | 459 | if (do_rebuild_request) |
2220 | 460 | { | 460 | { |
2222 | 461 | m_upgrade_soldier_request.reset | 461 | upgrade_soldier_request_.reset |
2223 | 462 | (new Request | 462 | (new Request |
2224 | 463 | (*this, | 463 | (*this, |
2225 | 464 | owner().tribe().soldier(), | 464 | owner().tribe().soldier(), |
2226 | 465 | MilitarySite::request_soldier_callback, | 465 | MilitarySite::request_soldier_callback, |
2227 | 466 | wwWORKER)); | 466 | wwWORKER)); |
2228 | 467 | 467 | ||
2231 | 468 | m_upgrade_soldier_request->set_requirements(m_soldier_upgrade_requirements); | 468 | upgrade_soldier_request_->set_requirements(soldier_upgrade_requirements_); |
2232 | 469 | m_upgrade_soldier_request->set_count(1); | 469 | upgrade_soldier_request_->set_count(1); |
2233 | 470 | } | 470 | } |
2234 | 471 | } | 471 | } |
2235 | 472 | 472 | ||
2236 | @@ -489,27 +489,27 @@ | |||
2237 | 489 | const uint32_t capacity = soldier_capacity(); | 489 | const uint32_t capacity = soldier_capacity(); |
2238 | 490 | const uint32_t stationed = stationed_soldiers().size(); | 490 | const uint32_t stationed = stationed_soldiers().size(); |
2239 | 491 | 491 | ||
2241 | 492 | if (m_doing_upgrade_request) | 492 | if (doing_upgrade_request_) |
2242 | 493 | { | 493 | { |
2244 | 494 | if (incd && m_upgrade_soldier_request) // update requests always ask for one soldier at time! | 494 | if (incd && upgrade_soldier_request_) // update requests always ask for one soldier at time! |
2245 | 495 | { | 495 | { |
2247 | 496 | m_upgrade_soldier_request.reset(); | 496 | upgrade_soldier_request_.reset(); |
2248 | 497 | } | 497 | } |
2249 | 498 | if (capacity > stationed) | 498 | if (capacity > stationed) |
2250 | 499 | { | 499 | { |
2251 | 500 | // Somebody is killing my soldiers in the middle of upgrade | 500 | // Somebody is killing my soldiers in the middle of upgrade |
2252 | 501 | // or I have kicked out his predecessor already. | 501 | // or I have kicked out his predecessor already. |
2255 | 502 | if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open() || | 502 | if (upgrade_soldier_request_ && (upgrade_soldier_request_->is_open() || |
2256 | 503 | 0 == m_upgrade_soldier_request->get_count())) { | 503 | 0 == upgrade_soldier_request_->get_count())) { |
2257 | 504 | 504 | ||
2258 | 505 | // Economy was not able to find the soldiers I need. | 505 | // Economy was not able to find the soldiers I need. |
2259 | 506 | // I can safely drop the upgrade request and go to fill mode. | 506 | // I can safely drop the upgrade request and go to fill mode. |
2261 | 507 | m_upgrade_soldier_request.reset(); | 507 | upgrade_soldier_request_.reset(); |
2262 | 508 | } | 508 | } |
2264 | 509 | if (! m_upgrade_soldier_request) | 509 | if (! upgrade_soldier_request_) |
2265 | 510 | { | 510 | { |
2266 | 511 | //phoo -- I can safely request new soldiers. | 511 | //phoo -- I can safely request new soldiers. |
2268 | 512 | m_doing_upgrade_request = false; | 512 | doing_upgrade_request_ = false; |
2269 | 513 | update_normal_soldier_request(); | 513 | update_normal_soldier_request(); |
2270 | 514 | } | 514 | } |
2271 | 515 | // else -- ohno please help me! Player is in trouble -- evil grin | 515 | // else -- ohno please help me! Player is in trouble -- evil grin |
2272 | @@ -522,9 +522,9 @@ | |||
2273 | 522 | else // capacity == stationed size | 522 | else // capacity == stationed size |
2274 | 523 | { | 523 | { |
2275 | 524 | if | 524 | if |
2279 | 525 | (m_upgrade_soldier_request | 525 | (upgrade_soldier_request_ |
2280 | 526 | && (!(m_upgrade_soldier_request->is_open())) | 526 | && (!(upgrade_soldier_request_->is_open())) |
2281 | 527 | && 1 == m_upgrade_soldier_request->get_count() | 527 | && 1 == upgrade_soldier_request_->get_count() |
2282 | 528 | && (!incd)) | 528 | && (!incd)) |
2283 | 529 | { | 529 | { |
2284 | 530 | drop_least_suited_soldier(false, nullptr); | 530 | drop_least_suited_soldier(false, nullptr); |
2285 | @@ -537,14 +537,14 @@ | |||
2286 | 537 | } | 537 | } |
2287 | 538 | else // not doing upgrade request | 538 | else // not doing upgrade request |
2288 | 539 | { | 539 | { |
2290 | 540 | if ((capacity != stationed) || (m_normal_soldier_request)) | 540 | if ((capacity != stationed) || (normal_soldier_request_)) |
2291 | 541 | update_normal_soldier_request(); | 541 | update_normal_soldier_request(); |
2292 | 542 | 542 | ||
2294 | 543 | if ((capacity == stationed) && (! m_normal_soldier_request)) | 543 | if ((capacity == stationed) && (! normal_soldier_request_)) |
2295 | 544 | { | 544 | { |
2296 | 545 | if (present_soldiers().size() == capacity) | 545 | if (present_soldiers().size() == capacity) |
2297 | 546 | { | 546 | { |
2299 | 547 | m_doing_upgrade_request = true; | 547 | doing_upgrade_request_ = true; |
2300 | 548 | update_upgrade_soldier_request(); | 548 | update_upgrade_soldier_request(); |
2301 | 549 | } | 549 | } |
2302 | 550 | // Note -- if there are non-present stationed soldiers, nothing gets | 550 | // Note -- if there are non-present stationed soldiers, nothing gets |
2303 | @@ -570,7 +570,7 @@ | |||
2304 | 570 | Building::act(game, data); | 570 | Building::act(game, data); |
2305 | 571 | 571 | ||
2306 | 572 | const int32_t timeofgame = game.get_gametime(); | 572 | const int32_t timeofgame = game.get_gametime(); |
2308 | 573 | if (m_normal_soldier_request && m_upgrade_soldier_request) | 573 | if (normal_soldier_request_ && upgrade_soldier_request_) |
2309 | 574 | { | 574 | { |
2310 | 575 | throw wexception("MilitarySite::act: Two soldier requests are ongoing -- should never happen!\n"); | 575 | throw wexception("MilitarySite::act: Two soldier requests are ongoing -- should never happen!\n"); |
2311 | 576 | } | 576 | } |
2312 | @@ -580,13 +580,13 @@ | |||
2313 | 580 | // to keep the game lightweight. | 580 | // to keep the game lightweight. |
2314 | 581 | 581 | ||
2315 | 582 | //TODO(unknown): I would need two new callbacks, to get rid ot this polling. | 582 | //TODO(unknown): I would need two new callbacks, to get rid ot this polling. |
2317 | 583 | if (timeofgame > m_next_swap_soldiers_time) | 583 | if (timeofgame > next_swap_soldiers_time_) |
2318 | 584 | { | 584 | { |
2320 | 585 | m_next_swap_soldiers_time = timeofgame + (m_soldier_upgrade_try ? 20000 : 100000); | 585 | next_swap_soldiers_time_ = timeofgame + (soldier_upgrade_try_ ? 20000 : 100000); |
2321 | 586 | update_soldier_request(); | 586 | update_soldier_request(); |
2322 | 587 | } | 587 | } |
2323 | 588 | 588 | ||
2325 | 589 | if (m_nexthealtime <= timeofgame) { | 589 | if (nexthealtime_ <= timeofgame) { |
2326 | 590 | uint32_t total_heal = descr().get_heal_per_second(); | 590 | uint32_t total_heal = descr().get_heal_per_second(); |
2327 | 591 | std::vector<Soldier *> soldiers = present_soldiers(); | 591 | std::vector<Soldier *> soldiers = present_soldiers(); |
2328 | 592 | uint32_t max_total_level = 0; | 592 | uint32_t max_total_level = 0; |
2329 | @@ -614,7 +614,7 @@ | |||
2330 | 614 | soldier_to_heal->heal(total_heal); | 614 | soldier_to_heal->heal(total_heal); |
2331 | 615 | } | 615 | } |
2332 | 616 | 616 | ||
2334 | 617 | m_nexthealtime = timeofgame + 1000; | 617 | nexthealtime_ = timeofgame + 1000; |
2335 | 618 | schedule_act(game, 1000); | 618 | schedule_act(game, 1000); |
2336 | 619 | } | 619 | } |
2337 | 620 | } | 620 | } |
2338 | @@ -644,7 +644,7 @@ | |||
2339 | 644 | { | 644 | { |
2340 | 645 | if (upcast(Soldier, soldier, &worker)) { | 645 | if (upcast(Soldier, soldier, &worker)) { |
2341 | 646 | // Evict soldiers that have returned home if the capacity is too low | 646 | // Evict soldiers that have returned home if the capacity is too low |
2343 | 647 | if (m_capacity < present_soldiers().size()) { | 647 | if (capacity_ < present_soldiers().size()) { |
2344 | 648 | worker.reset_tasks(game); | 648 | worker.reset_tasks(game); |
2345 | 649 | worker.start_task_leavebuilding(game, true); | 649 | worker.start_task_leavebuilding(game, true); |
2346 | 650 | return true; | 650 | return true; |
2347 | @@ -724,14 +724,14 @@ | |||
2348 | 724 | } | 724 | } |
2349 | 725 | uint32_t MilitarySite::soldier_capacity() const | 725 | uint32_t MilitarySite::soldier_capacity() const |
2350 | 726 | { | 726 | { |
2352 | 727 | return m_capacity; | 727 | return capacity_; |
2353 | 728 | } | 728 | } |
2354 | 729 | 729 | ||
2355 | 730 | void MilitarySite::set_soldier_capacity(uint32_t const capacity) { | 730 | void MilitarySite::set_soldier_capacity(uint32_t const capacity) { |
2356 | 731 | assert(min_soldier_capacity() <= capacity); | 731 | assert(min_soldier_capacity() <= capacity); |
2357 | 732 | assert (capacity <= max_soldier_capacity()); | 732 | assert (capacity <= max_soldier_capacity()); |
2360 | 733 | assert(m_capacity != capacity); | 733 | assert(capacity_ != capacity); |
2361 | 734 | m_capacity = capacity; | 734 | capacity_ = capacity; |
2362 | 735 | update_soldier_request(); | 735 | update_soldier_request(); |
2363 | 736 | } | 736 | } |
2364 | 737 | 737 | ||
2365 | @@ -758,19 +758,19 @@ | |||
2366 | 758 | 758 | ||
2367 | 759 | 759 | ||
2368 | 760 | void MilitarySite::conquer_area(EditorGameBase & egbase) { | 760 | void MilitarySite::conquer_area(EditorGameBase & egbase) { |
2370 | 761 | assert(!m_didconquer); | 761 | assert(!didconquer_); |
2371 | 762 | egbase.conquer_area | 762 | egbase.conquer_area |
2372 | 763 | (PlayerArea<Area<FCoords> > | 763 | (PlayerArea<Area<FCoords> > |
2373 | 764 | (owner().player_number(), | 764 | (owner().player_number(), |
2374 | 765 | Area<FCoords> | 765 | Area<FCoords> |
2375 | 766 | (egbase.map().get_fcoords(get_position()), descr().get_conquers()))); | 766 | (egbase.map().get_fcoords(get_position()), descr().get_conquers()))); |
2377 | 767 | m_didconquer = true; | 767 | didconquer_ = true; |
2378 | 768 | } | 768 | } |
2379 | 769 | 769 | ||
2380 | 770 | 770 | ||
2381 | 771 | bool MilitarySite::can_attack() | 771 | bool MilitarySite::can_attack() |
2382 | 772 | { | 772 | { |
2384 | 773 | return m_didconquer; | 773 | return didconquer_; |
2385 | 774 | } | 774 | } |
2386 | 775 | 775 | ||
2387 | 776 | void MilitarySite::aggressor(Soldier & enemy) | 776 | void MilitarySite::aggressor(Soldier & enemy) |
2388 | @@ -804,7 +804,7 @@ | |||
2389 | 804 | sj.soldier = temp_soldier; | 804 | sj.soldier = temp_soldier; |
2390 | 805 | sj.enemy = &enemy; | 805 | sj.enemy = &enemy; |
2391 | 806 | sj.stayhome = false; | 806 | sj.stayhome = false; |
2393 | 807 | m_soldierjobs.push_back(sj); | 807 | soldierjobs_.push_back(sj); |
2394 | 808 | temp_soldier->update_task_buildingwork(game); | 808 | temp_soldier->update_task_buildingwork(game); |
2395 | 809 | return; | 809 | return; |
2396 | 810 | } | 810 | } |
2397 | @@ -851,7 +851,7 @@ | |||
2398 | 851 | sj.soldier = defender; | 851 | sj.soldier = defender; |
2399 | 852 | sj.enemy = &enemy; | 852 | sj.enemy = &enemy; |
2400 | 853 | sj.stayhome = true; | 853 | sj.stayhome = true; |
2402 | 854 | m_soldierjobs.push_back(sj); | 854 | soldierjobs_.push_back(sj); |
2403 | 855 | 855 | ||
2404 | 856 | defender->update_task_buildingwork(game); | 856 | defender->update_task_buildingwork(game); |
2405 | 857 | 857 | ||
2406 | @@ -871,7 +871,7 @@ | |||
2407 | 871 | pgettext("building", "Lost!"), | 871 | pgettext("building", "Lost!"), |
2408 | 872 | descr().icon_filename(), | 872 | descr().icon_filename(), |
2409 | 873 | _("Militarysite lost!"), | 873 | _("Militarysite lost!"), |
2411 | 874 | descr().m_defeated_enemy_str, | 874 | descr().defeated_enemy_str_, |
2412 | 875 | false); | 875 | false); |
2413 | 876 | } | 876 | } |
2414 | 877 | 877 | ||
2415 | @@ -891,7 +891,7 @@ | |||
2416 | 891 | // In fact we do not conquer it, but place a new building of same type at | 891 | // In fact we do not conquer it, but place a new building of same type at |
2417 | 892 | // the old location. | 892 | // the old location. |
2418 | 893 | 893 | ||
2420 | 894 | Building::FormerBuildings former_buildings = m_old_buildings; | 894 | Building::FormerBuildings former_buildings = old_buildings_; |
2421 | 895 | 895 | ||
2422 | 896 | // The enemy conquers the building | 896 | // The enemy conquers the building |
2423 | 897 | // In fact we do not conquer it, but place a new building of same type at | 897 | // In fact we do not conquer it, but place a new building of same type at |
2424 | @@ -916,7 +916,7 @@ | |||
2425 | 916 | _("Enemy Defeated!"), | 916 | _("Enemy Defeated!"), |
2426 | 917 | newsite->descr().icon_filename(), | 917 | newsite->descr().icon_filename(), |
2427 | 918 | _("Enemy at site defeated!"), | 918 | _("Enemy at site defeated!"), |
2429 | 919 | newsite->descr().m_defeated_you_str, | 919 | newsite->descr().defeated_you_str_, |
2430 | 920 | true); | 920 | true); |
2431 | 921 | 921 | ||
2432 | 922 | return false; | 922 | return false; |
2433 | @@ -952,7 +952,7 @@ | |||
2434 | 952 | (this != militarysite && | 952 | (this != militarysite && |
2435 | 953 | &owner () == &militarysite->owner() && | 953 | &owner () == &militarysite->owner() && |
2436 | 954 | get_size() <= militarysite->get_size() && | 954 | get_size() <= militarysite->get_size() && |
2438 | 955 | militarysite->m_didconquer) | 955 | militarysite->didconquer_) |
2439 | 956 | return true; | 956 | return true; |
2440 | 957 | return false; | 957 | return false; |
2441 | 958 | } | 958 | } |
2442 | @@ -969,7 +969,7 @@ | |||
2443 | 969 | pgettext("building", "Attack!"), | 969 | pgettext("building", "Attack!"), |
2444 | 970 | descr().icon_filename(), | 970 | descr().icon_filename(), |
2445 | 971 | _("You are under attack"), | 971 | _("You are under attack"), |
2447 | 972 | discovered ? descr().m_aggressor_str : descr().m_attack_str, | 972 | discovered ? descr().aggressor_str_ : descr().attack_str_, |
2448 | 973 | false, | 973 | false, |
2449 | 974 | 60 * 1000, 5); | 974 | 60 * 1000, 5); |
2450 | 975 | } | 975 | } |
2451 | @@ -982,7 +982,7 @@ | |||
2452 | 982 | */ | 982 | */ |
2453 | 983 | void MilitarySite::set_requirements (const Requirements & r) | 983 | void MilitarySite::set_requirements (const Requirements & r) |
2454 | 984 | { | 984 | { |
2456 | 985 | m_soldier_requirements = r; | 985 | soldier_requirements_ = r; |
2457 | 986 | } | 986 | } |
2458 | 987 | 987 | ||
2459 | 988 | /* | 988 | /* |
2460 | @@ -992,7 +992,7 @@ | |||
2461 | 992 | */ | 992 | */ |
2462 | 993 | void MilitarySite::clear_requirements () | 993 | void MilitarySite::clear_requirements () |
2463 | 994 | { | 994 | { |
2465 | 995 | m_soldier_requirements = Requirements(); | 995 | soldier_requirements_ = Requirements(); |
2466 | 996 | } | 996 | } |
2467 | 997 | 997 | ||
2468 | 998 | void MilitarySite::send_attacker | 998 | void MilitarySite::send_attacker |
2469 | @@ -1007,7 +1007,7 @@ | |||
2470 | 1007 | sj.soldier = &soldier; | 1007 | sj.soldier = &soldier; |
2471 | 1008 | sj.enemy = ⌖ | 1008 | sj.enemy = ⌖ |
2472 | 1009 | sj.stayhome = false; | 1009 | sj.stayhome = false; |
2474 | 1010 | m_soldierjobs.push_back(sj); | 1010 | soldierjobs_.push_back(sj); |
2475 | 1011 | 1011 | ||
2476 | 1012 | soldier.update_task_buildingwork | 1012 | soldier.update_task_buildingwork |
2477 | 1013 | (dynamic_cast<Game&>(owner().egbase())); | 1013 | (dynamic_cast<Game&>(owner().egbase())); |
2478 | @@ -1016,7 +1016,7 @@ | |||
2479 | 1016 | 1016 | ||
2480 | 1017 | bool MilitarySite::has_soldier_job(Soldier & soldier) | 1017 | bool MilitarySite::has_soldier_job(Soldier & soldier) |
2481 | 1018 | { | 1018 | { |
2483 | 1019 | for (const SoldierJob& temp_job : m_soldierjobs) { | 1019 | for (const SoldierJob& temp_job : soldierjobs_) { |
2484 | 1020 | if (temp_job.soldier == &soldier) { | 1020 | if (temp_job.soldier == &soldier) { |
2485 | 1021 | return true; | 1021 | return true; |
2486 | 1022 | } | 1022 | } |
2487 | @@ -1032,14 +1032,14 @@ | |||
2488 | 1032 | MapObject * MilitarySite::pop_soldier_job | 1032 | MapObject * MilitarySite::pop_soldier_job |
2489 | 1033 | (Soldier * const soldier, bool * const stayhome) | 1033 | (Soldier * const soldier, bool * const stayhome) |
2490 | 1034 | { | 1034 | { |
2493 | 1035 | for (std::vector<SoldierJob>::iterator job_iter = m_soldierjobs.begin(); | 1035 | for (std::vector<SoldierJob>::iterator job_iter = soldierjobs_.begin(); |
2494 | 1036 | job_iter != m_soldierjobs.end(); ++job_iter) | 1036 | job_iter != soldierjobs_.end(); ++job_iter) |
2495 | 1037 | { | 1037 | { |
2496 | 1038 | if (job_iter->soldier == soldier) { | 1038 | if (job_iter->soldier == soldier) { |
2497 | 1039 | MapObject * const enemy = job_iter->enemy.get(owner().egbase()); | 1039 | MapObject * const enemy = job_iter->enemy.get(owner().egbase()); |
2498 | 1040 | if (stayhome) | 1040 | if (stayhome) |
2499 | 1041 | *stayhome = job_iter->stayhome; | 1041 | *stayhome = job_iter->stayhome; |
2501 | 1042 | m_soldierjobs.erase(job_iter); | 1042 | soldierjobs_.erase(job_iter); |
2502 | 1043 | return enemy; | 1043 | return enemy; |
2503 | 1044 | } | 1044 | } |
2504 | 1045 | } | 1045 | } |
2505 | @@ -1058,13 +1058,13 @@ | |||
2506 | 1058 | bool | 1058 | bool |
2507 | 1059 | MilitarySite::update_upgrade_requirements() | 1059 | MilitarySite::update_upgrade_requirements() |
2508 | 1060 | { | 1060 | { |
2511 | 1061 | int32_t soldier_upgrade_required_min = m_soldier_upgrade_requirements.get_min(); | 1061 | int32_t soldier_upgrade_required_min = soldier_upgrade_requirements_.get_min(); |
2512 | 1062 | int32_t soldier_upgrade_required_max = m_soldier_upgrade_requirements.get_max(); | 1062 | int32_t soldier_upgrade_required_max = soldier_upgrade_requirements_.get_max(); |
2513 | 1063 | 1063 | ||
2515 | 1064 | if (kPrefersHeroes != m_soldier_preference && kPrefersRookies != m_soldier_preference) | 1064 | if (kPrefersHeroes != soldier_preference_ && kPrefersRookies != soldier_preference_) |
2516 | 1065 | { | 1065 | { |
2519 | 1066 | log("MilitarySite::swapSoldiers: error: Unknown player preference %d.\n", m_soldier_preference); | 1066 | log("MilitarySite::swapSoldiers: error: Unknown player preference %d.\n", soldier_preference_); |
2520 | 1067 | m_soldier_upgrade_try = false; | 1067 | soldier_upgrade_try_ = false; |
2521 | 1068 | return false; | 1068 | return false; |
2522 | 1069 | } | 1069 | } |
2523 | 1070 | 1070 | ||
2524 | @@ -1078,29 +1078,29 @@ | |||
2525 | 1078 | 1078 | ||
2526 | 1079 | // Micro-optimization: I assume that the majority of military sites have only level-zero | 1079 | // Micro-optimization: I assume that the majority of military sites have only level-zero |
2527 | 1080 | // soldiers and prefer rookies. Handle them separately. | 1080 | // soldiers and prefer rookies. Handle them separately. |
2530 | 1081 | m_soldier_upgrade_try = true; | 1081 | soldier_upgrade_try_ = true; |
2531 | 1082 | if (kPrefersRookies == m_soldier_preference) { | 1082 | if (kPrefersRookies == soldier_preference_) { |
2532 | 1083 | if (0 == wg_level) | 1083 | if (0 == wg_level) |
2533 | 1084 | { | 1084 | { |
2535 | 1085 | m_soldier_upgrade_try = false; | 1085 | soldier_upgrade_try_ = false; |
2536 | 1086 | return false; | 1086 | return false; |
2537 | 1087 | } | 1087 | } |
2538 | 1088 | } | 1088 | } |
2539 | 1089 | 1089 | ||
2540 | 1090 | // Now I actually build the new requirements. | 1090 | // Now I actually build the new requirements. |
2543 | 1091 | int32_t reqmin = kPrefersHeroes == m_soldier_preference ? 1 + wg_level : 0; | 1091 | int32_t reqmin = kPrefersHeroes == soldier_preference_ ? 1 + wg_level : 0; |
2544 | 1092 | int32_t reqmax = kPrefersHeroes == m_soldier_preference ? SHRT_MAX : wg_level - 1; | 1092 | int32_t reqmax = kPrefersHeroes == soldier_preference_ ? SHRT_MAX : wg_level - 1; |
2545 | 1093 | 1093 | ||
2546 | 1094 | bool maxchanged = reqmax != soldier_upgrade_required_max; | 1094 | bool maxchanged = reqmax != soldier_upgrade_required_max; |
2547 | 1095 | bool minchanged = reqmin != soldier_upgrade_required_min; | 1095 | bool minchanged = reqmin != soldier_upgrade_required_min; |
2548 | 1096 | 1096 | ||
2549 | 1097 | if (maxchanged || minchanged) | 1097 | if (maxchanged || minchanged) |
2550 | 1098 | { | 1098 | { |
2552 | 1099 | if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open())) | 1099 | if (upgrade_soldier_request_ && (upgrade_soldier_request_->is_open())) |
2553 | 1100 | { | 1100 | { |
2555 | 1101 | m_upgrade_soldier_request.reset(); | 1101 | upgrade_soldier_request_.reset(); |
2556 | 1102 | } | 1102 | } |
2558 | 1103 | m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax); | 1103 | soldier_upgrade_requirements_ = RequireAttribute(atrTotal, reqmin, reqmax); |
2559 | 1104 | 1104 | ||
2560 | 1105 | return true; | 1105 | return true; |
2561 | 1106 | } | 1106 | } |
2562 | @@ -1114,8 +1114,8 @@ | |||
2563 | 1114 | MilitarySite::set_soldier_preference(MilitarySite::SoldierPreference p) | 1114 | MilitarySite::set_soldier_preference(MilitarySite::SoldierPreference p) |
2564 | 1115 | { | 1115 | { |
2565 | 1116 | assert(kPrefersHeroes == p || kPrefersRookies == p); | 1116 | assert(kPrefersHeroes == p || kPrefersRookies == p); |
2568 | 1117 | m_soldier_preference = p; | 1117 | soldier_preference_ = p; |
2569 | 1118 | m_next_swap_soldiers_time = 0; | 1118 | next_swap_soldiers_time_ = 0; |
2570 | 1119 | } | 1119 | } |
2571 | 1120 | 1120 | ||
2572 | 1121 | } | 1121 | } |
2573 | 1122 | 1122 | ||
2574 | === modified file 'src/logic/map_objects/tribes/militarysite.h' | |||
2575 | --- src/logic/map_objects/tribes/militarysite.h 2016-01-31 15:31:00 +0000 | |||
2576 | +++ src/logic/map_objects/tribes/militarysite.h 2016-02-08 18:17:36 +0000 | |||
2577 | @@ -42,26 +42,26 @@ | |||
2578 | 42 | 42 | ||
2579 | 43 | Building & create_object() const override; | 43 | Building & create_object() const override; |
2580 | 44 | 44 | ||
2582 | 45 | uint32_t get_conquers() const override {return m_conquer_radius;} | 45 | uint32_t get_conquers() const override {return conquer_radius_;} |
2583 | 46 | uint32_t get_max_number_of_soldiers () const { | 46 | uint32_t get_max_number_of_soldiers () const { |
2585 | 47 | return m_num_soldiers; | 47 | return num_soldiers_; |
2586 | 48 | } | 48 | } |
2587 | 49 | uint32_t get_heal_per_second () const { | 49 | uint32_t get_heal_per_second () const { |
2589 | 50 | return m_heal_per_second; | 50 | return heal_per_second_; |
2590 | 51 | } | 51 | } |
2591 | 52 | 52 | ||
2598 | 53 | bool m_prefers_heroes_at_start; | 53 | bool prefers_heroes_at_start_; |
2599 | 54 | std::string m_occupied_str; | 54 | std::string occupied_str_; |
2600 | 55 | std::string m_aggressor_str; | 55 | std::string aggressor_str_; |
2601 | 56 | std::string m_attack_str; | 56 | std::string attack_str_; |
2602 | 57 | std::string m_defeated_enemy_str; | 57 | std::string defeated_enemy_str_; |
2603 | 58 | std::string m_defeated_you_str; | 58 | std::string defeated_you_str_; |
2604 | 59 | 59 | ||
2605 | 60 | 60 | ||
2606 | 61 | private: | 61 | private: |
2610 | 62 | uint32_t m_conquer_radius; | 62 | uint32_t conquer_radius_; |
2611 | 63 | uint32_t m_num_soldiers; | 63 | uint32_t num_soldiers_; |
2612 | 64 | uint32_t m_heal_per_second; | 64 | uint32_t heal_per_second_; |
2613 | 65 | DISALLOW_COPY_AND_ASSIGN(MilitarySiteDescr); | 65 | DISALLOW_COPY_AND_ASSIGN(MilitarySiteDescr); |
2614 | 66 | }; | 66 | }; |
2615 | 67 | 67 | ||
2616 | @@ -115,7 +115,7 @@ | |||
2617 | 115 | void set_requirements (const Requirements &); | 115 | void set_requirements (const Requirements &); |
2618 | 116 | void clear_requirements(); | 116 | void clear_requirements(); |
2619 | 117 | const Requirements & get_requirements () const { | 117 | const Requirements & get_requirements () const { |
2621 | 118 | return m_soldier_requirements; | 118 | return soldier_requirements_; |
2622 | 119 | } | 119 | } |
2623 | 120 | 120 | ||
2624 | 121 | void reinit_after_conqueration(Game &); | 121 | void reinit_after_conqueration(Game &); |
2625 | @@ -124,7 +124,7 @@ | |||
2626 | 124 | 124 | ||
2627 | 125 | void set_soldier_preference(SoldierPreference); | 125 | void set_soldier_preference(SoldierPreference); |
2628 | 126 | SoldierPreference get_soldier_preference() const { | 126 | SoldierPreference get_soldier_preference() const { |
2630 | 127 | return m_soldier_preference; | 127 | return soldier_preference_; |
2631 | 128 | } | 128 | } |
2632 | 129 | 129 | ||
2633 | 130 | protected: | 130 | protected: |
2634 | @@ -153,28 +153,28 @@ | |||
2635 | 153 | 153 | ||
2636 | 154 | 154 | ||
2637 | 155 | private: | 155 | private: |
2644 | 156 | Requirements m_soldier_requirements; // This is used to grab a bunch of soldiers: Anything goes | 156 | Requirements soldier_requirements_; // This is used to grab a bunch of soldiers: Anything goes |
2645 | 157 | RequireAttribute m_soldier_upgrade_requirements; // This is used when exchanging soldiers. | 157 | RequireAttribute soldier_upgrade_requirements_; // This is used when exchanging soldiers. |
2646 | 158 | std::unique_ptr<Request> m_normal_soldier_request; // filling the site | 158 | std::unique_ptr<Request> normal_soldier_request_; // filling the site |
2647 | 159 | std::unique_ptr<Request> m_upgrade_soldier_request; // seeking for better soldiers | 159 | std::unique_ptr<Request> upgrade_soldier_request_; // seeking for better soldiers |
2648 | 160 | bool m_didconquer; | 160 | bool didconquer_; |
2649 | 161 | uint32_t m_capacity; | 161 | uint32_t capacity_; |
2650 | 162 | 162 | ||
2651 | 163 | /** | 163 | /** |
2652 | 164 | * Next gametime where we should heal something. | 164 | * Next gametime where we should heal something. |
2653 | 165 | */ | 165 | */ |
2655 | 166 | int32_t m_nexthealtime; | 166 | int32_t nexthealtime_; |
2656 | 167 | 167 | ||
2657 | 168 | struct SoldierJob { | 168 | struct SoldierJob { |
2658 | 169 | Soldier * soldier; | 169 | Soldier * soldier; |
2659 | 170 | ObjectPointer enemy; | 170 | ObjectPointer enemy; |
2660 | 171 | bool stayhome; | 171 | bool stayhome; |
2661 | 172 | }; | 172 | }; |
2667 | 173 | std::vector<SoldierJob> m_soldierjobs; | 173 | std::vector<SoldierJob> soldierjobs_; |
2668 | 174 | SoldierPreference m_soldier_preference; | 174 | SoldierPreference soldier_preference_; |
2669 | 175 | int32_t m_next_swap_soldiers_time; | 175 | int32_t next_swap_soldiers_time_; |
2670 | 176 | bool m_soldier_upgrade_try; // optimization -- if everybody is zero-level, do not downgrade | 176 | bool soldier_upgrade_try_; // optimization -- if everybody is zero-level, do not downgrade |
2671 | 177 | bool m_doing_upgrade_request; | 177 | bool doing_upgrade_request_; |
2672 | 178 | }; | 178 | }; |
2673 | 179 | 179 | ||
2674 | 180 | } | 180 | } |
2675 | 181 | 181 | ||
2676 | === modified file 'src/logic/map_objects/tribes/partially_finished_building.cc' | |||
2677 | --- src/logic/map_objects/tribes/partially_finished_building.cc 2016-01-28 05:24:34 +0000 | |||
2678 | +++ src/logic/map_objects/tribes/partially_finished_building.cc 2016-02-08 18:17:36 +0000 | |||
2679 | @@ -33,12 +33,12 @@ | |||
2680 | 33 | PartiallyFinishedBuilding::PartiallyFinishedBuilding | 33 | PartiallyFinishedBuilding::PartiallyFinishedBuilding |
2681 | 34 | (const BuildingDescr & gdescr) : | 34 | (const BuildingDescr & gdescr) : |
2682 | 35 | Building (gdescr), | 35 | Building (gdescr), |
2689 | 36 | m_building (nullptr), | 36 | building_ (nullptr), |
2690 | 37 | m_builder_request(nullptr), | 37 | builder_request_(nullptr), |
2691 | 38 | m_working (false), | 38 | working_ (false), |
2692 | 39 | m_work_steptime (0), | 39 | work_steptime_ (0), |
2693 | 40 | m_work_completed (0), | 40 | work_completed_ (0), |
2694 | 41 | m_work_steps (0) | 41 | work_steps_ (0) |
2695 | 42 | {} | 42 | {} |
2696 | 43 | 43 | ||
2697 | 44 | /* | 44 | /* |
2698 | @@ -47,22 +47,22 @@ | |||
2699 | 47 | =============== | 47 | =============== |
2700 | 48 | */ | 48 | */ |
2701 | 49 | void PartiallyFinishedBuilding::set_building(const BuildingDescr & building_descr) { | 49 | void PartiallyFinishedBuilding::set_building(const BuildingDescr & building_descr) { |
2703 | 50 | assert(!m_building); | 50 | assert(!building_); |
2704 | 51 | 51 | ||
2706 | 52 | m_building = &building_descr; | 52 | building_ = &building_descr; |
2707 | 53 | } | 53 | } |
2708 | 54 | 54 | ||
2709 | 55 | void PartiallyFinishedBuilding::cleanup(EditorGameBase & egbase) { | 55 | void PartiallyFinishedBuilding::cleanup(EditorGameBase & egbase) { |
2713 | 56 | if (m_builder_request) { | 56 | if (builder_request_) { |
2714 | 57 | delete m_builder_request; | 57 | delete builder_request_; |
2715 | 58 | m_builder_request = nullptr; | 58 | builder_request_ = nullptr; |
2716 | 59 | } | 59 | } |
2717 | 60 | 60 | ||
2719 | 61 | for (WaresQueue * temp_ware : m_wares) { | 61 | for (WaresQueue * temp_ware : wares_) { |
2720 | 62 | temp_ware->cleanup(); | 62 | temp_ware->cleanup(); |
2721 | 63 | delete temp_ware; | 63 | delete temp_ware; |
2722 | 64 | } | 64 | } |
2724 | 65 | m_wares.clear(); | 65 | wares_.clear(); |
2725 | 66 | 66 | ||
2726 | 67 | Building::cleanup(egbase); | 67 | Building::cleanup(egbase); |
2727 | 68 | } | 68 | } |
2728 | @@ -73,7 +73,7 @@ | |||
2729 | 73 | if (upcast(Game, game, &egbase)) | 73 | if (upcast(Game, game, &egbase)) |
2730 | 74 | request_builder(*game); | 74 | request_builder(*game); |
2731 | 75 | 75 | ||
2733 | 76 | g_sound_handler.play_fx("create_construction_site", m_position, 255); | 76 | g_sound_handler.play_fx("create_construction_site", position_, 255); |
2734 | 77 | } | 77 | } |
2735 | 78 | 78 | ||
2736 | 79 | /* | 79 | /* |
2737 | @@ -85,16 +85,16 @@ | |||
2738 | 85 | void PartiallyFinishedBuilding::set_economy(Economy * const e) | 85 | void PartiallyFinishedBuilding::set_economy(Economy * const e) |
2739 | 86 | { | 86 | { |
2740 | 87 | if (Economy * const old = get_economy()) { | 87 | if (Economy * const old = get_economy()) { |
2742 | 88 | for (WaresQueue * temp_ware : m_wares) { | 88 | for (WaresQueue * temp_ware : wares_) { |
2743 | 89 | temp_ware->remove_from_economy(*old); | 89 | temp_ware->remove_from_economy(*old); |
2744 | 90 | } | 90 | } |
2745 | 91 | } | 91 | } |
2746 | 92 | Building::set_economy(e); | 92 | Building::set_economy(e); |
2749 | 93 | if (m_builder_request) | 93 | if (builder_request_) |
2750 | 94 | m_builder_request->set_economy(e); | 94 | builder_request_->set_economy(e); |
2751 | 95 | 95 | ||
2752 | 96 | if (e) | 96 | if (e) |
2754 | 97 | for (WaresQueue * temp_ware : m_wares) { | 97 | for (WaresQueue * temp_ware : wares_) { |
2755 | 98 | temp_ware->add_to_economy(*e); | 98 | temp_ware->add_to_economy(*e); |
2756 | 99 | } | 99 | } |
2757 | 100 | } | 100 | } |
2758 | @@ -107,9 +107,9 @@ | |||
2759 | 107 | =============== | 107 | =============== |
2760 | 108 | */ | 108 | */ |
2761 | 109 | void PartiallyFinishedBuilding::request_builder(Game &) { | 109 | void PartiallyFinishedBuilding::request_builder(Game &) { |
2763 | 110 | assert(!m_builder.is_set() && !m_builder_request); | 110 | assert(!builder_.is_set() && !builder_request_); |
2764 | 111 | 111 | ||
2766 | 112 | m_builder_request = | 112 | builder_request_ = |
2767 | 113 | new Request | 113 | new Request |
2768 | 114 | (*this, | 114 | (*this, |
2769 | 115 | owner().tribe().builder(), | 115 | owner().tribe().builder(), |
2770 | @@ -123,7 +123,7 @@ | |||
2771 | 123 | =============== | 123 | =============== |
2772 | 124 | */ | 124 | */ |
2773 | 125 | int32_t PartiallyFinishedBuilding::get_size() const { | 125 | int32_t PartiallyFinishedBuilding::get_size() const { |
2775 | 126 | return m_building->get_size(); | 126 | return building_->get_size(); |
2776 | 127 | } | 127 | } |
2777 | 128 | 128 | ||
2778 | 129 | /* | 129 | /* |
2779 | @@ -149,7 +149,7 @@ | |||
2780 | 149 | */ | 149 | */ |
2781 | 150 | const Image* PartiallyFinishedBuilding::representative_image() const | 150 | const Image* PartiallyFinishedBuilding::representative_image() const |
2782 | 151 | { | 151 | { |
2784 | 152 | return m_building->representative_image(&owner().get_playercolor()); | 152 | return building_->representative_image(&owner().get_playercolor()); |
2785 | 153 | } | 153 | } |
2786 | 154 | 154 | ||
2787 | 155 | 155 | ||
2788 | @@ -166,8 +166,8 @@ | |||
2789 | 166 | uint32_t thisstep = 0; | 166 | uint32_t thisstep = 0; |
2790 | 167 | 167 | ||
2791 | 168 | uint32_t ts = build_step_time(); | 168 | uint32_t ts = build_step_time(); |
2794 | 169 | if (m_working) { | 169 | if (working_) { |
2795 | 170 | thisstep = ts - (m_work_steptime - time); | 170 | thisstep = ts - (work_steptime_ - time); |
2796 | 171 | // The check below is necessary because we drive construction via | 171 | // The check below is necessary because we drive construction via |
2797 | 172 | // the construction worker in get_building_work(), and there can be | 172 | // the construction worker in get_building_work(), and there can be |
2798 | 173 | // a small delay between the worker completing his job and requesting | 173 | // a small delay between the worker completing his job and requesting |
2799 | @@ -176,9 +176,9 @@ | |||
2800 | 176 | thisstep = ts; | 176 | thisstep = ts; |
2801 | 177 | } | 177 | } |
2802 | 178 | thisstep = (thisstep << 16) / ts; | 178 | thisstep = (thisstep << 16) / ts; |
2806 | 179 | uint32_t total = (thisstep + (m_work_completed << 16)); | 179 | uint32_t total = (thisstep + (work_completed_ << 16)); |
2807 | 180 | if (m_work_steps) | 180 | if (work_steps_) |
2808 | 181 | total /= m_work_steps; | 181 | total /= work_steps_; |
2809 | 182 | 182 | ||
2810 | 183 | assert(total <= (1 << 16)); | 183 | assert(total <= (1 << 16)); |
2811 | 184 | 184 | ||
2812 | @@ -203,10 +203,10 @@ | |||
2813 | 203 | 203 | ||
2814 | 204 | PartiallyFinishedBuilding & b = dynamic_cast<PartiallyFinishedBuilding&>(target); | 204 | PartiallyFinishedBuilding & b = dynamic_cast<PartiallyFinishedBuilding&>(target); |
2815 | 205 | 205 | ||
2817 | 206 | b.m_builder = w; | 206 | b.builder_ = w; |
2818 | 207 | 207 | ||
2819 | 208 | delete &rq; | 208 | delete &rq; |
2821 | 209 | b.m_builder_request = nullptr; | 209 | b.builder_request_ = nullptr; |
2822 | 210 | 210 | ||
2823 | 211 | w->start_task_buildingwork(game); | 211 | w->start_task_buildingwork(game); |
2824 | 212 | b.set_seeing(true); | 212 | b.set_seeing(true); |
2825 | 213 | 213 | ||
2826 | === modified file 'src/logic/map_objects/tribes/partially_finished_building.h' | |||
2827 | --- src/logic/map_objects/tribes/partially_finished_building.h 2015-11-28 22:29:26 +0000 | |||
2828 | +++ src/logic/map_objects/tribes/partially_finished_building.h 2016-02-08 18:17:36 +0000 | |||
2829 | @@ -50,11 +50,11 @@ | |||
2830 | 50 | void init (EditorGameBase &) override; | 50 | void init (EditorGameBase &) override; |
2831 | 51 | void set_economy(Economy *) override; | 51 | void set_economy(Economy *) override; |
2832 | 52 | 52 | ||
2835 | 53 | uint32_t get_nrwaresqueues() {return m_wares.size();} | 53 | uint32_t get_nrwaresqueues() {return wares_.size();} |
2836 | 54 | WaresQueue * get_waresqueue(uint32_t const idx) {return m_wares[idx];} | 54 | WaresQueue * get_waresqueue(uint32_t const idx) {return wares_[idx];} |
2837 | 55 | 55 | ||
2838 | 56 | uint32_t get_built_per64k() const; | 56 | uint32_t get_built_per64k() const; |
2840 | 57 | Request * get_builder_request() {return m_builder_request;} | 57 | Request * get_builder_request() {return builder_request_;} |
2841 | 58 | static void request_builder_callback(Game &, Request &, DescriptionIndex, Worker *, PlayerImmovable &); | 58 | static void request_builder_callback(Game &, Request &, DescriptionIndex, Worker *, PlayerImmovable &); |
2842 | 59 | 59 | ||
2843 | 60 | private: | 60 | private: |
2844 | @@ -64,19 +64,19 @@ | |||
2845 | 64 | virtual uint32_t build_step_time() const = 0; | 64 | virtual uint32_t build_step_time() const = 0; |
2846 | 65 | 65 | ||
2847 | 66 | protected: | 66 | protected: |
2849 | 67 | const BuildingDescr * m_building; // type of building that was or will become | 67 | const BuildingDescr * building_; // type of building that was or will become |
2850 | 68 | 68 | ||
2853 | 69 | Request * m_builder_request; | 69 | Request * builder_request_; |
2854 | 70 | OPtr<Worker> m_builder; | 70 | OPtr<Worker> builder_; |
2855 | 71 | 71 | ||
2856 | 72 | using Wares = std::vector<WaresQueue *>; | 72 | using Wares = std::vector<WaresQueue *>; |
2858 | 73 | Wares m_wares; | 73 | Wares wares_; |
2859 | 74 | 74 | ||
2865 | 75 | bool m_working; // true if the builder is currently working | 75 | bool working_; // true if the builder is currently working |
2866 | 76 | uint32_t m_work_steptime; // time when next step is completed | 76 | uint32_t work_steptime_; // time when next step is completed |
2867 | 77 | uint32_t m_work_completed; // how many steps have we done so far? | 77 | uint32_t work_completed_; // how many steps have we done so far? |
2868 | 78 | uint32_t m_work_steps; // how many steps (= wares) until we're done? | 78 | uint32_t work_steps_; // how many steps (= wares) until we're done? |
2869 | 79 | //Player::ConstructionsiteInformation * m_info; // asked for by player point of view for the gameview | 79 | //Player::ConstructionsiteInformation * info_; // asked for by player point of view for the gameview |
2870 | 80 | }; | 80 | }; |
2871 | 81 | 81 | ||
2872 | 82 | } | 82 | } |
2873 | 83 | 83 | ||
2874 | === modified file 'src/logic/map_objects/tribes/production_program.cc' | |||
2875 | --- src/logic/map_objects/tribes/production_program.cc 2016-02-01 16:18:17 +0000 | |||
2876 | +++ src/logic/map_objects/tribes/production_program.cc 2016-02-08 18:17:36 +0000 | |||
2877 | @@ -722,7 +722,7 @@ | |||
2878 | 722 | 722 | ||
2879 | 723 | for (const std::pair<uint32_t, std::set<std::string> >& area_info : worker_workarea_info) { | 723 | for (const std::pair<uint32_t, std::set<std::string> >& area_info : worker_workarea_info) { |
2880 | 724 | std::set<std::string> & building_radius_infos = | 724 | std::set<std::string> & building_radius_infos = |
2882 | 725 | descr->m_workarea_info[area_info.first]; | 725 | descr->workarea_info_[area_info.first]; |
2883 | 726 | 726 | ||
2884 | 727 | for (const std::string& worker_descname : area_info.second) { | 727 | for (const std::string& worker_descname : area_info.second) { |
2885 | 728 | std::string description = descr->descname(); | 728 | std::string description = descr->descname(); |
2886 | @@ -1228,7 +1228,7 @@ | |||
2887 | 1228 | % world.get_resource(m_resource)->descname()) | 1228 | % world.get_resource(m_resource)->descname()) |
2888 | 1229 | .str(); | 1229 | .str(); |
2889 | 1230 | 1230 | ||
2891 | 1231 | descr->m_workarea_info[m_distance].insert(description); | 1231 | descr->workarea_info_[m_distance].insert(description); |
2892 | 1232 | } catch (const WException & e) { | 1232 | } catch (const WException & e) { |
2893 | 1233 | throw GameDataError("mine: %s", e.what()); | 1233 | throw GameDataError("mine: %s", e.what()); |
2894 | 1234 | } | 1234 | } |
2895 | @@ -1546,7 +1546,7 @@ | |||
2896 | 1546 | void ProductionProgram::ActPlayFX::execute | 1546 | void ProductionProgram::ActPlayFX::execute |
2897 | 1547 | (Game & game, ProductionSite & ps) const | 1547 | (Game & game, ProductionSite & ps) const |
2898 | 1548 | { | 1548 | { |
2900 | 1549 | g_sound_handler.play_fx(name, ps.m_position, priority); | 1549 | g_sound_handler.play_fx(name, ps.position_, priority); |
2901 | 1550 | return ps.program_step(game); | 1550 | return ps.program_step(game); |
2902 | 1551 | } | 1551 | } |
2903 | 1552 | 1552 | ||
2904 | @@ -1562,7 +1562,7 @@ | |||
2905 | 1562 | workerprogram = params[1]; | 1562 | workerprogram = params[1]; |
2906 | 1563 | radius = boost::lexical_cast<uint32_t>(params[2]); | 1563 | radius = boost::lexical_cast<uint32_t>(params[2]); |
2907 | 1564 | 1564 | ||
2909 | 1565 | std::set<std::string> & building_radius_infos = descr->m_workarea_info[radius]; | 1565 | std::set<std::string> & building_radius_infos = descr->workarea_info_[radius]; |
2910 | 1566 | std::string description = descr->name() + ' ' + production_program_name; | 1566 | std::string description = descr->name() + ' ' + production_program_name; |
2911 | 1567 | description += " construct "; | 1567 | description += " construct "; |
2912 | 1568 | description += objectname; | 1568 | description += objectname; |
2913 | 1569 | 1569 | ||
2914 | === modified file 'src/logic/map_objects/tribes/productionsite.cc' | |||
2915 | --- src/logic/map_objects/tribes/productionsite.cc 2016-01-23 16:35:30 +0000 | |||
2916 | +++ src/logic/map_objects/tribes/productionsite.cc 2016-02-08 18:17:36 +0000 | |||
2917 | @@ -688,7 +688,7 @@ | |||
2918 | 688 | if (state.program->size() <= state.ip) | 688 | if (state.program->size() <= state.ip) |
2919 | 689 | return program_end(game, Completed); | 689 | return program_end(game, Completed); |
2920 | 690 | 690 | ||
2922 | 691 | if (m_anim != descr().get_animation(m_default_anim)) { | 691 | if (anim_ != descr().get_animation(m_default_anim)) { |
2923 | 692 | // Restart idle animation, which is the default | 692 | // Restart idle animation, which is the default |
2924 | 693 | start_animation(game, descr().get_animation(m_default_anim)); | 693 | start_animation(game, descr().get_animation(m_default_anim)); |
2925 | 694 | } | 694 | } |
2926 | 695 | 695 | ||
2927 | === modified file 'src/logic/map_objects/tribes/warehouse.cc' | |||
2928 | --- src/logic/map_objects/tribes/warehouse.cc 2016-02-07 06:10:47 +0000 | |||
2929 | +++ src/logic/map_objects/tribes/warehouse.cc 2016-02-08 18:17:36 +0000 | |||
2930 | @@ -261,7 +261,7 @@ | |||
2931 | 261 | m_heal_per_second = table.get_int("heal_per_second"); | 261 | m_heal_per_second = table.get_int("heal_per_second"); |
2932 | 262 | if (table.has_key("conquers")) { | 262 | if (table.has_key("conquers")) { |
2933 | 263 | m_conquers = table.get_int("conquers"); | 263 | m_conquers = table.get_int("conquers"); |
2935 | 264 | m_workarea_info[m_conquers].insert(descname() + " conquer"); | 264 | workarea_info_[m_conquers].insert(descname() + " conquer"); |
2936 | 265 | } | 265 | } |
2937 | 266 | } | 266 | } |
2938 | 267 | 267 | ||
2939 | @@ -629,7 +629,7 @@ | |||
2940 | 629 | (PlayerArea<Area<FCoords> > | 629 | (PlayerArea<Area<FCoords> > |
2941 | 630 | (owner().player_number(), | 630 | (owner().player_number(), |
2942 | 631 | Area<FCoords>(map.get_fcoords(get_position()), conquer_radius)), | 631 | Area<FCoords>(map.get_fcoords(get_position()), conquer_radius)), |
2944 | 632 | m_defeating_player); | 632 | defeating_player_); |
2945 | 633 | 633 | ||
2946 | 634 | // Unsee the area that we started seeing in init() | 634 | // Unsee the area that we started seeing in init() |
2947 | 635 | Player & player = owner(); | 635 | Player & player = owner(); |
2948 | @@ -903,7 +903,7 @@ | |||
2949 | 903 | // NOTE: This code lies about the TrainingAttributes of the new worker | 903 | // NOTE: This code lies about the TrainingAttributes of the new worker |
2950 | 904 | m_supply->remove_workers(worker_id, 1); | 904 | m_supply->remove_workers(worker_id, 1); |
2951 | 905 | const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(worker_id); | 905 | const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(worker_id); |
2953 | 906 | return workerdescr.create(game, owner(), this, m_position); | 906 | return workerdescr.create(game, owner(), this, position_); |
2954 | 907 | } | 907 | } |
2955 | 908 | } | 908 | } |
2956 | 909 | 909 | ||
2957 | @@ -1105,7 +1105,7 @@ | |||
2958 | 1105 | remove_workers(owner().tribe().safe_worker_index(input), buildcost.second); | 1105 | remove_workers(owner().tribe().safe_worker_index(input), buildcost.second); |
2959 | 1106 | } | 1106 | } |
2960 | 1107 | 1107 | ||
2962 | 1108 | incorporate_worker(game, &w_desc.create(game, owner(), this, m_position)); | 1108 | incorporate_worker(game, &w_desc.create(game, owner(), this, position_)); |
2963 | 1109 | 1109 | ||
2964 | 1110 | // Update PlannedWorkers::amount here if appropriate, because this function | 1110 | // Update PlannedWorkers::amount here if appropriate, because this function |
2965 | 1111 | // may have been called directly by the Economy. | 1111 | // may have been called directly by the Economy. |
2966 | 1112 | 1112 | ||
2967 | === modified file 'src/logic/player.cc' | |||
2968 | --- src/logic/player.cc 2016-01-28 05:24:34 +0000 | |||
2969 | +++ src/logic/player.cc 2016-02-08 18:17:36 +0000 | |||
2970 | @@ -1253,9 +1253,9 @@ | |||
2971 | 1253 | 1253 | ||
2972 | 1254 | Player::BuildingStatsVector* Player::get_mutable_building_statistics(const DescriptionIndex& i) { | 1254 | Player::BuildingStatsVector* Player::get_mutable_building_statistics(const DescriptionIndex& i) { |
2973 | 1255 | DescriptionIndex const nr_buildings = egbase().tribes().nrbuildings(); | 1255 | DescriptionIndex const nr_buildings = egbase().tribes().nrbuildings(); |
2977 | 1256 | if (m_building_stats.size() < nr_buildings) | 1256 | if (building_stats_.size() < nr_buildings) |
2978 | 1257 | m_building_stats.resize(nr_buildings); | 1257 | building_stats_.resize(nr_buildings); |
2979 | 1258 | return &m_building_stats[i]; | 1258 | return &building_stats_[i]; |
2980 | 1259 | } | 1259 | } |
2981 | 1260 | 1260 | ||
2982 | 1261 | /** | 1261 | /** |
2983 | @@ -1273,8 +1273,8 @@ | |||
2984 | 1273 | const size_t nr_buildings = egbase().tribes().nrbuildings(); | 1273 | const size_t nr_buildings = egbase().tribes().nrbuildings(); |
2985 | 1274 | 1274 | ||
2986 | 1275 | // Get the valid vector for this | 1275 | // Get the valid vector for this |
2989 | 1276 | if (m_building_stats.size() < nr_buildings) | 1276 | if (building_stats_.size() < nr_buildings) |
2990 | 1277 | m_building_stats.resize(nr_buildings); | 1277 | building_stats_.resize(nr_buildings); |
2991 | 1278 | 1278 | ||
2992 | 1279 | std::vector<BuildingStats>& stat = | 1279 | std::vector<BuildingStats>& stat = |
2993 | 1280 | *get_mutable_building_statistics(egbase().tribes().building_index(building_name.c_str())); | 1280 | *get_mutable_building_statistics(egbase().tribes().building_index(building_name.c_str())); |
2994 | 1281 | 1281 | ||
2995 | === modified file 'src/logic/player.h' | |||
2996 | --- src/logic/player.h 2016-01-31 15:31:00 +0000 | |||
2997 | +++ src/logic/player.h 2016-02-08 18:17:36 +0000 | |||
2998 | @@ -613,7 +613,7 @@ | |||
2999 | 613 | */ | 613 | */ |
3000 | 614 | std::vector< std::vector<uint32_t> > m_ware_stocks; | 614 | std::vector< std::vector<uint32_t> > m_ware_stocks; |
3001 | 615 | 615 | ||
3003 | 616 | PlayerBuildingStats m_building_stats; | 616 | PlayerBuildingStats building_stats_; |
3004 | 617 | 617 | ||
3005 | 618 | DISALLOW_COPY_AND_ASSIGN(Player); | 618 | DISALLOW_COPY_AND_ASSIGN(Player); |
3006 | 619 | }; | 619 | }; |
3007 | 620 | 620 | ||
3008 | === modified file 'src/map_io/map_building_packet.cc' | |||
3009 | --- src/map_io/map_building_packet.cc 2016-02-06 11:11:24 +0000 | |||
3010 | +++ src/map_io/map_building_packet.cc 2016-02-08 18:17:36 +0000 | |||
3011 | @@ -142,12 +142,12 @@ | |||
3012 | 142 | 142 | ||
3013 | 143 | if (building->descr().type() == MapObjectType::CONSTRUCTIONSITE) { | 143 | if (building->descr().type() == MapObjectType::CONSTRUCTIONSITE) { |
3014 | 144 | upcast(PartiallyFinishedBuilding const, pfb, building); | 144 | upcast(PartiallyFinishedBuilding const, pfb, building); |
3016 | 145 | fw.c_string((*pfb->m_building).name().c_str()); | 145 | fw.c_string((*pfb->building_).name().c_str()); |
3017 | 146 | fw.unsigned_8(kTypeConstructionSite); | 146 | fw.unsigned_8(kTypeConstructionSite); |
3018 | 147 | 147 | ||
3019 | 148 | } else if (building->descr().type() == MapObjectType::DISMANTLESITE) { | 148 | } else if (building->descr().type() == MapObjectType::DISMANTLESITE) { |
3020 | 149 | upcast(PartiallyFinishedBuilding const, pfb, building); | 149 | upcast(PartiallyFinishedBuilding const, pfb, building); |
3022 | 150 | fw.c_string((*pfb->m_building).name().c_str()); | 150 | fw.c_string((*pfb->building_).name().c_str()); |
3023 | 151 | fw.unsigned_8(kTypeDismantleSite); | 151 | fw.unsigned_8(kTypeDismantleSite); |
3024 | 152 | 152 | ||
3025 | 153 | } else { | 153 | } else { |
3026 | 154 | 154 | ||
3027 | === modified file 'src/map_io/map_buildingdata_packet.cc' | |||
3028 | --- src/map_io/map_buildingdata_packet.cc 2016-02-07 06:10:47 +0000 | |||
3029 | +++ src/map_io/map_buildingdata_packet.cc 2016-02-08 18:17:36 +0000 | |||
3030 | @@ -87,7 +87,7 @@ | |||
3031 | 87 | if (fr.unsigned_8()) { | 87 | if (fr.unsigned_8()) { |
3032 | 88 | char const * const animation_name = fr.c_string(); | 88 | char const * const animation_name = fr.c_string(); |
3033 | 89 | try { | 89 | try { |
3035 | 90 | building.m_anim = | 90 | building.anim_ = |
3036 | 91 | building.descr().get_animation(animation_name); | 91 | building.descr().get_animation(animation_name); |
3037 | 92 | } catch (const MapObjectDescr::AnimationNonexistent &) { | 92 | } catch (const MapObjectDescr::AnimationNonexistent &) { |
3038 | 93 | log | 93 | log |
3039 | @@ -96,15 +96,15 @@ | |||
3040 | 96 | building.owner().tribe().name().c_str(), | 96 | building.owner().tribe().name().c_str(), |
3041 | 97 | building.descr().descname().c_str(), | 97 | building.descr().descname().c_str(), |
3042 | 98 | animation_name); | 98 | animation_name); |
3044 | 99 | building.m_anim = building.descr().get_animation("idle"); | 99 | building.anim_ = building.descr().get_animation("idle"); |
3045 | 100 | } | 100 | } |
3046 | 101 | } else { | 101 | } else { |
3048 | 102 | building.m_anim = 0; | 102 | building.anim_ = 0; |
3049 | 103 | } | 103 | } |
3051 | 104 | building.m_animstart = fr.unsigned_32(); | 104 | building.animstart_ = fr.unsigned_32(); |
3052 | 105 | 105 | ||
3053 | 106 | { | 106 | { |
3055 | 107 | Building::LeaveQueue & leave_queue = building.m_leave_queue; | 107 | Building::LeaveQueue & leave_queue = building.leave_queue_; |
3056 | 108 | leave_queue.resize(fr.unsigned_16()); | 108 | leave_queue.resize(fr.unsigned_16()); |
3057 | 109 | 109 | ||
3058 | 110 | for (Building::LeaveQueue::iterator queue_iter = leave_queue.begin(); | 110 | for (Building::LeaveQueue::iterator queue_iter = leave_queue.begin(); |
3059 | @@ -131,26 +131,26 @@ | |||
3060 | 131 | } | 131 | } |
3061 | 132 | } | 132 | } |
3062 | 133 | 133 | ||
3064 | 134 | building.m_leave_time = fr.unsigned_32(); | 134 | building.leave_time_ = fr.unsigned_32(); |
3065 | 135 | 135 | ||
3066 | 136 | if (uint32_t const leaver_serial = fr.unsigned_32()) | 136 | if (uint32_t const leaver_serial = fr.unsigned_32()) |
3067 | 137 | try { | 137 | try { |
3069 | 138 | building.m_leave_allow = | 138 | building.leave_allow_ = |
3070 | 139 | &mol.get<MapObject>(leaver_serial); | 139 | &mol.get<MapObject>(leaver_serial); |
3071 | 140 | } catch (const WException & e) { | 140 | } catch (const WException & e) { |
3072 | 141 | throw GameDataError | 141 | throw GameDataError |
3073 | 142 | ("leave allow item (%u): %s", leaver_serial, e.what()); | 142 | ("leave allow item (%u): %s", leaver_serial, e.what()); |
3074 | 143 | } | 143 | } |
3075 | 144 | else { | 144 | else { |
3077 | 145 | building.m_leave_allow = nullptr; | 145 | building.leave_allow_ = nullptr; |
3078 | 146 | } | 146 | } |
3079 | 147 | 147 | ||
3080 | 148 | while (fr.unsigned_8()) { | 148 | while (fr.unsigned_8()) { |
3081 | 149 | DescriptionIndex oldidx = building.owner().tribe().safe_building_index(fr.c_string()); | 149 | DescriptionIndex oldidx = building.owner().tribe().safe_building_index(fr.c_string()); |
3083 | 150 | building.m_old_buildings.push_back(oldidx); | 150 | building.old_buildings_.push_back(oldidx); |
3084 | 151 | } | 151 | } |
3085 | 152 | // Only construction sites may have an empty list | 152 | // Only construction sites may have an empty list |
3087 | 153 | if (building.m_old_buildings.empty() && !is_a(ConstructionSite, &building)) { | 153 | if (building.old_buildings_.empty() && !is_a(ConstructionSite, &building)) { |
3088 | 154 | throw GameDataError | 154 | throw GameDataError |
3089 | 155 | ("Failed to read %s %u: No former buildings informations.\n" | 155 | ("Failed to read %s %u: No former buildings informations.\n" |
3090 | 156 | "Your savegame is corrupted", building.descr().descname().c_str(), building.serial()); | 156 | "Your savegame is corrupted", building.descr().descname().c_str(), building.serial()); |
3091 | @@ -180,7 +180,7 @@ | |||
3092 | 180 | } | 180 | } |
3093 | 181 | 181 | ||
3094 | 182 | // Set economy now, some stuff below will count on this. | 182 | // Set economy now, some stuff below will count on this. |
3096 | 183 | building.set_economy(building.m_flag->get_economy()); | 183 | building.set_economy(building.flag_->get_economy()); |
3097 | 184 | 184 | ||
3098 | 185 | Game& game = dynamic_cast<Game&>(egbase); | 185 | Game& game = dynamic_cast<Game&>(egbase); |
3099 | 186 | 186 | ||
3100 | @@ -226,49 +226,49 @@ | |||
3101 | 226 | uint16_t const packet_version = fr.unsigned_16(); | 226 | uint16_t const packet_version = fr.unsigned_16(); |
3102 | 227 | if (packet_version == kCurrentPacketPFBuilding) { | 227 | if (packet_version == kCurrentPacketPFBuilding) { |
3103 | 228 | const TribeDescr & tribe = pfb.owner().tribe(); | 228 | const TribeDescr & tribe = pfb.owner().tribe(); |
3105 | 229 | pfb.m_building = | 229 | pfb.building_ = |
3106 | 230 | tribe.get_building_descr(tribe.safe_building_index(fr.c_string())); | 230 | tribe.get_building_descr(tribe.safe_building_index(fr.c_string())); |
3107 | 231 | 231 | ||
3109 | 232 | delete pfb.m_builder_request; | 232 | delete pfb.builder_request_; |
3110 | 233 | if (fr.unsigned_8()) { | 233 | if (fr.unsigned_8()) { |
3112 | 234 | pfb.m_builder_request = | 234 | pfb.builder_request_ = |
3113 | 235 | new Request | 235 | new Request |
3114 | 236 | (pfb, | 236 | (pfb, |
3115 | 237 | 0, | 237 | 0, |
3116 | 238 | PartiallyFinishedBuilding::request_builder_callback, | 238 | PartiallyFinishedBuilding::request_builder_callback, |
3117 | 239 | wwWORKER); | 239 | wwWORKER); |
3119 | 240 | pfb.m_builder_request->read(fr, game, mol); | 240 | pfb.builder_request_->read(fr, game, mol); |
3120 | 241 | } else | 241 | } else |
3122 | 242 | pfb.m_builder_request = nullptr; | 242 | pfb.builder_request_ = nullptr; |
3123 | 243 | 243 | ||
3124 | 244 | if (uint32_t const builder_serial = fr.unsigned_32()) { | 244 | if (uint32_t const builder_serial = fr.unsigned_32()) { |
3125 | 245 | try { | 245 | try { |
3127 | 246 | pfb.m_builder = &mol.get<Worker>(builder_serial); | 246 | pfb.builder_ = &mol.get<Worker>(builder_serial); |
3128 | 247 | } catch (const WException & e) { | 247 | } catch (const WException & e) { |
3129 | 248 | throw GameDataError | 248 | throw GameDataError |
3130 | 249 | ("builder (%u): %s", builder_serial, e.what()); | 249 | ("builder (%u): %s", builder_serial, e.what()); |
3131 | 250 | } | 250 | } |
3132 | 251 | } else | 251 | } else |
3134 | 252 | pfb.m_builder = nullptr; | 252 | pfb.builder_ = nullptr; |
3135 | 253 | 253 | ||
3136 | 254 | try { | 254 | try { |
3137 | 255 | uint16_t const size = fr.unsigned_16(); | 255 | uint16_t const size = fr.unsigned_16(); |
3140 | 256 | pfb.m_wares.resize(size); | 256 | pfb.wares_.resize(size); |
3141 | 257 | for (uint16_t i = 0; i < pfb.m_wares.size(); ++i) | 257 | for (uint16_t i = 0; i < pfb.wares_.size(); ++i) |
3142 | 258 | { | 258 | { |
3144 | 259 | pfb.m_wares[i] = | 259 | pfb.wares_[i] = |
3145 | 260 | new WaresQueue | 260 | new WaresQueue |
3146 | 261 | (pfb, INVALID_INDEX, 0); | 261 | (pfb, INVALID_INDEX, 0); |
3148 | 262 | pfb.m_wares[i]->read(fr, game, mol); | 262 | pfb.wares_[i]->read(fr, game, mol); |
3149 | 263 | } | 263 | } |
3150 | 264 | } catch (const WException & e) { | 264 | } catch (const WException & e) { |
3151 | 265 | throw GameDataError("wares: %s", e.what()); | 265 | throw GameDataError("wares: %s", e.what()); |
3152 | 266 | } | 266 | } |
3153 | 267 | 267 | ||
3158 | 268 | pfb.m_working = fr.unsigned_8 (); | 268 | pfb.working_ = fr.unsigned_8 (); |
3159 | 269 | pfb.m_work_steptime = fr.unsigned_32(); | 269 | pfb.work_steptime_ = fr.unsigned_32(); |
3160 | 270 | pfb.m_work_completed = fr.unsigned_32(); | 270 | pfb.work_completed_ = fr.unsigned_32(); |
3161 | 271 | pfb.m_work_steps = fr.unsigned_32(); | 271 | pfb.work_steps_ = fr.unsigned_32(); |
3162 | 272 | } else { | 272 | } else { |
3163 | 273 | throw UnhandledVersionError("MapBuildingdataPacket - Partially Finished Building", | 273 | throw UnhandledVersionError("MapBuildingdataPacket - Partially Finished Building", |
3164 | 274 | packet_version, kCurrentPacketPFBuilding); | 274 | packet_version, kCurrentPacketPFBuilding); |
3165 | @@ -289,15 +289,15 @@ | |||
3166 | 289 | if (packet_version >= kCurrentPacketVersionConstructionsite) { | 289 | if (packet_version >= kCurrentPacketVersionConstructionsite) { |
3167 | 290 | read_partially_finished_building(constructionsite, fr, game, mol); | 290 | read_partially_finished_building(constructionsite, fr, game, mol); |
3168 | 291 | 291 | ||
3171 | 292 | for (ConstructionSite::Wares::iterator wares_iter = constructionsite.m_wares.begin(); | 292 | for (ConstructionSite::Wares::iterator wares_iter = constructionsite.wares_.begin(); |
3172 | 293 | wares_iter != constructionsite.m_wares.end(); | 293 | wares_iter != constructionsite.wares_.end(); |
3173 | 294 | ++wares_iter) { | 294 | ++wares_iter) { |
3174 | 295 | 295 | ||
3175 | 296 | (*wares_iter)->set_callback | 296 | (*wares_iter)->set_callback |
3176 | 297 | (ConstructionSite::wares_queue_callback, &constructionsite); | 297 | (ConstructionSite::wares_queue_callback, &constructionsite); |
3177 | 298 | } | 298 | } |
3178 | 299 | 299 | ||
3180 | 300 | constructionsite.m_fetchfromflag = fr. signed_32(); | 300 | constructionsite.fetchfromflag_ = fr. signed_32(); |
3181 | 301 | } else { | 301 | } else { |
3182 | 302 | throw UnhandledVersionError("MapBuildingdataPacket - Constructionsite", | 302 | throw UnhandledVersionError("MapBuildingdataPacket - Constructionsite", |
3183 | 303 | packet_version, kCurrentPacketVersionConstructionsite); | 303 | packet_version, kCurrentPacketVersionConstructionsite); |
3184 | @@ -510,36 +510,36 @@ | |||
3185 | 510 | try { | 510 | try { |
3186 | 511 | uint16_t const packet_version = fr.unsigned_16(); | 511 | uint16_t const packet_version = fr.unsigned_16(); |
3187 | 512 | if (packet_version == kCurrentPacketVersionMilitarysite) { | 512 | if (packet_version == kCurrentPacketVersionMilitarysite) { |
3189 | 513 | militarysite.m_normal_soldier_request.reset(); | 513 | militarysite.normal_soldier_request_.reset(); |
3190 | 514 | 514 | ||
3191 | 515 | if (fr.unsigned_8()) { | 515 | if (fr.unsigned_8()) { |
3193 | 516 | militarysite.m_normal_soldier_request.reset | 516 | militarysite.normal_soldier_request_.reset |
3194 | 517 | (new Request | 517 | (new Request |
3195 | 518 | (militarysite, | 518 | (militarysite, |
3196 | 519 | 0, | 519 | 0, |
3197 | 520 | MilitarySite::request_soldier_callback, | 520 | MilitarySite::request_soldier_callback, |
3198 | 521 | wwWORKER)); | 521 | wwWORKER)); |
3200 | 522 | militarysite.m_normal_soldier_request->read(fr, game, mol); | 522 | militarysite.normal_soldier_request_->read(fr, game, mol); |
3201 | 523 | } | 523 | } |
3202 | 524 | else | 524 | else |
3204 | 525 | militarysite.m_normal_soldier_request.reset(); | 525 | militarysite.normal_soldier_request_.reset(); |
3205 | 526 | 526 | ||
3206 | 527 | if (fr.unsigned_8()) | 527 | if (fr.unsigned_8()) |
3207 | 528 | { | 528 | { |
3209 | 529 | militarysite.m_upgrade_soldier_request.reset | 529 | militarysite.upgrade_soldier_request_.reset |
3210 | 530 | (new Request | 530 | (new Request |
3211 | 531 | (militarysite, | 531 | (militarysite, |
3213 | 532 | (!militarysite.m_normal_soldier_request) ? 0 | 532 | (!militarysite.normal_soldier_request_) ? 0 |
3214 | 533 | : militarysite.owner().tribe().soldier(), | 533 | : militarysite.owner().tribe().soldier(), |
3215 | 534 | MilitarySite::request_soldier_callback, | 534 | MilitarySite::request_soldier_callback, |
3216 | 535 | wwWORKER)); | 535 | wwWORKER)); |
3218 | 536 | militarysite.m_upgrade_soldier_request->read(fr, game, mol); | 536 | militarysite.upgrade_soldier_request_->read(fr, game, mol); |
3219 | 537 | } | 537 | } |
3220 | 538 | else | 538 | else |
3225 | 539 | militarysite.m_upgrade_soldier_request.reset(); | 539 | militarysite.upgrade_soldier_request_.reset(); |
3226 | 540 | 540 | ||
3227 | 541 | 541 | ||
3228 | 542 | if ((militarysite.m_didconquer = fr.unsigned_8())) { | 542 | if ((militarysite.didconquer_ = fr.unsigned_8())) { |
3229 | 543 | // Add to map of military influence. | 543 | // Add to map of military influence. |
3230 | 544 | const Map & map = game.map(); | 544 | const Map & map = game.map(); |
3231 | 545 | Area<FCoords> a | 545 | Area<FCoords> a |
3232 | @@ -557,16 +557,16 @@ | |||
3233 | 557 | } | 557 | } |
3234 | 558 | 558 | ||
3235 | 559 | // capacity (modified by user) | 559 | // capacity (modified by user) |
3238 | 560 | militarysite.m_capacity = fr.unsigned_8(); | 560 | militarysite.capacity_ = fr.unsigned_8(); |
3239 | 561 | militarysite.m_nexthealtime = fr.signed_32(); | 561 | militarysite.nexthealtime_ = fr.signed_32(); |
3240 | 562 | 562 | ||
3241 | 563 | uint16_t reqmin = fr.unsigned_16(); | 563 | uint16_t reqmin = fr.unsigned_16(); |
3242 | 564 | uint16_t reqmax = fr.unsigned_16(); | 564 | uint16_t reqmax = fr.unsigned_16(); |
3248 | 565 | militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax); | 565 | militarysite.soldier_upgrade_requirements_ = RequireAttribute(atrTotal, reqmin, reqmax); |
3249 | 566 | militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.unsigned_8()); | 566 | militarysite.soldier_preference_ = static_cast<MilitarySite::SoldierPreference>(fr.unsigned_8()); |
3250 | 567 | militarysite.m_next_swap_soldiers_time = fr.signed_32(); | 567 | militarysite.next_swap_soldiers_time_ = fr.signed_32(); |
3251 | 568 | militarysite.m_soldier_upgrade_try = 0 != fr.unsigned_8() ? true : false; | 568 | militarysite.soldier_upgrade_try_ = 0 != fr.unsigned_8() ? true : false; |
3252 | 569 | militarysite.m_doing_upgrade_request = 0 != fr.unsigned_8() ? true : false; | 569 | militarysite.doing_upgrade_request_ = 0 != fr.unsigned_8() ? true : false; |
3253 | 570 | 570 | ||
3254 | 571 | } else { | 571 | } else { |
3255 | 572 | throw UnhandledVersionError("MapBuildingdataPacket - Militarysite", | 572 | throw UnhandledVersionError("MapBuildingdataPacket - Militarysite", |
3256 | @@ -582,22 +582,22 @@ | |||
3257 | 582 | // Cmd_ChangeSoldierCapacity to the beginning of the game's command | 582 | // Cmd_ChangeSoldierCapacity to the beginning of the game's command |
3258 | 583 | // queue. But that would not work because the command queue is not read | 583 | // queue. But that would not work because the command queue is not read |
3259 | 584 | // yet and will be cleared before it is read. | 584 | // yet and will be cleared before it is read. |
3261 | 585 | if (militarysite.m_capacity < militarysite.min_soldier_capacity()) { | 585 | if (militarysite.capacity_ < militarysite.min_soldier_capacity()) { |
3262 | 586 | log | 586 | log |
3263 | 587 | ("WARNING: militarysite %u of player %u at (%i, %i) has capacity " | 587 | ("WARNING: militarysite %u of player %u at (%i, %i) has capacity " |
3264 | 588 | "set to %u but it must be at least %u. Changing to that value.\n", | 588 | "set to %u but it must be at least %u. Changing to that value.\n", |
3265 | 589 | militarysite.serial(), militarysite.owner().player_number(), | 589 | militarysite.serial(), militarysite.owner().player_number(), |
3266 | 590 | militarysite.get_position().x, militarysite.get_position().y, | 590 | militarysite.get_position().x, militarysite.get_position().y, |
3270 | 591 | militarysite.m_capacity, militarysite.min_soldier_capacity()); | 591 | militarysite.capacity_, militarysite.min_soldier_capacity()); |
3271 | 592 | militarysite.m_capacity = militarysite.min_soldier_capacity(); | 592 | militarysite.capacity_ = militarysite.min_soldier_capacity(); |
3272 | 593 | } else if (militarysite.max_soldier_capacity() < militarysite.m_capacity) { | 593 | } else if (militarysite.max_soldier_capacity() < militarysite.capacity_) { |
3273 | 594 | log | 594 | log |
3274 | 595 | ("WARNING: militarysite %u of player %u at (%i, %i) has capacity " | 595 | ("WARNING: militarysite %u of player %u at (%i, %i) has capacity " |
3275 | 596 | "set to %u but it can be at most %u. Changing to that value.\n", | 596 | "set to %u but it can be at most %u. Changing to that value.\n", |
3276 | 597 | militarysite.serial(), militarysite.owner().player_number(), | 597 | militarysite.serial(), militarysite.owner().player_number(), |
3277 | 598 | militarysite.get_position().x, militarysite.get_position().y, | 598 | militarysite.get_position().x, militarysite.get_position().y, |
3280 | 599 | militarysite.m_capacity, militarysite.max_soldier_capacity()); | 599 | militarysite.capacity_, militarysite.max_soldier_capacity()); |
3281 | 600 | militarysite.m_capacity = militarysite.max_soldier_capacity(); | 600 | militarysite.capacity_ = militarysite.max_soldier_capacity(); |
3282 | 601 | } | 601 | } |
3283 | 602 | } catch (const WException & e) { | 602 | } catch (const WException & e) { |
3284 | 603 | throw GameDataError("militarysite: %s", e.what()); | 603 | throw GameDataError("militarysite: %s", e.what()); |
3285 | @@ -898,16 +898,16 @@ | |||
3286 | 898 | // player immovable owner is already in existence packet | 898 | // player immovable owner is already in existence packet |
3287 | 899 | 899 | ||
3288 | 900 | // write the general stuff | 900 | // write the general stuff |
3290 | 901 | if (building->m_anim) { | 901 | if (building->anim_) { |
3291 | 902 | fw.unsigned_8(1); | 902 | fw.unsigned_8(1); |
3293 | 903 | fw.string(building->descr().get_animation_name(building->m_anim)); | 903 | fw.string(building->descr().get_animation_name(building->anim_)); |
3294 | 904 | } else | 904 | } else |
3295 | 905 | fw.unsigned_8(0); | 905 | fw.unsigned_8(0); |
3296 | 906 | 906 | ||
3298 | 907 | fw.unsigned_32(building->m_animstart); | 907 | fw.unsigned_32(building->animstart_); |
3299 | 908 | 908 | ||
3300 | 909 | { | 909 | { |
3302 | 910 | const Building::LeaveQueue & leave_queue = building->m_leave_queue; | 910 | const Building::LeaveQueue & leave_queue = building->leave_queue_; |
3303 | 911 | fw.unsigned_16(leave_queue.size()); | 911 | fw.unsigned_16(leave_queue.size()); |
3304 | 912 | for (const OPtr<Worker >& temp_queue: leave_queue) { | 912 | for (const OPtr<Worker >& temp_queue: leave_queue) { |
3305 | 913 | assert(mos.is_object_known(*temp_queue.get(egbase))); | 913 | assert(mos.is_object_known(*temp_queue.get(egbase))); |
3306 | @@ -915,8 +915,8 @@ | |||
3307 | 915 | (mos.get_object_file_index(*temp_queue.get(egbase))); | 915 | (mos.get_object_file_index(*temp_queue.get(egbase))); |
3308 | 916 | } | 916 | } |
3309 | 917 | } | 917 | } |
3312 | 918 | fw.unsigned_32(building->m_leave_time); | 918 | fw.unsigned_32(building->leave_time_); |
3313 | 919 | if (MapObject const * const o = building->m_leave_allow.get(egbase)) | 919 | if (MapObject const * const o = building->leave_allow_.get(egbase)) |
3314 | 920 | { | 920 | { |
3315 | 921 | assert(mos.is_object_known(*o)); | 921 | assert(mos.is_object_known(*o)); |
3316 | 922 | fw.unsigned_32(mos.get_object_file_index(*o)); | 922 | fw.unsigned_32(mos.get_object_file_index(*o)); |
3317 | @@ -925,7 +925,7 @@ | |||
3318 | 925 | } | 925 | } |
3319 | 926 | { | 926 | { |
3320 | 927 | const TribeDescr& td = building->owner().tribe(); | 927 | const TribeDescr& td = building->owner().tribe(); |
3322 | 928 | for (DescriptionIndex b_idx : building->m_old_buildings) { | 928 | for (DescriptionIndex b_idx : building->old_buildings_) { |
3323 | 929 | const BuildingDescr* b_descr = td.get_building_descr(b_idx); | 929 | const BuildingDescr* b_descr = td.get_building_descr(b_idx); |
3324 | 930 | fw.unsigned_8(1); | 930 | fw.unsigned_8(1); |
3325 | 931 | fw.string(b_descr->name()); | 931 | fw.string(b_descr->name()); |
3326 | @@ -976,31 +976,31 @@ | |||
3327 | 976 | fw.unsigned_16(kCurrentPacketPFBuilding); | 976 | fw.unsigned_16(kCurrentPacketPFBuilding); |
3328 | 977 | 977 | ||
3329 | 978 | // descriptions | 978 | // descriptions |
3331 | 979 | fw.string(pfb.m_building->name()); | 979 | fw.string(pfb.building_->name()); |
3332 | 980 | 980 | ||
3333 | 981 | // builder request | 981 | // builder request |
3335 | 982 | if (pfb.m_builder_request) { | 982 | if (pfb.builder_request_) { |
3336 | 983 | fw.unsigned_8(1); | 983 | fw.unsigned_8(1); |
3338 | 984 | pfb.m_builder_request->write(fw, game, mos); | 984 | pfb.builder_request_->write(fw, game, mos); |
3339 | 985 | } else | 985 | } else |
3340 | 986 | fw.unsigned_8(0); | 986 | fw.unsigned_8(0); |
3341 | 987 | 987 | ||
3342 | 988 | // builder | 988 | // builder |
3344 | 989 | if (Worker const * builder = pfb.m_builder.get(game)) { | 989 | if (Worker const * builder = pfb.builder_.get(game)) { |
3345 | 990 | assert(mos.is_object_known(*builder)); | 990 | assert(mos.is_object_known(*builder)); |
3346 | 991 | fw.unsigned_32(mos.get_object_file_index(*builder)); | 991 | fw.unsigned_32(mos.get_object_file_index(*builder)); |
3347 | 992 | } else | 992 | } else |
3348 | 993 | fw.unsigned_32(0); | 993 | fw.unsigned_32(0); |
3349 | 994 | 994 | ||
3351 | 995 | const uint16_t wares_size = pfb.m_wares.size(); | 995 | const uint16_t wares_size = pfb.wares_.size(); |
3352 | 996 | fw.unsigned_16(wares_size); | 996 | fw.unsigned_16(wares_size); |
3353 | 997 | for (uint16_t i = 0; i < wares_size; ++i) | 997 | for (uint16_t i = 0; i < wares_size; ++i) |
3355 | 998 | pfb.m_wares[i]->write(fw, game, mos); | 998 | pfb.wares_[i]->write(fw, game, mos); |
3356 | 999 | 999 | ||
3361 | 1000 | fw.unsigned_8 (pfb.m_working); | 1000 | fw.unsigned_8 (pfb.working_); |
3362 | 1001 | fw.unsigned_32(pfb.m_work_steptime); | 1001 | fw.unsigned_32(pfb.work_steptime_); |
3363 | 1002 | fw.unsigned_32(pfb.m_work_completed); | 1002 | fw.unsigned_32(pfb.work_completed_); |
3364 | 1003 | fw.unsigned_32(pfb.m_work_steps); | 1003 | fw.unsigned_32(pfb.work_steps_); |
3365 | 1004 | } | 1004 | } |
3366 | 1005 | 1005 | ||
3367 | 1006 | void MapBuildingdataPacket::write_constructionsite | 1006 | void MapBuildingdataPacket::write_constructionsite |
3368 | @@ -1014,7 +1014,7 @@ | |||
3369 | 1014 | 1014 | ||
3370 | 1015 | write_partially_finished_building(constructionsite, fw, game, mos); | 1015 | write_partially_finished_building(constructionsite, fw, game, mos); |
3371 | 1016 | 1016 | ||
3373 | 1017 | fw.signed_32(constructionsite.m_fetchfromflag); | 1017 | fw.signed_32(constructionsite.fetchfromflag_); |
3374 | 1018 | } | 1018 | } |
3375 | 1019 | 1019 | ||
3376 | 1020 | void MapBuildingdataPacket::write_dismantlesite | 1020 | void MapBuildingdataPacket::write_dismantlesite |
3377 | @@ -1134,40 +1134,40 @@ | |||
3378 | 1134 | { | 1134 | { |
3379 | 1135 | fw.unsigned_16(kCurrentPacketVersionMilitarysite); | 1135 | fw.unsigned_16(kCurrentPacketVersionMilitarysite); |
3380 | 1136 | 1136 | ||
3382 | 1137 | if (militarysite.m_normal_soldier_request) { | 1137 | if (militarysite.normal_soldier_request_) { |
3383 | 1138 | fw.unsigned_8(1); | 1138 | fw.unsigned_8(1); |
3385 | 1139 | militarysite.m_normal_soldier_request->write(fw, game, mos); | 1139 | militarysite.normal_soldier_request_->write(fw, game, mos); |
3386 | 1140 | } else { | 1140 | } else { |
3387 | 1141 | fw.unsigned_8(0); | 1141 | fw.unsigned_8(0); |
3388 | 1142 | } | 1142 | } |
3389 | 1143 | 1143 | ||
3391 | 1144 | if (militarysite.m_upgrade_soldier_request) | 1144 | if (militarysite.upgrade_soldier_request_) |
3392 | 1145 | { | 1145 | { |
3393 | 1146 | fw.unsigned_8(1); | 1146 | fw.unsigned_8(1); |
3395 | 1147 | militarysite.m_upgrade_soldier_request->write(fw, game, mos); | 1147 | militarysite.upgrade_soldier_request_->write(fw, game, mos); |
3396 | 1148 | } | 1148 | } |
3397 | 1149 | else | 1149 | else |
3398 | 1150 | fw.unsigned_8(0); | 1150 | fw.unsigned_8(0); |
3399 | 1151 | 1151 | ||
3400 | 1152 | 1152 | ||
3404 | 1153 | fw.unsigned_8(militarysite.m_didconquer); | 1153 | fw.unsigned_8(militarysite.didconquer_); |
3405 | 1154 | fw.unsigned_8(militarysite.m_capacity); | 1154 | fw.unsigned_8(militarysite.capacity_); |
3406 | 1155 | fw.signed_32(militarysite.m_nexthealtime); | 1155 | fw.signed_32(militarysite.nexthealtime_); |
3407 | 1156 | 1156 | ||
3409 | 1157 | if (militarysite.m_normal_soldier_request) | 1157 | if (militarysite.normal_soldier_request_) |
3410 | 1158 | { | 1158 | { |
3412 | 1159 | if (militarysite.m_upgrade_soldier_request) | 1159 | if (militarysite.upgrade_soldier_request_) |
3413 | 1160 | { | 1160 | { |
3414 | 1161 | throw GameDataError | 1161 | throw GameDataError |
3415 | 1162 | ("Internal error in a MilitarySite -- cannot continue. Use previous autosave."); | 1162 | ("Internal error in a MilitarySite -- cannot continue. Use previous autosave."); |
3416 | 1163 | } | 1163 | } |
3417 | 1164 | } | 1164 | } |
3424 | 1165 | fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_min()); | 1165 | fw.unsigned_16(militarysite.soldier_upgrade_requirements_.get_min()); |
3425 | 1166 | fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_max()); | 1166 | fw.unsigned_16(militarysite.soldier_upgrade_requirements_.get_max()); |
3426 | 1167 | fw.unsigned_8(militarysite.m_soldier_preference); | 1167 | fw.unsigned_8(militarysite.soldier_preference_); |
3427 | 1168 | fw.signed_32(militarysite.m_next_swap_soldiers_time); | 1168 | fw.signed_32(militarysite.next_swap_soldiers_time_); |
3428 | 1169 | fw.unsigned_8(militarysite.m_soldier_upgrade_try ? 1 : 0); | 1169 | fw.unsigned_8(militarysite.soldier_upgrade_try_ ? 1 : 0); |
3429 | 1170 | fw.unsigned_8(militarysite.m_doing_upgrade_request ? 1 : 0); | 1170 | fw.unsigned_8(militarysite.doing_upgrade_request_ ? 1 : 0); |
3430 | 1171 | 1171 | ||
3431 | 1172 | } | 1172 | } |
3432 | 1173 | 1173 | ||
3433 | 1174 | 1174 | ||
3434 | === modified file 'src/scripting/lua_map.cc' | |||
3435 | --- src/scripting/lua_map.cc 2016-01-31 15:31:00 +0000 | |||
3436 | +++ src/scripting/lua_map.cc 2016-02-08 18:17:36 +0000 | |||
3437 | @@ -1638,7 +1638,7 @@ | |||
3438 | 1638 | (RO) the workarea_radius of the building as an int. | 1638 | (RO) the workarea_radius of the building as an int. |
3439 | 1639 | */ | 1639 | */ |
3440 | 1640 | int LuaBuildingDescription::get_workarea_radius(lua_State * L) { | 1640 | int LuaBuildingDescription::get_workarea_radius(lua_State * L) { |
3442 | 1641 | lua_pushinteger(L, get()->m_workarea_info.begin()->first); | 1641 | lua_pushinteger(L, get()->workarea_info_.begin()->first); |
3443 | 1642 | return 1; | 1642 | return 1; |
3444 | 1643 | } | 1643 | } |
3445 | 1644 | 1644 | ||
3446 | 1645 | 1645 | ||
3447 | === modified file 'src/wui/building_ui.cc' | |||
3448 | --- src/wui/building_ui.cc 2015-11-28 22:29:26 +0000 | |||
3449 | +++ src/wui/building_ui.cc 2016-02-08 18:17:36 +0000 | |||
3450 | @@ -33,21 +33,21 @@ | |||
3451 | 33 | */ | 33 | */ |
3452 | 34 | void Building::show_options(InteractiveGameBase & igbase, bool avoid_fastclick, Point pos) | 34 | void Building::show_options(InteractiveGameBase & igbase, bool avoid_fastclick, Point pos) |
3453 | 35 | { | 35 | { |
3458 | 36 | if (m_optionswindow) { | 36 | if (optionswindow_) { |
3459 | 37 | if (m_optionswindow->is_minimal()) | 37 | if (optionswindow_->is_minimal()) |
3460 | 38 | m_optionswindow->restore(); | 38 | optionswindow_->restore(); |
3461 | 39 | m_optionswindow->move_to_top(); | 39 | optionswindow_->move_to_top(); |
3462 | 40 | } else { | 40 | } else { |
3465 | 41 | create_options_window(igbase, m_optionswindow); | 41 | create_options_window(igbase, optionswindow_); |
3466 | 42 | if (upcast(BuildingWindow, bw, m_optionswindow)) { | 42 | if (upcast(BuildingWindow, bw, optionswindow_)) { |
3467 | 43 | bw->set_avoid_fastclick(avoid_fastclick); | 43 | bw->set_avoid_fastclick(avoid_fastclick); |
3468 | 44 | } | 44 | } |
3469 | 45 | // Run a first think here so that certain things like caps buttons | 45 | // Run a first think here so that certain things like caps buttons |
3470 | 46 | // get properly initialized | 46 | // get properly initialized |
3472 | 47 | m_optionswindow->think(); | 47 | optionswindow_->think(); |
3473 | 48 | } | 48 | } |
3474 | 49 | if (pos.x >= 0 && pos.y >= 0) { | 49 | if (pos.x >= 0 && pos.y >= 0) { |
3476 | 50 | m_optionswindow->set_pos(pos); | 50 | optionswindow_->set_pos(pos); |
3477 | 51 | } | 51 | } |
3478 | 52 | } | 52 | } |
3479 | 53 | 53 | ||
3480 | @@ -58,8 +58,8 @@ | |||
3481 | 58 | { | 58 | { |
3482 | 59 | for (boost::signals2::connection& c : options_window_connections) | 59 | for (boost::signals2::connection& c : options_window_connections) |
3483 | 60 | c.disconnect(); | 60 | c.disconnect(); |
3486 | 61 | delete m_optionswindow; | 61 | delete optionswindow_; |
3487 | 62 | m_optionswindow = nullptr; | 62 | optionswindow_ = nullptr; |
3488 | 63 | } | 63 | } |
3489 | 64 | 64 | ||
3490 | 65 | /** | 65 | /** |
3491 | @@ -67,10 +67,10 @@ | |||
3492 | 67 | */ | 67 | */ |
3493 | 68 | void Building::refresh_options(InteractiveGameBase & igb) { | 68 | void Building::refresh_options(InteractiveGameBase & igb) { |
3494 | 69 | // Only do something if there is actually a window | 69 | // Only do something if there is actually a window |
3497 | 70 | if (m_optionswindow) { | 70 | if (optionswindow_) { |
3498 | 71 | Point window_position = m_optionswindow->get_pos(); | 71 | Point window_position = optionswindow_->get_pos(); |
3499 | 72 | hide_options(); | 72 | hide_options(); |
3500 | 73 | show_options(igb, true); | 73 | show_options(igb, true); |
3502 | 74 | m_optionswindow->set_pos(window_position); | 74 | optionswindow_->set_pos(window_position); |
3503 | 75 | } | 75 | } |
3504 | 76 | } | 76 | } |
3505 | 77 | 77 | ||
3506 | === modified file 'src/wui/buildingwindow.cc' | |||
3507 | --- src/wui/buildingwindow.cc 2016-01-29 08:37:22 +0000 | |||
3508 | +++ src/wui/buildingwindow.cc 2016-02-08 18:17:36 +0000 | |||
3509 | @@ -304,9 +304,9 @@ | |||
3510 | 304 | if (can_see) { | 304 | if (can_see) { |
3511 | 305 | WorkareaInfo wa_info; | 305 | WorkareaInfo wa_info; |
3512 | 306 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { | 306 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { |
3514 | 307 | wa_info = csite->building().m_workarea_info; | 307 | wa_info = csite->building().workarea_info_; |
3515 | 308 | } else { | 308 | } else { |
3517 | 309 | wa_info = building_.descr().m_workarea_info; | 309 | wa_info = building_.descr().workarea_info_; |
3518 | 310 | } | 310 | } |
3519 | 311 | if (!wa_info.empty()) { | 311 | if (!wa_info.empty()) { |
3520 | 312 | toggle_workarea_ = new UI::Button | 312 | toggle_workarea_ = new UI::Button |
3521 | @@ -471,9 +471,9 @@ | |||
3522 | 471 | } | 471 | } |
3523 | 472 | WorkareaInfo workarea_info; | 472 | WorkareaInfo workarea_info; |
3524 | 473 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { | 473 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { |
3526 | 474 | workarea_info = csite->building().m_workarea_info; | 474 | workarea_info = csite->building().workarea_info_; |
3527 | 475 | } else { | 475 | } else { |
3529 | 476 | workarea_info = building_.descr().m_workarea_info; | 476 | workarea_info = building_.descr().workarea_info_; |
3530 | 477 | } | 477 | } |
3531 | 478 | if (workarea_info.empty()) { | 478 | if (workarea_info.empty()) { |
3532 | 479 | return; | 479 | return; |
3533 | 480 | 480 | ||
3534 | === modified file 'src/wui/fieldaction.cc' | |||
3535 | --- src/wui/fieldaction.cc 2016-01-29 08:37:22 +0000 | |||
3536 | +++ src/wui/fieldaction.cc 2016-02-08 18:17:36 +0000 | |||
3537 | @@ -821,7 +821,7 @@ | |||
3538 | 821 | { | 821 | { |
3539 | 822 | if (ibase().show_workarea_preview_ && !m_workarea_preview_overlay_id) { | 822 | if (ibase().show_workarea_preview_ && !m_workarea_preview_overlay_id) { |
3540 | 823 | const WorkareaInfo& workarea_info = | 823 | const WorkareaInfo& workarea_info = |
3542 | 824 | m_plr->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->m_workarea_info; | 824 | m_plr->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->workarea_info_; |
3543 | 825 | m_workarea_preview_overlay_id = ibase().show_work_area(workarea_info, m_node); | 825 | m_workarea_preview_overlay_id = ibase().show_work_area(workarea_info, m_node); |
3544 | 826 | } | 826 | } |
3545 | 827 | } | 827 | } |
3546 | 828 | 828 | ||
3547 | === modified file 'src/wui/soldiercapacitycontrol.cc' | |||
3548 | --- src/wui/soldiercapacitycontrol.cc 2016-01-29 08:37:22 +0000 | |||
3549 | +++ src/wui/soldiercapacitycontrol.cc 2016-02-08 18:17:36 +0000 | |||
3550 | @@ -46,7 +46,7 @@ | |||
3551 | 46 | void click_increase(); | 46 | void click_increase(); |
3552 | 47 | 47 | ||
3553 | 48 | InteractiveGameBase & m_igb; | 48 | InteractiveGameBase & m_igb; |
3555 | 49 | Widelands::Building & m_building; | 49 | Widelands::Building & building_; |
3556 | 50 | 50 | ||
3557 | 51 | UI::Button m_decrease; | 51 | UI::Button m_decrease; |
3558 | 52 | UI::Button m_increase; | 52 | UI::Button m_increase; |
3559 | @@ -59,7 +59,7 @@ | |||
3560 | 59 | : | 59 | : |
3561 | 60 | Box(parent, 0, 0, Horizontal), | 60 | Box(parent, 0, 0, Horizontal), |
3562 | 61 | m_igb(igb), | 61 | m_igb(igb), |
3564 | 62 | m_building(building), | 62 | building_(building), |
3565 | 63 | m_decrease | 63 | m_decrease |
3566 | 64 | (this, "decrease", 0, 0, 32, 32, | 64 | (this, "decrease", 0, 0, 32, 32, |
3567 | 65 | g_gr->images().get("images/ui_basic/but4.png"), | 65 | g_gr->images().get("images/ui_basic/but4.png"), |
3568 | @@ -86,21 +86,21 @@ | |||
3569 | 86 | 86 | ||
3570 | 87 | void SoldierCapacityControl::think() | 87 | void SoldierCapacityControl::think() |
3571 | 88 | { | 88 | { |
3573 | 89 | SoldierControl * soldiers = dynamic_cast<SoldierControl *>(&m_building); | 89 | SoldierControl * soldiers = dynamic_cast<SoldierControl *>(&building_); |
3574 | 90 | uint32_t const capacity = soldiers->soldier_capacity(); | 90 | uint32_t const capacity = soldiers->soldier_capacity(); |
3575 | 91 | char buffer[sizeof("4294967295")]; | 91 | char buffer[sizeof("4294967295")]; |
3576 | 92 | 92 | ||
3577 | 93 | sprintf(buffer, "%2u", capacity); | 93 | sprintf(buffer, "%2u", capacity); |
3578 | 94 | m_value.set_text(buffer); | 94 | m_value.set_text(buffer); |
3579 | 95 | 95 | ||
3581 | 96 | bool const can_act = m_igb.can_act(m_building.owner().player_number()); | 96 | bool const can_act = m_igb.can_act(building_.owner().player_number()); |
3582 | 97 | m_decrease.set_enabled(can_act && soldiers->min_soldier_capacity() < capacity); | 97 | m_decrease.set_enabled(can_act && soldiers->min_soldier_capacity() < capacity); |
3583 | 98 | m_increase.set_enabled(can_act && soldiers->max_soldier_capacity() > capacity); | 98 | m_increase.set_enabled(can_act && soldiers->max_soldier_capacity() > capacity); |
3584 | 99 | } | 99 | } |
3585 | 100 | 100 | ||
3586 | 101 | void SoldierCapacityControl::change_soldier_capacity(int delta) | 101 | void SoldierCapacityControl::change_soldier_capacity(int delta) |
3587 | 102 | { | 102 | { |
3589 | 103 | m_igb.game().send_player_change_soldier_capacity(m_building, delta); | 103 | m_igb.game().send_player_change_soldier_capacity(building_, delta); |
3590 | 104 | } | 104 | } |
3591 | 105 | 105 | ||
3592 | 106 | void SoldierCapacityControl::click_decrease() | 106 | void SoldierCapacityControl::click_decrease() |
3593 | 107 | 107 | ||
3594 | === modified file 'src/wui/soldierlist.cc' | |||
3595 | --- src/wui/soldierlist.cc 2016-01-31 21:03:15 +0000 | |||
3596 | +++ src/wui/soldierlist.cc 2016-02-08 18:17:36 +0000 | |||
3597 | @@ -371,7 +371,7 @@ | |||
3598 | 371 | void think() override; | 371 | void think() override; |
3599 | 372 | 372 | ||
3600 | 373 | InteractiveGameBase & m_igb; | 373 | InteractiveGameBase & m_igb; |
3602 | 374 | Widelands::Building & m_building; | 374 | Widelands::Building & building_; |
3603 | 375 | SoldierPanel m_soldierpanel; | 375 | SoldierPanel m_soldierpanel; |
3604 | 376 | UI::Radiogroup m_soldier_preference; | 376 | UI::Radiogroup m_soldier_preference; |
3605 | 377 | UI::Textarea m_infotext; | 377 | UI::Textarea m_infotext; |
3606 | @@ -385,7 +385,7 @@ | |||
3607 | 385 | UI::Box(&parent, 0, 0, UI::Box::Vertical), | 385 | UI::Box(&parent, 0, 0, UI::Box::Vertical), |
3608 | 386 | 386 | ||
3609 | 387 | m_igb(igb), | 387 | m_igb(igb), |
3611 | 388 | m_building(building), | 388 | building_(building), |
3612 | 389 | m_soldierpanel(*this, igb.egbase(), building), | 389 | m_soldierpanel(*this, igb.egbase(), building), |
3613 | 390 | m_infotext(this, _("Click soldier to send away")) | 390 | m_infotext(this, _("Click soldier to send away")) |
3614 | 391 | { | 391 | { |
3615 | @@ -413,7 +413,7 @@ | |||
3616 | 413 | 413 | ||
3617 | 414 | UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal); | 414 | UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal); |
3618 | 415 | 415 | ||
3620 | 416 | bool can_act = m_igb.can_act(m_building.owner().player_number()); | 416 | bool can_act = m_igb.can_act(building_.owner().player_number()); |
3621 | 417 | if (upcast(Widelands::MilitarySite, ms, &building)) { | 417 | if (upcast(Widelands::MilitarySite, ms, &building)) { |
3622 | 418 | m_soldier_preference.add_button | 418 | m_soldier_preference.add_button |
3623 | 419 | (buttons, Point(0, 0), | 419 | (buttons, Point(0, 0), |
3624 | @@ -450,16 +450,16 @@ | |||
3625 | 450 | 450 | ||
3626 | 451 | SoldierControl & SoldierList::soldiers() const | 451 | SoldierControl & SoldierList::soldiers() const |
3627 | 452 | { | 452 | { |
3629 | 453 | return *dynamic_cast<SoldierControl *>(&m_building); | 453 | return *dynamic_cast<SoldierControl *>(&building_); |
3630 | 454 | } | 454 | } |
3631 | 455 | 455 | ||
3632 | 456 | void SoldierList::think() | 456 | void SoldierList::think() |
3633 | 457 | { | 457 | { |
3634 | 458 | // Only update the soldiers pref radio if player is spectator | 458 | // Only update the soldiers pref radio if player is spectator |
3636 | 459 | if (m_igb.can_act(m_building.owner().player_number())) { | 459 | if (m_igb.can_act(building_.owner().player_number())) { |
3637 | 460 | return; | 460 | return; |
3638 | 461 | } | 461 | } |
3640 | 462 | if (upcast(Widelands::MilitarySite, ms, &m_building)) { | 462 | if (upcast(Widelands::MilitarySite, ms, &building_)) { |
3641 | 463 | switch (ms->get_soldier_preference()) { | 463 | switch (ms->get_soldier_preference()) { |
3642 | 464 | case Widelands::MilitarySite::kPrefersRookies: | 464 | case Widelands::MilitarySite::kPrefersRookies: |
3643 | 465 | m_soldier_preference.set_state(0); | 465 | m_soldier_preference.set_state(0); |
3644 | @@ -495,20 +495,20 @@ | |||
3645 | 495 | void SoldierList::eject(const Soldier * soldier) | 495 | void SoldierList::eject(const Soldier * soldier) |
3646 | 496 | { | 496 | { |
3647 | 497 | uint32_t const capacity_min = soldiers().min_soldier_capacity(); | 497 | uint32_t const capacity_min = soldiers().min_soldier_capacity(); |
3649 | 498 | bool can_act = m_igb.can_act(m_building.owner().player_number()); | 498 | bool can_act = m_igb.can_act(building_.owner().player_number()); |
3650 | 499 | bool over_min = capacity_min < soldiers().present_soldiers().size(); | 499 | bool over_min = capacity_min < soldiers().present_soldiers().size(); |
3651 | 500 | 500 | ||
3652 | 501 | if (can_act && over_min) | 501 | if (can_act && over_min) |
3654 | 502 | m_igb.game().send_player_drop_soldier(m_building, soldier->serial()); | 502 | m_igb.game().send_player_drop_soldier(building_, soldier->serial()); |
3655 | 503 | } | 503 | } |
3656 | 504 | 504 | ||
3657 | 505 | void SoldierList::set_soldier_preference(int32_t changed_to) { | 505 | void SoldierList::set_soldier_preference(int32_t changed_to) { |
3658 | 506 | #ifndef NDEBUG | 506 | #ifndef NDEBUG |
3660 | 507 | upcast(Widelands::MilitarySite, ms, &m_building); | 507 | upcast(Widelands::MilitarySite, ms, &building_); |
3661 | 508 | assert(ms); | 508 | assert(ms); |
3662 | 509 | #endif | 509 | #endif |
3663 | 510 | m_igb.game().send_player_militarysite_set_soldier_preference | 510 | m_igb.game().send_player_militarysite_set_soldier_preference |
3665 | 511 | (m_building, changed_to == 0 ? | 511 | (building_, changed_to == 0 ? |
3666 | 512 | Widelands::MilitarySite::kPrefersRookies: | 512 | Widelands::MilitarySite::kPrefersRookies: |
3667 | 513 | Widelands::MilitarySite::kPrefersHeroes); | 513 | Widelands::MilitarySite::kPrefersHeroes); |
3668 | 514 | } | 514 | } |
Continuous integration builds have changed state:
Travis build 638. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 107834812. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ bug_1395278_ tribes_ a_p-494.
Appveyor build 494. State: failed. Details: https:/