Merge lp:~widelands-dev/widelands/bug-1395278-tribes-t-z into lp:widelands
- bug-1395278-tribes-t-z
- Merge into trunk
Proposed by
GunChleoc
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7834 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1395278-tribes-t-z | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
2427 lines (+462/-465) 11 files modified
src/logic/map_objects/tribes/trainingsite.cc (+111/-111) src/logic/map_objects/tribes/trainingsite.h (+36/-39) src/logic/map_objects/tribes/tribe_descr.cc (+1/-1) src/logic/map_objects/tribes/tribe_descr.h (+2/-2) src/logic/map_objects/tribes/warehouse.cc (+111/-111) src/logic/map_objects/tribes/warehouse.h (+13/-13) src/logic/map_objects/tribes/warelist.cc (+23/-23) src/logic/map_objects/tribes/warelist.h (+5/-5) src/logic/map_objects/tribes/worker.cc (+93/-93) src/logic/map_objects/tribes/worker.h (+22/-22) src/map_io/map_buildingdata_packet.cc (+45/-45) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1395278-tribes-t-z | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
Review via email: mp+285969@code.launchpad.net |
Commit message
Refactored remaining member variables in tribes.
Description of the change
To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote : | # |
Revision history for this message
SirVer (sirver) wrote : | # |
how many more of these do we have o_O?
lgtm.
@bunnybot merge
review:
Approve
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Lots - if we put them all into 1 branch, we would go blind trying to read the diff :P
I think that the worst is over now though :)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/logic/map_objects/tribes/trainingsite.cc' |
2 | --- src/logic/map_objects/tribes/trainingsite.cc 2016-01-18 19:35:25 +0000 |
3 | +++ src/logic/map_objects/tribes/trainingsite.cc 2016-02-13 14:28:04 +0000 |
4 | @@ -39,28 +39,28 @@ |
5 | |
6 | namespace Widelands { |
7 | |
8 | -const uint32_t TrainingSite::training_state_multiplier = 12; |
9 | +const uint32_t TrainingSite::training_state_multiplier_ = 12; |
10 | |
11 | TrainingSiteDescr::TrainingSiteDescr |
12 | (const std::string& init_descname, const LuaTable& table, const EditorGameBase& egbase) |
13 | : |
14 | ProductionSiteDescr |
15 | (init_descname, "", MapObjectType::TRAININGSITE, table, egbase), |
16 | - m_num_soldiers (table.get_int("soldier_capacity")), |
17 | - m_max_stall (table.get_int("trainer_patience")), |
18 | + num_soldiers_ (table.get_int("soldier_capacity")), |
19 | + max_stall_ (table.get_int("trainer_patience")), |
20 | |
21 | - m_train_hp (false), |
22 | - m_train_attack (false), |
23 | - m_train_defense (false), |
24 | - m_train_evade (false), |
25 | - m_min_hp (0), |
26 | - m_min_attack (0), |
27 | - m_min_defense (0), |
28 | - m_min_evade (0), |
29 | - m_max_hp (0), |
30 | - m_max_attack (0), |
31 | - m_max_defense (0), |
32 | - m_max_evade (0) |
33 | + train_hp_ (false), |
34 | + train_attack_ (false), |
35 | + train_defense_ (false), |
36 | + train_evade_ (false), |
37 | + min_hp_ (0), |
38 | + min_attack_ (0), |
39 | + min_defense_ (0), |
40 | + min_evade_ (0), |
41 | + max_hp_ (0), |
42 | + max_attack_ (0), |
43 | + max_defense_ (0), |
44 | + max_evade_ (0) |
45 | { |
46 | // Read the range of levels that can update this building |
47 | // TODO(unknown): This is currently hardcoded to "soldier" but it should search for |
48 | @@ -70,31 +70,31 @@ |
49 | std::unique_ptr<LuaTable> items_table; |
50 | if (table.has_key("soldier hp")) { |
51 | items_table = table.get_table("soldier hp"); |
52 | - m_train_hp = true; |
53 | - m_min_hp = items_table->get_int("min_level"); |
54 | - m_max_hp = items_table->get_int("max_level"); |
55 | + train_hp_ = true; |
56 | + min_hp_ = items_table->get_int("min_level"); |
57 | + max_hp_ = items_table->get_int("max_level"); |
58 | add_training_inputs(*items_table.get(), &food_hp_, &weapons_hp_); |
59 | } |
60 | |
61 | if (table.has_key("soldier attack")) { |
62 | items_table = table.get_table("soldier attack"); |
63 | - m_train_attack = true; |
64 | - m_min_attack = items_table->get_int("min_level"); |
65 | - m_max_attack = items_table->get_int("max_level"); |
66 | + train_attack_ = true; |
67 | + min_attack_ = items_table->get_int("min_level"); |
68 | + max_attack_ = items_table->get_int("max_level"); |
69 | add_training_inputs(*items_table.get(), &food_attack_, &weapons_attack_); |
70 | } |
71 | if (table.has_key("soldier defense")) { |
72 | items_table = table.get_table("soldier defense"); |
73 | - m_train_defense = true; |
74 | - m_min_defense = items_table->get_int("min_level"); |
75 | - m_max_defense = items_table->get_int("max_level"); |
76 | + train_defense_ = true; |
77 | + min_defense_ = items_table->get_int("min_level"); |
78 | + max_defense_ = items_table->get_int("max_level"); |
79 | add_training_inputs(*items_table.get(), &food_defense_, &weapons_defense_); |
80 | } |
81 | if (table.has_key("soldier evade")) { |
82 | items_table = table.get_table("soldier evade"); |
83 | - m_train_evade = true; |
84 | - m_min_evade = items_table->get_int("min_level"); |
85 | - m_max_evade = items_table->get_int("max_level"); |
86 | + train_evade_ = true; |
87 | + min_evade_ = items_table->get_int("min_level"); |
88 | + max_evade_ = items_table->get_int("max_level"); |
89 | add_training_inputs(*items_table.get(), &food_evade_, &weapons_evade_); |
90 | } |
91 | } |
92 | @@ -115,13 +115,13 @@ |
93 | int32_t TrainingSiteDescr::get_min_level(const TrainingAttribute at) const { |
94 | switch (at) { |
95 | case atrHP: |
96 | - return m_min_hp; |
97 | + return min_hp_; |
98 | case atrAttack: |
99 | - return m_min_attack; |
100 | + return min_attack_; |
101 | case atrDefense: |
102 | - return m_min_defense; |
103 | + return min_defense_; |
104 | case atrEvade: |
105 | - return m_min_evade; |
106 | + return min_evade_; |
107 | case atrTotal: |
108 | throw wexception("Unknown attribute value!"); |
109 | } |
110 | @@ -137,13 +137,13 @@ |
111 | int32_t TrainingSiteDescr::get_max_level(const TrainingAttribute at) const { |
112 | switch (at) { |
113 | case atrHP: |
114 | - return m_max_hp; |
115 | + return max_hp_; |
116 | case atrAttack: |
117 | - return m_max_attack; |
118 | + return max_attack_; |
119 | case atrDefense: |
120 | - return m_max_defense; |
121 | + return max_defense_; |
122 | case atrEvade: |
123 | - return m_max_evade; |
124 | + return max_evade_; |
125 | case atrTotal: |
126 | throw wexception("Unknown attribute value!"); |
127 | } |
128 | @@ -153,7 +153,7 @@ |
129 | int32_t |
130 | TrainingSiteDescr::get_max_stall() const |
131 | { |
132 | - return m_max_stall; |
133 | + return max_stall_; |
134 | } |
135 | |
136 | void TrainingSiteDescr::add_training_inputs( |
137 | @@ -188,18 +188,18 @@ |
138 | |
139 | TrainingSite::TrainingSite(const TrainingSiteDescr & d) : |
140 | ProductionSite (d), |
141 | -m_soldier_request(nullptr), |
142 | -m_capacity (descr().get_max_number_of_soldiers()), |
143 | -m_build_heroes (false), |
144 | -m_result (Failed) |
145 | +soldier_request_(nullptr), |
146 | +capacity_ (descr().get_max_number_of_soldiers()), |
147 | +build_heroes_ (false), |
148 | +result_ (Failed) |
149 | { |
150 | // Initialize this in the constructor so that loading code may |
151 | // overwrite priorities. |
152 | calc_upgrades(); |
153 | - m_current_upgrade = nullptr; |
154 | + current_upgrade_ = nullptr; |
155 | set_post_timer(6000); |
156 | - training_failure_count.clear(); |
157 | - max_stall_val = training_state_multiplier * d.get_max_stall(); |
158 | + training_failure_count_.clear(); |
159 | + max_stall_val_ = training_state_multiplier_ * d.get_max_stall(); |
160 | |
161 | if (d.get_train_hp()) |
162 | init_kick_state(atrHP, d); |
163 | @@ -228,7 +228,7 @@ |
164 | |
165 | upcast(Game, game, &egbase); |
166 | |
167 | - for (Soldier * soldier : m_soldiers) { |
168 | + for (Soldier * soldier : soldiers_) { |
169 | soldier->set_location_initially(*this); |
170 | assert(!soldier->get_state()); // Should be newly created. |
171 | |
172 | @@ -249,8 +249,8 @@ |
173 | { |
174 | ProductionSite::set_economy(e); |
175 | |
176 | - if (m_soldier_request) |
177 | - m_soldier_request->set_economy(e); |
178 | + if (soldier_request_) |
179 | + soldier_request_->set_economy(e); |
180 | } |
181 | |
182 | /** |
183 | @@ -260,8 +260,8 @@ |
184 | */ |
185 | void TrainingSite::cleanup(EditorGameBase & egbase) |
186 | { |
187 | - delete m_soldier_request; |
188 | - m_soldier_request = nullptr; |
189 | + delete soldier_request_; |
190 | + soldier_request_ = nullptr; |
191 | |
192 | ProductionSite::cleanup(egbase); |
193 | } |
194 | @@ -275,9 +275,9 @@ |
195 | // Note that the given Soldier might already be in the array |
196 | // for loadgames. |
197 | if |
198 | - (std::find(m_soldiers.begin(), m_soldiers.end(), soldier) == |
199 | - m_soldiers.end()) |
200 | - m_soldiers.push_back(soldier); |
201 | + (std::find(soldiers_.begin(), soldiers_.end(), soldier) == |
202 | + soldiers_.end()) |
203 | + soldiers_.push_back(soldier); |
204 | |
205 | if (upcast(Game, game, &owner().egbase())) |
206 | schedule_act(*game, 100); |
207 | @@ -290,9 +290,9 @@ |
208 | |
209 | if (upcast(Soldier, soldier, &w)) { |
210 | std::vector<Soldier *>::iterator const it = |
211 | - std::find(m_soldiers.begin(), m_soldiers.end(), soldier); |
212 | - if (it != m_soldiers.end()) { |
213 | - m_soldiers.erase(it); |
214 | + std::find(soldiers_.begin(), soldiers_.end(), soldier); |
215 | + if (it != soldiers_.end()) { |
216 | + soldiers_.erase(it); |
217 | |
218 | if (game) |
219 | schedule_act(*game, 100); |
220 | @@ -307,9 +307,9 @@ |
221 | * Request soldiers up to capacity, or let go of surplus soldiers. |
222 | */ |
223 | void TrainingSite::update_soldier_request() { |
224 | - if (m_soldiers.size() < m_capacity) { |
225 | - if (!m_soldier_request) { |
226 | - m_soldier_request = |
227 | + if (soldiers_.size() < capacity_) { |
228 | + if (!soldier_request_) { |
229 | + soldier_request_ = |
230 | new Request |
231 | (*this, |
232 | owner().tribe().soldier(), |
233 | @@ -344,16 +344,16 @@ |
234 | descr().get_min_level(atrHP), |
235 | descr().get_max_level(atrHP))); |
236 | |
237 | - m_soldier_request->set_requirements(r); |
238 | + soldier_request_->set_requirements(r); |
239 | } |
240 | |
241 | - m_soldier_request->set_count(m_capacity - m_soldiers.size()); |
242 | - } else if (m_soldiers.size() >= m_capacity) { |
243 | - delete m_soldier_request; |
244 | - m_soldier_request = nullptr; |
245 | + soldier_request_->set_count(capacity_ - soldiers_.size()); |
246 | + } else if (soldiers_.size() >= capacity_) { |
247 | + delete soldier_request_; |
248 | + soldier_request_ = nullptr; |
249 | |
250 | - while (m_soldiers.size() > m_capacity) { |
251 | - drop_soldier(**m_soldiers.rbegin()); |
252 | + while (soldiers_.size() > capacity_) { |
253 | + drop_soldier(**soldiers_.rbegin()); |
254 | } |
255 | } |
256 | } |
257 | @@ -378,7 +378,7 @@ |
258 | Soldier& s = dynamic_cast<Soldier&>(*w); |
259 | |
260 | assert(s.get_location(game) == &tsite); |
261 | - assert(tsite.m_soldier_request == &rq); |
262 | + assert(tsite.soldier_request_ == &rq); |
263 | |
264 | tsite.incorporate_soldier(game, s); |
265 | } |
266 | @@ -411,12 +411,12 @@ |
267 | |
268 | std::vector<Soldier *> TrainingSite::present_soldiers() const |
269 | { |
270 | - return m_soldiers; |
271 | + return soldiers_; |
272 | } |
273 | |
274 | std::vector<Soldier *> TrainingSite::stationed_soldiers() const |
275 | { |
276 | - return m_soldiers; |
277 | + return soldiers_; |
278 | } |
279 | |
280 | uint32_t TrainingSite::min_soldier_capacity() const { |
281 | @@ -427,14 +427,14 @@ |
282 | } |
283 | uint32_t TrainingSite::soldier_capacity() const |
284 | { |
285 | - return m_capacity; |
286 | + return capacity_; |
287 | } |
288 | |
289 | void TrainingSite::set_soldier_capacity(uint32_t const capacity) { |
290 | assert(min_soldier_capacity() <= capacity); |
291 | assert (capacity <= max_soldier_capacity()); |
292 | - assert(m_capacity != capacity); |
293 | - m_capacity = capacity; |
294 | + assert(capacity_ != capacity); |
295 | + capacity_ = capacity; |
296 | update_soldier_request(); |
297 | } |
298 | |
299 | @@ -452,13 +452,13 @@ |
300 | Game & game = dynamic_cast<Game&>(owner().egbase()); |
301 | |
302 | std::vector<Soldier *>::iterator it = |
303 | - std::find(m_soldiers.begin(), m_soldiers.end(), &soldier); |
304 | - if (it == m_soldiers.end()) { |
305 | + std::find(soldiers_.begin(), soldiers_.end(), &soldier); |
306 | + if (it == soldiers_.end()) { |
307 | molog("TrainingSite::drop_soldier: soldier not in training site"); |
308 | return; |
309 | } |
310 | |
311 | - m_soldiers.erase(it); |
312 | + soldiers_.erase(it); |
313 | |
314 | soldier.reset_tasks(game); |
315 | soldier.start_task_leavebuilding(game, true); |
316 | @@ -476,16 +476,16 @@ |
317 | { |
318 | std::vector<Soldier *> droplist; |
319 | |
320 | - for (uint32_t i = 0; i < m_soldiers.size(); ++i) { |
321 | - std::vector<Upgrade>::iterator it = m_upgrades.begin(); |
322 | - for (; it != m_upgrades.end(); ++it) { |
323 | - int32_t level = m_soldiers[i]->get_level(it->attribute); |
324 | + for (uint32_t i = 0; i < soldiers_.size(); ++i) { |
325 | + std::vector<Upgrade>::iterator it = upgrades_.begin(); |
326 | + for (; it != upgrades_.end(); ++it) { |
327 | + int32_t level = soldiers_[i]->get_level(it->attribute); |
328 | if (level >= it->min && level <= it->max) |
329 | break; |
330 | } |
331 | |
332 | - if (it == m_upgrades.end()) |
333 | - droplist.push_back(m_soldiers[i]); |
334 | + if (it == upgrades_.end()) |
335 | + droplist.push_back(soldiers_[i]); |
336 | } |
337 | |
338 | // Drop soldiers only now, so that changes in the soldiers array don't |
339 | @@ -504,9 +504,9 @@ |
340 | Soldier * soldier_to_drop = nullptr; |
341 | uint32_t highest_soldier_level_seen = 0; |
342 | |
343 | - for (uint32_t i = 0; i < m_soldiers.size(); ++i) |
344 | + for (uint32_t i = 0; i < soldiers_.size(); ++i) |
345 | { |
346 | - uint32_t this_soldier_level = m_soldiers[i]->get_level(atrTotal); |
347 | + uint32_t this_soldier_level = soldiers_[i]->get_level(atrTotal); |
348 | |
349 | bool this_soldier_is_safe = false; |
350 | if (this_soldier_level <= highest_soldier_level_seen) |
351 | @@ -517,14 +517,14 @@ |
352 | } |
353 | else |
354 | { |
355 | - for (const Upgrade& upgrade: m_upgrades) |
356 | + for (const Upgrade& upgrade: upgrades_) |
357 | if (! this_soldier_is_safe) |
358 | { |
359 | // Soldier is safe, if he: |
360 | // - is below maximum, and |
361 | // - is not in a stalled state |
362 | // Check done separately for each art. |
363 | - int32_t level = m_soldiers[i]->get_level(upgrade.attribute); |
364 | + int32_t level = soldiers_[i]->get_level(upgrade.attribute); |
365 | |
366 | // Below maximum -check |
367 | if (level > upgrade.max) |
368 | @@ -533,8 +533,8 @@ |
369 | } |
370 | |
371 | TypeAndLevel train_tl(upgrade.attribute, level); |
372 | - TrainFailCount::iterator tstep = training_failure_count.find(train_tl); |
373 | - if (tstep == training_failure_count.end()) |
374 | + TrainFailCount::iterator tstep = training_failure_count_.find(train_tl); |
375 | + if (tstep == training_failure_count_.end()) |
376 | { |
377 | log("\nTrainingSite::drop_stalled_soldiers: "); |
378 | log("training step %d,%d not found in this school!\n", upgrade.attribute, level); |
379 | @@ -544,7 +544,7 @@ |
380 | tstep->second.second = 1; // a soldier is present at this level |
381 | |
382 | // Stalled state -check |
383 | - if (max_stall_val > tstep->second.first) |
384 | + if (max_stall_val_ > tstep->second.first) |
385 | { |
386 | this_soldier_is_safe = true; |
387 | break; |
388 | @@ -554,7 +554,7 @@ |
389 | if (!this_soldier_is_safe) |
390 | { |
391 | // Make this soldier a kick-out candidate |
392 | - soldier_to_drop = m_soldiers[i]; |
393 | + soldier_to_drop = soldiers_[i]; |
394 | highest_soldier_level_seen = this_soldier_level; |
395 | } |
396 | } |
397 | @@ -583,7 +583,7 @@ |
398 | |
399 | void TrainingSite::program_end(Game & game, ProgramResult const result) |
400 | { |
401 | - m_result = result; |
402 | + result_ = result; |
403 | ProductionSite::program_end(game, result); |
404 | // For unknown reasons sometimes there is a fully upgraded soldier |
405 | // that failed to be send away, so at the end of this function |
406 | @@ -591,19 +591,19 @@ |
407 | // function were run |
408 | bool leftover_soldiers_check = true; |
409 | |
410 | - if (m_current_upgrade) { |
411 | - if (m_result == Completed) { |
412 | + if (current_upgrade_) { |
413 | + if (result_ == Completed) { |
414 | drop_unupgradable_soldiers(game); |
415 | leftover_soldiers_check = false; |
416 | - m_current_upgrade->lastsuccess = true; |
417 | - m_current_upgrade->failures = 0; |
418 | + current_upgrade_->lastsuccess = true; |
419 | + current_upgrade_->failures = 0; |
420 | } |
421 | else { |
422 | - m_current_upgrade->failures++; |
423 | + current_upgrade_->failures++; |
424 | drop_stalled_soldiers(game); |
425 | leftover_soldiers_check = false; |
426 | } |
427 | - m_current_upgrade = nullptr; |
428 | + current_upgrade_ = nullptr; |
429 | } |
430 | |
431 | if (leftover_soldiers_check) { |
432 | @@ -627,7 +627,7 @@ |
433 | uint32_t maxprio = 0; |
434 | uint32_t maxcredit = 0; |
435 | |
436 | - for (Upgrade& upgrade : m_upgrades) { |
437 | + for (Upgrade& upgrade : upgrades_) { |
438 | if (upgrade.credit >= 10) { |
439 | upgrade.credit -= 10; |
440 | return start_upgrade(game, upgrade); |
441 | @@ -645,7 +645,7 @@ |
442 | |
443 | uint32_t const multiplier = 1 + (10 - maxcredit) / maxprio; |
444 | |
445 | - for (Upgrade& upgrade : m_upgrades) { |
446 | + for (Upgrade& upgrade : upgrades_) { |
447 | upgrade.credit += multiplier * upgrade.prio; |
448 | } |
449 | } |
450 | @@ -661,7 +661,7 @@ |
451 | int32_t minlevel = upgrade.max; |
452 | int32_t maxlevel = upgrade.min; |
453 | |
454 | - for (Soldier * soldier : m_soldiers) { |
455 | + for (Soldier * soldier : soldiers_) { |
456 | int32_t const level = soldier->get_level(upgrade.attribute); |
457 | |
458 | if (level > upgrade.max || level < upgrade.min) |
459 | @@ -680,7 +680,7 @@ |
460 | if (upgrade.lastsuccess || upgrade.lastattempt < 0) { |
461 | // Start greedily on the first ever attempt, and restart greedily |
462 | // after a sucessful upgrade |
463 | - if (m_build_heroes) |
464 | + if (build_heroes_) |
465 | level = maxlevel; |
466 | else |
467 | level = minlevel; |
468 | @@ -688,7 +688,7 @@ |
469 | // The last attempt wasn't successful; |
470 | // This happens e.g. when lots of low-level soldiers are present, |
471 | // but the prerequisites for improving them aren't. |
472 | - if (m_build_heroes) { |
473 | + if (build_heroes_) { |
474 | level = upgrade.lastattempt - 1; |
475 | if (level < minlevel) |
476 | level = maxlevel; |
477 | @@ -699,7 +699,7 @@ |
478 | } |
479 | } |
480 | |
481 | - m_current_upgrade = &upgrade; |
482 | + current_upgrade_ = &upgrade; |
483 | upgrade.lastattempt = level; |
484 | upgrade.lastsuccess = false; |
485 | |
486 | @@ -710,7 +710,7 @@ |
487 | |
488 | TrainingSite::Upgrade * TrainingSite::get_upgrade(TrainingAttribute const atr) |
489 | { |
490 | - for (Upgrade& upgrade : m_upgrades) { |
491 | + for (Upgrade& upgrade : upgrades_) { |
492 | if (upgrade.attribute == atr) { |
493 | return &upgrade; |
494 | } |
495 | @@ -724,7 +724,7 @@ |
496 | */ |
497 | int32_t TrainingSite::get_pri(TrainingAttribute atr) |
498 | { |
499 | - for (const Upgrade& upgrade : m_upgrades) { |
500 | + for (const Upgrade& upgrade : upgrades_) { |
501 | if (upgrade.attribute == atr) { |
502 | return upgrade.prio; |
503 | } |
504 | @@ -740,7 +740,7 @@ |
505 | if (prio < 0) |
506 | prio = 0; |
507 | |
508 | - for (Upgrade& upgrade : m_upgrades) { |
509 | + for (Upgrade& upgrade : upgrades_) { |
510 | if (upgrade.attribute == atr) { |
511 | upgrade.prio = prio; |
512 | return; |
513 | @@ -764,14 +764,14 @@ |
514 | u.lastattempt = -1; |
515 | u.lastsuccess = false; |
516 | u.failures = 0; |
517 | - m_upgrades.push_back(u); |
518 | + upgrades_.push_back(u); |
519 | } |
520 | |
521 | /** |
522 | - * Called once at initialization to populate \ref m_upgrades. |
523 | + * Called once at initialization to populate \ref upgrades_. |
524 | */ |
525 | void TrainingSite::calc_upgrades() { |
526 | - assert(m_upgrades.empty()); |
527 | + assert(upgrades_.empty()); |
528 | |
529 | // TODO(unknown): This is currently hardcoded for "soldier" but it should allow any |
530 | // soldier type name. |
531 | @@ -790,10 +790,10 @@ |
532 | TrainingSite::training_attempted(uint32_t type, uint32_t level) |
533 | { |
534 | TypeAndLevel key(type, level); |
535 | - if (training_failure_count.find(key) == training_failure_count.end()) |
536 | - training_failure_count[key] = std::make_pair(training_state_multiplier, 0); |
537 | + if (training_failure_count_.find(key) == training_failure_count_.end()) |
538 | + training_failure_count_[key] = std::make_pair(training_state_multiplier_, 0); |
539 | else |
540 | - training_failure_count[key].first += training_state_multiplier; |
541 | + training_failure_count_[key].first += training_state_multiplier_; |
542 | } |
543 | |
544 | /** |
545 | @@ -805,14 +805,14 @@ |
546 | { |
547 | TypeAndLevel key(type, level); |
548 | // Here I assume that key exists: training has been attempted before it can succeed. |
549 | - training_failure_count[key].first = 0; |
550 | + training_failure_count_[key].first = 0; |
551 | } |
552 | |
553 | void |
554 | TrainingSite::training_done() |
555 | { |
556 | TrainFailCount::iterator it; |
557 | - for (it = training_failure_count.begin(); it != training_failure_count.end(); it++) |
558 | + for (it = training_failure_count_.begin(); it != training_failure_count_.end(); it++) |
559 | { |
560 | // If a soldier is present at this training level, deteoriate |
561 | if (it->second.second) |
562 | |
563 | === modified file 'src/logic/map_objects/tribes/trainingsite.h' |
564 | --- src/logic/map_objects/tribes/trainingsite.h 2016-01-31 15:31:00 +0000 |
565 | +++ src/logic/map_objects/tribes/trainingsite.h 2016-02-13 14:28:04 +0000 |
566 | @@ -39,12 +39,12 @@ |
567 | Building & create_object() const override; |
568 | |
569 | uint32_t get_max_number_of_soldiers() const { |
570 | - return m_num_soldiers; |
571 | + return num_soldiers_; |
572 | } |
573 | - bool get_train_hp () const {return m_train_hp;} |
574 | - bool get_train_attack () const {return m_train_attack;} |
575 | - bool get_train_defense() const {return m_train_defense;} |
576 | - bool get_train_evade () const {return m_train_evade;} |
577 | + bool get_train_hp () const {return train_hp_;} |
578 | + bool get_train_attack () const {return train_attack_;} |
579 | + bool get_train_defense() const {return train_defense_;} |
580 | + bool get_train_evade () const {return train_evade_;} |
581 | |
582 | int32_t get_min_level(TrainingAttribute) const; |
583 | int32_t get_max_level(TrainingAttribute) const; |
584 | @@ -85,35 +85,35 @@ |
585 | // struct and there should be a vector, indexed by Soldier_Index, |
586 | // with that struct structs as element type. |
587 | /** Maximum number of soldiers for a training site*/ |
588 | - uint32_t m_num_soldiers; |
589 | + uint32_t num_soldiers_; |
590 | /** Number of rounds w/o successful training, after which a soldier is kicked out.**/ |
591 | - uint32_t m_max_stall; |
592 | + uint32_t max_stall_; |
593 | /** Whether this site can train hitpoints*/ |
594 | - bool m_train_hp; |
595 | + bool train_hp_; |
596 | /** Whether this site can train attack*/ |
597 | - bool m_train_attack; |
598 | + bool train_attack_; |
599 | /** Whether this site can train defense*/ |
600 | - bool m_train_defense; |
601 | + bool train_defense_; |
602 | /** Whether this site can train evasion*/ |
603 | - bool m_train_evade; |
604 | + bool train_evade_; |
605 | |
606 | /** Minimum hitpoints to which a soldier can drop at this site*/ |
607 | - int32_t m_min_hp; |
608 | + int32_t min_hp_; |
609 | /** Minimum attacks to which a soldier can drop at this site*/ |
610 | - int32_t m_min_attack; |
611 | + int32_t min_attack_; |
612 | /** Minimum defense to which a soldier can drop at this site*/ |
613 | - int32_t m_min_defense; |
614 | + int32_t min_defense_; |
615 | /** Minimum evasion to which a soldier can drop at this site*/ |
616 | - int32_t m_min_evade; |
617 | + int32_t min_evade_; |
618 | |
619 | /** Maximum hitpoints a soldier can acquire at this site*/ |
620 | - int32_t m_max_hp; |
621 | + int32_t max_hp_; |
622 | /** Maximum attack a soldier can acquire at this site*/ |
623 | - int32_t m_max_attack; |
624 | + int32_t max_attack_; |
625 | /** Maximum defense a soldier can acquire at this site*/ |
626 | - int32_t m_max_defense; |
627 | + int32_t max_defense_; |
628 | /** Maximum evasion a soldier can acquire at this site*/ |
629 | - int32_t m_max_evade; |
630 | + int32_t max_evade_; |
631 | |
632 | // For building help |
633 | std::vector<std::vector<std::string>> food_hp_; |
634 | @@ -125,8 +125,6 @@ |
635 | std::vector<std::string> weapons_defense_; |
636 | std::vector<std::string> weapons_evade_; |
637 | |
638 | - // Re-use of m_inputs to get the resources |
639 | - // TrainingMap m_programs; |
640 | DISALLOW_COPY_AND_ASSIGN(TrainingSiteDescr); |
641 | }; |
642 | |
643 | @@ -167,14 +165,14 @@ |
644 | void remove_worker(Worker &) override; |
645 | |
646 | bool get_build_heroes() { |
647 | - return m_build_heroes; |
648 | + return build_heroes_; |
649 | } |
650 | void set_build_heroes(bool b_heroes) { |
651 | - m_build_heroes = b_heroes; |
652 | + build_heroes_ = b_heroes; |
653 | } |
654 | void switch_heroes() { |
655 | - m_build_heroes = !m_build_heroes; |
656 | - molog("BUILD_HEROES: %s", m_build_heroes ? "TRUE" : "FALSE"); |
657 | + build_heroes_ = !build_heroes_; |
658 | + molog("BUILD_HEROES: %s", build_heroes_ ? "TRUE" : "FALSE"); |
659 | } |
660 | |
661 | void set_economy(Economy * e) override; |
662 | @@ -217,38 +215,37 @@ |
663 | void drop_stalled_soldiers(Game &); |
664 | Upgrade * get_upgrade(TrainingAttribute); |
665 | |
666 | -private: |
667 | /// Open requests for soldiers. The soldiers can be under way or unavailable |
668 | - Request * m_soldier_request; |
669 | + Request * soldier_request_; |
670 | |
671 | /** The soldiers currently at the training site*/ |
672 | - std::vector<Soldier *> m_soldiers; |
673 | + std::vector<Soldier *> soldiers_; |
674 | |
675 | /** Number of soldiers that should be trained concurrently. |
676 | * Equal or less to maximum number of soldiers supported by a training site. |
677 | - * There is no guarantee there really are m_capacity soldiers in the |
678 | + * There is no guarantee there really are capacity_ soldiers in the |
679 | * building - some of them might still be under way or even not yet |
680 | * available*/ |
681 | - uint32_t m_capacity; |
682 | + uint32_t capacity_; |
683 | |
684 | /** True, \b always upgrade already experienced soldiers first, when possible |
685 | * False, \b always upgrade inexperienced soldiers first, when possible */ |
686 | - bool m_build_heroes; |
687 | - |
688 | - std::vector<Upgrade> m_upgrades; |
689 | - Upgrade * m_current_upgrade; |
690 | - |
691 | - ProgramResult m_result; /// The result of the last training program. |
692 | + bool build_heroes_; |
693 | + |
694 | + std::vector<Upgrade> upgrades_; |
695 | + Upgrade * current_upgrade_; |
696 | + |
697 | + ProgramResult result_; /// The result of the last training program. |
698 | |
699 | // These are used for kicking out soldiers prematurely |
700 | - static const uint32_t training_state_multiplier; |
701 | + static const uint32_t training_state_multiplier_; |
702 | // Unuque key to address each training level of each war art |
703 | using TypeAndLevel = std::pair<uint16_t, uint16_t>; |
704 | // First entry is the "stallness", second is a bool |
705 | using FailAndPresence = std::pair<uint16_t, uint8_t>; // first might wrap in a long play.. |
706 | using TrainFailCount = std::map<TypeAndLevel, FailAndPresence>; |
707 | - TrainFailCount training_failure_count; |
708 | - uint32_t max_stall_val; |
709 | + TrainFailCount training_failure_count_; |
710 | + uint32_t max_stall_val_; |
711 | void init_kick_state(const TrainingAttribute&, const TrainingSiteDescr&); |
712 | |
713 | |
714 | |
715 | === modified file 'src/logic/map_objects/tribes/tribe_descr.cc' |
716 | --- src/logic/map_objects/tribes/tribe_descr.cc 2016-01-28 05:24:34 +0000 |
717 | +++ src/logic/map_objects/tribes/tribe_descr.cc 2016-02-13 14:28:04 +0000 |
718 | @@ -56,7 +56,7 @@ |
719 | : name_(table.get_string("name")), descname_(info.descname), tribes_(init_tribes) { |
720 | |
721 | try { |
722 | - m_initializations = info.initializations; |
723 | + initializations_ = info.initializations; |
724 | |
725 | std::unique_ptr<LuaTable> items_table = table.get_table("animations"); |
726 | frontier_animation_id_ = g_gr->animations().load(*items_table->get_table("frontier")); |
727 | |
728 | === modified file 'src/logic/map_objects/tribes/tribe_descr.h' |
729 | --- src/logic/map_objects/tribes/tribe_descr.h 2016-01-24 20:11:53 +0000 |
730 | +++ src/logic/map_objects/tribes/tribe_descr.h 2016-02-13 14:28:04 +0000 |
731 | @@ -126,7 +126,7 @@ |
732 | |
733 | // Returns the initalization at 'index' (which must not be out of bounds). |
734 | const TribeBasicInfo::Initialization& initialization(const uint8_t index) const { |
735 | - return m_initializations.at(index); |
736 | + return initializations_.at(index); |
737 | } |
738 | |
739 | using WaresOrder = std::vector<std::vector<Widelands::DescriptionIndex>>; |
740 | @@ -184,7 +184,7 @@ |
741 | WaresOrder workers_order_; |
742 | WaresOrderCoords workers_order_coords_; |
743 | |
744 | - std::vector<TribeBasicInfo::Initialization> m_initializations; |
745 | + std::vector<TribeBasicInfo::Initialization> initializations_; |
746 | |
747 | DISALLOW_COPY_AND_ASSIGN(TribeDescr); |
748 | }; |
749 | |
750 | === modified file 'src/logic/map_objects/tribes/warehouse.cc' |
751 | --- src/logic/map_objects/tribes/warehouse.cc 2016-02-13 11:25:41 +0000 |
752 | +++ src/logic/map_objects/tribes/warehouse.cc 2016-02-13 14:28:04 +0000 |
753 | @@ -255,13 +255,13 @@ |
754 | WarehouseDescr::WarehouseDescr |
755 | (const std::string& init_descname, const LuaTable& table, const EditorGameBase& egbase) |
756 | : BuildingDescr(init_descname, MapObjectType::WAREHOUSE, table, egbase), |
757 | - m_conquers (0), |
758 | - m_heal_per_second (0) |
759 | + conquers_ (0), |
760 | + heal_per_second_ (0) |
761 | { |
762 | - m_heal_per_second = table.get_int("heal_per_second"); |
763 | + heal_per_second_ = table.get_int("heal_per_second"); |
764 | if (table.has_key("conquers")) { |
765 | - m_conquers = table.get_int("conquers"); |
766 | - workarea_info_[m_conquers].insert(descname() + " conquer"); |
767 | + conquers_ = table.get_int("conquers"); |
768 | + workarea_info_[conquers_].insert(descname() + " conquer"); |
769 | } |
770 | } |
771 | |
772 | @@ -273,18 +273,18 @@ |
773 | |
774 | Warehouse::Warehouse(const WarehouseDescr & warehouse_descr) : |
775 | Building(warehouse_descr), |
776 | - m_supply(new WarehouseSupply(this)), |
777 | - m_next_military_act(0), |
778 | + supply_(new WarehouseSupply(this)), |
779 | + next_military_act_(0), |
780 | portdock_(nullptr) |
781 | { |
782 | - m_next_stock_remove_act = 0; |
783 | + next_stock_remove_act_ = 0; |
784 | cleanup_in_progress_ = false; |
785 | } |
786 | |
787 | |
788 | Warehouse::~Warehouse() |
789 | { |
790 | - delete m_supply; |
791 | + delete supply_; |
792 | } |
793 | |
794 | /** |
795 | @@ -295,7 +295,7 @@ |
796 | { |
797 | const TribeDescr& tribe = owner().tribe(); |
798 | |
799 | - if (pw.index == INVALID_INDEX || !(pw.index < m_supply->get_workers().get_nrwareids())) { |
800 | + if (pw.index == INVALID_INDEX || !(pw.index < supply_->get_workers().get_nrwareids())) { |
801 | return false; |
802 | } |
803 | |
804 | @@ -305,7 +305,7 @@ |
805 | return false; |
806 | } |
807 | |
808 | - if (!(pw.index < m_supply->get_workers().get_nrwareids())) { |
809 | + if (!(pw.index < supply_->get_workers().get_nrwareids())) { |
810 | return false; |
811 | } |
812 | |
813 | @@ -380,12 +380,12 @@ |
814 | DescriptionIndex const worker_index = worker_types_without_cost.at(--i); |
815 | if |
816 | (owner().is_worker_type_allowed(worker_index) && |
817 | - m_next_worker_without_cost_spawn[i] == never()) |
818 | + next_worker_without_cost_spawn_[i] == never()) |
819 | { |
820 | if (next_spawn == never()) { |
821 | next_spawn = schedule_act(dynamic_cast<Game&>(egbase), WORKER_WITHOUT_COST_SPAWN_INTERVAL); |
822 | } |
823 | - m_next_worker_without_cost_spawn[i] = next_spawn; |
824 | + next_worker_without_cost_spawn_[i] = next_spawn; |
825 | log |
826 | ("WARNING: player %u is allowed to create worker type %s but his " |
827 | "%s %u at (%i, %i) does not have a next_spawn time set for that " |
828 | @@ -400,10 +400,10 @@ |
829 | // Ensure consistency of PlannedWorker requests |
830 | { |
831 | uint32_t pwidx = 0; |
832 | - while (pwidx < m_planned_workers.size()) { |
833 | - if (!_load_finish_planned_worker(m_planned_workers[pwidx])) { |
834 | - m_planned_workers[pwidx].cleanup(); |
835 | - m_planned_workers.erase(m_planned_workers.begin() + pwidx); |
836 | + while (pwidx < planned_workers_.size()) { |
837 | + if (!_load_finish_planned_worker(planned_workers_[pwidx])) { |
838 | + planned_workers_[pwidx].cleanup(); |
839 | + planned_workers_.erase(planned_workers_.begin() + pwidx); |
840 | } else { |
841 | pwidx++; |
842 | } |
843 | @@ -435,16 +435,16 @@ |
844 | |
845 | for (size_t i = 0; i < worker_types_without_cost.size(); ++i) { |
846 | if (owner().is_worker_type_allowed(worker_types_without_cost.at(i))) { |
847 | - m_next_worker_without_cost_spawn[i] = act_time; |
848 | + next_worker_without_cost_spawn_[i] = act_time; |
849 | } |
850 | } |
851 | } |
852 | - // m_next_military_act is not touched in the loading code. Is only needed |
853 | + // next_military_act_ is not touched in the loading code. Is only needed |
854 | // if the warehouse is created in the game? I assume it's for the |
855 | // conquer_radius thing |
856 | - m_next_military_act = schedule_act(*game, 1000); |
857 | + next_military_act_ = schedule_act(*game, 1000); |
858 | |
859 | - m_next_stock_remove_act = schedule_act(*game, 4000); |
860 | + next_stock_remove_act_ = schedule_act(*game, 4000); |
861 | |
862 | log("Message: adding %s for player %i at (%d, %d)\n", to_string(descr().type()).c_str(), |
863 | player.player_number(), position_.x, position_.y); |
864 | @@ -501,14 +501,14 @@ |
865 | void Warehouse::init_containers(Player& player) { |
866 | DescriptionIndex const nr_wares = player.egbase().tribes().nrwares(); |
867 | DescriptionIndex const nr_workers = player.egbase().tribes().nrworkers(); |
868 | - m_supply->set_nrwares(nr_wares); |
869 | - m_supply->set_nrworkers(nr_workers); |
870 | + supply_->set_nrwares(nr_wares); |
871 | + supply_->set_nrworkers(nr_workers); |
872 | |
873 | - m_ware_policy.resize(nr_wares, SP_Normal); |
874 | - m_worker_policy.resize(nr_workers, SP_Normal); |
875 | + ware_policy_.resize(nr_wares, SP_Normal); |
876 | + worker_policy_.resize(nr_workers, SP_Normal); |
877 | |
878 | uint8_t nr_worker_types_without_cost = player.tribe().worker_types_without_cost().size(); |
879 | - m_next_worker_without_cost_spawn.resize(nr_worker_types_without_cost, never()); |
880 | + next_worker_without_cost_spawn_.resize(nr_worker_types_without_cost, never()); |
881 | } |
882 | |
883 | /** |
884 | @@ -603,7 +603,7 @@ |
885 | for (uint32_t i = 0; i < stock; ++i) { |
886 | launch_worker(*game, id, Requirements()).start_task_leavebuilding(*game, true); |
887 | } |
888 | - assert(!m_incorporated_workers.count(id) || m_incorporated_workers[id].empty()); |
889 | + assert(!incorporated_workers_.count(id) || incorporated_workers_[id].empty()); |
890 | } |
891 | else |
892 | { |
893 | @@ -612,11 +612,11 @@ |
894 | } |
895 | } |
896 | } |
897 | - m_incorporated_workers.clear(); |
898 | + incorporated_workers_.clear(); |
899 | |
900 | - while (!m_planned_workers.empty()) { |
901 | - m_planned_workers.back().cleanup(); |
902 | - m_planned_workers.pop_back(); |
903 | + while (!planned_workers_.empty()) { |
904 | + planned_workers_.back().cleanup(); |
905 | + planned_workers_.pop_back(); |
906 | } |
907 | |
908 | Map& map = egbase.map(); |
909 | @@ -650,10 +650,10 @@ |
910 | const std::vector<DescriptionIndex> & worker_types_without_cost = |
911 | owner().tribe().worker_types_without_cost(); |
912 | for (size_t i = worker_types_without_cost.size(); i;) |
913 | - if (m_next_worker_without_cost_spawn[--i] <= gametime) { |
914 | + if (next_worker_without_cost_spawn_[--i] <= gametime) { |
915 | DescriptionIndex const id = worker_types_without_cost.at(i); |
916 | if (owner().is_worker_type_allowed(id)) { |
917 | - int32_t const stock = m_supply->stock_workers(id); |
918 | + int32_t const stock = supply_->stock_workers(id); |
919 | int32_t tdelta = WORKER_WITHOUT_COST_SPAWN_INTERVAL; |
920 | |
921 | if (stock < 100) { |
922 | @@ -666,19 +666,19 @@ |
923 | remove_workers(id, 1); |
924 | } |
925 | |
926 | - m_next_worker_without_cost_spawn[i] = |
927 | + next_worker_without_cost_spawn_[i] = |
928 | schedule_act(game, tdelta); |
929 | } else |
930 | - m_next_worker_without_cost_spawn[i] = never(); |
931 | + next_worker_without_cost_spawn_[i] = never(); |
932 | } |
933 | } |
934 | |
935 | // Military stuff: Kill the soldiers that are dead. |
936 | - if (m_next_military_act <= gametime) { |
937 | + if (next_military_act_ <= gametime) { |
938 | DescriptionIndex const soldier_index = owner().tribe().soldier(); |
939 | |
940 | - if (m_incorporated_workers.count(soldier_index)) { |
941 | - WorkerList & soldiers = m_incorporated_workers[soldier_index]; |
942 | + if (incorporated_workers_.count(soldier_index)) { |
943 | + WorkerList & soldiers = incorporated_workers_[soldier_index]; |
944 | |
945 | uint32_t total_heal = descr().get_heal_per_second(); |
946 | // Using an explicit iterator, as we plan to erase some |
947 | @@ -695,7 +695,7 @@ |
948 | // Soldier dead ... |
949 | if (!soldier || soldier->get_current_hitpoints() == 0) { |
950 | it = soldiers.erase(it); |
951 | - m_supply->remove_workers(soldier_index, 1); |
952 | + supply_->remove_workers(soldier_index, 1); |
953 | continue; |
954 | } |
955 | |
956 | @@ -706,13 +706,13 @@ |
957 | |
958 | } |
959 | } |
960 | - m_next_military_act = schedule_act(game, 1000); |
961 | + next_military_act_ = schedule_act(game, 1000); |
962 | } |
963 | |
964 | - if (static_cast<int32_t>(m_next_stock_remove_act - gametime) <= 0) { |
965 | + if (static_cast<int32_t>(next_stock_remove_act_ - gametime) <= 0) { |
966 | check_remove_stock(game); |
967 | |
968 | - m_next_stock_remove_act = schedule_act(game, 4000); |
969 | + next_stock_remove_act_ = schedule_act(game, 4000); |
970 | } |
971 | |
972 | // Update planned workers; this is to update the request amounts and |
973 | @@ -738,10 +738,10 @@ |
974 | |
975 | if (portdock_) |
976 | portdock_->set_economy(e); |
977 | - m_supply->set_economy(e); |
978 | + supply_->set_economy(e); |
979 | Building::set_economy(e); |
980 | |
981 | - for (const PlannedWorkers& pw : m_planned_workers) { |
982 | + for (const PlannedWorkers& pw : planned_workers_) { |
983 | for (Request * req : pw.requests) { |
984 | req->set_economy(e); |
985 | } |
986 | @@ -757,20 +757,20 @@ |
987 | |
988 | const WareList & Warehouse::get_wares() const |
989 | { |
990 | - return m_supply->get_wares(); |
991 | + return supply_->get_wares(); |
992 | } |
993 | |
994 | |
995 | const WareList & Warehouse::get_workers() const |
996 | { |
997 | - return m_supply->get_workers(); |
998 | + return supply_->get_workers(); |
999 | } |
1000 | |
1001 | PlayerImmovable::Workers Warehouse::get_incorporated_workers() |
1002 | { |
1003 | PlayerImmovable::Workers all_workers; |
1004 | |
1005 | - for (const std::pair<DescriptionIndex, WorkerList>& worker_pair : m_incorporated_workers) { |
1006 | + for (const std::pair<DescriptionIndex, WorkerList>& worker_pair : incorporated_workers_) { |
1007 | for (Worker * worker : worker_pair.second) { |
1008 | all_workers.push_back(worker); |
1009 | } |
1010 | @@ -782,28 +782,28 @@ |
1011 | /// Magically create wares in this warehouse. Updates the economy accordingly. |
1012 | void Warehouse::insert_wares(DescriptionIndex const id, uint32_t const count) |
1013 | { |
1014 | - m_supply->add_wares(id, count); |
1015 | + supply_->add_wares(id, count); |
1016 | } |
1017 | |
1018 | |
1019 | /// Magically destroy wares. |
1020 | void Warehouse::remove_wares(DescriptionIndex const id, uint32_t const count) |
1021 | { |
1022 | - m_supply->remove_wares(id, count); |
1023 | + supply_->remove_wares(id, count); |
1024 | } |
1025 | |
1026 | |
1027 | /// Magically create workers in this warehouse. Updates the economy accordingly. |
1028 | void Warehouse::insert_workers(DescriptionIndex const id, uint32_t const count) |
1029 | { |
1030 | - m_supply->add_workers(id, count); |
1031 | + supply_->add_workers(id, count); |
1032 | } |
1033 | |
1034 | |
1035 | /// Magically destroy workers. |
1036 | void Warehouse::remove_workers(DescriptionIndex const id, uint32_t const count) |
1037 | { |
1038 | - m_supply->remove_workers(id, count); |
1039 | + supply_->remove_workers(id, count); |
1040 | } |
1041 | |
1042 | |
1043 | @@ -813,14 +813,14 @@ |
1044 | { |
1045 | DescriptionIndex const carrierid = owner().tribe().carrier(); |
1046 | |
1047 | - if (!m_supply->stock_workers(carrierid)) |
1048 | + if (!supply_->stock_workers(carrierid)) |
1049 | { |
1050 | if (can_create_worker(game, carrierid)) |
1051 | { |
1052 | create_worker(game, carrierid); |
1053 | } |
1054 | } |
1055 | - if (m_supply->stock_workers(carrierid)) |
1056 | + if (supply_->stock_workers(carrierid)) |
1057 | { |
1058 | launch_worker(game, carrierid, Requirements()).start_task_fetchfromflag(game); |
1059 | } |
1060 | @@ -839,11 +839,11 @@ |
1061 | uint32_t sum = 0; |
1062 | |
1063 | do { |
1064 | - sum += m_supply->stock_workers(ware); |
1065 | + sum += supply_->stock_workers(ware); |
1066 | |
1067 | // NOTE: This code lies about the TrainingAttributes of non-instantiated workers. |
1068 | - if (m_incorporated_workers.count(ware)) { |
1069 | - for (Worker * worker : m_incorporated_workers[ware]) { |
1070 | + if (incorporated_workers_.count(ware)) { |
1071 | + for (Worker * worker : incorporated_workers_[ware]) { |
1072 | if (!req.check(*worker)) { |
1073 | // This is one of the workers in our sum. |
1074 | // But he is too stupid for this job |
1075 | @@ -864,16 +864,16 @@ |
1076 | (Game & game, DescriptionIndex worker_id, const Requirements & req) |
1077 | { |
1078 | do { |
1079 | - if (m_supply->stock_workers(worker_id)) { |
1080 | - uint32_t unincorporated = m_supply->stock_workers(worker_id); |
1081 | + if (supply_->stock_workers(worker_id)) { |
1082 | + uint32_t unincorporated = supply_->stock_workers(worker_id); |
1083 | |
1084 | // look if we got one of those in stock |
1085 | - if (m_incorporated_workers.count(worker_id)) { |
1086 | + if (incorporated_workers_.count(worker_id)) { |
1087 | // On cleanup, it could be that the worker was deleted under |
1088 | // us, so we erase the pointer we had to it and create a new |
1089 | // one. |
1090 | - remove_no_longer_existing_workers(game, &m_incorporated_workers[worker_id]); |
1091 | - WorkerList& incorporated_workers = m_incorporated_workers[worker_id]; |
1092 | + remove_no_longer_existing_workers(game, &incorporated_workers_[worker_id]); |
1093 | + WorkerList& incorporated_workers = incorporated_workers_[worker_id]; |
1094 | |
1095 | for (std::vector<Worker *>::iterator worker_iter = incorporated_workers.begin(); |
1096 | worker_iter != incorporated_workers.end(); ++worker_iter) |
1097 | @@ -886,18 +886,18 @@ |
1098 | worker->set_location(this); // back in a economy |
1099 | incorporated_workers.erase(worker_iter); |
1100 | |
1101 | - m_supply->remove_workers(worker_id, 1); |
1102 | + supply_->remove_workers(worker_id, 1); |
1103 | return *worker; |
1104 | } |
1105 | } |
1106 | } |
1107 | |
1108 | - assert(unincorporated <= m_supply->stock_workers(worker_id)); |
1109 | + assert(unincorporated <= supply_->stock_workers(worker_id)); |
1110 | |
1111 | if (unincorporated) { |
1112 | // Create a new one |
1113 | // NOTE: This code lies about the TrainingAttributes of the new worker |
1114 | - m_supply->remove_workers(worker_id, 1); |
1115 | + supply_->remove_workers(worker_id, 1); |
1116 | const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(worker_id); |
1117 | return workerdescr.create(game, owner(), this, position_); |
1118 | } |
1119 | @@ -926,7 +926,7 @@ |
1120 | |
1121 | DescriptionIndex worker_index = owner().tribe().worker_index(w->descr().name().c_str()); |
1122 | |
1123 | - m_supply->add_workers(worker_index, 1); |
1124 | + supply_->add_workers(worker_index, 1); |
1125 | |
1126 | // We remove carriers, but we keep other workers around. |
1127 | // TODO(unknown): Remove all workers that do not have properties such as experience. |
1128 | @@ -942,9 +942,9 @@ |
1129 | } |
1130 | |
1131 | // Incorporate the worker |
1132 | - if (!m_incorporated_workers.count(worker_index)) |
1133 | - m_incorporated_workers[worker_index] = std::vector<Worker *>(); |
1134 | - m_incorporated_workers[worker_index].push_back(w); |
1135 | + if (!incorporated_workers_.count(worker_index)) |
1136 | + incorporated_workers_[worker_index] = std::vector<Worker *>(); |
1137 | + incorporated_workers_[worker_index].push_back(w); |
1138 | |
1139 | w->set_location(nullptr); // no longer in an economy |
1140 | |
1141 | @@ -963,7 +963,7 @@ |
1142 | ware.init(game); |
1143 | if (do_launch_ware(game, ware)) |
1144 | { |
1145 | - m_supply->remove_wares(ware_index, 1); |
1146 | + supply_->remove_wares(ware_index, 1); |
1147 | } |
1148 | return ware; |
1149 | } |
1150 | @@ -975,14 +975,14 @@ |
1151 | // Create a carrier |
1152 | const DescriptionIndex carrierid = owner().tribe().carrier(); |
1153 | |
1154 | - if (!m_supply->stock_workers(carrierid)) |
1155 | + if (!supply_->stock_workers(carrierid)) |
1156 | { |
1157 | if (can_create_worker(game, carrierid)) |
1158 | { |
1159 | create_worker(game, carrierid); |
1160 | } |
1161 | } |
1162 | - if (m_supply->stock_workers(carrierid)) |
1163 | + if (supply_->stock_workers(carrierid)) |
1164 | { |
1165 | Widelands::Worker & worker = launch_worker(game, carrierid, Requirements()); |
1166 | // Setup the carrier |
1167 | @@ -997,7 +997,7 @@ |
1168 | |
1169 | void Warehouse::incorporate_ware(EditorGameBase & egbase, WareInstance* ware) |
1170 | { |
1171 | - m_supply->add_wares(ware->descr_index(), 1); |
1172 | + supply_->add_wares(ware->descr_index(), 1); |
1173 | ware->destroy(egbase); |
1174 | } |
1175 | |
1176 | @@ -1015,7 +1015,7 @@ |
1177 | if (w) { |
1178 | w->schedule_incorporate(game); |
1179 | } else { |
1180 | - wh.m_supply->add_wares(ware, 1); |
1181 | + wh.supply_->add_wares(ware, 1); |
1182 | |
1183 | // This ware may be used to build planned workers, |
1184 | // so it seems like a good idea to update the associated requests |
1185 | @@ -1029,7 +1029,7 @@ |
1186 | */ |
1187 | void Warehouse::receive_ware(Game & /* game */, DescriptionIndex ware) |
1188 | { |
1189 | - m_supply->add_wares(ware, 1); |
1190 | + supply_->add_wares(ware, 1); |
1191 | } |
1192 | |
1193 | /** |
1194 | @@ -1048,10 +1048,10 @@ |
1195 | bool Warehouse::can_create_worker(Game &, DescriptionIndex const worker) const { |
1196 | assert(owner().tribe().has_worker(worker)); |
1197 | |
1198 | - if (!(worker < m_supply->get_workers().get_nrwareids())) |
1199 | + if (!(worker < supply_->get_workers().get_nrwareids())) |
1200 | throw wexception |
1201 | ("worker type %d does not exists (max is %d)", |
1202 | - worker, m_supply->get_workers().get_nrwareids()); |
1203 | + worker, supply_->get_workers().get_nrwareids()); |
1204 | |
1205 | const WorkerDescr& w_desc = *owner().tribe().get_worker_descr(worker); |
1206 | assert(&w_desc); |
1207 | @@ -1064,13 +1064,13 @@ |
1208 | const std::string & input_name = buildcost.first; |
1209 | DescriptionIndex id_w = owner().tribe().ware_index(input_name); |
1210 | if (owner().tribe().has_ware(id_w)) { |
1211 | - if (m_supply->stock_wares(id_w) < buildcost.second) { |
1212 | + if (supply_->stock_wares(id_w) < buildcost.second) { |
1213 | return false; |
1214 | } |
1215 | } else { |
1216 | id_w = owner().tribe().worker_index(input_name); |
1217 | if (owner().tribe().has_worker(id_w)) { |
1218 | - if (m_supply->stock_workers(id_w) < buildcost.second) { |
1219 | + if (supply_->stock_workers(id_w) < buildcost.second) { |
1220 | return false; |
1221 | } |
1222 | } else |
1223 | @@ -1107,7 +1107,7 @@ |
1224 | // may have been called directly by the Economy. |
1225 | // Do not update anything else about PlannedWorkers here, because this |
1226 | // function is called by _update_planned_workers, so avoid recursion |
1227 | - for (PlannedWorkers& planned_worker : m_planned_workers) { |
1228 | + for (PlannedWorkers& planned_worker : planned_workers_) { |
1229 | if (planned_worker.index == worker && planned_worker.amount) |
1230 | planned_worker.amount--; |
1231 | } |
1232 | @@ -1119,7 +1119,7 @@ |
1233 | */ |
1234 | uint32_t Warehouse::get_planned_workers(Game & /* game */, DescriptionIndex index) const |
1235 | { |
1236 | - for (const PlannedWorkers& pw : m_planned_workers) { |
1237 | + for (const PlannedWorkers& pw : planned_workers_) { |
1238 | if (pw.index == index) |
1239 | return pw.amount; |
1240 | } |
1241 | @@ -1154,7 +1154,7 @@ |
1242 | } |
1243 | } |
1244 | |
1245 | - for (const PlannedWorkers& pw : m_planned_workers) { |
1246 | + for (const PlannedWorkers& pw : planned_workers_) { |
1247 | if (pw.index == index) { |
1248 | assert(available.size() == pw.requests.size()); |
1249 | |
1250 | @@ -1176,7 +1176,7 @@ |
1251 | { |
1252 | PlannedWorkers * pw = nullptr; |
1253 | |
1254 | - for (PlannedWorkers& planned_worker : m_planned_workers) { |
1255 | + for (PlannedWorkers& planned_worker : planned_workers_) { |
1256 | if (planned_worker.index == index) { |
1257 | pw = &planned_worker; |
1258 | break; |
1259 | @@ -1187,8 +1187,8 @@ |
1260 | if (!amount) |
1261 | return; |
1262 | |
1263 | - m_planned_workers.push_back(PlannedWorkers()); |
1264 | - pw = &m_planned_workers.back(); |
1265 | + planned_workers_.push_back(PlannedWorkers()); |
1266 | + pw = &planned_workers_.back(); |
1267 | pw->index = index; |
1268 | pw->amount = 0; |
1269 | |
1270 | @@ -1239,11 +1239,11 @@ |
1271 | |
1272 | DescriptionIndex id_w = owner().tribe().ware_index(input_name); |
1273 | if (owner().tribe().has_ware(id_w)) { |
1274 | - supply = m_supply->stock_wares(id_w); |
1275 | + supply = supply_->stock_wares(id_w); |
1276 | } else { |
1277 | id_w = owner().tribe().worker_index(input_name); |
1278 | if (owner().tribe().has_worker(id_w)) { |
1279 | - supply = m_supply->stock_workers(id_w); |
1280 | + supply = supply_->stock_workers(id_w); |
1281 | } else |
1282 | throw wexception |
1283 | ("_update_planned_workers: bad buildcost '%s'", input_name.c_str()); |
1284 | @@ -1271,12 +1271,12 @@ |
1285 | void Warehouse::_update_all_planned_workers(Game & game) |
1286 | { |
1287 | uint32_t idx = 0; |
1288 | - while (idx < m_planned_workers.size()) { |
1289 | - _update_planned_workers(game, m_planned_workers[idx]); |
1290 | + while (idx < planned_workers_.size()) { |
1291 | + _update_planned_workers(game, planned_workers_[idx]); |
1292 | |
1293 | - if (!m_planned_workers[idx].amount) { |
1294 | - m_planned_workers[idx].cleanup(); |
1295 | - m_planned_workers.erase(m_planned_workers.begin() + idx); |
1296 | + if (!planned_workers_[idx].amount) { |
1297 | + planned_workers_[idx].cleanup(); |
1298 | + planned_workers_.erase(planned_workers_.begin() + idx); |
1299 | } else { |
1300 | idx++; |
1301 | } |
1302 | @@ -1286,14 +1286,14 @@ |
1303 | void Warehouse::enable_spawn |
1304 | (Game & game, uint8_t const worker_types_without_cost_index) |
1305 | { |
1306 | - assert(m_next_worker_without_cost_spawn[worker_types_without_cost_index] == never()); |
1307 | - m_next_worker_without_cost_spawn[worker_types_without_cost_index] = |
1308 | + assert(next_worker_without_cost_spawn_[worker_types_without_cost_index] == never()); |
1309 | + next_worker_without_cost_spawn_[worker_types_without_cost_index] = |
1310 | schedule_act(game, WORKER_WITHOUT_COST_SPAWN_INTERVAL); |
1311 | } |
1312 | void Warehouse::disable_spawn(uint8_t const worker_types_without_cost_index) |
1313 | { |
1314 | - assert(m_next_worker_without_cost_spawn[worker_types_without_cost_index] != never()); |
1315 | - m_next_worker_without_cost_spawn[worker_types_without_cost_index] = never(); |
1316 | + assert(next_worker_without_cost_spawn_[worker_types_without_cost_index] != never()); |
1317 | + next_worker_without_cost_spawn_[worker_types_without_cost_index] = never(); |
1318 | } |
1319 | |
1320 | |
1321 | @@ -1362,14 +1362,14 @@ |
1322 | |
1323 | Warehouse::StockPolicy Warehouse::get_ware_policy(DescriptionIndex ware) const |
1324 | { |
1325 | - assert(ware < static_cast<DescriptionIndex>(m_ware_policy.size())); |
1326 | - return m_ware_policy[ware]; |
1327 | + assert(ware < static_cast<DescriptionIndex>(ware_policy_.size())); |
1328 | + return ware_policy_[ware]; |
1329 | } |
1330 | |
1331 | Warehouse::StockPolicy Warehouse::get_worker_policy(DescriptionIndex ware) const |
1332 | { |
1333 | - assert(ware < static_cast<DescriptionIndex>(m_worker_policy.size())); |
1334 | - return m_worker_policy[ware]; |
1335 | + assert(ware < static_cast<DescriptionIndex>(worker_policy_.size())); |
1336 | + return worker_policy_[ware]; |
1337 | } |
1338 | |
1339 | Warehouse::StockPolicy Warehouse::get_stock_policy |
1340 | @@ -1384,15 +1384,15 @@ |
1341 | |
1342 | void Warehouse::set_ware_policy(DescriptionIndex ware, Warehouse::StockPolicy policy) |
1343 | { |
1344 | - assert(ware < static_cast<DescriptionIndex>(m_ware_policy.size())); |
1345 | - m_ware_policy[ware] = policy; |
1346 | + assert(ware < static_cast<DescriptionIndex>(ware_policy_.size())); |
1347 | + ware_policy_[ware] = policy; |
1348 | } |
1349 | |
1350 | void Warehouse::set_worker_policy |
1351 | (DescriptionIndex ware, Warehouse::StockPolicy policy) |
1352 | { |
1353 | - assert(ware < static_cast<DescriptionIndex>(m_worker_policy.size())); |
1354 | - m_worker_policy[ware] = policy; |
1355 | + assert(ware < static_cast<DescriptionIndex>(worker_policy_.size())); |
1356 | + worker_policy_[ware] = policy; |
1357 | } |
1358 | |
1359 | /** |
1360 | @@ -1402,7 +1402,7 @@ |
1361 | void Warehouse::check_remove_stock(Game & game) |
1362 | { |
1363 | if (base_flag().current_wares() < base_flag().total_capacity() / 2) { |
1364 | - for (DescriptionIndex ware = 0; ware < static_cast<DescriptionIndex>(m_ware_policy.size()); ++ware) { |
1365 | + for (DescriptionIndex ware = 0; ware < static_cast<DescriptionIndex>(ware_policy_.size()); ++ware) { |
1366 | if (get_ware_policy(ware) != SP_Remove || !get_wares().stock(ware)) |
1367 | continue; |
1368 | |
1369 | @@ -1411,7 +1411,7 @@ |
1370 | } |
1371 | } |
1372 | |
1373 | - for (DescriptionIndex widx = 0; widx < static_cast<DescriptionIndex>(m_worker_policy.size()); ++widx) { |
1374 | + for (DescriptionIndex widx = 0; widx < static_cast<DescriptionIndex>(worker_policy_.size()); ++widx) { |
1375 | if (get_worker_policy(widx) != SP_Remove || !get_workers().stock(widx)) |
1376 | continue; |
1377 | |
1378 | @@ -1436,9 +1436,9 @@ |
1379 | std::vector<Soldier *> rv; |
1380 | |
1381 | DescriptionIndex const soldier_index = owner().tribe().soldier(); |
1382 | - IncorporatedWorkers::const_iterator sidx = m_incorporated_workers.find(soldier_index); |
1383 | + IncorporatedWorkers::const_iterator sidx = incorporated_workers_.find(soldier_index); |
1384 | |
1385 | - if (sidx != m_incorporated_workers.end()) { |
1386 | + if (sidx != incorporated_workers_.end()) { |
1387 | const WorkerList & soldiers = sidx->second; |
1388 | |
1389 | for (Worker * temp_soldier: soldiers) { |
1390 | @@ -1456,14 +1456,14 @@ |
1391 | int Warehouse::outcorporate_soldier(EditorGameBase & /* egbase */, Soldier & soldier) { |
1392 | |
1393 | DescriptionIndex const soldier_index = owner().tribe().soldier(); |
1394 | - if (m_incorporated_workers.count(soldier_index)) { |
1395 | - WorkerList & soldiers = m_incorporated_workers[soldier_index]; |
1396 | + if (incorporated_workers_.count(soldier_index)) { |
1397 | + WorkerList & soldiers = incorporated_workers_[soldier_index]; |
1398 | |
1399 | WorkerList::iterator i = std::find |
1400 | (soldiers.begin(), soldiers.end(), &soldier); |
1401 | |
1402 | soldiers.erase(i); |
1403 | - m_supply->remove_workers(soldier_index, 1); |
1404 | + supply_->remove_workers(soldier_index, 1); |
1405 | } |
1406 | #ifndef NDEBUG |
1407 | else |
1408 | @@ -1488,7 +1488,7 @@ |
1409 | if (fleet) { |
1410 | molog("* fleet: %u\n", fleet->serial()); |
1411 | molog(" ships: %u, ports: %u\n", fleet->count_ships(), fleet->count_ports()); |
1412 | - molog(" m_act_pending: %s\n", (fleet->get_act_pending())?"true":"false"); |
1413 | + molog(" act_pending: %s\n", (fleet->get_act_pending())?"true":"false"); |
1414 | } else { |
1415 | molog("No fleet?!\n"); |
1416 | } |
1417 | |
1418 | === modified file 'src/logic/map_objects/tribes/warehouse.h' |
1419 | --- src/logic/map_objects/tribes/warehouse.h 2016-02-07 06:10:47 +0000 |
1420 | +++ src/logic/map_objects/tribes/warehouse.h 2016-02-13 14:28:04 +0000 |
1421 | @@ -54,15 +54,15 @@ |
1422 | |
1423 | Building & create_object() const override; |
1424 | |
1425 | - uint32_t get_conquers() const override {return m_conquers;} |
1426 | + uint32_t get_conquers() const override {return conquers_;} |
1427 | |
1428 | uint32_t get_heal_per_second () const { |
1429 | - return m_heal_per_second; |
1430 | + return heal_per_second_; |
1431 | } |
1432 | |
1433 | private: |
1434 | - int32_t m_conquers; |
1435 | - uint32_t m_heal_per_second; |
1436 | + int32_t conquers_; |
1437 | + uint32_t heal_per_second_; |
1438 | DISALLOW_COPY_AND_ASSIGN(WarehouseDescr); |
1439 | }; |
1440 | |
1441 | @@ -122,7 +122,7 @@ |
1442 | /// * Sets a next_spawn time for each buildable worker type without cost |
1443 | /// that the owning player is allowed to create and schedules act for for |
1444 | /// the spawn. |
1445 | - /// * Schedules act for military stuff (and sets m_next_military_act). |
1446 | + /// * Schedules act for military stuff (and sets next_military_act_). |
1447 | /// * Sees the area (since a warehouse is considered to be always occupied). |
1448 | /// * Conquers land if the the warehouse type is configured to do that. |
1449 | /// * Sends a message to the player about the creation of this warehouse. |
1450 | @@ -256,20 +256,20 @@ |
1451 | void _update_planned_workers(Game &, PlannedWorkers & pw); |
1452 | void _update_all_planned_workers(Game &); |
1453 | |
1454 | - WarehouseSupply * m_supply; |
1455 | + WarehouseSupply * supply_; |
1456 | |
1457 | - std::vector<StockPolicy> m_ware_policy; |
1458 | - std::vector<StockPolicy> m_worker_policy; |
1459 | + std::vector<StockPolicy> ware_policy_; |
1460 | + std::vector<StockPolicy> worker_policy_; |
1461 | |
1462 | // Workers who live here at the moment |
1463 | using WorkerList = std::vector<Worker *>; |
1464 | using IncorporatedWorkers = std::map<DescriptionIndex, WorkerList>; |
1465 | - IncorporatedWorkers m_incorporated_workers; |
1466 | - std::vector<Time> m_next_worker_without_cost_spawn; |
1467 | - Time m_next_military_act; |
1468 | - Time m_next_stock_remove_act; |
1469 | + IncorporatedWorkers incorporated_workers_; |
1470 | + std::vector<Time> next_worker_without_cost_spawn_; |
1471 | + Time next_military_act_; |
1472 | + Time next_stock_remove_act_; |
1473 | |
1474 | - std::vector<PlannedWorkers> m_planned_workers; |
1475 | + std::vector<PlannedWorkers> planned_workers_; |
1476 | |
1477 | PortDock * portdock_; |
1478 | |
1479 | |
1480 | === modified file 'src/logic/map_objects/tribes/warelist.cc' |
1481 | --- src/logic/map_objects/tribes/warelist.cc 2015-11-28 22:29:26 +0000 |
1482 | +++ src/logic/map_objects/tribes/warelist.cc 2016-02-13 14:28:04 +0000 |
1483 | @@ -32,9 +32,9 @@ |
1484 | */ |
1485 | WareList::~WareList() |
1486 | { |
1487 | - for (uint32_t id = 0; id < m_wares.size(); ++id) { |
1488 | - if (m_wares[id]) |
1489 | - log("WareList: %i items of %i left.\n", m_wares[id], id); |
1490 | + for (uint32_t id = 0; id < wares_.size(); ++id) { |
1491 | + if (wares_[id]) |
1492 | + log("WareList: %i items of %i left.\n", wares_[id], id); |
1493 | } |
1494 | } |
1495 | |
1496 | @@ -46,10 +46,10 @@ |
1497 | if (!count) |
1498 | return; |
1499 | |
1500 | - if (m_wares.size() <= i) |
1501 | - m_wares.resize(i + 1, 0); |
1502 | - m_wares[i] += count; |
1503 | - assert(m_wares[i] >= count); |
1504 | + if (wares_.size() <= i) |
1505 | + wares_.resize(i + 1, 0); |
1506 | + wares_[i] += count; |
1507 | + assert(wares_[i] >= count); |
1508 | |
1509 | changed(); |
1510 | } |
1511 | @@ -58,11 +58,11 @@ |
1512 | void WareList::add(const WareList & wl) |
1513 | { |
1514 | DescriptionIndex const nr_wares = wl.get_nrwareids(); |
1515 | - if (m_wares.size() < nr_wares) |
1516 | - m_wares.reserve(nr_wares); |
1517 | + if (wares_.size() < nr_wares) |
1518 | + wares_.reserve(nr_wares); |
1519 | for (DescriptionIndex i = 0; i < nr_wares; ++i) |
1520 | - if (wl.m_wares[i]) |
1521 | - add(i, wl.m_wares[i]); |
1522 | + if (wl.wares_[i]) |
1523 | + add(i, wl.wares_[i]); |
1524 | } |
1525 | |
1526 | |
1527 | @@ -73,9 +73,9 @@ |
1528 | if (!count) |
1529 | return; |
1530 | |
1531 | - assert(i < m_wares.size()); |
1532 | - assert(m_wares[i] >= count); |
1533 | - m_wares[i] -= count; |
1534 | + assert(i < wares_.size()); |
1535 | + assert(wares_[i] >= count); |
1536 | + wares_[i] -= count; |
1537 | |
1538 | changed(); |
1539 | } |
1540 | @@ -85,15 +85,15 @@ |
1541 | { |
1542 | DescriptionIndex const nr_wares = wl.get_nrwareids(); |
1543 | for (DescriptionIndex i = 0; i < nr_wares; ++i) |
1544 | - if (wl.m_wares[i]) |
1545 | - remove(i, wl.m_wares[i]); |
1546 | + if (wl.wares_[i]) |
1547 | + remove(i, wl.wares_[i]); |
1548 | } |
1549 | |
1550 | /** |
1551 | * Return the number of wares of a given type stored in this storage. |
1552 | */ |
1553 | WareList::WareCount WareList::stock(DescriptionIndex const id) const { |
1554 | - return id < m_wares.size() ? m_wares[id] : 0; |
1555 | + return id < wares_.size() ? wares_[id] : 0; |
1556 | } |
1557 | |
1558 | |
1559 | @@ -105,10 +105,10 @@ |
1560 | { |
1561 | uint32_t i = 0; |
1562 | |
1563 | - while (i < wl.m_wares.size()) { |
1564 | - const WareCount count = wl.m_wares[i]; |
1565 | - if (i < m_wares.size()) { |
1566 | - if (count != m_wares[i]) |
1567 | + while (i < wl.wares_.size()) { |
1568 | + const WareCount count = wl.wares_[i]; |
1569 | + if (i < wares_.size()) { |
1570 | + if (count != wares_[i]) |
1571 | return false; |
1572 | } else { |
1573 | if (count) // wl2 has 0 stock per definition |
1574 | @@ -117,8 +117,8 @@ |
1575 | ++i; |
1576 | } |
1577 | |
1578 | - while (i < m_wares.size()) { |
1579 | - if (m_wares[i]) // wl1 has 0 stock per definition |
1580 | + while (i < wares_.size()) { |
1581 | + if (wares_[i]) // wl1 has 0 stock per definition |
1582 | return false; |
1583 | ++i; |
1584 | } |
1585 | |
1586 | === modified file 'src/logic/map_objects/tribes/warelist.h' |
1587 | --- src/logic/map_objects/tribes/warelist.h 2015-11-28 22:29:26 +0000 |
1588 | +++ src/logic/map_objects/tribes/warelist.h 2016-02-13 14:28:04 +0000 |
1589 | @@ -38,13 +38,13 @@ |
1590 | WareList() {} |
1591 | ~WareList(); |
1592 | |
1593 | - void clear() {m_wares.clear();} /// Clear the storage |
1594 | + void clear() {wares_.clear();} /// Clear the storage |
1595 | |
1596 | using WareCount = uint32_t; |
1597 | using WareCountVector = std::vector<WareCount>; |
1598 | |
1599 | /// \return Highest possible ware id |
1600 | - DescriptionIndex get_nrwareids() const {return DescriptionIndex(m_wares.size());} |
1601 | + DescriptionIndex get_nrwareids() const {return DescriptionIndex(wares_.size());} |
1602 | |
1603 | void add (DescriptionIndex, WareCount = 1); |
1604 | void add(const WareList &); |
1605 | @@ -53,8 +53,8 @@ |
1606 | WareCount stock(DescriptionIndex) const; |
1607 | |
1608 | void set_nrwares(DescriptionIndex const i) { |
1609 | - assert(m_wares.empty()); |
1610 | - m_wares.resize(i, 0); |
1611 | + assert(wares_.empty()); |
1612 | + wares_.resize(i, 0); |
1613 | } |
1614 | |
1615 | bool operator== (const WareList &) const; |
1616 | @@ -63,7 +63,7 @@ |
1617 | mutable boost::signals2::signal<void ()> changed; |
1618 | |
1619 | private: |
1620 | - WareCountVector m_wares; |
1621 | + WareCountVector wares_; |
1622 | }; |
1623 | |
1624 | } |
1625 | |
1626 | === modified file 'src/logic/map_objects/tribes/worker.cc' |
1627 | --- src/logic/map_objects/tribes/worker.cc 2016-02-07 09:30:20 +0000 |
1628 | +++ src/logic/map_objects/tribes/worker.cc 2016-02-13 14:28:04 +0000 |
1629 | @@ -1021,17 +1021,17 @@ |
1630 | Worker::Worker(const WorkerDescr & worker_descr) |
1631 | : |
1632 | Bob (worker_descr), |
1633 | - m_economy (nullptr), |
1634 | - m_supply (nullptr), |
1635 | - m_transfer (nullptr), |
1636 | - m_current_exp(0) |
1637 | + economy_ (nullptr), |
1638 | + supply_ (nullptr), |
1639 | + transfer_ (nullptr), |
1640 | + current_exp_(0) |
1641 | { |
1642 | } |
1643 | |
1644 | Worker::~Worker() |
1645 | { |
1646 | - assert(!m_location.is_set()); |
1647 | - assert(!m_transfer); |
1648 | + assert(!location_.is_set()); |
1649 | + assert(!transfer_); |
1650 | } |
1651 | |
1652 | |
1653 | @@ -1040,29 +1040,29 @@ |
1654 | { |
1655 | Bob::log_general_info(egbase); |
1656 | |
1657 | - if (upcast(PlayerImmovable, loc, m_location.get(egbase))) { |
1658 | + if (upcast(PlayerImmovable, loc, location_.get(egbase))) { |
1659 | molog("* Owner: (%p)\n", &loc->owner()); |
1660 | molog("** Owner (plrnr): %i\n", loc->owner().player_number()); |
1661 | molog("* Economy: %p\n", loc->get_economy()); |
1662 | } |
1663 | |
1664 | - PlayerImmovable * imm = m_location.get(egbase); |
1665 | + PlayerImmovable * imm = location_.get(egbase); |
1666 | molog("location: %u\n", imm ? imm->serial() : 0); |
1667 | - molog("Economy: %p\n", m_economy); |
1668 | - molog("transfer: %p\n", m_transfer); |
1669 | + molog("Economy: %p\n", economy_); |
1670 | + molog("transfer: %p\n", transfer_); |
1671 | |
1672 | - if (upcast(WareInstance, ware, m_carried_ware.get(egbase))) { |
1673 | + if (upcast(WareInstance, ware, carried_ware_.get(egbase))) { |
1674 | molog |
1675 | - ("* m_carried_ware->get_ware() (id): %i\n", |
1676 | + ("* carried_ware->get_ware() (id): %i\n", |
1677 | ware->descr_index()); |
1678 | - molog("* m_carried_ware->get_economy() (): %p\n", ware->get_economy()); |
1679 | + molog("* carried_ware->get_economy() (): %p\n", ware->get_economy()); |
1680 | } |
1681 | |
1682 | molog |
1683 | - ("m_current_exp: %i / %i\n", |
1684 | - m_current_exp, descr().get_needed_experience()); |
1685 | + ("current_exp: %i / %i\n", |
1686 | + current_exp_, descr().get_needed_experience()); |
1687 | |
1688 | - molog("m_supply: %p\n", m_supply); |
1689 | + molog("supply: %p\n", supply_); |
1690 | } |
1691 | |
1692 | |
1693 | @@ -1076,28 +1076,28 @@ |
1694 | { |
1695 | assert(!location || ObjectPointer(location).get(owner().egbase())); |
1696 | |
1697 | - PlayerImmovable * const oldlocation = get_location(owner().egbase()); |
1698 | - if (oldlocation == location) |
1699 | + PlayerImmovable * const old_location = get_location(owner().egbase()); |
1700 | + if (old_location == location) |
1701 | return; |
1702 | |
1703 | - if (oldlocation) { |
1704 | - // Note: even though we have an oldlocation, m_economy may be zero |
1705 | - // (oldlocation got deleted) |
1706 | - oldlocation->remove_worker(*this); |
1707 | + if (old_location) { |
1708 | + // Note: even though we have an old location, economy_ may be zero |
1709 | + // (old_location got deleted) |
1710 | + old_location->remove_worker(*this); |
1711 | } else { |
1712 | if (!is_shipping()) { |
1713 | - assert(!m_economy); |
1714 | + assert(!economy_); |
1715 | } |
1716 | } |
1717 | |
1718 | - m_location = location; |
1719 | + location_ = location; |
1720 | |
1721 | if (location) { |
1722 | Economy * const eco = location->get_economy(); |
1723 | |
1724 | - if (!m_economy || (descr().type() == MapObjectType::SOLDIER)) { |
1725 | + if (!economy_ || (descr().type() == MapObjectType::SOLDIER)) { |
1726 | set_economy(eco); |
1727 | - } else if (m_economy != eco) { |
1728 | + } else if (economy_ != eco) { |
1729 | throw wexception |
1730 | ("Worker::set_location changes economy, but worker is no soldier"); |
1731 | } |
1732 | @@ -1124,22 +1124,22 @@ |
1733 | */ |
1734 | void Worker::set_economy(Economy * const economy) |
1735 | { |
1736 | - if (economy == m_economy) |
1737 | + if (economy == economy_) |
1738 | return; |
1739 | |
1740 | - if (m_economy) |
1741 | - m_economy->remove_workers |
1742 | + if (economy_) |
1743 | + economy_->remove_workers |
1744 | (owner().tribe().worker_index(descr().name().c_str()), 1); |
1745 | |
1746 | - m_economy = economy; |
1747 | + economy_ = economy; |
1748 | |
1749 | if (WareInstance * const ware = get_carried_ware(owner().egbase())) |
1750 | - ware->set_economy(m_economy); |
1751 | - if (m_supply) |
1752 | - m_supply->set_economy(m_economy); |
1753 | + ware->set_economy(economy_); |
1754 | + if (supply_) |
1755 | + supply_->set_economy(economy_); |
1756 | |
1757 | - if (m_economy) |
1758 | - m_economy->add_workers(owner().tribe().worker_index(descr().name().c_str()), 1); |
1759 | + if (economy_) |
1760 | + economy_->add_workers(owner().tribe().worker_index(descr().name().c_str()), 1); |
1761 | } |
1762 | |
1763 | |
1764 | @@ -1167,9 +1167,9 @@ |
1765 | { |
1766 | WareInstance * const ware = get_carried_ware(egbase); |
1767 | |
1768 | - if (m_supply) { |
1769 | - delete m_supply; |
1770 | - m_supply = nullptr; |
1771 | + if (supply_) { |
1772 | + delete supply_; |
1773 | + supply_ = nullptr; |
1774 | } |
1775 | |
1776 | if (ware) |
1777 | @@ -1204,7 +1204,7 @@ |
1778 | delete oldware; |
1779 | } |
1780 | |
1781 | - m_carried_ware = ware; |
1782 | + carried_ware_ = ware; |
1783 | ware->set_location(egbase, this); |
1784 | if (upcast(Game, game, &egbase)) |
1785 | ware->update(*game); |
1786 | @@ -1220,7 +1220,7 @@ |
1787 | |
1788 | if (ware) { |
1789 | ware->set_location(game, nullptr); |
1790 | - m_carried_ware = nullptr; |
1791 | + carried_ware_ = nullptr; |
1792 | } |
1793 | |
1794 | return ware; |
1795 | @@ -1261,11 +1261,11 @@ |
1796 | void Worker::create_needed_experience(Game & /* game */) |
1797 | { |
1798 | if (descr().get_needed_experience() == INVALID_INDEX) { |
1799 | - m_current_exp = INVALID_INDEX; |
1800 | + current_exp_ = INVALID_INDEX; |
1801 | return; |
1802 | } |
1803 | |
1804 | - m_current_exp = 0; |
1805 | + current_exp_ = 0; |
1806 | } |
1807 | |
1808 | |
1809 | @@ -1278,7 +1278,7 @@ |
1810 | */ |
1811 | DescriptionIndex Worker::gain_experience(Game & game) { |
1812 | return (descr().get_needed_experience() == INVALID_INDEX || |
1813 | - ++m_current_exp < descr().get_needed_experience()) ? |
1814 | + ++current_exp_ < descr().get_needed_experience()) ? |
1815 | INVALID_INDEX : |
1816 | level(game); |
1817 | } |
1818 | @@ -1304,8 +1304,8 @@ |
1819 | assert(t.has_worker(new_index)); |
1820 | |
1821 | // Inform the economy, that something has changed |
1822 | - m_economy->remove_workers(old_index, 1); |
1823 | - m_economy->add_workers (new_index, 1); |
1824 | + economy_->remove_workers(old_index, 1); |
1825 | + economy_->add_workers (new_index, 1); |
1826 | |
1827 | create_needed_experience(game); |
1828 | return old_index; // So that the caller knows what to replace him with. |
1829 | @@ -1354,21 +1354,21 @@ |
1830 | // (in that case, the transfer task already exists on the stack |
1831 | // when this is called). |
1832 | if (get_state(taskGowarehouse) || get_state(taskTransfer)) { |
1833 | - assert(!m_transfer); |
1834 | + assert(!transfer_); |
1835 | |
1836 | - m_transfer = t; |
1837 | + transfer_ = t; |
1838 | send_signal(game, "transfer"); |
1839 | } else { // just start a normal transfer |
1840 | push_task(game, taskTransfer); |
1841 | - m_transfer = t; |
1842 | + transfer_ = t; |
1843 | } |
1844 | } |
1845 | |
1846 | void Worker::transfer_pop(Game & /* game */, State & /* state */) |
1847 | { |
1848 | - if (m_transfer) { |
1849 | - m_transfer->has_failed(); |
1850 | - m_transfer = nullptr; |
1851 | + if (transfer_) { |
1852 | + transfer_->has_failed(); |
1853 | + transfer_ = nullptr; |
1854 | } |
1855 | } |
1856 | |
1857 | @@ -1384,7 +1384,7 @@ |
1858 | } |
1859 | |
1860 | // The request is no longer valid, the task has failed |
1861 | - if (!m_transfer) { |
1862 | + if (!transfer_) { |
1863 | molog("[transfer]: Fail (without transfer)\n"); |
1864 | |
1865 | send_signal(game, "fail"); |
1866 | @@ -1435,12 +1435,12 @@ |
1867 | // Figure out where to go |
1868 | bool success; |
1869 | PlayerImmovable * const nextstep = |
1870 | - m_transfer->get_next_step(location, success); |
1871 | + transfer_->get_next_step(location, success); |
1872 | |
1873 | if (!nextstep) { |
1874 | - Transfer * const t = m_transfer; |
1875 | + Transfer * const t = transfer_; |
1876 | |
1877 | - m_transfer = nullptr; |
1878 | + transfer_ = nullptr; |
1879 | |
1880 | if (success) { |
1881 | pop_task(game); |
1882 | @@ -1550,7 +1550,7 @@ |
1883 | */ |
1884 | void Worker::cancel_task_transfer(Game & game) |
1885 | { |
1886 | - m_transfer = nullptr; |
1887 | + transfer_ = nullptr; |
1888 | send_signal(game, "cancel"); |
1889 | } |
1890 | |
1891 | @@ -1946,7 +1946,7 @@ |
1892 | */ |
1893 | void Worker::start_task_gowarehouse(Game & game) |
1894 | { |
1895 | - assert(!m_supply); |
1896 | + assert(!supply_); |
1897 | |
1898 | push_task(game, taskGowarehouse); |
1899 | } |
1900 | @@ -1978,17 +1978,17 @@ |
1901 | } |
1902 | |
1903 | if (dynamic_cast<Warehouse const *>(location)) { |
1904 | - delete m_supply; |
1905 | - m_supply = nullptr; |
1906 | + delete supply_; |
1907 | + supply_ = nullptr; |
1908 | |
1909 | schedule_incorporate(game); |
1910 | return; |
1911 | } |
1912 | |
1913 | // If we got a transfer, use it |
1914 | - if (m_transfer) { |
1915 | - Transfer * const t = m_transfer; |
1916 | - m_transfer = nullptr; |
1917 | + if (transfer_) { |
1918 | + Transfer * const t = transfer_; |
1919 | + transfer_ = nullptr; |
1920 | |
1921 | molog("[gowarehouse]: Got transfer\n"); |
1922 | |
1923 | @@ -2011,8 +2011,8 @@ |
1924 | // check against disappearing warehouses, or the worker will just |
1925 | // idle on a flag until the end of days (actually, until either the |
1926 | // flag is removed or a warehouse connects to the Economy). |
1927 | - if (!m_supply) |
1928 | - m_supply = new IdleWorkerSupply(*this); |
1929 | + if (!supply_) |
1930 | + supply_ = new IdleWorkerSupply(*this); |
1931 | |
1932 | return start_task_idle(game, descr().get_animation("idle"), 1000); |
1933 | } |
1934 | @@ -2023,19 +2023,19 @@ |
1935 | if (signal == "transfer") { |
1936 | // We are assigned a transfer, make sure our supply disappears immediately |
1937 | // Otherwise, we might receive two transfers in a row. |
1938 | - delete m_supply; |
1939 | - m_supply = nullptr; |
1940 | + delete supply_; |
1941 | + supply_ = nullptr; |
1942 | } |
1943 | } |
1944 | |
1945 | void Worker::gowarehouse_pop(Game &, State &) |
1946 | { |
1947 | - delete m_supply; |
1948 | - m_supply = nullptr; |
1949 | + delete supply_; |
1950 | + supply_ = nullptr; |
1951 | |
1952 | - if (m_transfer) { |
1953 | - m_transfer->has_failed(); |
1954 | - m_transfer = nullptr; |
1955 | + if (transfer_) { |
1956 | + transfer_->has_failed(); |
1957 | + transfer_ = nullptr; |
1958 | } |
1959 | } |
1960 | |
1961 | @@ -2477,16 +2477,16 @@ |
1962 | } |
1963 | |
1964 | struct FindFlagWithPlayersWarehouse { |
1965 | - FindFlagWithPlayersWarehouse(const Player & owner) : m_owner(owner) {} |
1966 | + FindFlagWithPlayersWarehouse(const Player & owner) : owner_(owner) {} |
1967 | bool accept(const BaseImmovable & imm) const { |
1968 | if (upcast(Flag const, flag, &imm)) |
1969 | - if (&flag->owner() == &m_owner) |
1970 | + if (&flag->owner() == &owner_) |
1971 | if (flag->economy().warehouses().size()) |
1972 | return true; |
1973 | return false; |
1974 | } |
1975 | private: |
1976 | - const Player & m_owner; |
1977 | + const Player & owner_; |
1978 | }; |
1979 | |
1980 | void Worker::fugitive_update(Game & game, State & state) |
1981 | @@ -2925,8 +2925,8 @@ |
1982 | constexpr uint8_t kCurrentPacketVersion = 2; |
1983 | |
1984 | Worker::Loader::Loader() : |
1985 | - m_location(0), |
1986 | - m_carried_ware(0) |
1987 | + location_(0), |
1988 | + carried_ware_(0) |
1989 | { |
1990 | } |
1991 | |
1992 | @@ -2938,13 +2938,13 @@ |
1993 | if (packet_version == kCurrentPacketVersion) { |
1994 | |
1995 | Worker & worker = get<Worker>(); |
1996 | - m_location = fr.unsigned_32(); |
1997 | - m_carried_ware = fr.unsigned_32(); |
1998 | - worker.m_current_exp = fr.signed_32(); |
1999 | + location_ = fr.unsigned_32(); |
2000 | + carried_ware_ = fr.unsigned_32(); |
2001 | + worker.current_exp_ = fr.signed_32(); |
2002 | |
2003 | if (fr.unsigned_8()) { |
2004 | - worker.m_transfer = new Transfer(dynamic_cast<Game&>(egbase()), worker); |
2005 | - worker.m_transfer->read(fr, m_transfer); |
2006 | + worker.transfer_ = new Transfer(dynamic_cast<Game&>(egbase()), worker); |
2007 | + worker.transfer_->read(fr, transfer_); |
2008 | } |
2009 | } else { |
2010 | throw UnhandledVersionError("Worker", packet_version, kCurrentPacketVersion); |
2011 | @@ -2960,12 +2960,12 @@ |
2012 | |
2013 | Worker & worker = get<Worker>(); |
2014 | |
2015 | - if (m_location) |
2016 | - worker.set_location(&mol().get<PlayerImmovable>(m_location)); |
2017 | - if (m_carried_ware) |
2018 | - worker.m_carried_ware = &mol().get<WareInstance>(m_carried_ware); |
2019 | - if (worker.m_transfer) |
2020 | - worker.m_transfer->read_pointers(mol(), m_transfer); |
2021 | + if (location_) |
2022 | + worker.set_location(&mol().get<PlayerImmovable>(location_)); |
2023 | + if (carried_ware_) |
2024 | + worker.carried_ware_ = &mol().get<WareInstance>(carried_ware_); |
2025 | + if (worker.transfer_) |
2026 | + worker.transfer_->read_pointers(mol(), transfer_); |
2027 | } |
2028 | |
2029 | void Worker::Loader::load_finish() |
2030 | @@ -2980,7 +2980,7 @@ |
2031 | // us and will do so on load too. To make the order at which we are loaded |
2032 | // not a factor, we do not overwrite the economy they might have set for us |
2033 | // already. |
2034 | - if (PlayerImmovable * const location = worker.m_location.get(egbase())) { |
2035 | + if (PlayerImmovable * const location = worker.location_.get(egbase())) { |
2036 | worker.set_economy(location->get_economy()); |
2037 | } |
2038 | } |
2039 | @@ -3076,13 +3076,13 @@ |
2040 | Bob::save(egbase, mos, fw); |
2041 | |
2042 | fw.unsigned_8(kCurrentPacketVersion); |
2043 | - fw.unsigned_32(mos.get_object_file_index_or_zero(m_location.get(egbase))); |
2044 | - fw.unsigned_32(mos.get_object_file_index_or_zero(m_carried_ware.get(egbase))); |
2045 | - fw.signed_32(m_current_exp); |
2046 | + fw.unsigned_32(mos.get_object_file_index_or_zero(location_.get(egbase))); |
2047 | + fw.unsigned_32(mos.get_object_file_index_or_zero(carried_ware_.get(egbase))); |
2048 | + fw.signed_32(current_exp_); |
2049 | |
2050 | - if (m_transfer) { |
2051 | + if (transfer_) { |
2052 | fw.unsigned_8(1); |
2053 | - m_transfer->write(mos, fw); |
2054 | + transfer_->write(mos, fw); |
2055 | } else { |
2056 | fw.unsigned_8(0); |
2057 | } |
2058 | |
2059 | === modified file 'src/logic/map_objects/tribes/worker.h' |
2060 | --- src/logic/map_objects/tribes/worker.h 2016-02-02 12:38:05 +0000 |
2061 | +++ src/logic/map_objects/tribes/worker.h 2016-02-13 14:28:04 +0000 |
2062 | @@ -43,7 +43,7 @@ |
2063 | * - Work: the worker is running his working schedule |
2064 | */ |
2065 | class Worker : public Bob { |
2066 | - friend class Soldier; // allow access to m_supply |
2067 | + friend class Soldier; // allow access to supply_ |
2068 | friend struct WorkerProgram; |
2069 | friend struct MapBobdataPacket; |
2070 | |
2071 | @@ -80,32 +80,32 @@ |
2072 | |
2073 | Player & owner() const {assert(get_owner()); return *get_owner();} |
2074 | PlayerImmovable * get_location(EditorGameBase & egbase) { |
2075 | - return m_location.get(egbase); |
2076 | + return location_.get(egbase); |
2077 | } |
2078 | - OPtr<PlayerImmovable> get_location() const {return m_location;} |
2079 | - Economy * get_economy() const {return m_economy;} |
2080 | + OPtr<PlayerImmovable> get_location() const {return location_;} |
2081 | + Economy * get_economy() const {return economy_;} |
2082 | |
2083 | /// Sets the location of the worker initially. It may not have a previous |
2084 | /// location. Does not add the worker to the location's set of workers (it |
2085 | /// should be there already). The worker must already be in the same economy |
2086 | /// as the location. |
2087 | void set_location_initially(PlayerImmovable & location) { |
2088 | - assert(!m_location.is_set()); |
2089 | + assert(!location_.is_set()); |
2090 | assert(location.serial()); |
2091 | - assert(m_economy); |
2092 | - assert(m_economy == location.get_economy()); |
2093 | - m_location = &location; |
2094 | + assert(economy_); |
2095 | + assert(economy_ == location.get_economy()); |
2096 | + location_ = &location; |
2097 | } |
2098 | |
2099 | void set_location(PlayerImmovable *); |
2100 | void set_economy(Economy *); |
2101 | |
2102 | WareInstance * get_carried_ware(EditorGameBase & egbase) { |
2103 | - return m_carried_ware.get(egbase); |
2104 | + return carried_ware_.get(egbase); |
2105 | } |
2106 | WareInstance const * get_carried_ware(const EditorGameBase & egbase) const |
2107 | { |
2108 | - return m_carried_ware.get(egbase); |
2109 | + return carried_ware_.get(egbase); |
2110 | } |
2111 | void set_carried_ware(EditorGameBase &, WareInstance *); |
2112 | WareInstance * fetch_carried_ware(EditorGameBase &); |
2113 | @@ -131,7 +131,7 @@ |
2114 | void create_needed_experience(Game &); |
2115 | DescriptionIndex level (Game &); |
2116 | |
2117 | - int32_t get_current_experience() const {return m_current_exp;} |
2118 | + int32_t get_current_experience() const {return current_exp_;} |
2119 | bool needs_experience() const {return descr().get_needed_experience() != INVALID_INDEX;} |
2120 | |
2121 | // debug |
2122 | @@ -140,7 +140,7 @@ |
2123 | // worker-specific tasks |
2124 | void start_task_transfer(Game &, Transfer *); |
2125 | void cancel_task_transfer(Game &); |
2126 | - Transfer * get_transfer() const {return m_transfer;} |
2127 | + Transfer * get_transfer() const {return transfer_;} |
2128 | |
2129 | void start_task_shipping(Game &, PortDock*); |
2130 | void end_shipping(Game &); |
2131 | @@ -175,7 +175,7 @@ |
2132 | void draw(const EditorGameBase &, RenderTarget &, const Point&) const override; |
2133 | void init_auto_task(Game &) override; |
2134 | |
2135 | - bool does_carry_ware() {return m_carried_ware.is_set();} |
2136 | + bool does_carry_ware() {return carried_ware_.is_set();} |
2137 | |
2138 | void set_program_objvar(Game &, State &, MapObject * obj); |
2139 | |
2140 | @@ -242,12 +242,12 @@ |
2141 | bool run_playfx (Game &, State &, const Action &); |
2142 | bool run_construct (Game &, State &, const Action &); |
2143 | |
2144 | - OPtr<PlayerImmovable> m_location; ///< meta location of the worker |
2145 | - Economy * m_economy; ///< economy this worker is registered in |
2146 | - OPtr<WareInstance> m_carried_ware; ///< ware we are carrying |
2147 | - IdleWorkerSupply * m_supply; ///< supply while gowarehouse and not transfer |
2148 | - Transfer * m_transfer; ///< where we are currently being sent |
2149 | - int32_t m_current_exp; ///< current experience |
2150 | + OPtr<PlayerImmovable> location_; ///< meta location of the worker |
2151 | + Economy * economy_; ///< economy this worker is registered in |
2152 | + OPtr<WareInstance> carried_ware_; ///< ware we are carrying |
2153 | + IdleWorkerSupply * supply_; ///< supply while gowarehouse and not transfer |
2154 | + Transfer * transfer_; ///< where we are currently being sent |
2155 | + int32_t current_exp_; ///< current experience |
2156 | |
2157 | // saving and loading |
2158 | protected: |
2159 | @@ -264,9 +264,9 @@ |
2160 | const BobProgramBase * get_program(const std::string & name) override; |
2161 | |
2162 | private: |
2163 | - uint32_t m_location; |
2164 | - uint32_t m_carried_ware; |
2165 | - Transfer::ReadData m_transfer; |
2166 | + uint32_t location_; |
2167 | + uint32_t carried_ware_; |
2168 | + Transfer::ReadData transfer_; |
2169 | }; |
2170 | |
2171 | virtual Loader * create_loader(); |
2172 | |
2173 | === modified file 'src/map_io/map_buildingdata_packet.cc' |
2174 | --- src/map_io/map_buildingdata_packet.cc 2016-02-09 08:07:48 +0000 |
2175 | +++ src/map_io/map_buildingdata_packet.cc 2016-02-13 14:28:04 +0000 |
2176 | @@ -365,7 +365,7 @@ |
2177 | } |
2178 | } |
2179 | |
2180 | - assert(warehouse.m_incorporated_workers.empty()); |
2181 | + assert(warehouse.incorporated_workers_.empty()); |
2182 | { |
2183 | uint16_t const nrworkers = fr.unsigned_16(); |
2184 | for (uint16_t i = 0; i < nrworkers; ++i) { |
2185 | @@ -374,9 +374,9 @@ |
2186 | try { |
2187 | Worker & worker = mol.get<Worker>(worker_serial); |
2188 | const DescriptionIndex& worker_index = tribe.worker_index(worker.descr().name().c_str()); |
2189 | - if (!warehouse.m_incorporated_workers.count(worker_index)) |
2190 | - warehouse.m_incorporated_workers[worker_index] = std::vector<Worker *>(); |
2191 | - warehouse.m_incorporated_workers[worker_index].push_back(&worker); |
2192 | + if (!warehouse.incorporated_workers_.count(worker_index)) |
2193 | + warehouse.incorporated_workers_[worker_index] = std::vector<Worker *>(); |
2194 | + warehouse.incorporated_workers_[worker_index].push_back(&worker); |
2195 | } catch (const WException & e) { |
2196 | throw GameDataError |
2197 | ("incorporated worker #%u (%u): %s", |
2198 | @@ -415,7 +415,7 @@ |
2199 | assert(i < worker_types_without_cost.size()); |
2200 | if (worker_types_without_cost.at(i) == worker_index) { |
2201 | if |
2202 | - (warehouse.m_next_worker_without_cost_spawn[i] != never()) |
2203 | + (warehouse.next_worker_without_cost_spawn_[i] != never()) |
2204 | throw GameDataError |
2205 | ( |
2206 | "%s %u has a next_spawn time for worker type " |
2207 | @@ -423,8 +423,8 @@ |
2208 | "to %u\n", |
2209 | warehouse.descr().descname().c_str(), warehouse.serial(), |
2210 | worker_typename, next_spawn, |
2211 | - warehouse.m_next_worker_without_cost_spawn[i]); |
2212 | - warehouse.m_next_worker_without_cost_spawn[i] = next_spawn; |
2213 | + warehouse.next_worker_without_cost_spawn_[i]); |
2214 | + warehouse.next_worker_without_cost_spawn_[i] = next_spawn; |
2215 | break; |
2216 | } |
2217 | } |
2218 | @@ -437,10 +437,10 @@ |
2219 | // Consistency checks are in Warehouse::load_finish |
2220 | uint32_t nr_planned_workers = fr.unsigned_32(); |
2221 | while (nr_planned_workers--) { |
2222 | - warehouse.m_planned_workers.push_back |
2223 | + warehouse.planned_workers_.push_back |
2224 | (Warehouse::PlannedWorkers()); |
2225 | Warehouse::PlannedWorkers & pw = |
2226 | - warehouse.m_planned_workers.back(); |
2227 | + warehouse.planned_workers_.back(); |
2228 | pw.index = tribe.worker_index(fr.c_string()); |
2229 | pw.amount = fr.unsigned_32(); |
2230 | |
2231 | @@ -456,7 +456,7 @@ |
2232 | } |
2233 | } |
2234 | |
2235 | - warehouse.m_next_stock_remove_act = fr.unsigned_32(); |
2236 | + warehouse.next_stock_remove_act_ = fr.unsigned_32(); |
2237 | |
2238 | if (warehouse.descr().get_isport()) { |
2239 | if (Serial portdock = fr.unsigned_32()) { |
2240 | @@ -489,7 +489,7 @@ |
2241 | (Area<FCoords> |
2242 | (game.map().get_fcoords(warehouse.get_position()), |
2243 | warehouse.descr().vision_range())); |
2244 | - warehouse.m_next_military_act = game.get_gametime(); |
2245 | + warehouse.next_military_act_ = game.get_gametime(); |
2246 | //log("Read warehouse stuff for %p\n", &warehouse); |
2247 | } else { |
2248 | throw UnhandledVersionError("MapBuildingdataPacket - Warehouse", |
2249 | @@ -792,20 +792,20 @@ |
2250 | if (packet_version == kCurrentPacketVersionTrainingsite) { |
2251 | read_productionsite(trainingsite, fr, game, mol); |
2252 | |
2253 | - delete trainingsite.m_soldier_request; |
2254 | - trainingsite.m_soldier_request = nullptr; |
2255 | + delete trainingsite.soldier_request_; |
2256 | + trainingsite.soldier_request_ = nullptr; |
2257 | if (fr.unsigned_8()) { |
2258 | - trainingsite.m_soldier_request = |
2259 | + trainingsite.soldier_request_ = |
2260 | new Request |
2261 | (trainingsite, |
2262 | 0, |
2263 | TrainingSite::request_soldier_callback, |
2264 | wwWORKER); |
2265 | - trainingsite.m_soldier_request->read(fr, game, mol); |
2266 | + trainingsite.soldier_request_->read(fr, game, mol); |
2267 | } |
2268 | |
2269 | - trainingsite.m_capacity = fr.unsigned_8(); |
2270 | - trainingsite.m_build_heroes = fr.unsigned_8(); |
2271 | + trainingsite.capacity_ = fr.unsigned_8(); |
2272 | + trainingsite.build_heroes_ = fr.unsigned_8(); |
2273 | |
2274 | uint8_t const nr_upgrades = fr.unsigned_8(); |
2275 | for (uint8_t i = 0; i < nr_upgrades; ++i) { |
2276 | @@ -835,7 +835,7 @@ |
2277 | uint16_t spresence = fr.unsigned_8(); |
2278 | mapsize--; |
2279 | std::pair<uint16_t, uint8_t> t = std::make_pair(trainstall, spresence); |
2280 | - trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t; |
2281 | + trainingsite.training_failure_count_[std::make_pair(traintype, trainlevel)] = t; |
2282 | } |
2283 | } else { |
2284 | throw UnhandledVersionError("MapBuildingdataPacket - Trainingsite", |
2285 | @@ -851,22 +851,22 @@ |
2286 | // Cmd_ChangeSoldierCapacity to the beginning of the game's command |
2287 | // queue. But that would not work because the command queue is not read |
2288 | // yet and will be cleared before it is read. |
2289 | - if (trainingsite.m_capacity < trainingsite.min_soldier_capacity()) { |
2290 | + if (trainingsite.capacity_ < trainingsite.min_soldier_capacity()) { |
2291 | log |
2292 | ("WARNING: trainingsite %u of player %u at (%i, %i) has capacity " |
2293 | "set to %u but it must be at least %u. Changing to that value.\n", |
2294 | trainingsite.serial(), trainingsite.owner().player_number(), |
2295 | trainingsite.get_position().x, trainingsite.get_position().y, |
2296 | - trainingsite.m_capacity, trainingsite.min_soldier_capacity()); |
2297 | - trainingsite.m_capacity = trainingsite.min_soldier_capacity(); |
2298 | - } else if (trainingsite.max_soldier_capacity() < trainingsite.m_capacity) { |
2299 | + trainingsite.capacity_, trainingsite.min_soldier_capacity()); |
2300 | + trainingsite.capacity_ = trainingsite.min_soldier_capacity(); |
2301 | + } else if (trainingsite.max_soldier_capacity() < trainingsite.capacity_) { |
2302 | log |
2303 | ("WARNING: trainingsite %u of player %u at (%i, %i) has capacity " |
2304 | "set to %u but it can be at most %u. Changing to that value.\n", |
2305 | trainingsite.serial(), trainingsite.owner().player_number(), |
2306 | trainingsite.get_position().x, trainingsite.get_position().y, |
2307 | - trainingsite.m_capacity, trainingsite.max_soldier_capacity()); |
2308 | - trainingsite.m_capacity = trainingsite.max_soldier_capacity(); |
2309 | + trainingsite.capacity_, trainingsite.max_soldier_capacity()); |
2310 | + trainingsite.capacity_ = trainingsite.max_soldier_capacity(); |
2311 | } |
2312 | } catch (const WException & e) { |
2313 | throw GameDataError("trainingsite: %s", e.what()); |
2314 | @@ -1042,7 +1042,7 @@ |
2315 | |
2316 | // supply |
2317 | const TribeDescr & tribe = warehouse.owner().tribe(); |
2318 | - const WareList & wares = warehouse.m_supply->get_wares(); |
2319 | + const WareList & wares = warehouse.supply_->get_wares(); |
2320 | for (DescriptionIndex i = 0; i < wares.get_nrwareids (); ++i) { |
2321 | fw.unsigned_8(1); |
2322 | fw.string(tribe.get_ware_descr(i)->name()); |
2323 | @@ -1050,7 +1050,7 @@ |
2324 | fw.unsigned_8(warehouse.get_ware_policy(i)); |
2325 | } |
2326 | fw.unsigned_8(0); |
2327 | - const WareList & workers = warehouse.m_supply->get_workers(); |
2328 | + const WareList & workers = warehouse.supply_->get_workers(); |
2329 | for (DescriptionIndex i = 0; i < workers.get_nrwareids(); ++i) { |
2330 | fw.unsigned_8(1); |
2331 | fw.string(tribe.get_worker_descr(i)->name()); |
2332 | @@ -1061,14 +1061,14 @@ |
2333 | |
2334 | // Incorporated workers, write sorted after file-serial. |
2335 | uint32_t nworkers = 0; |
2336 | - for (const std::pair<DescriptionIndex, Warehouse::WorkerList>& cwt: warehouse.m_incorporated_workers) { |
2337 | + for (const std::pair<DescriptionIndex, Warehouse::WorkerList>& cwt: warehouse.incorporated_workers_) { |
2338 | nworkers += cwt.second.size(); |
2339 | } |
2340 | |
2341 | fw.unsigned_16(nworkers); |
2342 | using TWorkerMap = std::map<uint32_t, const Worker *>; |
2343 | TWorkerMap workermap; |
2344 | - for (const std::pair<DescriptionIndex, Warehouse::WorkerList>& cwt : warehouse.m_incorporated_workers) { |
2345 | + for (const std::pair<DescriptionIndex, Warehouse::WorkerList>& cwt : warehouse.incorporated_workers_) { |
2346 | for (Worker * temp_worker : cwt.second) { |
2347 | const Worker & w = *temp_worker; |
2348 | assert(mos.is_object_known(w)); |
2349 | @@ -1088,9 +1088,9 @@ |
2350 | const std::vector<DescriptionIndex> & worker_types_without_cost = |
2351 | tribe.worker_types_without_cost(); |
2352 | assert(worker_types_without_cost.size() == |
2353 | - warehouse.m_next_worker_without_cost_spawn.size()); |
2354 | + warehouse.next_worker_without_cost_spawn_.size()); |
2355 | for (uint8_t i = worker_types_without_cost.size(); i;) { |
2356 | - const Time& next_spawn = warehouse.m_next_worker_without_cost_spawn[--i]; |
2357 | + const Time& next_spawn = warehouse.next_worker_without_cost_spawn_[--i]; |
2358 | if (next_spawn != never()) { |
2359 | fw.string |
2360 | (tribe.get_worker_descr(tribe.worker_types_without_cost().at(i)) |
2361 | @@ -1101,8 +1101,8 @@ |
2362 | } |
2363 | fw.unsigned_8(0); // terminator for spawn times |
2364 | |
2365 | - fw.unsigned_32(warehouse.m_planned_workers.size()); |
2366 | - for (const Warehouse::PlannedWorkers& temp_worker : warehouse.m_planned_workers) { |
2367 | + fw.unsigned_32(warehouse.planned_workers_.size()); |
2368 | + for (const Warehouse::PlannedWorkers& temp_worker : warehouse.planned_workers_) { |
2369 | fw.c_string(tribe.get_worker_descr(temp_worker.index)->name()); |
2370 | fw.unsigned_32(temp_worker.amount); |
2371 | |
2372 | @@ -1113,7 +1113,7 @@ |
2373 | } |
2374 | } |
2375 | |
2376 | - fw.unsigned_32(warehouse.m_next_stock_remove_act); |
2377 | + fw.unsigned_32(warehouse.next_stock_remove_act_); |
2378 | |
2379 | if (warehouse.descr().get_isport()) { |
2380 | fw.unsigned_32(mos.get_object_file_index_or_zero(warehouse.portdock_)); |
2381 | @@ -1261,34 +1261,34 @@ |
2382 | |
2383 | // requests |
2384 | |
2385 | - if (trainingsite.m_soldier_request) { |
2386 | + if (trainingsite.soldier_request_) { |
2387 | fw.unsigned_8(1); |
2388 | - trainingsite.m_soldier_request->write(fw, game, mos); |
2389 | + trainingsite.soldier_request_->write(fw, game, mos); |
2390 | } else { |
2391 | fw.unsigned_8(0); |
2392 | } |
2393 | |
2394 | - fw.unsigned_8(trainingsite.m_capacity); |
2395 | - fw.unsigned_8(trainingsite.m_build_heroes); |
2396 | + fw.unsigned_8(trainingsite.capacity_); |
2397 | + fw.unsigned_8(trainingsite.build_heroes_); |
2398 | |
2399 | // upgrades |
2400 | - fw.unsigned_8(trainingsite.m_upgrades.size()); |
2401 | - for (uint8_t i = 0; i < trainingsite.m_upgrades.size(); ++i) { |
2402 | - const TrainingSite::Upgrade & upgrade = trainingsite.m_upgrades[i]; |
2403 | + fw.unsigned_8(trainingsite.upgrades_.size()); |
2404 | + for (uint8_t i = 0; i < trainingsite.upgrades_.size(); ++i) { |
2405 | + const TrainingSite::Upgrade & upgrade = trainingsite.upgrades_[i]; |
2406 | fw.unsigned_8(upgrade.attribute); |
2407 | fw.unsigned_8(upgrade.prio); |
2408 | fw.unsigned_8(upgrade.credit); |
2409 | fw.signed_32(upgrade.lastattempt); |
2410 | fw.signed_8(upgrade.lastsuccess); |
2411 | } |
2412 | - if (255 < trainingsite.training_failure_count.size()) |
2413 | + if (255 < trainingsite.training_failure_count_.size()) |
2414 | log |
2415 | ("Save TrainingSite: Failure counter has ridiculously many entries! (%u)\n", |
2416 | - static_cast<uint16_t>(trainingsite.training_failure_count.size())); |
2417 | - fw.unsigned_16(static_cast<uint16_t> (trainingsite.training_failure_count.size())); |
2418 | + static_cast<uint16_t>(trainingsite.training_failure_count_.size())); |
2419 | + fw.unsigned_16(static_cast<uint16_t> (trainingsite.training_failure_count_.size())); |
2420 | for |
2421 | - (TrainingSite::TrainFailCount::const_iterator i = trainingsite.training_failure_count.begin(); |
2422 | - i != trainingsite.training_failure_count.end(); i++) |
2423 | + (TrainingSite::TrainFailCount::const_iterator i = trainingsite.training_failure_count_.begin(); |
2424 | + i != trainingsite.training_failure_count_.end(); i++) |
2425 | { |
2426 | fw.unsigned_16(i->first.first); |
2427 | fw.unsigned_16(i->first.second); |
Continuous integration builds have changed state:
Travis build 683. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 109009669. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ bug_1395278_ tribes_ t_z-535.
Appveyor build 535. State: success. Details: https:/