widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05983
[Merge] lp:~widelands-dev/widelands/bug-1395278-tribes-a-p into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1395278-tribes-a-p into lp:widelands.
Commit message:
Fixed member variable names in src/logic/map_objects/tribes from battle - partially_finished_building.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1395278 in widelands: "Consolidate naming of member variables"
https://bugs.launchpad.net/widelands/+bug/1395278
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1395278-tribes-a-p/+merge/285395
Fixed member variable names in src/logic/map_objects/tribes from battle - partially_finished_building.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-tribes-a-p into lp:widelands.
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2016-02-03 10:01:08 +0000
+++ src/ai/defaultai.cc 2016-02-08 18:17:36 +0000
@@ -3114,7 +3114,7 @@
// Get max radius of recursive workarea
WorkareaInfo::size_type radius = 0;
- const WorkareaInfo& workarea_info = site.bo->desc->m_workarea_info;
+ const WorkareaInfo& workarea_info = site.bo->desc->workarea_info_;
for (const std::pair<uint32_t, std::set<std::string>>& temp_info : workarea_info) {
if (radius < temp_info.first) {
radius = temp_info.first;
=== modified file 'src/graphic/animation.cc'
--- src/graphic/animation.cc 2016-01-28 05:24:34 +0000
+++ src/graphic/animation.cc 2016-02-08 18:17:36 +0000
@@ -299,12 +299,12 @@
uint32_t dir5,
uint32_t dir6)
{
- m_animations[0] = dir1;
- m_animations[1] = dir2;
- m_animations[2] = dir3;
- m_animations[3] = dir4;
- m_animations[4] = dir5;
- m_animations[5] = dir6;
+ animations_[0] = dir1;
+ animations_[1] = dir2;
+ animations_[2] = dir3;
+ animations_[3] = dir4;
+ animations_[4] = dir5;
+ animations_[5] = dir6;
}
/*
=== modified file 'src/graphic/diranimations.h'
--- src/graphic/diranimations.h 2016-01-17 19:54:32 +0000
+++ src/graphic/diranimations.h 2016-02-08 18:17:36 +0000
@@ -33,20 +33,20 @@
uint32_t dir4 = 0, uint32_t dir5 = 0, uint32_t dir6 = 0);
uint32_t get_animation(Widelands::Direction const dir) const {
- return m_animations[dir - 1];
+ return animations_[dir - 1];
}
void set_animation(const Widelands::Direction dir, const uint32_t anim) {
- m_animations[dir - 1] = anim;
+ animations_[dir - 1] = anim;
}
static DirAnimations null() {
return DirAnimations(0); // Since real animation IDs are positive, this is safe
}
- operator bool() const {return m_animations[0];}
+ operator bool() const {return animations_[0];}
private:
- uint32_t m_animations[6];
+ uint32_t animations_[6];
};
#endif // end of include guard: WL_GRAPHIC_DIRANIMATIONS_H
=== modified file 'src/logic/map_objects/tribes/battle.cc'
--- src/logic/map_objects/tribes/battle.cc 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/battle.cc 2016-02-08 18:17:36 +0000
@@ -45,22 +45,22 @@
Battle::Battle ()
:
MapObject(&g_battle_descr),
- m_first(nullptr),
- m_second(nullptr),
- m_creationtime(0),
- m_readyflags(0),
- m_damage(0),
- m_first_strikes(true),
- m_last_attack_hits(false)
+ first_(nullptr),
+ second_(nullptr),
+ creationtime_(0),
+ readyflags_(0),
+ damage_(0),
+ first_strikes_(true),
+ last_attack_hits_(false)
{}
Battle::Battle(Game & game, Soldier & First, Soldier & Second) :
MapObject (&g_battle_descr),
- m_first (&First),
- m_second (&Second),
- m_readyflags (0),
- m_damage (0),
- m_first_strikes(true)
+ first_ (&First),
+ second_ (&Second),
+ readyflags_ (0),
+ damage_ (0),
+ first_strikes_(true)
{
assert(First.get_owner() != Second.get_owner());
{
@@ -81,30 +81,30 @@
{
MapObject::init(egbase);
- m_creationtime = egbase.get_gametime();
+ creationtime_ = egbase.get_gametime();
Game& game = dynamic_cast<Game&>(egbase);
- if (Battle* battle = m_first ->get_battle()) {
- battle->cancel(game, *m_first);
- }
- m_first->set_battle(game, this);
- if (Battle* battle = m_second->get_battle()) {
- battle->cancel(game, *m_second);
- }
- m_second->set_battle(game, this);
+ if (Battle* battle = first_ ->get_battle()) {
+ battle->cancel(game, *first_);
+ }
+ first_->set_battle(game, this);
+ if (Battle* battle = second_->get_battle()) {
+ battle->cancel(game, *second_);
+ }
+ second_->set_battle(game, this);
}
void Battle::cleanup (EditorGameBase & egbase)
{
- if (m_first) {
- m_first ->set_battle(dynamic_cast<Game&>(egbase), nullptr);
- m_first = nullptr;
+ if (first_) {
+ first_ ->set_battle(dynamic_cast<Game&>(egbase), nullptr);
+ first_ = nullptr;
}
- if (m_second) {
- m_second->set_battle(dynamic_cast<Game&>(egbase), nullptr);
- m_second = nullptr;
+ if (second_) {
+ second_->set_battle(dynamic_cast<Game&>(egbase), nullptr);
+ second_ = nullptr;
}
MapObject::cleanup(egbase);
@@ -116,11 +116,11 @@
*/
void Battle::cancel(Game & game, Soldier & soldier)
{
- if (&soldier == m_first) {
- m_first = nullptr;
+ if (&soldier == first_) {
+ first_ = nullptr;
soldier.set_battle(game, nullptr);
- } else if (&soldier == m_second) {
- m_second = nullptr;
+ } else if (&soldier == second_) {
+ second_ = nullptr;
soldier.set_battle(game, nullptr);
} else
return;
@@ -131,17 +131,17 @@
bool Battle::locked(Game & game)
{
- if (!m_first || !m_second)
+ if (!first_ || !second_)
return false;
- if (game.get_gametime() - m_creationtime < 1000)
+ if (game.get_gametime() - creationtime_ < 1000)
return true; // don't change battles around willy-nilly
- return m_first->get_position() == m_second->get_position();
+ return first_->get_position() == second_->get_position();
}
Soldier * Battle::opponent(Soldier& soldier)
{
- assert(m_first == &soldier || m_second == &soldier);
- Soldier* other_soldier = m_first == &soldier ? m_second : m_first;
+ assert(first_ == &soldier || second_ == &soldier);
+ Soldier* other_soldier = first_ == &soldier ? second_ : first_;
return other_soldier;
}
@@ -153,35 +153,35 @@
void Battle::get_battle_work(Game & game, Soldier & soldier)
{
// Identify what soldier is calling the routine
- uint8_t const this_soldier_is = &soldier == m_first ? 1 : 2;
+ uint8_t const this_soldier_is = &soldier == first_ ? 1 : 2;
- assert(m_first->get_battle() == this || m_second->get_battle() == this);
+ assert(first_->get_battle() == this || second_->get_battle() == this);
// Created this four 'states' of the battle:
// *First time entered, one enters :
- // oneReadyToFight, mark m_readyflags as he is ready to fight
+ // oneReadyToFight, mark readyflags_ as he is ready to fight
// *Next time, the opponent enters:
- // bothReadyToFight, mark m_readyflags as 3 (round fighted)
+ // bothReadyToFight, mark readyflags_ as 3 (round fighted)
// *Next time, the first enters again:
- // roundFought, reset m_readyflags
+ // roundFought, reset readyflags_
// *Opponent not on field yet, so one enters :
// waitingForOpponent, if others are false
- bool const oneReadyToFight = (m_readyflags == 0);
- bool const roundFought = (m_readyflags == 3);
- bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) &&
+ bool const oneReadyToFight = (readyflags_ == 0);
+ bool const roundFought = (readyflags_ == 3);
+ bool const bothReadyToFight = ((this_soldier_is | readyflags_) == 3) &&
(!roundFought);
bool const waitingForOpponent = !(oneReadyToFight || roundFought || bothReadyToFight);
std::string what_anim;
// Apply pending damage
- if (m_damage && oneReadyToFight) {
+ if (damage_ && oneReadyToFight) {
// Current attacker is last defender, so damage goes to current attacker
- if (m_first_strikes)
- m_first ->damage(m_damage);
+ if (first_strikes_)
+ first_ ->damage(damage_);
else
- m_second->damage(m_damage);
- m_damage = 0;
+ second_->damage(damage_);
+ damage_ = 0;
}
if (soldier.get_current_hitpoints() < 1) {
@@ -194,15 +194,15 @@
return schedule_destroy(game);
}
- if (!m_first || !m_second)
+ if (!first_ || !second_)
return soldier.skip_act();
// Here is a timeout to prevent battle freezes
- if (waitingForOpponent && (game.get_gametime() - m_creationtime) > 90 * 1000) {
+ if (waitingForOpponent && (game.get_gametime() - creationtime_) > 90 * 1000) {
molog("[battle] soldier %u waiting for opponent %u too long (%5d sec), cancelling battle...\n",
soldier.serial(),
opponent(soldier)->serial(),
- (game.get_gametime() - m_creationtime) / 1000);
+ (game.get_gametime() - creationtime_) / 1000);
cancel(game, soldier);
return;
}
@@ -220,9 +220,9 @@
//
if (oneReadyToFight) {
// My opponent is not ready to battle. Idle until he wakes me up.
- assert(m_readyflags == 0);
- m_readyflags = this_soldier_is;
- assert(m_readyflags == this_soldier_is);
+ assert(readyflags_ == 0);
+ readyflags_ = this_soldier_is;
+ assert(readyflags_ == this_soldier_is);
what_anim = this_soldier_is == 1 ?
"evade_success_e" :
@@ -236,12 +236,12 @@
// Time for one of us to hurt the other. Which one is on turn is decided
// by calculate_round.
assert
- ((m_readyflags == 1 && this_soldier_is == 2) ||
- (m_readyflags == 2 && this_soldier_is == 1));
+ ((readyflags_ == 1 && this_soldier_is == 2) ||
+ (readyflags_ == 2 && this_soldier_is == 1));
// Both are now ready, mark flags, so our opponent can get new animation
- m_readyflags = 3;
- assert(m_readyflags == 3);
+ readyflags_ = 3;
+ assert(readyflags_ == 3);
// Resolve combat turn
calculate_round(game);
@@ -253,23 +253,23 @@
if (roundFought) {
// Both of us were already ready. That means that we already fought and
// it is time to wait until both become ready.
- m_readyflags = 0;
+ readyflags_ = 0;
}
- // The function calculate_round inverts value of m_first_strikes, so
- // attacker will be the m_first when m_first_strikes = false and
- // attacker will be m_second when m_first_strikes = true
+ // The function calculate_round inverts value of first_strikes_, so
+ // attacker will be the first_ when first_strikes_ = false and
+ // attacker will be second_ when first_strikes_ = true
molog
("[battle] (%u) vs (%u) is %d, first strikes %d, last hit %d\n",
soldier.serial(),
opponent(soldier)->serial(),
this_soldier_is,
- m_first_strikes,
- m_last_attack_hits);
+ first_strikes_,
+ last_attack_hits_);
if (this_soldier_is == 1) {
- if (m_first_strikes) {
- if (m_last_attack_hits) {
+ if (first_strikes_) {
+ if (last_attack_hits_) {
what_anim = "evade_failure_e";
}
else {
@@ -277,7 +277,7 @@
}
}
else {
- if (m_last_attack_hits) {
+ if (last_attack_hits_) {
what_anim = "attack_success_e";
}
else {
@@ -285,8 +285,8 @@
}
}
} else {
- if (m_first_strikes) {
- if (m_last_attack_hits) {
+ if (first_strikes_) {
+ if (last_attack_hits_) {
what_anim = "attack_success_w";
}
else {
@@ -294,7 +294,7 @@
}
}
else {
- if (m_last_attack_hits) {
+ if (last_attack_hits_) {
what_anim = "evade_failure_w";
}
else {
@@ -312,25 +312,25 @@
void Battle::calculate_round(Game & game)
{
- assert(!m_damage);
+ assert(!damage_);
Soldier * attacker;
Soldier * defender;
- if (m_first_strikes) {
- attacker = m_first;
- defender = m_second;
+ if (first_strikes_) {
+ attacker = first_;
+ defender = second_;
} else {
- attacker = m_second;
- defender = m_first;
+ attacker = second_;
+ defender = first_;
}
- m_first_strikes = !m_first_strikes;
+ first_strikes_ = !first_strikes_;
uint32_t const hit = game.logic_rand() % 100;
if (hit > defender->get_evade()) {
// Attacker hits!
- m_last_attack_hits = true;
+ last_attack_hits_ = true;
assert(attacker->get_min_attack() <= attacker->get_max_attack());
uint32_t const attack =
@@ -338,11 +338,11 @@
(game.logic_rand()
%
(1 + attacker->get_max_attack() - attacker->get_min_attack()));
- m_damage = attack - (attack * defender->get_defense()) / 100;
+ damage_ = attack - (attack * defender->get_defense()) / 100;
}
else {
// Defender evaded
- m_last_attack_hits = false;
+ last_attack_hits_ = false;
}
}
@@ -363,12 +363,12 @@
Battle & battle = get<Battle>();
- battle.m_creationtime = fr.signed_32();
- battle.m_readyflags = fr.unsigned_8();
- battle.m_first_strikes = fr.unsigned_8();
- battle.m_damage = fr.unsigned_32();
- m_first = fr.unsigned_32();
- m_second = fr.unsigned_32();
+ battle.creationtime_ = fr.signed_32();
+ battle.readyflags_ = fr.unsigned_8();
+ battle.first_strikes_ = fr.unsigned_8();
+ battle.damage_ = fr.unsigned_32();
+ first_ = fr.unsigned_32();
+ second_ = fr.unsigned_32();
}
void Battle::Loader::load_pointers()
@@ -376,17 +376,17 @@
Battle & battle = get<Battle>();
try {
MapObject::Loader::load_pointers();
- if (m_first)
+ if (first_)
try {
- battle.m_first = &mol().get<Soldier>(m_first);
+ battle.first_ = &mol().get<Soldier>(first_);
} catch (const WException & e) {
- throw wexception("soldier 1 (%u): %s", m_first, e.what());
+ throw wexception("soldier 1 (%u): %s", first_, e.what());
}
- if (m_second)
+ if (second_)
try {
- battle.m_second = &mol().get<Soldier>(m_second);
+ battle.second_ = &mol().get<Soldier>(second_);
} catch (const WException & e) {
- throw wexception("soldier 2 (%u): %s", m_second, e.what());
+ throw wexception("soldier 2 (%u): %s", second_, e.what());
}
} catch (const WException & e) {
throw wexception("battle: %s", e.what());
@@ -401,14 +401,14 @@
MapObject::save(egbase, mos, fw);
- fw.signed_32(m_creationtime);
- fw.unsigned_8(m_readyflags);
- fw.unsigned_8(m_first_strikes);
- fw.unsigned_32(m_damage);
+ fw.signed_32(creationtime_);
+ fw.unsigned_8(readyflags_);
+ fw.unsigned_8(first_strikes_);
+ fw.unsigned_32(damage_);
// And now, the serials of the soldiers !
- fw.unsigned_32(m_first ? mos.get_object_file_index(*m_first) : 0);
- fw.unsigned_32(m_second ? mos.get_object_file_index(*m_second) : 0);
+ fw.unsigned_32(first_ ? mos.get_object_file_index(*first_) : 0);
+ fw.unsigned_32(second_ ? mos.get_object_file_index(*second_) : 0);
}
=== modified file 'src/logic/map_objects/tribes/battle.h'
--- src/logic/map_objects/tribes/battle.h 2015-11-29 09:43:15 +0000
+++ src/logic/map_objects/tribes/battle.h 2016-02-08 18:17:36 +0000
@@ -66,8 +66,8 @@
bool locked(Game &);
// The two soldiers involved in this fight.
- Soldier * first() {return m_first;}
- Soldier * second() {return m_second;}
+ Soldier * first() {return first_;}
+ Soldier * second() {return second_;}
// Returns the other soldier involved in this battle. CHECKs that the given
// soldier is participating in this battle. Can return nullptr, but I have
@@ -83,41 +83,41 @@
virtual void load(FileRead &);
void load_pointers() override;
- Serial m_first;
- Serial m_second;
+ Serial first_;
+ Serial second_;
};
void calculate_round(Game &);
- Soldier * m_first;
- Soldier * m_second;
+ Soldier * first_;
+ Soldier * second_;
/**
* Gametime when the battle was created.
*/
- int32_t m_creationtime;
+ int32_t creationtime_;
/**
* 1 if only the first soldier is ready, 2 if only the second soldier
* is ready, 3 if both are ready.
*/
- uint8_t m_readyflags;
+ uint8_t readyflags_;
/**
* Damage pending to apply. Damage is applied at end of round so animations
* can show current action.
*/
- uint32_t m_damage;
+ uint32_t damage_;
/**
* \c true if the first soldier is the next to strike.
*/
- bool m_first_strikes;
+ bool first_strikes_;
/**
* \c true if the last turn attacker damaged his opponent
*/
- bool m_last_attack_hits;
+ bool last_attack_hits_;
};
}
=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc 2016-02-07 09:30:20 +0000
+++ src/logic/map_objects/tribes/building.cc 2016-02-08 18:17:36 +0000
@@ -60,15 +60,15 @@
:
MapObjectDescr(_type, table.get_string("name"), init_descname, table),
egbase_ (egbase),
- m_buildable (false),
- m_size (BaseImmovable::SMALL),
- m_mine (false),
- m_port (false),
- m_enhancement (INVALID_INDEX),
- m_enhanced_from (INVALID_INDEX),
- m_enhanced_building(false),
- m_hints (table.get_table("aihints")),
- m_vision_range (0)
+ buildable_ (false),
+ size_ (BaseImmovable::SMALL),
+ mine_ (false),
+ port_ (false),
+ enhancement_ (INVALID_INDEX),
+ enhanced_from_ (INVALID_INDEX),
+ enhanced_building_(false),
+ hints_ (table.get_table("aihints")),
+ vision_range_ (0)
{
if (!is_animation_known("idle")) {
throw GameDataError("Building %s has no idle animation", table.get_string("name").c_str());
@@ -84,17 +84,17 @@
try {
const std::string size = table.get_string("size");
if (boost::iequals(size, "small")) {
- m_size = BaseImmovable::SMALL;
+ size_ = BaseImmovable::SMALL;
} else if (boost::iequals(size, "medium")) {
- m_size = BaseImmovable::MEDIUM;
+ size_ = BaseImmovable::MEDIUM;
} else if (boost::iequals(size, "big")) {
- m_size = BaseImmovable::BIG;
+ size_ = BaseImmovable::BIG;
} else if (boost::iequals(size, "mine")) {
- m_size = BaseImmovable::SMALL;
- m_mine = true;
+ size_ = BaseImmovable::SMALL;
+ mine_ = true;
} else if (boost::iequals(size, "port")) {
- m_size = BaseImmovable::BIG;
- m_port = true;
+ size_ = BaseImmovable::BIG;
+ port_ = true;
} else {
throw GameDataError
("expected %s but found \"%s\"",
@@ -106,7 +106,7 @@
}
// Parse build options
- m_destructible = table.has_key("destructible") ? table.get_bool("destructible") : true;
+ destructible_ = table.has_key("destructible") ? table.get_bool("destructible") : true;
if (table.has_key("enhancement")) {
const std::string enh = table.get_string("enhancement");
@@ -116,14 +116,14 @@
}
DescriptionIndex const en_i = egbase_.tribes().building_index(enh);
if (egbase_.tribes().building_exists(en_i)) {
- m_enhancement = en_i;
+ enhancement_ = en_i;
// Merge the enhancements workarea info into this building's
// workarea info.
const BuildingDescr * tmp_enhancement = egbase_.tribes().get_building_descr(en_i);
- for (std::pair<uint32_t, std::set<std::string>> area : tmp_enhancement->m_workarea_info)
+ for (std::pair<uint32_t, std::set<std::string>> area : tmp_enhancement->workarea_info_)
{
- std::set<std::string> & strs = m_workarea_info[area.first];
+ std::set<std::string> & strs = workarea_info_[area.first];
for (std::string str : area.second)
strs.insert(str);
}
@@ -135,10 +135,10 @@
}
if (table.has_key("buildcost")) {
- m_buildable = true;
+ buildable_ = true;
try {
- m_buildcost = Buildcost(table.get_table("buildcost"), egbase_.tribes());
- m_return_dismantle = Buildcost(table.get_table("return_on_dismantle"), egbase_.tribes());
+ buildcost_ = Buildcost(table.get_table("buildcost"), egbase_.tribes());
+ return_dismantle_ = Buildcost(table.get_table("return_on_dismantle"), egbase_.tribes());
} catch (const WException & e) {
throw wexception
("A buildable building must define \"buildcost\" and \"return_on_dismantle\": %s",
@@ -146,10 +146,10 @@
}
}
if (table.has_key("enhancement_cost")) {
- m_enhanced_building = true;
+ enhanced_building_ = true;
try {
- m_enhance_cost = Buildcost(table.get_table("enhancement_cost"), egbase_.tribes());
- m_return_enhanced = Buildcost(table.get_table("return_on_dismantle_on_enhanced"), egbase_.tribes());
+ enhance_cost_ = Buildcost(table.get_table("enhancement_cost"), egbase_.tribes());
+ return_enhanced_ = Buildcost(table.get_table("return_on_dismantle_on_enhanced"), egbase_.tribes());
} catch (const WException & e) {
throw wexception
("An enhanced building must define \"enhancement_cost\""
@@ -159,10 +159,10 @@
helptext_script_ = table.get_string("helptext_script");
- m_needs_seafaring = table.has_key("needs_seafaring") ? table.get_bool("needs_seafaring") : false;
+ needs_seafaring_ = table.has_key("needs_seafaring") ? table.get_bool("needs_seafaring") : false;
if (table.has_key("vision_range")) {
- m_vision_range = table.get_int("vision_range");
+ vision_range_ = table.get_int("vision_range");
}
}
@@ -177,10 +177,10 @@
const
{
Building & b = construct ? create_constructionsite() : create_object();
- b.m_position = pos;
+ b.position_ = pos;
b.set_owner(&owner);
for (DescriptionIndex idx : former_buildings) {
- b.m_old_buildings.push_back(idx);
+ b.old_buildings_.push_back(idx);
}
if (loading) {
b.Building::init(egbase);
@@ -192,7 +192,7 @@
int32_t BuildingDescr::suitability(const Map &, FCoords const fc) const {
- return m_size <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK);
+ return size_ <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK);
}
/**
@@ -212,7 +212,7 @@
*/
uint32_t BuildingDescr::vision_range() const
{
- return m_vision_range ? m_vision_range : get_conquers() + 4;
+ return vision_range_ ? vision_range_ : get_conquers() + 4;
}
@@ -244,18 +244,18 @@
Building::Building(const BuildingDescr & building_descr) :
PlayerImmovable(building_descr),
- m_optionswindow(nullptr),
- m_flag (nullptr),
- m_anim(0),
- m_animstart(0),
- m_leave_time(0),
- m_defeating_player(0),
- m_seeing(false)
+ optionswindow_(nullptr),
+ flag_ (nullptr),
+ anim_(0),
+ animstart_(0),
+ leave_time_(0),
+ defeating_player_(0),
+ seeing_(false)
{}
Building::~Building()
{
- if (m_optionswindow)
+ if (optionswindow_)
hide_options();
}
@@ -294,9 +294,9 @@
return false;
};
- m_leave_queue.erase(
- std::remove_if(m_leave_queue.begin(), m_leave_queue.end(), should_be_deleted),
- m_leave_queue.end());
+ leave_queue_.erase(
+ std::remove_if(leave_queue_.begin(), leave_queue_.end(), should_be_deleted),
+ leave_queue_.end());
}
int32_t Building::get_size() const {return descr().get_size();}
@@ -305,7 +305,7 @@
Flag & Building::base_flag()
{
- return *m_flag;
+ return *flag_;
}
@@ -331,8 +331,8 @@
void Building::start_animation(EditorGameBase & egbase, uint32_t const anim)
{
- m_anim = anim;
- m_animstart = egbase.get_gametime();
+ anim_ = anim;
+ animstart_ = egbase.get_gametime();
}
/*
@@ -349,29 +349,29 @@
Map & map = egbase.map();
Coords neighb;
- set_position(egbase, m_position);
+ set_position(egbase, position_);
if (get_size() == BIG) {
- map.get_ln(m_position, &neighb);
- set_position(egbase, neighb);
-
- map.get_tln(m_position, &neighb);
- set_position(egbase, neighb);
-
- map.get_trn(m_position, &neighb);
+ map.get_ln(position_, &neighb);
+ set_position(egbase, neighb);
+
+ map.get_tln(position_, &neighb);
+ set_position(egbase, neighb);
+
+ map.get_trn(position_, &neighb);
set_position(egbase, neighb);
}
// Make sure the flag is there
- map.get_brn(m_position, &neighb);
+ map.get_brn(position_, &neighb);
{
Flag * flag = dynamic_cast<Flag *>(map.get_immovable(neighb));
if (!flag)
flag =
new Flag (egbase, owner(), neighb);
- m_flag = flag;
+ flag_ = flag;
flag->attach_building(egbase, *this);
}
@@ -381,14 +381,14 @@
else
start_animation(egbase, descr().get_animation("idle"));
- m_leave_time = egbase.get_gametime();
+ leave_time_ = egbase.get_gametime();
}
void Building::cleanup(EditorGameBase & egbase)
{
- if (m_defeating_player) {
- Player & defeating_player = egbase.player(m_defeating_player);
+ if (defeating_player_) {
+ Player & defeating_player = egbase.player(defeating_player_);
if (descr().get_conquers()) {
owner() .count_msite_lost ();
defeating_player.count_msite_defeated ();
@@ -399,22 +399,22 @@
}
// Remove from flag
- m_flag->detach_building(egbase);
+ flag_->detach_building(egbase);
// Unset the building
- unset_position(egbase, m_position);
+ unset_position(egbase, position_);
if (get_size() == BIG) {
Map & map = egbase.map();
Coords neighb;
- map.get_ln(m_position, &neighb);
- unset_position(egbase, neighb);
-
- map.get_tln(m_position, &neighb);
- unset_position(egbase, neighb);
-
- map.get_trn(m_position, &neighb);
+ map.get_ln(position_, &neighb);
+ unset_position(egbase, neighb);
+
+ map.get_tln(position_, &neighb);
+ unset_position(egbase, neighb);
+
+ map.get_trn(position_, &neighb);
unset_position(egbase, neighb);
}
@@ -447,18 +447,18 @@
{
PositionList rv;
- rv.push_back(m_position);
+ rv.push_back(position_);
if (get_size() == BIG) {
Map & map = egbase.map();
Coords neighb;
- map.get_ln(m_position, &neighb);
- rv.push_back(neighb);
-
- map.get_tln(m_position, &neighb);
- rv.push_back(neighb);
-
- map.get_trn(m_position, &neighb);
+ map.get_ln(position_, &neighb);
+ rv.push_back(neighb);
+
+ map.get_tln(position_, &neighb);
+ rv.push_back(neighb);
+
+ map.get_trn(position_, &neighb);
rv.push_back(neighb);
}
return rv;
@@ -474,7 +474,7 @@
void Building::destroy(EditorGameBase & egbase)
{
const bool fire = burn_on_destroy();
- const Coords pos = m_position;
+ const Coords pos = position_;
PlayerImmovable::destroy(egbase);
// We are deleted. Only use stack variables beyond this point
if (fire)
@@ -541,24 +541,24 @@
*/
bool Building::leave_check_and_wait(Game & game, Worker & w)
{
- if (&w == m_leave_allow.get(game)) {
- m_leave_allow = nullptr;
+ if (&w == leave_allow_.get(game)) {
+ leave_allow_ = nullptr;
return true;
}
// Check time and queue
uint32_t const time = game.get_gametime();
- if (m_leave_queue.empty()) {
- if (m_leave_time <= time) {
- m_leave_time = time + BUILDING_LEAVE_INTERVAL;
+ if (leave_queue_.empty()) {
+ if (leave_time_ <= time) {
+ leave_time_ = time + BUILDING_LEAVE_INTERVAL;
return true;
}
- schedule_act(game, m_leave_time - time);
+ schedule_act(game, leave_time_ - time);
}
- m_leave_queue.push_back(&w);
+ leave_queue_.push_back(&w);
return false;
}
@@ -574,10 +574,10 @@
void Building::leave_skip(Game &, Worker & w)
{
LeaveQueue::iterator const it =
- std::find(m_leave_queue.begin(), m_leave_queue.end(), &w);
+ std::find(leave_queue_.begin(), leave_queue_.end(), &w);
- if (it != m_leave_queue.end())
- m_leave_queue.erase(it);
+ if (it != leave_queue_.end())
+ leave_queue_.erase(it);
}
@@ -590,31 +590,31 @@
{
uint32_t const time = game.get_gametime();
- if (m_leave_time <= time) {
+ if (leave_time_ <= time) {
bool wakeup = false;
// Wake up one worker
- while (!m_leave_queue.empty()) {
- upcast(Worker, worker, m_leave_queue[0].get(game));
+ while (!leave_queue_.empty()) {
+ upcast(Worker, worker, leave_queue_[0].get(game));
- m_leave_queue.erase(m_leave_queue.begin());
+ leave_queue_.erase(leave_queue_.begin());
if (worker) {
- m_leave_allow = worker;
+ leave_allow_ = worker;
if (worker->wakeup_leave_building(game, *this)) {
- m_leave_time = time + BUILDING_LEAVE_INTERVAL;
+ leave_time_ = time + BUILDING_LEAVE_INTERVAL;
wakeup = true;
break;
}
}
}
- if (!m_leave_queue.empty())
- schedule_act(game, m_leave_time - time);
+ if (!leave_queue_.empty())
+ schedule_act(game, leave_time_ - time);
if (!wakeup)
- m_leave_time = time; // make sure leave_time doesn't get too far behind
+ leave_time_ = time; // make sure leave_time doesn't get too far behind
}
PlayerImmovable::act(game, data);
@@ -647,9 +647,9 @@
void Building::draw
(const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos)
{
- if (coords == m_position) { // draw big buildings only once
+ if (coords == position_) { // draw big buildings only once
dst.blit_animation(
- pos, m_anim, game.get_gametime() - m_animstart, get_owner()->get_playercolor());
+ pos, anim_, game.get_gametime() - animstart_, get_owner()->get_playercolor());
// door animation?
@@ -699,8 +699,8 @@
// if priority is defined for specific ware,
// combine base priority and ware priority
std::map<DescriptionIndex, int32_t>::const_iterator it =
- m_ware_priorities.find(ware_index);
- if (it != m_ware_priorities.end())
+ ware_priorities_.find(ware_index);
+ if (it != ware_priorities_.end())
priority = adjust
? (priority * it->second / DEFAULT_PRIORITY)
: it->second;
@@ -716,11 +716,11 @@
void Building::collect_priorities
(std::map<int32_t, std::map<DescriptionIndex, int32_t> > & p) const
{
- if (m_ware_priorities.empty())
+ if (ware_priorities_.empty())
return;
std::map<DescriptionIndex, int32_t> & ware_priorities = p[wwWARE];
std::map<DescriptionIndex, int32_t>::const_iterator it;
- for (it = m_ware_priorities.begin(); it != m_ware_priorities.end(); ++it) {
+ for (it = ware_priorities_.begin(); it != ware_priorities_.end(); ++it) {
if (it->second == DEFAULT_PRIORITY)
continue;
ware_priorities[it->first] = it->second;
@@ -736,7 +736,7 @@
int32_t const new_priority)
{
if (type == wwWARE) {
- m_ware_priorities[ware_index] = new_priority;
+ ware_priorities_[ware_index] = new_priority;
}
}
@@ -744,21 +744,21 @@
void Building::log_general_info(const EditorGameBase & egbase) {
PlayerImmovable::log_general_info(egbase);
- molog("m_position: (%i, %i)\n", m_position.x, m_position.y);
- molog("m_flag: %p\n", m_flag);
+ molog("position: (%i, %i)\n", position_.x, position_.y);
+ molog("flag: %p\n", flag_);
molog
("* position: (%i, %i)\n",
- m_flag->get_position().x, m_flag->get_position().y);
-
- molog("m_anim: %s\n", descr().get_animation_name(m_anim).c_str());
- molog("m_animstart: %i\n", m_animstart);
-
- molog("m_leave_time: %i\n", m_leave_time);
+ flag_->get_position().x, flag_->get_position().y);
+
+ molog("anim: %s\n", descr().get_animation_name(anim_).c_str());
+ molog("animstart: %i\n", animstart_);
+
+ molog("leave_time: %i\n", leave_time_);
molog
- ("m_leave_queue.size(): %lu\n",
- static_cast<long unsigned int>(m_leave_queue.size()));
- molog("m_leave_allow.get(): %p\n", m_leave_allow.get(egbase));
+ ("leave_queue.size(): %lu\n",
+ static_cast<long unsigned int>(leave_queue_.size()));
+ molog("leave_allow.get(): %p\n", leave_allow_.get(egbase));
}
@@ -788,7 +788,7 @@
*/
void Building::set_seeing(bool see)
{
- if (see == m_seeing)
+ if (see == seeing_)
return;
Player & player = owner();
@@ -801,7 +801,7 @@
player.unsee_area
(Area<FCoords>(map.get_fcoords(get_position()), descr().vision_range()));
- m_seeing = see;
+ seeing_ = see;
}
/**
=== modified file 'src/logic/map_objects/tribes/building.h'
--- src/logic/map_objects/tribes/building.h 2016-02-02 12:47:45 +0000
+++ src/logic/map_objects/tribes/building.h 2016-02-08 18:17:36 +0000
@@ -66,43 +66,43 @@
const LuaTable& t, const EditorGameBase& egbase);
~BuildingDescr() override {}
- bool is_buildable () const {return m_buildable;}
- bool is_destructible() const {return m_destructible;}
- bool is_enhanced () const {return m_enhanced_building;}
+ bool is_buildable () const {return buildable_;}
+ bool is_destructible() const {return destructible_;}
+ bool is_enhanced () const {return enhanced_building_;}
/**
* The build cost for direct construction
*/
- const Buildcost & buildcost() const {return m_buildcost;}
+ const Buildcost & buildcost() const {return buildcost_;}
/**
* Returned wares for dismantling
*/
- const Buildcost & returned_wares() const {return m_return_dismantle;}
+ const Buildcost & returned_wares() const {return return_dismantle_;}
/**
* The build cost for enhancing a previous building
*/
- const Buildcost & enhancement_cost() const {return m_enhance_cost;}
+ const Buildcost & enhancement_cost() const {return enhance_cost_;}
/**
* The returned wares for a enhaced building
*/
- const Buildcost & returned_wares_enhanced() const {return m_return_enhanced;}
+ const Buildcost & returned_wares_enhanced() const {return return_enhanced_;}
std::string helptext_script() const {return helptext_script_;}
- int32_t get_size() const {return m_size;}
- bool get_ismine() const {return m_mine;}
- bool get_isport() const {return m_port;}
- bool needs_seafaring() const {return m_needs_seafaring;}
+ int32_t get_size() const {return size_;}
+ bool get_ismine() const {return mine_;}
+ bool get_isport() const {return port_;}
+ bool needs_seafaring() const {return needs_seafaring_;}
// Returns the enhancement this building can become or
// INVALID_INDEX if it cannot be enhanced.
- const DescriptionIndex & enhancement() const {return m_enhancement;}
+ const DescriptionIndex & enhancement() const {return enhancement_;}
// Returns the building from which this building can be enhanced or
// INVALID_INDEX if it cannot be built as an enhanced building.
- const DescriptionIndex& enhanced_from() const {return m_enhanced_from;}
- void set_enhanced_from(const DescriptionIndex& index) {m_enhanced_from = index;}
+ const DescriptionIndex& enhanced_from() const {return enhanced_from_;}
+ void set_enhanced_from(const DescriptionIndex& index) {enhanced_from_ = index;}
/// Create a building of this type in the game. Calls init, which does
/// different things for different types of buildings (such as conquering
@@ -123,10 +123,10 @@
virtual uint32_t get_conquers() const;
virtual uint32_t vision_range() const;
- WorkareaInfo m_workarea_info;
+ WorkareaInfo workarea_info_;
virtual int32_t suitability(const Map &, FCoords) const;
- const BuildingHints & hints() const {return m_hints;}
+ const BuildingHints & hints() const {return hints_;}
protected:
virtual Building & create_object() const = 0;
@@ -134,24 +134,24 @@
private:
const EditorGameBase& egbase_;
- bool m_buildable; // the player can build this himself
- bool m_destructible; // the player can destruct this himself
- Buildcost m_buildcost;
- Buildcost m_return_dismantle; // Returned wares on dismantle
- Buildcost m_enhance_cost; // cost for enhancing
- Buildcost m_return_enhanced; // Returned ware for dismantling an enhanced building
+ bool buildable_; // the player can build this himself
+ bool destructible_; // the player can destruct this himself
+ Buildcost buildcost_;
+ Buildcost return_dismantle_; // Returned wares on dismantle
+ Buildcost enhance_cost_; // cost for enhancing
+ Buildcost return_enhanced_; // Returned ware for dismantling an enhanced building
std::string helptext_script_; // The path and filename to the building's helptext script
- int32_t m_size; // size of the building
- bool m_mine;
- bool m_port;
- bool m_needs_seafaring; // This building should only be built on seafaring maps.
- DescriptionIndex m_enhancement;
- DescriptionIndex m_enhanced_from; // The building this building was enhanced from, or INVALID_INDEX
- bool m_enhanced_building; // if it is one, it is bulldozable
- BuildingHints m_hints; // hints (knowledge) for computer players
+ int32_t size_; // size of the building
+ bool mine_;
+ bool port_;
+ bool needs_seafaring_; // This building should only be built on seafaring maps.
+ DescriptionIndex enhancement_;
+ DescriptionIndex enhanced_from_; // The building this building was enhanced from, or INVALID_INDEX
+ bool enhanced_building_; // if it is one, it is bulldozable
+ BuildingHints hints_; // hints (knowledge) for computer players
// for migration, 0 is the default, meaning get_conquers() + 4
- uint32_t m_vision_range;
+ uint32_t vision_range_;
DISALLOW_COPY_AND_ASSIGN(BuildingDescr);
};
@@ -190,7 +190,7 @@
Flag & base_flag() override;
virtual uint32_t get_playercaps() const;
- virtual Coords get_position() const {return m_position;}
+ virtual Coords get_position() const {return position_;}
PositionList get_positions (const EditorGameBase &) const override;
std::string info_string(const InfoStringFormat& format);
@@ -198,8 +198,8 @@
// Return the overlay string that is displayed on the map view when enabled
// by the player.
const std::string& update_and_get_statistics_string() {
- update_statistics_string(&m_statistics_string);
- return m_statistics_string;
+ update_statistics_string(&statistics_string_);
+ return statistics_string_;
}
/// \returns the queue for a ware type or \throws WException.
@@ -238,7 +238,7 @@
* be the one being dismantled.
*/
const FormerBuildings get_former_buildings() {
- return m_old_buildings;
+ return old_buildings_;
}
void log_general_info(const EditorGameBase &) override;
@@ -249,7 +249,7 @@
/// Stores the PlayerNumber of the player who has defeated this building.
void set_defeating_player(PlayerNumber const player_number) {
- m_defeating_player = player_number;
+ defeating_player_ = player_number;
}
void add_worker(Worker &) override;
@@ -287,35 +287,35 @@
void set_seeing(bool see);
- UI::Window * m_optionswindow;
- Coords m_position;
- Flag * m_flag;
+ UI::Window * optionswindow_;
+ Coords position_;
+ Flag * flag_;
- uint32_t m_anim;
- int32_t m_animstart;
+ uint32_t anim_;
+ int32_t animstart_;
using LeaveQueue = std::vector<OPtr<Worker>>;
- LeaveQueue m_leave_queue; // FIFO queue of workers leaving the building
- uint32_t m_leave_time; // when to wake the next one from leave queue
- ObjectPointer m_leave_allow; // worker that is allowed to leave now
+ LeaveQueue leave_queue_; // FIFO queue of workers leaving the building
+ uint32_t leave_time_; // when to wake the next one from leave queue
+ ObjectPointer leave_allow_; // worker that is allowed to leave now
// The player who has defeated this building.
- PlayerNumber m_defeating_player;
+ PlayerNumber defeating_player_;
- int32_t m_priority; // base priority
- std::map<DescriptionIndex, int32_t> m_ware_priorities;
+ int32_t priority_; // base priority
+ std::map<DescriptionIndex, int32_t> ware_priorities_;
/// Whether we see our vision_range area based on workers in the building
- bool m_seeing;
+ bool seeing_;
// Signals connected for the option window
std::vector<boost::signals2::connection> options_window_connections;
// The former buildings names, with the current one in last position.
- FormerBuildings m_old_buildings;
+ FormerBuildings old_buildings_;
private:
- std::string m_statistics_string;
+ std::string statistics_string_;
};
}
=== modified file 'src/logic/map_objects/tribes/carrier.cc'
--- src/logic/map_objects/tribes/carrier.cc 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/carrier.cc 2016-02-08 18:17:36 +0000
@@ -53,7 +53,7 @@
top_state().ivar1 = 0;
- m_promised_pickup_to = NOONE;
+ promised_pickup_to_ = NOONE;
}
@@ -85,13 +85,13 @@
}
// Check for pending wares
- if (m_promised_pickup_to == NOONE)
+ if (promised_pickup_to_ == NOONE)
find_pending_ware(game);
- if (m_promised_pickup_to != NOONE) {
+ if (promised_pickup_to_ != NOONE) {
if (state.ivar1) {
state.ivar1 = 0;
- return start_task_transport(game, m_promised_pickup_to);
+ return start_task_transport(game, promised_pickup_to_);
} else {
// Short delay before we move to pick up
state.ivar1 = 1;
@@ -126,10 +126,10 @@
*/
void Carrier::road_pop(Game & game, State & /* state */)
{
- if (m_promised_pickup_to != NOONE && get_location(game)) {
+ if (promised_pickup_to_ != NOONE && get_location(game)) {
Road & road = dynamic_cast<Road&>(*get_location(game));
- Flag & flag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to));
- Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(m_promised_pickup_to ^ 1));
+ Flag & flag = road.get_flag(static_cast<Road::FlagId>(promised_pickup_to_));
+ Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(promised_pickup_to_ ^ 1));
flag.cancel_pickup(game, otherflag);
}
@@ -274,7 +274,7 @@
int32_t const ivar1 = state.ivar1;
if (!start_task_walktoflag(game, ivar1)) {
- m_promised_pickup_to = NOONE;
+ promised_pickup_to_ = NOONE;
Road & road = dynamic_cast<Road&>(*get_location(game));
Flag & flag = road.get_flag(static_cast<Road::FlagId>(ivar1));
@@ -307,7 +307,7 @@
Road & road = dynamic_cast<Road&>(*get_location(game));
Flag & flag = road.get_flag(static_cast<Road::FlagId>(state.ivar1 ^ 1));
- if (m_promised_pickup_to == (state.ivar1 ^ 1)) {
+ if (promised_pickup_to_ == (state.ivar1 ^ 1)) {
// If there's an ware we acked, we can drop ours even if the flag is
// flooded
other =
@@ -319,13 +319,13 @@
("[Carrier]: strange: acked ware from busy flag no longer "
"present.\n");
- m_promised_pickup_to = NOONE;
+ promised_pickup_to_ = NOONE;
set_animation(game, descr().get_animation("idle"));
return schedule_act(game, 20);
}
- state.ivar1 = m_promised_pickup_to;
- m_promised_pickup_to = NOONE;
+ state.ivar1 = promised_pickup_to_;
+ promised_pickup_to_ = NOONE;
}
// Drop our ware
@@ -382,7 +382,7 @@
Flag & otherflag = road.get_flag(static_cast<Road::FlagId>(state.ivar1));
- if (m_promised_pickup_to == (state.ivar1 ^ 1)) {
+ if (promised_pickup_to_ == (state.ivar1 ^ 1)) {
// All is well, we already acked an ware that we can pick up
// from this flag
return false;
@@ -392,7 +392,7 @@
("MO(%u): transport: overload exchange: flag %u is fucked up",
serial(), flag.serial());
- m_promised_pickup_to = state.ivar1 ^ 1;
+ promised_pickup_to_ = state.ivar1 ^ 1;
return false;
} else if (!start_task_walktoflag(game, state.ivar1 ^ 1, true))
start_task_waitforcapacity(game, flag); // wait one node away
@@ -411,7 +411,7 @@
State & state = top_state();
// Check if we've already acked something
- if (m_promised_pickup_to != NOONE)
+ if (promised_pickup_to_ != NOONE)
return false;
// If we are currently in a transport.
@@ -438,7 +438,7 @@
return false;
// Ack it if we haven't
- m_promised_pickup_to = flag;
+ promised_pickup_to_ = flag;
if (state.task == &taskRoad)
send_signal(game, "ware");
@@ -450,7 +450,7 @@
/**
- * Find a pending ware on one of the road's flags, ack it and set m_promised_pickup_to
+ * Find a pending ware on one of the road's flags, ack it and set promised_pickup_to_
* accordingly.
*/
void Carrier::find_pending_ware(Game & game)
@@ -458,7 +458,7 @@
Road & road = dynamic_cast<Road&>(*get_location(game));
uint32_t havewarebits = 0;
- assert(m_promised_pickup_to == NOONE);
+ assert(promised_pickup_to_ == NOONE);
if (road.get_flag(Road::FlagStart).has_pending_ware
(game, road.get_flag(Road::FlagEnd))) {
@@ -477,7 +477,7 @@
// Ack our decision
if (havewarebits == 1) {
- m_promised_pickup_to = START_FLAG;
+ promised_pickup_to_ = START_FLAG;
if
(!
road.get_flag(Road::FlagStart).ack_pickup
@@ -486,7 +486,7 @@
("Carrier::find_pending_ware: start flag is messed up");
} else if (havewarebits == 2) {
- m_promised_pickup_to = END_FLAG;
+ promised_pickup_to_ = END_FLAG;
if
(!
road.get_flag(Road::FlagEnd).ack_pickup
@@ -575,7 +575,7 @@
Worker::log_general_info(egbase);
- molog("m_promised_pickup_to = %i\n", m_promised_pickup_to);
+ molog("promised_pickup_to = %i\n", promised_pickup_to_);
}
/*
@@ -601,7 +601,7 @@
uint8_t packet_version = fr.unsigned_8();
if (packet_version == kCurrentPacketVersion) {
Carrier & carrier = get<Carrier>();
- carrier.m_promised_pickup_to = fr.signed_32();
+ carrier.promised_pickup_to_ = fr.signed_32();
} else {
throw UnhandledVersionError("Carrier", packet_version, kCurrentPacketVersion);
}
@@ -628,7 +628,7 @@
Worker::do_save(egbase, mos, fw);
fw.unsigned_8(kCurrentPacketVersion);
- fw.signed_32(m_promised_pickup_to);
+ fw.signed_32(promised_pickup_to_);
}
/**
=== modified file 'src/logic/map_objects/tribes/carrier.h'
--- src/logic/map_objects/tribes/carrier.h 2016-01-31 15:31:00 +0000
+++ src/logic/map_objects/tribes/carrier.h 2016-02-08 18:17:36 +0000
@@ -48,7 +48,7 @@
MO_DESCR(CarrierDescr)
Carrier(const CarrierDescr & carrier_descr)
- : Worker(carrier_descr), m_promised_pickup_to(NOONE)
+ : Worker(carrier_descr), promised_pickup_to_(NOONE)
{}
virtual ~Carrier() {}
@@ -86,7 +86,7 @@
static const int32_t NOONE = -1;
static const int32_t START_FLAG = 0;
static const int32_t END_FLAG = 1;
- int32_t m_promised_pickup_to;
+ int32_t promised_pickup_to_;
// saving and loading
protected:
=== modified file 'src/logic/map_objects/tribes/constructionsite.cc'
--- src/logic/map_objects/tribes/constructionsite.cc 2016-01-17 19:54:32 +0000
+++ src/logic/map_objects/tribes/constructionsite.cc 2016-02-08 18:17:36 +0000
@@ -65,8 +65,8 @@
ConstructionSite::ConstructionSite(const ConstructionSiteDescr & cs_descr) :
PartiallyFinishedBuilding (cs_descr),
-m_fetchfromflag (0),
-m_builder_idle (false)
+fetchfromflag_ (0),
+builder_idle_ (false)
{}
@@ -83,14 +83,14 @@
=======
*/
WaresQueue & ConstructionSite::waresqueue(DescriptionIndex const wi) {
- for (WaresQueue * ware : m_wares) {
+ for (WaresQueue * ware : wares_) {
if (ware->get_ware() == wi) {
return *ware;
}
}
throw wexception
("%s (%u) (building %s) has no WaresQueue for %u",
- descr().name().c_str(), serial(), m_building->name().c_str(), wi);
+ descr().name().c_str(), serial(), building_->name().c_str(), wi);
}
@@ -102,7 +102,7 @@
void ConstructionSite::set_building(const BuildingDescr & building_descr) {
PartiallyFinishedBuilding::set_building(building_descr);
- m_info.becomes = &building_descr;
+ info_.becomes = &building_descr;
}
/*
@@ -115,31 +115,31 @@
PartiallyFinishedBuilding::init(egbase);
const std::map<DescriptionIndex, uint8_t> * buildcost;
- if (!m_old_buildings.empty()) {
+ if (!old_buildings_.empty()) {
// Enhancement
- DescriptionIndex was_index = m_old_buildings.back();
+ DescriptionIndex was_index = old_buildings_.back();
const BuildingDescr* was_descr = owner().tribe().get_building_descr(was_index);
- m_info.was = was_descr;
- buildcost = &m_building->enhancement_cost();
+ info_.was = was_descr;
+ buildcost = &building_->enhancement_cost();
} else {
- buildcost = &m_building->buildcost();
+ buildcost = &building_->buildcost();
}
// TODO(unknown): figure out whether planing is necessary
// initialize the wares queues
size_t const buildcost_size = buildcost->size();
- m_wares.resize(buildcost_size);
+ wares_.resize(buildcost_size);
std::map<DescriptionIndex, uint8_t>::const_iterator it = buildcost->begin();
for (size_t i = 0; i < buildcost_size; ++i, ++it) {
WaresQueue & wq =
- *(m_wares[i] = new WaresQueue(*this, it->first, it->second));
+ *(wares_[i] = new WaresQueue(*this, it->first, it->second));
wq.set_callback(ConstructionSite::wares_queue_callback, this);
wq.set_consume_interval(CONSTRUCTIONSITE_STEP_TIME);
- m_work_steps += it->second;
+ work_steps_ += it->second;
}
}
@@ -154,19 +154,19 @@
{
PartiallyFinishedBuilding::cleanup(egbase);
- if (m_work_steps <= m_work_completed) {
+ if (work_steps_ <= work_completed_) {
// Put the real building in place
- DescriptionIndex becomes_idx = owner().tribe().building_index(m_building->name());
- m_old_buildings.push_back(becomes_idx);
+ DescriptionIndex becomes_idx = owner().tribe().building_index(building_->name());
+ old_buildings_.push_back(becomes_idx);
Building & b =
- m_building->create(egbase, owner(), m_position, false, false, m_old_buildings);
- if (Worker * const builder = m_builder.get(egbase)) {
+ building_->create(egbase, owner(), position_, false, false, old_buildings_);
+ if (Worker * const builder = builder_.get(egbase)) {
builder->reset_tasks(dynamic_cast<Game&>(egbase));
builder->set_location(&b);
}
// Open the new building window if needed
- if (m_optionswindow) {
- Point window_position = m_optionswindow->get_pos();
+ if (optionswindow_) {
+ Point window_position = optionswindow_->get_pos();
hide_options();
InteractiveGameBase & igbase =
dynamic_cast<InteractiveGameBase&>(*egbase.get_ibase());
@@ -183,10 +183,10 @@
*/
bool ConstructionSite::burn_on_destroy()
{
- if (m_work_completed >= m_work_steps)
+ if (work_completed_ >= work_steps_)
return false; // completed, so don't burn
- return m_work_completed || !m_old_buildings.empty();
+ return work_completed_ || !old_buildings_.empty();
}
/*
@@ -196,9 +196,9 @@
*/
bool ConstructionSite::fetch_from_flag(Game & game)
{
- ++m_fetchfromflag;
+ ++fetchfromflag_;
- if (Worker * const builder = m_builder.get(game))
+ if (Worker * const builder = builder_.get(game))
builder->update_task_buildingwork(game);
return true;
@@ -211,7 +211,7 @@
===============
*/
bool ConstructionSite::get_building_work(Game & game, Worker & worker, bool) {
- if (&worker != m_builder.get(game)) {
+ if (&worker != builder_.get(game)) {
// Not our construction worker; e.g. a miner leaving a mine
// that is supposed to be enhanced. Make him return to a warehouse
worker.pop_task(game);
@@ -219,40 +219,40 @@
return true;
}
- if (!m_work_steps) // Happens for building without buildcost.
+ if (!work_steps_) // Happens for building without buildcost.
schedule_destroy(game); // Complete the building immediately.
// Check if one step has completed
- if (m_working) {
- if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) < 0) {
+ if (working_) {
+ if (static_cast<int32_t>(game.get_gametime() - work_steptime_) < 0) {
worker.start_task_idle
(game,
worker.descr().get_animation("work"),
- m_work_steptime - game.get_gametime());
- m_builder_idle = false;
+ work_steptime_ - game.get_gametime());
+ builder_idle_ = false;
return true;
} else {
//TODO(fweber): cause "construction sounds" to be played -
//perhaps dependent on kind of construction?
- ++m_work_completed;
- if (m_work_completed >= m_work_steps)
+ ++work_completed_;
+ if (work_completed_ >= work_steps_)
schedule_destroy(game);
- m_working = false;
+ working_ = false;
}
}
// Fetch wares from flag
- if (m_fetchfromflag) {
- --m_fetchfromflag;
- m_builder_idle = false;
+ if (fetchfromflag_) {
+ --fetchfromflag_;
+ builder_idle_ = false;
worker.start_task_fetchfromflag(game);
return true;
}
// Drop all the wares that are too much out to the flag.
- for (WaresQueue * iqueue: m_wares) {
+ for (WaresQueue * iqueue: wares_) {
WaresQueue * queue = iqueue;
if (queue->get_filled() > queue->get_max_fill()) {
queue->set_filled(queue->get_filled() - 1);
@@ -265,10 +265,10 @@
}
// Check if we've got wares to consume
- if (m_work_completed < m_work_steps)
+ if (work_completed_ < work_steps_)
{
- for (uint32_t i = 0; i < m_wares.size(); ++i) {
- WaresQueue & wq = *m_wares[i];
+ for (uint32_t i = 0; i < wares_.size(); ++i) {
+ WaresQueue & wq = *wares_[i];
if (!wq.get_filled())
continue;
@@ -279,19 +279,19 @@
//update consumption statistic
owner().ware_consumed(wq.get_ware(), 1);
- m_working = true;
- m_work_steptime = game.get_gametime() + CONSTRUCTIONSITE_STEP_TIME;
+ working_ = true;
+ work_steptime_ = game.get_gametime() + CONSTRUCTIONSITE_STEP_TIME;
worker.start_task_idle
(game, worker.descr().get_animation("work"), CONSTRUCTIONSITE_STEP_TIME);
- m_builder_idle = false;
+ builder_idle_ = false;
return true;
}
}
// The only work we have got for you, is to run around to look cute ;)
- if (!m_builder_idle) {
+ if (!builder_idle_) {
worker.set_animation(game, worker.descr().get_animation("idle"));
- m_builder_idle = true;
+ builder_idle_ = true;
}
worker.schedule_act(game, 2000);
return true;
@@ -308,8 +308,8 @@
{
ConstructionSite & cs = *static_cast<ConstructionSite *>(data);
- if (!cs.m_working)
- if (Worker * const builder = cs.m_builder.get(game))
+ if (!cs.working_)
+ if (Worker * const builder = cs.builder_.get(game))
builder->update_task_buildingwork(game);
}
@@ -323,27 +323,27 @@
(const EditorGameBase & game, RenderTarget & dst, const FCoords& coords, const Point& pos)
{
const uint32_t gametime = game.get_gametime();
- uint32_t tanim = gametime - m_animstart;
+ uint32_t tanim = gametime - animstart_;
- if (coords != m_position)
+ if (coords != position_)
return; // draw big buildings only once
// Draw the construction site marker
const RGBColor& player_color = get_owner()->get_playercolor();
- dst.blit_animation(pos, m_anim, tanim, player_color);
+ dst.blit_animation(pos, anim_, tanim, player_color);
// Draw the partially finished building
static_assert(0 <= CONSTRUCTIONSITE_STEP_TIME, "assert(0 <= CONSTRUCTIONSITE_STEP_TIME) failed.");
- m_info.totaltime = CONSTRUCTIONSITE_STEP_TIME * m_work_steps;
- m_info.completedtime = CONSTRUCTIONSITE_STEP_TIME * m_work_completed;
+ info_.totaltime = CONSTRUCTIONSITE_STEP_TIME * work_steps_;
+ info_.completedtime = CONSTRUCTIONSITE_STEP_TIME * work_completed_;
- if (m_working) {
+ if (working_) {
assert
- (m_work_steptime
+ (work_steptime_
<=
- m_info.completedtime + CONSTRUCTIONSITE_STEP_TIME + gametime);
- m_info.completedtime += CONSTRUCTIONSITE_STEP_TIME + gametime - m_work_steptime;
+ info_.completedtime + CONSTRUCTIONSITE_STEP_TIME + gametime);
+ info_.completedtime += CONSTRUCTIONSITE_STEP_TIME + gametime - work_steptime_;
}
uint32_t anim_idx;
@@ -359,16 +359,16 @@
}
const Animation& anim = g_gr->animations().get_animation(anim_idx);
const size_t nr_frames = anim.nr_frames();
- cur_frame = m_info.totaltime ? m_info.completedtime * nr_frames / m_info.totaltime : 0;
+ cur_frame = info_.totaltime ? info_.completedtime * nr_frames / info_.totaltime : 0;
// Redefine tanim
tanim = cur_frame * FRAME_LENGTH;
const uint16_t w = anim.width();
const uint16_t h = anim.height();
- uint32_t lines = h * m_info.completedtime * nr_frames;
- if (m_info.totaltime)
- lines /= m_info.totaltime;
+ uint32_t lines = h * info_.completedtime * nr_frames;
+ if (info_.totaltime)
+ lines /= info_.totaltime;
assert(h * cur_frame <= lines);
lines -= h * cur_frame; // This won't work if pictures have various sizes.
@@ -376,8 +376,8 @@
// draw the prev pic from top to where next image will be drawing
dst.blit_animation(pos, anim_idx, tanim - FRAME_LENGTH, player_color,
Rect(Point(0, 0), w, h - lines));
- } else if (!m_old_buildings.empty()) {
- DescriptionIndex prev_idx = m_old_buildings.back();
+ } else if (!old_buildings_.empty()) {
+ DescriptionIndex prev_idx = old_buildings_.back();
const BuildingDescr* prev_building = owner().tribe().get_building_descr(prev_idx);
// Is the first picture but there was another building here before,
// get its most fitting picture and draw it instead.
=== modified file 'src/logic/map_objects/tribes/constructionsite.h'
--- src/logic/map_objects/tribes/constructionsite.h 2016-01-31 15:31:00 +0000
+++ src/logic/map_objects/tribes/constructionsite.h 2016-02-08 18:17:36 +0000
@@ -80,12 +80,12 @@
public:
ConstructionSite(const ConstructionSiteDescr & descr);
- const ConstructionsiteInformation & get_info() {return m_info;}
+ const ConstructionsiteInformation & get_info() {return info_;}
WaresQueue & waresqueue(DescriptionIndex) override;
void set_building(const BuildingDescr &) override;
- const BuildingDescr & building() const {return *m_building;}
+ const BuildingDescr & building() const {return *building_;}
void init (EditorGameBase &) override;
void cleanup(EditorGameBase &) override;
@@ -107,10 +107,10 @@
void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override;
private:
- int32_t m_fetchfromflag; // # of wares to fetch from flag
+ int32_t fetchfromflag_; // # of wares to fetch from flag
- bool m_builder_idle; // used to determine whether the builder is idle
- ConstructionsiteInformation m_info; // asked for by player point of view for the gameview
+ bool builder_idle_; // used to determine whether the builder is idle
+ ConstructionsiteInformation info_; // asked for by player point of view for the gameview
};
}
=== modified file 'src/logic/map_objects/tribes/dismantlesite.cc'
--- src/logic/map_objects/tribes/dismantlesite.cc 2016-01-17 19:54:32 +0000
+++ src/logic/map_objects/tribes/dismantlesite.cc 2016-02-08 18:17:36 +0000
@@ -68,14 +68,14 @@
:
PartiallyFinishedBuilding(gdescr)
{
- m_position = c;
+ position_ = c;
set_owner(&plr);
assert(!former_buildings.empty());
for (DescriptionIndex former_idx : former_buildings) {
- m_old_buildings.push_back(former_idx);
+ old_buildings_.push_back(former_idx);
}
- const BuildingDescr* cur_descr = owner().tribe().get_building_descr(m_old_buildings.back());
+ const BuildingDescr* cur_descr = owner().tribe().get_building_descr(old_buildings_.back());
set_building(*cur_descr);
if (loading) {
@@ -109,14 +109,14 @@
count_returned_wares(this, wares);
std::map<DescriptionIndex, uint8_t>::const_iterator it = wares.begin();
- m_wares.resize(wares.size());
+ wares_.resize(wares.size());
for (size_t i = 0; i < wares.size(); ++i, ++it) {
WaresQueue & wq =
- *(m_wares[i] = new WaresQueue(*this, it->first, it->second));
+ *(wares_[i] = new WaresQueue(*this, it->first, it->second));
wq.set_filled(it->second);
- m_work_steps += it->second;
+ work_steps_ += it->second;
}
}
@@ -154,7 +154,7 @@
*/
bool DismantleSite::burn_on_destroy()
{
- if (m_work_completed >= m_work_steps)
+ if (work_completed_ >= work_steps_)
return false; // completed, so don't burn
return true;
@@ -166,7 +166,7 @@
===============
*/
bool DismantleSite::get_building_work(Game & game, Worker & worker, bool) {
- if (&worker != m_builder.get(game)) {
+ if (&worker != builder_.get(game)) {
// Not our construction worker; e.g. a miner leaving a mine
// that is supposed to be enhanced. Make him return to a warehouse
worker.pop_task(game);
@@ -174,15 +174,15 @@
return true;
}
- if (!m_work_steps) // Happens for building without buildcost.
+ if (!work_steps_) // Happens for building without buildcost.
schedule_destroy(game); // Complete the building immediately.
// Check if one step has completed
- if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 && m_working) {
- ++m_work_completed;
+ if (static_cast<int32_t>(game.get_gametime() - work_steptime_) >= 0 && working_) {
+ ++work_completed_;
- for (uint32_t i = 0; i < m_wares.size(); ++i) {
- WaresQueue & wq = *m_wares[i];
+ for (uint32_t i = 0; i < wares_.size(); ++i) {
+ WaresQueue & wq = *wares_[i];
if (!wq.get_filled())
continue;
@@ -198,12 +198,12 @@
ware.init(game);
worker.start_task_dropoff(game, ware);
- m_working = false;
+ working_ = false;
return true;
}
}
- if (m_work_completed >= m_work_steps) {
+ if (work_completed_ >= work_steps_) {
schedule_destroy(game);
worker.pop_task(game);
@@ -214,12 +214,12 @@
worker.descr().get_right_walk_anims(false),
true);
worker.set_location(nullptr);
- } else if (!m_working) {
- m_work_steptime = game.get_gametime() + DISMANTLESITE_STEP_TIME;
+ } else if (!working_) {
+ work_steptime_ = game.get_gametime() + DISMANTLESITE_STEP_TIME;
worker.start_task_idle
(game, worker.descr().get_animation("work"), DISMANTLESITE_STEP_TIME);
- m_working = true;
+ working_ = true;
}
return true;
}
@@ -233,29 +233,29 @@
(const EditorGameBase& game, RenderTarget& dst, const FCoords& coords, const Point& pos)
{
const uint32_t gametime = game.get_gametime();
- uint32_t tanim = gametime - m_animstart;
+ uint32_t tanim = gametime - animstart_;
- if (coords != m_position)
+ if (coords != position_)
return; // draw big buildings only once
const RGBColor& player_color = get_owner()->get_playercolor();
// Draw the construction site marker
- dst.blit_animation(pos, m_anim, tanim, player_color);
+ dst.blit_animation(pos, anim_, tanim, player_color);
// Draw the partially dismantled building
static_assert(0 <= DISMANTLESITE_STEP_TIME, "assert(0 <= DISMANTLESITE_STEP_TIME) failed.");
- uint32_t total_time = DISMANTLESITE_STEP_TIME * m_work_steps;
- uint32_t completed_time = DISMANTLESITE_STEP_TIME * m_work_completed;
+ uint32_t total_time = DISMANTLESITE_STEP_TIME * work_steps_;
+ uint32_t completed_time = DISMANTLESITE_STEP_TIME * work_completed_;
- if (m_working)
- completed_time += DISMANTLESITE_STEP_TIME + gametime - m_work_steptime;
+ if (working_)
+ completed_time += DISMANTLESITE_STEP_TIME + gametime - work_steptime_;
uint32_t anim_idx;
try {
- anim_idx = m_building->get_animation("unoccupied");
+ anim_idx = building_->get_animation("unoccupied");
} catch (MapObjectDescr::AnimationNonexistent &) {
- anim_idx = m_building->get_animation("idle");
+ anim_idx = building_->get_animation("idle");
}
const Animation& anim = g_gr->animations().get_animation(anim_idx);
const uint16_t w = anim.width();
=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
--- src/logic/map_objects/tribes/militarysite.cc 2016-01-31 15:31:00 +0000
+++ src/logic/map_objects/tribes/militarysite.cc 2016-02-08 18:17:36 +0000
@@ -48,26 +48,26 @@
:
BuildingDescr
(init_descname, MapObjectType::MILITARYSITE, table, egbase),
- m_conquer_radius (0),
- m_num_soldiers (0),
- m_heal_per_second (0)
+ conquer_radius_ (0),
+ num_soldiers_ (0),
+ heal_per_second_ (0)
{
i18n::Textdomain td("tribes");
- m_conquer_radius = table.get_int("conquers");
- m_num_soldiers = table.get_int("max_soldiers");
- m_heal_per_second = table.get_int("heal_per_second");
+ conquer_radius_ = table.get_int("conquers");
+ num_soldiers_ = table.get_int("max_soldiers");
+ heal_per_second_ = table.get_int("heal_per_second");
- if (m_conquer_radius > 0)
- m_workarea_info[m_conquer_radius].insert(descname() + " conquer");
- m_prefers_heroes_at_start = table.get_bool("prefer_heroes");
+ if (conquer_radius_ > 0)
+ workarea_info_[conquer_radius_].insert(descname() + " conquer");
+ prefers_heroes_at_start_ = table.get_bool("prefer_heroes");
std::unique_ptr<LuaTable> items_table = table.get_table("messages");
- m_occupied_str = _(items_table->get_string("occupied"));
- m_aggressor_str = _(items_table->get_string("aggressor"));
- m_attack_str = _(items_table->get_string("attack"));
- m_defeated_enemy_str = _(items_table->get_string("defeated_enemy"));
- m_defeated_you_str = _(items_table->get_string("defeated_you"));
+ occupied_str_ = _(items_table->get_string("occupied"));
+ aggressor_str_ = _(items_table->get_string("aggressor"));
+ attack_str_ = _(items_table->get_string("attack"));
+ defeated_enemy_str_ = _(items_table->get_string("defeated_enemy"));
+ defeated_you_str_ = _(items_table->get_string("defeated_you"));
}
/**
@@ -90,21 +90,21 @@
MilitarySite::MilitarySite(const MilitarySiteDescr & ms_descr) :
Building(ms_descr),
-m_didconquer (false),
-m_capacity (ms_descr.get_max_number_of_soldiers()),
-m_nexthealtime(0),
-m_soldier_preference(ms_descr.m_prefers_heroes_at_start ? kPrefersHeroes : kPrefersRookies),
-m_soldier_upgrade_try(false),
-m_doing_upgrade_request(false)
+didconquer_ (false),
+capacity_ (ms_descr.get_max_number_of_soldiers()),
+nexthealtime_(0),
+soldier_preference_(ms_descr.prefers_heroes_at_start_ ? kPrefersHeroes : kPrefersRookies),
+soldier_upgrade_try_(false),
+doing_upgrade_request_(false)
{
- m_next_swap_soldiers_time = 0;
+ next_swap_soldiers_time_ = 0;
}
MilitarySite::~MilitarySite()
{
- assert(!m_normal_soldier_request);
- assert(!m_upgrade_soldier_request);
+ assert(!normal_soldier_request_);
+ assert(!upgrade_soldier_request_);
}
@@ -120,25 +120,25 @@
uint32_t stationed = stationed_soldiers().size();
if (present == stationed) {
- if (m_capacity > stationed) {
+ if (capacity_ > stationed) {
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
/** TRANSLATORS: %2% is the maximum number of soldier slots in the building */
*s += (boost::format(ngettext("%1% soldier (+%2%)",
"%1% soldiers (+%2%)",
stationed))
- % stationed % (m_capacity - stationed)).str();
+ % stationed % (capacity_ - stationed)).str();
} else {
*s += (boost::format(ngettext("%u soldier", "%u soldiers", stationed))
% stationed).str();
}
} else {
- if (m_capacity > stationed) {
+ if (capacity_ > stationed) {
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
/** TRANSLATORS: %2% are currently open soldier slots in the building */
/** TRANSLATORS: %3% is the maximum number of soldier slots in the building */
*s =
(boost::format(ngettext("%1%(+%2%) soldier (+%3%)", "%1%(+%2%) soldiers (+%3%)", stationed))
- % present % (stationed - present) % (m_capacity - stationed)).str();
+ % present % (stationed - present) % (capacity_ - stationed)).str();
} else {
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
/** TRANSLATORS: %2% are currently open soldier slots in the building */
@@ -166,7 +166,7 @@
update_soldier_request();
// schedule the first healing
- m_nexthealtime = egbase.get_gametime() + 1000;
+ nexthealtime_ = egbase.get_gametime() + 1000;
if (game)
schedule_act(*game, 1000);
}
@@ -182,10 +182,10 @@
{
Building::set_economy(e);
- if (m_normal_soldier_request && e)
- m_normal_soldier_request->set_economy(e);
- if (m_upgrade_soldier_request && e)
- m_upgrade_soldier_request->set_economy(e);
+ if (normal_soldier_request_ && e)
+ normal_soldier_request_->set_economy(e);
+ if (upgrade_soldier_request_ && e)
+ upgrade_soldier_request_->set_economy(e);
}
/**
@@ -196,25 +196,25 @@
void MilitarySite::cleanup(EditorGameBase & egbase)
{
// unconquer land
- if (m_didconquer)
+ if (didconquer_)
egbase.unconquer_area
(PlayerArea<Area<FCoords> >
(owner().player_number(),
Area<FCoords>
(egbase.map().get_fcoords(get_position()), descr().get_conquers())),
- m_defeating_player);
+ defeating_player_);
Building::cleanup(egbase);
// Evict soldiers to get rid of requests
- while (m_capacity > 0) {
+ while (capacity_ > 0) {
update_soldier_request();
- --m_capacity;
+ --capacity_;
}
update_soldier_request();
- m_normal_soldier_request.reset();
- m_upgrade_soldier_request.reset();
+ normal_soldier_request_.reset();
+ upgrade_soldier_request_.reset();
}
@@ -246,7 +246,7 @@
return incorporate_upgraded_soldier(egbase, s) ? 0 : -1;
}
- if (!m_didconquer) {
+ if (!didconquer_) {
conquer_area(egbase);
// Building is now occupied - idle animation should be played
start_animation(egbase, descr().get_animation("idle"));
@@ -258,7 +258,7 @@
descr().descname(),
descr().icon_filename(),
descr().descname(),
- descr().m_occupied_str,
+ descr().occupied_str_,
true);
}
}
@@ -285,7 +285,7 @@
MilitarySite::find_least_suited_soldier()
{
const std::vector<Soldier *> present = present_soldiers();
- const int32_t multiplier = kPrefersHeroes == m_soldier_preference ? -1 : 1;
+ const int32_t multiplier = kPrefersHeroes == soldier_preference_ ? -1 : 1;
int worst_soldier_level = INT_MIN;
Soldier * worst_soldier = nullptr;
for (Soldier* sld : present) {
@@ -329,12 +329,12 @@
{
int32_t old_level = kickoutCandidate->get_level(atrTotal);
int32_t new_level = newguy->get_level(atrTotal);
- if (kPrefersHeroes == m_soldier_preference && old_level >= new_level)
+ if (kPrefersHeroes == soldier_preference_ && old_level >= new_level)
{
return false;
}
else
- if (kPrefersRookies == m_soldier_preference && old_level <= new_level)
+ if (kPrefersRookies == soldier_preference_ && old_level <= new_level)
{
return false;
}
@@ -361,7 +361,7 @@
MilitarySite::incorporate_upgraded_soldier(EditorGameBase & egbase, Soldier & s)
{
// Call to drop_least routine has side effects: it tries to drop a soldier. Order is important!
- if (stationed_soldiers().size() < m_capacity || drop_least_suited_soldier(true, &s))
+ if (stationed_soldiers().size() < capacity_ || drop_least_suited_soldier(true, &s))
{
Game & game = dynamic_cast<Game&>(egbase);
s.set_location(this);
@@ -400,25 +400,25 @@
std::vector<Soldier *> present = present_soldiers();
uint32_t const stationed = stationed_soldiers().size();
- if (stationed < m_capacity) {
- if (!m_normal_soldier_request) {
- m_normal_soldier_request.reset
+ if (stationed < capacity_) {
+ if (!normal_soldier_request_) {
+ normal_soldier_request_.reset
(new Request
(*this,
owner().tribe().soldier(),
MilitarySite::request_soldier_callback,
wwWORKER));
- m_normal_soldier_request->set_requirements (m_soldier_requirements);
+ normal_soldier_request_->set_requirements (soldier_requirements_);
}
- m_normal_soldier_request->set_count(m_capacity - stationed);
+ normal_soldier_request_->set_count(capacity_ - stationed);
} else {
- m_normal_soldier_request.reset();
+ normal_soldier_request_.reset();
}
- if (m_capacity < present.size()) {
+ if (capacity_ < present.size()) {
Game & game = dynamic_cast<Game&>(owner().egbase());
- for (uint32_t i = 0; i < present.size() - m_capacity; ++i) {
+ for (uint32_t i = 0; i < present.size() - capacity_; ++i) {
Soldier & soldier = *present[i];
soldier.reset_tasks(game);
soldier.start_task_leavebuilding(game, true);
@@ -440,17 +440,17 @@
void MilitarySite::update_upgrade_soldier_request()
{
bool reqch = update_upgrade_requirements();
- if (!m_soldier_upgrade_try)
+ if (!soldier_upgrade_try_)
return;
bool do_rebuild_request = reqch;
- if (m_upgrade_soldier_request)
+ if (upgrade_soldier_request_)
{
- if (!m_upgrade_soldier_request->is_open())
+ if (!upgrade_soldier_request_->is_open())
// If a replacement is already walking this way, let's not change our minds.
do_rebuild_request = false;
- if (0 == m_upgrade_soldier_request->get_count())
+ if (0 == upgrade_soldier_request_->get_count())
do_rebuild_request = true;
}
else
@@ -458,15 +458,15 @@
if (do_rebuild_request)
{
- m_upgrade_soldier_request.reset
+ upgrade_soldier_request_.reset
(new Request
(*this,
owner().tribe().soldier(),
MilitarySite::request_soldier_callback,
wwWORKER));
- m_upgrade_soldier_request->set_requirements(m_soldier_upgrade_requirements);
- m_upgrade_soldier_request->set_count(1);
+ upgrade_soldier_request_->set_requirements(soldier_upgrade_requirements_);
+ upgrade_soldier_request_->set_count(1);
}
}
@@ -489,27 +489,27 @@
const uint32_t capacity = soldier_capacity();
const uint32_t stationed = stationed_soldiers().size();
- if (m_doing_upgrade_request)
+ if (doing_upgrade_request_)
{
- if (incd && m_upgrade_soldier_request) // update requests always ask for one soldier at time!
+ if (incd && upgrade_soldier_request_) // update requests always ask for one soldier at time!
{
- m_upgrade_soldier_request.reset();
+ upgrade_soldier_request_.reset();
}
if (capacity > stationed)
{
// Somebody is killing my soldiers in the middle of upgrade
// or I have kicked out his predecessor already.
- if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open() ||
- 0 == m_upgrade_soldier_request->get_count())) {
+ if (upgrade_soldier_request_ && (upgrade_soldier_request_->is_open() ||
+ 0 == upgrade_soldier_request_->get_count())) {
// Economy was not able to find the soldiers I need.
// I can safely drop the upgrade request and go to fill mode.
- m_upgrade_soldier_request.reset();
+ upgrade_soldier_request_.reset();
}
- if (! m_upgrade_soldier_request)
+ if (! upgrade_soldier_request_)
{
//phoo -- I can safely request new soldiers.
- m_doing_upgrade_request = false;
+ doing_upgrade_request_ = false;
update_normal_soldier_request();
}
// else -- ohno please help me! Player is in trouble -- evil grin
@@ -522,9 +522,9 @@
else // capacity == stationed size
{
if
- (m_upgrade_soldier_request
- && (!(m_upgrade_soldier_request->is_open()))
- && 1 == m_upgrade_soldier_request->get_count()
+ (upgrade_soldier_request_
+ && (!(upgrade_soldier_request_->is_open()))
+ && 1 == upgrade_soldier_request_->get_count()
&& (!incd))
{
drop_least_suited_soldier(false, nullptr);
@@ -537,14 +537,14 @@
}
else // not doing upgrade request
{
- if ((capacity != stationed) || (m_normal_soldier_request))
+ if ((capacity != stationed) || (normal_soldier_request_))
update_normal_soldier_request();
- if ((capacity == stationed) && (! m_normal_soldier_request))
+ if ((capacity == stationed) && (! normal_soldier_request_))
{
if (present_soldiers().size() == capacity)
{
- m_doing_upgrade_request = true;
+ doing_upgrade_request_ = true;
update_upgrade_soldier_request();
}
// Note -- if there are non-present stationed soldiers, nothing gets
@@ -570,7 +570,7 @@
Building::act(game, data);
const int32_t timeofgame = game.get_gametime();
- if (m_normal_soldier_request && m_upgrade_soldier_request)
+ if (normal_soldier_request_ && upgrade_soldier_request_)
{
throw wexception("MilitarySite::act: Two soldier requests are ongoing -- should never happen!\n");
}
@@ -580,13 +580,13 @@
// to keep the game lightweight.
//TODO(unknown): I would need two new callbacks, to get rid ot this polling.
- if (timeofgame > m_next_swap_soldiers_time)
+ if (timeofgame > next_swap_soldiers_time_)
{
- m_next_swap_soldiers_time = timeofgame + (m_soldier_upgrade_try ? 20000 : 100000);
+ next_swap_soldiers_time_ = timeofgame + (soldier_upgrade_try_ ? 20000 : 100000);
update_soldier_request();
}
- if (m_nexthealtime <= timeofgame) {
+ if (nexthealtime_ <= timeofgame) {
uint32_t total_heal = descr().get_heal_per_second();
std::vector<Soldier *> soldiers = present_soldiers();
uint32_t max_total_level = 0;
@@ -614,7 +614,7 @@
soldier_to_heal->heal(total_heal);
}
- m_nexthealtime = timeofgame + 1000;
+ nexthealtime_ = timeofgame + 1000;
schedule_act(game, 1000);
}
}
@@ -644,7 +644,7 @@
{
if (upcast(Soldier, soldier, &worker)) {
// Evict soldiers that have returned home if the capacity is too low
- if (m_capacity < present_soldiers().size()) {
+ if (capacity_ < present_soldiers().size()) {
worker.reset_tasks(game);
worker.start_task_leavebuilding(game, true);
return true;
@@ -724,14 +724,14 @@
}
uint32_t MilitarySite::soldier_capacity() const
{
- return m_capacity;
+ return capacity_;
}
void MilitarySite::set_soldier_capacity(uint32_t const capacity) {
assert(min_soldier_capacity() <= capacity);
assert (capacity <= max_soldier_capacity());
- assert(m_capacity != capacity);
- m_capacity = capacity;
+ assert(capacity_ != capacity);
+ capacity_ = capacity;
update_soldier_request();
}
@@ -758,19 +758,19 @@
void MilitarySite::conquer_area(EditorGameBase & egbase) {
- assert(!m_didconquer);
+ assert(!didconquer_);
egbase.conquer_area
(PlayerArea<Area<FCoords> >
(owner().player_number(),
Area<FCoords>
(egbase.map().get_fcoords(get_position()), descr().get_conquers())));
- m_didconquer = true;
+ didconquer_ = true;
}
bool MilitarySite::can_attack()
{
- return m_didconquer;
+ return didconquer_;
}
void MilitarySite::aggressor(Soldier & enemy)
@@ -804,7 +804,7 @@
sj.soldier = temp_soldier;
sj.enemy = &enemy;
sj.stayhome = false;
- m_soldierjobs.push_back(sj);
+ soldierjobs_.push_back(sj);
temp_soldier->update_task_buildingwork(game);
return;
}
@@ -851,7 +851,7 @@
sj.soldier = defender;
sj.enemy = &enemy;
sj.stayhome = true;
- m_soldierjobs.push_back(sj);
+ soldierjobs_.push_back(sj);
defender->update_task_buildingwork(game);
@@ -871,7 +871,7 @@
pgettext("building", "Lost!"),
descr().icon_filename(),
_("Militarysite lost!"),
- descr().m_defeated_enemy_str,
+ descr().defeated_enemy_str_,
false);
}
@@ -891,7 +891,7 @@
// In fact we do not conquer it, but place a new building of same type at
// the old location.
- Building::FormerBuildings former_buildings = m_old_buildings;
+ Building::FormerBuildings former_buildings = old_buildings_;
// The enemy conquers the building
// In fact we do not conquer it, but place a new building of same type at
@@ -916,7 +916,7 @@
_("Enemy Defeated!"),
newsite->descr().icon_filename(),
_("Enemy at site defeated!"),
- newsite->descr().m_defeated_you_str,
+ newsite->descr().defeated_you_str_,
true);
return false;
@@ -952,7 +952,7 @@
(this != militarysite &&
&owner () == &militarysite->owner() &&
get_size() <= militarysite->get_size() &&
- militarysite->m_didconquer)
+ militarysite->didconquer_)
return true;
return false;
}
@@ -969,7 +969,7 @@
pgettext("building", "Attack!"),
descr().icon_filename(),
_("You are under attack"),
- discovered ? descr().m_aggressor_str : descr().m_attack_str,
+ discovered ? descr().aggressor_str_ : descr().attack_str_,
false,
60 * 1000, 5);
}
@@ -982,7 +982,7 @@
*/
void MilitarySite::set_requirements (const Requirements & r)
{
- m_soldier_requirements = r;
+ soldier_requirements_ = r;
}
/*
@@ -992,7 +992,7 @@
*/
void MilitarySite::clear_requirements ()
{
- m_soldier_requirements = Requirements();
+ soldier_requirements_ = Requirements();
}
void MilitarySite::send_attacker
@@ -1007,7 +1007,7 @@
sj.soldier = &soldier;
sj.enemy = ⌖
sj.stayhome = false;
- m_soldierjobs.push_back(sj);
+ soldierjobs_.push_back(sj);
soldier.update_task_buildingwork
(dynamic_cast<Game&>(owner().egbase()));
@@ -1016,7 +1016,7 @@
bool MilitarySite::has_soldier_job(Soldier & soldier)
{
- for (const SoldierJob& temp_job : m_soldierjobs) {
+ for (const SoldierJob& temp_job : soldierjobs_) {
if (temp_job.soldier == &soldier) {
return true;
}
@@ -1032,14 +1032,14 @@
MapObject * MilitarySite::pop_soldier_job
(Soldier * const soldier, bool * const stayhome)
{
- for (std::vector<SoldierJob>::iterator job_iter = m_soldierjobs.begin();
- job_iter != m_soldierjobs.end(); ++job_iter)
+ for (std::vector<SoldierJob>::iterator job_iter = soldierjobs_.begin();
+ job_iter != soldierjobs_.end(); ++job_iter)
{
if (job_iter->soldier == soldier) {
MapObject * const enemy = job_iter->enemy.get(owner().egbase());
if (stayhome)
*stayhome = job_iter->stayhome;
- m_soldierjobs.erase(job_iter);
+ soldierjobs_.erase(job_iter);
return enemy;
}
}
@@ -1058,13 +1058,13 @@
bool
MilitarySite::update_upgrade_requirements()
{
- int32_t soldier_upgrade_required_min = m_soldier_upgrade_requirements.get_min();
- int32_t soldier_upgrade_required_max = m_soldier_upgrade_requirements.get_max();
+ int32_t soldier_upgrade_required_min = soldier_upgrade_requirements_.get_min();
+ int32_t soldier_upgrade_required_max = soldier_upgrade_requirements_.get_max();
- if (kPrefersHeroes != m_soldier_preference && kPrefersRookies != m_soldier_preference)
+ if (kPrefersHeroes != soldier_preference_ && kPrefersRookies != soldier_preference_)
{
- log("MilitarySite::swapSoldiers: error: Unknown player preference %d.\n", m_soldier_preference);
- m_soldier_upgrade_try = false;
+ log("MilitarySite::swapSoldiers: error: Unknown player preference %d.\n", soldier_preference_);
+ soldier_upgrade_try_ = false;
return false;
}
@@ -1078,29 +1078,29 @@
// Micro-optimization: I assume that the majority of military sites have only level-zero
// soldiers and prefer rookies. Handle them separately.
- m_soldier_upgrade_try = true;
- if (kPrefersRookies == m_soldier_preference) {
+ soldier_upgrade_try_ = true;
+ if (kPrefersRookies == soldier_preference_) {
if (0 == wg_level)
{
- m_soldier_upgrade_try = false;
+ soldier_upgrade_try_ = false;
return false;
}
}
// Now I actually build the new requirements.
- int32_t reqmin = kPrefersHeroes == m_soldier_preference ? 1 + wg_level : 0;
- int32_t reqmax = kPrefersHeroes == m_soldier_preference ? SHRT_MAX : wg_level - 1;
+ int32_t reqmin = kPrefersHeroes == soldier_preference_ ? 1 + wg_level : 0;
+ int32_t reqmax = kPrefersHeroes == soldier_preference_ ? SHRT_MAX : wg_level - 1;
bool maxchanged = reqmax != soldier_upgrade_required_max;
bool minchanged = reqmin != soldier_upgrade_required_min;
if (maxchanged || minchanged)
{
- if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open()))
+ if (upgrade_soldier_request_ && (upgrade_soldier_request_->is_open()))
{
- m_upgrade_soldier_request.reset();
+ upgrade_soldier_request_.reset();
}
- m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
+ soldier_upgrade_requirements_ = RequireAttribute(atrTotal, reqmin, reqmax);
return true;
}
@@ -1114,8 +1114,8 @@
MilitarySite::set_soldier_preference(MilitarySite::SoldierPreference p)
{
assert(kPrefersHeroes == p || kPrefersRookies == p);
- m_soldier_preference = p;
- m_next_swap_soldiers_time = 0;
+ soldier_preference_ = p;
+ next_swap_soldiers_time_ = 0;
}
}
=== modified file 'src/logic/map_objects/tribes/militarysite.h'
--- src/logic/map_objects/tribes/militarysite.h 2016-01-31 15:31:00 +0000
+++ src/logic/map_objects/tribes/militarysite.h 2016-02-08 18:17:36 +0000
@@ -42,26 +42,26 @@
Building & create_object() const override;
- uint32_t get_conquers() const override {return m_conquer_radius;}
+ uint32_t get_conquers() const override {return conquer_radius_;}
uint32_t get_max_number_of_soldiers () const {
- return m_num_soldiers;
+ return num_soldiers_;
}
uint32_t get_heal_per_second () const {
- return m_heal_per_second;
+ return heal_per_second_;
}
- bool m_prefers_heroes_at_start;
- std::string m_occupied_str;
- std::string m_aggressor_str;
- std::string m_attack_str;
- std::string m_defeated_enemy_str;
- std::string m_defeated_you_str;
+ bool prefers_heroes_at_start_;
+ std::string occupied_str_;
+ std::string aggressor_str_;
+ std::string attack_str_;
+ std::string defeated_enemy_str_;
+ std::string defeated_you_str_;
private:
- uint32_t m_conquer_radius;
- uint32_t m_num_soldiers;
- uint32_t m_heal_per_second;
+ uint32_t conquer_radius_;
+ uint32_t num_soldiers_;
+ uint32_t heal_per_second_;
DISALLOW_COPY_AND_ASSIGN(MilitarySiteDescr);
};
@@ -115,7 +115,7 @@
void set_requirements (const Requirements &);
void clear_requirements();
const Requirements & get_requirements () const {
- return m_soldier_requirements;
+ return soldier_requirements_;
}
void reinit_after_conqueration(Game &);
@@ -124,7 +124,7 @@
void set_soldier_preference(SoldierPreference);
SoldierPreference get_soldier_preference() const {
- return m_soldier_preference;
+ return soldier_preference_;
}
protected:
@@ -153,28 +153,28 @@
private:
- Requirements m_soldier_requirements; // This is used to grab a bunch of soldiers: Anything goes
- RequireAttribute m_soldier_upgrade_requirements; // This is used when exchanging soldiers.
- std::unique_ptr<Request> m_normal_soldier_request; // filling the site
- std::unique_ptr<Request> m_upgrade_soldier_request; // seeking for better soldiers
- bool m_didconquer;
- uint32_t m_capacity;
+ Requirements soldier_requirements_; // This is used to grab a bunch of soldiers: Anything goes
+ RequireAttribute soldier_upgrade_requirements_; // This is used when exchanging soldiers.
+ std::unique_ptr<Request> normal_soldier_request_; // filling the site
+ std::unique_ptr<Request> upgrade_soldier_request_; // seeking for better soldiers
+ bool didconquer_;
+ uint32_t capacity_;
/**
* Next gametime where we should heal something.
*/
- int32_t m_nexthealtime;
+ int32_t nexthealtime_;
struct SoldierJob {
Soldier * soldier;
ObjectPointer enemy;
bool stayhome;
};
- std::vector<SoldierJob> m_soldierjobs;
- SoldierPreference m_soldier_preference;
- int32_t m_next_swap_soldiers_time;
- bool m_soldier_upgrade_try; // optimization -- if everybody is zero-level, do not downgrade
- bool m_doing_upgrade_request;
+ std::vector<SoldierJob> soldierjobs_;
+ SoldierPreference soldier_preference_;
+ int32_t next_swap_soldiers_time_;
+ bool soldier_upgrade_try_; // optimization -- if everybody is zero-level, do not downgrade
+ bool doing_upgrade_request_;
};
}
=== modified file 'src/logic/map_objects/tribes/partially_finished_building.cc'
--- src/logic/map_objects/tribes/partially_finished_building.cc 2016-01-28 05:24:34 +0000
+++ src/logic/map_objects/tribes/partially_finished_building.cc 2016-02-08 18:17:36 +0000
@@ -33,12 +33,12 @@
PartiallyFinishedBuilding::PartiallyFinishedBuilding
(const BuildingDescr & gdescr) :
Building (gdescr),
-m_building (nullptr),
-m_builder_request(nullptr),
-m_working (false),
-m_work_steptime (0),
-m_work_completed (0),
-m_work_steps (0)
+building_ (nullptr),
+builder_request_(nullptr),
+working_ (false),
+work_steptime_ (0),
+work_completed_ (0),
+work_steps_ (0)
{}
/*
@@ -47,22 +47,22 @@
===============
*/
void PartiallyFinishedBuilding::set_building(const BuildingDescr & building_descr) {
- assert(!m_building);
+ assert(!building_);
- m_building = &building_descr;
+ building_ = &building_descr;
}
void PartiallyFinishedBuilding::cleanup(EditorGameBase & egbase) {
- if (m_builder_request) {
- delete m_builder_request;
- m_builder_request = nullptr;
+ if (builder_request_) {
+ delete builder_request_;
+ builder_request_ = nullptr;
}
- for (WaresQueue * temp_ware : m_wares) {
+ for (WaresQueue * temp_ware : wares_) {
temp_ware->cleanup();
delete temp_ware;
}
- m_wares.clear();
+ wares_.clear();
Building::cleanup(egbase);
}
@@ -73,7 +73,7 @@
if (upcast(Game, game, &egbase))
request_builder(*game);
- g_sound_handler.play_fx("create_construction_site", m_position, 255);
+ g_sound_handler.play_fx("create_construction_site", position_, 255);
}
/*
@@ -85,16 +85,16 @@
void PartiallyFinishedBuilding::set_economy(Economy * const e)
{
if (Economy * const old = get_economy()) {
- for (WaresQueue * temp_ware : m_wares) {
+ for (WaresQueue * temp_ware : wares_) {
temp_ware->remove_from_economy(*old);
}
}
Building::set_economy(e);
- if (m_builder_request)
- m_builder_request->set_economy(e);
+ if (builder_request_)
+ builder_request_->set_economy(e);
if (e)
- for (WaresQueue * temp_ware : m_wares) {
+ for (WaresQueue * temp_ware : wares_) {
temp_ware->add_to_economy(*e);
}
}
@@ -107,9 +107,9 @@
===============
*/
void PartiallyFinishedBuilding::request_builder(Game &) {
- assert(!m_builder.is_set() && !m_builder_request);
+ assert(!builder_.is_set() && !builder_request_);
- m_builder_request =
+ builder_request_ =
new Request
(*this,
owner().tribe().builder(),
@@ -123,7 +123,7 @@
===============
*/
int32_t PartiallyFinishedBuilding::get_size() const {
- return m_building->get_size();
+ return building_->get_size();
}
/*
@@ -149,7 +149,7 @@
*/
const Image* PartiallyFinishedBuilding::representative_image() const
{
- return m_building->representative_image(&owner().get_playercolor());
+ return building_->representative_image(&owner().get_playercolor());
}
@@ -166,8 +166,8 @@
uint32_t thisstep = 0;
uint32_t ts = build_step_time();
- if (m_working) {
- thisstep = ts - (m_work_steptime - time);
+ if (working_) {
+ thisstep = ts - (work_steptime_ - time);
// The check below is necessary because we drive construction via
// the construction worker in get_building_work(), and there can be
// a small delay between the worker completing his job and requesting
@@ -176,9 +176,9 @@
thisstep = ts;
}
thisstep = (thisstep << 16) / ts;
- uint32_t total = (thisstep + (m_work_completed << 16));
- if (m_work_steps)
- total /= m_work_steps;
+ uint32_t total = (thisstep + (work_completed_ << 16));
+ if (work_steps_)
+ total /= work_steps_;
assert(total <= (1 << 16));
@@ -203,10 +203,10 @@
PartiallyFinishedBuilding & b = dynamic_cast<PartiallyFinishedBuilding&>(target);
- b.m_builder = w;
+ b.builder_ = w;
delete &rq;
- b.m_builder_request = nullptr;
+ b.builder_request_ = nullptr;
w->start_task_buildingwork(game);
b.set_seeing(true);
=== modified file 'src/logic/map_objects/tribes/partially_finished_building.h'
--- src/logic/map_objects/tribes/partially_finished_building.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/partially_finished_building.h 2016-02-08 18:17:36 +0000
@@ -50,11 +50,11 @@
void init (EditorGameBase &) override;
void set_economy(Economy *) override;
- uint32_t get_nrwaresqueues() {return m_wares.size();}
- WaresQueue * get_waresqueue(uint32_t const idx) {return m_wares[idx];}
+ uint32_t get_nrwaresqueues() {return wares_.size();}
+ WaresQueue * get_waresqueue(uint32_t const idx) {return wares_[idx];}
uint32_t get_built_per64k() const;
- Request * get_builder_request() {return m_builder_request;}
+ Request * get_builder_request() {return builder_request_;}
static void request_builder_callback(Game &, Request &, DescriptionIndex, Worker *, PlayerImmovable &);
private:
@@ -64,19 +64,19 @@
virtual uint32_t build_step_time() const = 0;
protected:
- const BuildingDescr * m_building; // type of building that was or will become
+ const BuildingDescr * building_; // type of building that was or will become
- Request * m_builder_request;
- OPtr<Worker> m_builder;
+ Request * builder_request_;
+ OPtr<Worker> builder_;
using Wares = std::vector<WaresQueue *>;
- Wares m_wares;
+ Wares wares_;
- bool m_working; // true if the builder is currently working
- uint32_t m_work_steptime; // time when next step is completed
- uint32_t m_work_completed; // how many steps have we done so far?
- uint32_t m_work_steps; // how many steps (= wares) until we're done?
- //Player::ConstructionsiteInformation * m_info; // asked for by player point of view for the gameview
+ bool working_; // true if the builder is currently working
+ uint32_t work_steptime_; // time when next step is completed
+ uint32_t work_completed_; // how many steps have we done so far?
+ uint32_t work_steps_; // how many steps (= wares) until we're done?
+ //Player::ConstructionsiteInformation * info_; // asked for by player point of view for the gameview
};
}
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc 2016-02-01 16:18:17 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2016-02-08 18:17:36 +0000
@@ -722,7 +722,7 @@
for (const std::pair<uint32_t, std::set<std::string> >& area_info : worker_workarea_info) {
std::set<std::string> & building_radius_infos =
- descr->m_workarea_info[area_info.first];
+ descr->workarea_info_[area_info.first];
for (const std::string& worker_descname : area_info.second) {
std::string description = descr->descname();
@@ -1228,7 +1228,7 @@
% world.get_resource(m_resource)->descname())
.str();
- descr->m_workarea_info[m_distance].insert(description);
+ descr->workarea_info_[m_distance].insert(description);
} catch (const WException & e) {
throw GameDataError("mine: %s", e.what());
}
@@ -1546,7 +1546,7 @@
void ProductionProgram::ActPlayFX::execute
(Game & game, ProductionSite & ps) const
{
- g_sound_handler.play_fx(name, ps.m_position, priority);
+ g_sound_handler.play_fx(name, ps.position_, priority);
return ps.program_step(game);
}
@@ -1562,7 +1562,7 @@
workerprogram = params[1];
radius = boost::lexical_cast<uint32_t>(params[2]);
- std::set<std::string> & building_radius_infos = descr->m_workarea_info[radius];
+ std::set<std::string> & building_radius_infos = descr->workarea_info_[radius];
std::string description = descr->name() + ' ' + production_program_name;
description += " construct ";
description += objectname;
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc 2016-01-23 16:35:30 +0000
+++ src/logic/map_objects/tribes/productionsite.cc 2016-02-08 18:17:36 +0000
@@ -688,7 +688,7 @@
if (state.program->size() <= state.ip)
return program_end(game, Completed);
- if (m_anim != descr().get_animation(m_default_anim)) {
+ if (anim_ != descr().get_animation(m_default_anim)) {
// Restart idle animation, which is the default
start_animation(game, descr().get_animation(m_default_anim));
}
=== modified file 'src/logic/map_objects/tribes/warehouse.cc'
--- src/logic/map_objects/tribes/warehouse.cc 2016-02-07 06:10:47 +0000
+++ src/logic/map_objects/tribes/warehouse.cc 2016-02-08 18:17:36 +0000
@@ -261,7 +261,7 @@
m_heal_per_second = table.get_int("heal_per_second");
if (table.has_key("conquers")) {
m_conquers = table.get_int("conquers");
- m_workarea_info[m_conquers].insert(descname() + " conquer");
+ workarea_info_[m_conquers].insert(descname() + " conquer");
}
}
@@ -629,7 +629,7 @@
(PlayerArea<Area<FCoords> >
(owner().player_number(),
Area<FCoords>(map.get_fcoords(get_position()), conquer_radius)),
- m_defeating_player);
+ defeating_player_);
// Unsee the area that we started seeing in init()
Player & player = owner();
@@ -903,7 +903,7 @@
// NOTE: This code lies about the TrainingAttributes of the new worker
m_supply->remove_workers(worker_id, 1);
const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(worker_id);
- return workerdescr.create(game, owner(), this, m_position);
+ return workerdescr.create(game, owner(), this, position_);
}
}
@@ -1105,7 +1105,7 @@
remove_workers(owner().tribe().safe_worker_index(input), buildcost.second);
}
- incorporate_worker(game, &w_desc.create(game, owner(), this, m_position));
+ incorporate_worker(game, &w_desc.create(game, owner(), this, position_));
// Update PlannedWorkers::amount here if appropriate, because this function
// may have been called directly by the Economy.
=== modified file 'src/logic/player.cc'
--- src/logic/player.cc 2016-01-28 05:24:34 +0000
+++ src/logic/player.cc 2016-02-08 18:17:36 +0000
@@ -1253,9 +1253,9 @@
Player::BuildingStatsVector* Player::get_mutable_building_statistics(const DescriptionIndex& i) {
DescriptionIndex const nr_buildings = egbase().tribes().nrbuildings();
- if (m_building_stats.size() < nr_buildings)
- m_building_stats.resize(nr_buildings);
- return &m_building_stats[i];
+ if (building_stats_.size() < nr_buildings)
+ building_stats_.resize(nr_buildings);
+ return &building_stats_[i];
}
/**
@@ -1273,8 +1273,8 @@
const size_t nr_buildings = egbase().tribes().nrbuildings();
// Get the valid vector for this
- if (m_building_stats.size() < nr_buildings)
- m_building_stats.resize(nr_buildings);
+ if (building_stats_.size() < nr_buildings)
+ building_stats_.resize(nr_buildings);
std::vector<BuildingStats>& stat =
*get_mutable_building_statistics(egbase().tribes().building_index(building_name.c_str()));
=== modified file 'src/logic/player.h'
--- src/logic/player.h 2016-01-31 15:31:00 +0000
+++ src/logic/player.h 2016-02-08 18:17:36 +0000
@@ -613,7 +613,7 @@
*/
std::vector< std::vector<uint32_t> > m_ware_stocks;
- PlayerBuildingStats m_building_stats;
+ PlayerBuildingStats building_stats_;
DISALLOW_COPY_AND_ASSIGN(Player);
};
=== modified file 'src/map_io/map_building_packet.cc'
--- src/map_io/map_building_packet.cc 2016-02-06 11:11:24 +0000
+++ src/map_io/map_building_packet.cc 2016-02-08 18:17:36 +0000
@@ -142,12 +142,12 @@
if (building->descr().type() == MapObjectType::CONSTRUCTIONSITE) {
upcast(PartiallyFinishedBuilding const, pfb, building);
- fw.c_string((*pfb->m_building).name().c_str());
+ fw.c_string((*pfb->building_).name().c_str());
fw.unsigned_8(kTypeConstructionSite);
} else if (building->descr().type() == MapObjectType::DISMANTLESITE) {
upcast(PartiallyFinishedBuilding const, pfb, building);
- fw.c_string((*pfb->m_building).name().c_str());
+ fw.c_string((*pfb->building_).name().c_str());
fw.unsigned_8(kTypeDismantleSite);
} else {
=== modified file 'src/map_io/map_buildingdata_packet.cc'
--- src/map_io/map_buildingdata_packet.cc 2016-02-07 06:10:47 +0000
+++ src/map_io/map_buildingdata_packet.cc 2016-02-08 18:17:36 +0000
@@ -87,7 +87,7 @@
if (fr.unsigned_8()) {
char const * const animation_name = fr.c_string();
try {
- building.m_anim =
+ building.anim_ =
building.descr().get_animation(animation_name);
} catch (const MapObjectDescr::AnimationNonexistent &) {
log
@@ -96,15 +96,15 @@
building.owner().tribe().name().c_str(),
building.descr().descname().c_str(),
animation_name);
- building.m_anim = building.descr().get_animation("idle");
+ building.anim_ = building.descr().get_animation("idle");
}
} else {
- building.m_anim = 0;
+ building.anim_ = 0;
}
- building.m_animstart = fr.unsigned_32();
+ building.animstart_ = fr.unsigned_32();
{
- Building::LeaveQueue & leave_queue = building.m_leave_queue;
+ Building::LeaveQueue & leave_queue = building.leave_queue_;
leave_queue.resize(fr.unsigned_16());
for (Building::LeaveQueue::iterator queue_iter = leave_queue.begin();
@@ -131,26 +131,26 @@
}
}
- building.m_leave_time = fr.unsigned_32();
+ building.leave_time_ = fr.unsigned_32();
if (uint32_t const leaver_serial = fr.unsigned_32())
try {
- building.m_leave_allow =
+ building.leave_allow_ =
&mol.get<MapObject>(leaver_serial);
} catch (const WException & e) {
throw GameDataError
("leave allow item (%u): %s", leaver_serial, e.what());
}
else {
- building.m_leave_allow = nullptr;
+ building.leave_allow_ = nullptr;
}
while (fr.unsigned_8()) {
DescriptionIndex oldidx = building.owner().tribe().safe_building_index(fr.c_string());
- building.m_old_buildings.push_back(oldidx);
+ building.old_buildings_.push_back(oldidx);
}
// Only construction sites may have an empty list
- if (building.m_old_buildings.empty() && !is_a(ConstructionSite, &building)) {
+ if (building.old_buildings_.empty() && !is_a(ConstructionSite, &building)) {
throw GameDataError
("Failed to read %s %u: No former buildings informations.\n"
"Your savegame is corrupted", building.descr().descname().c_str(), building.serial());
@@ -180,7 +180,7 @@
}
// Set economy now, some stuff below will count on this.
- building.set_economy(building.m_flag->get_economy());
+ building.set_economy(building.flag_->get_economy());
Game& game = dynamic_cast<Game&>(egbase);
@@ -226,49 +226,49 @@
uint16_t const packet_version = fr.unsigned_16();
if (packet_version == kCurrentPacketPFBuilding) {
const TribeDescr & tribe = pfb.owner().tribe();
- pfb.m_building =
+ pfb.building_ =
tribe.get_building_descr(tribe.safe_building_index(fr.c_string()));
- delete pfb.m_builder_request;
+ delete pfb.builder_request_;
if (fr.unsigned_8()) {
- pfb.m_builder_request =
+ pfb.builder_request_ =
new Request
(pfb,
0,
PartiallyFinishedBuilding::request_builder_callback,
wwWORKER);
- pfb.m_builder_request->read(fr, game, mol);
+ pfb.builder_request_->read(fr, game, mol);
} else
- pfb.m_builder_request = nullptr;
+ pfb.builder_request_ = nullptr;
if (uint32_t const builder_serial = fr.unsigned_32()) {
try {
- pfb.m_builder = &mol.get<Worker>(builder_serial);
+ pfb.builder_ = &mol.get<Worker>(builder_serial);
} catch (const WException & e) {
throw GameDataError
("builder (%u): %s", builder_serial, e.what());
}
} else
- pfb.m_builder = nullptr;
+ pfb.builder_ = nullptr;
try {
uint16_t const size = fr.unsigned_16();
- pfb.m_wares.resize(size);
- for (uint16_t i = 0; i < pfb.m_wares.size(); ++i)
+ pfb.wares_.resize(size);
+ for (uint16_t i = 0; i < pfb.wares_.size(); ++i)
{
- pfb.m_wares[i] =
+ pfb.wares_[i] =
new WaresQueue
(pfb, INVALID_INDEX, 0);
- pfb.m_wares[i]->read(fr, game, mol);
+ pfb.wares_[i]->read(fr, game, mol);
}
} catch (const WException & e) {
throw GameDataError("wares: %s", e.what());
}
- pfb.m_working = fr.unsigned_8 ();
- pfb.m_work_steptime = fr.unsigned_32();
- pfb.m_work_completed = fr.unsigned_32();
- pfb.m_work_steps = fr.unsigned_32();
+ pfb.working_ = fr.unsigned_8 ();
+ pfb.work_steptime_ = fr.unsigned_32();
+ pfb.work_completed_ = fr.unsigned_32();
+ pfb.work_steps_ = fr.unsigned_32();
} else {
throw UnhandledVersionError("MapBuildingdataPacket - Partially Finished Building",
packet_version, kCurrentPacketPFBuilding);
@@ -289,15 +289,15 @@
if (packet_version >= kCurrentPacketVersionConstructionsite) {
read_partially_finished_building(constructionsite, fr, game, mol);
- for (ConstructionSite::Wares::iterator wares_iter = constructionsite.m_wares.begin();
- wares_iter != constructionsite.m_wares.end();
+ for (ConstructionSite::Wares::iterator wares_iter = constructionsite.wares_.begin();
+ wares_iter != constructionsite.wares_.end();
++wares_iter) {
(*wares_iter)->set_callback
(ConstructionSite::wares_queue_callback, &constructionsite);
}
- constructionsite.m_fetchfromflag = fr. signed_32();
+ constructionsite.fetchfromflag_ = fr. signed_32();
} else {
throw UnhandledVersionError("MapBuildingdataPacket - Constructionsite",
packet_version, kCurrentPacketVersionConstructionsite);
@@ -510,36 +510,36 @@
try {
uint16_t const packet_version = fr.unsigned_16();
if (packet_version == kCurrentPacketVersionMilitarysite) {
- militarysite.m_normal_soldier_request.reset();
+ militarysite.normal_soldier_request_.reset();
if (fr.unsigned_8()) {
- militarysite.m_normal_soldier_request.reset
+ militarysite.normal_soldier_request_.reset
(new Request
(militarysite,
0,
MilitarySite::request_soldier_callback,
wwWORKER));
- militarysite.m_normal_soldier_request->read(fr, game, mol);
+ militarysite.normal_soldier_request_->read(fr, game, mol);
}
else
- militarysite.m_normal_soldier_request.reset();
+ militarysite.normal_soldier_request_.reset();
if (fr.unsigned_8())
{
- militarysite.m_upgrade_soldier_request.reset
+ militarysite.upgrade_soldier_request_.reset
(new Request
(militarysite,
- (!militarysite.m_normal_soldier_request) ? 0
+ (!militarysite.normal_soldier_request_) ? 0
: militarysite.owner().tribe().soldier(),
MilitarySite::request_soldier_callback,
wwWORKER));
- militarysite.m_upgrade_soldier_request->read(fr, game, mol);
+ militarysite.upgrade_soldier_request_->read(fr, game, mol);
}
else
- militarysite.m_upgrade_soldier_request.reset();
-
-
- if ((militarysite.m_didconquer = fr.unsigned_8())) {
+ militarysite.upgrade_soldier_request_.reset();
+
+
+ if ((militarysite.didconquer_ = fr.unsigned_8())) {
// Add to map of military influence.
const Map & map = game.map();
Area<FCoords> a
@@ -557,16 +557,16 @@
}
// capacity (modified by user)
- militarysite.m_capacity = fr.unsigned_8();
- militarysite.m_nexthealtime = fr.signed_32();
+ militarysite.capacity_ = fr.unsigned_8();
+ militarysite.nexthealtime_ = fr.signed_32();
uint16_t reqmin = fr.unsigned_16();
uint16_t reqmax = fr.unsigned_16();
- militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
- militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.unsigned_8());
- militarysite.m_next_swap_soldiers_time = fr.signed_32();
- militarysite.m_soldier_upgrade_try = 0 != fr.unsigned_8() ? true : false;
- militarysite.m_doing_upgrade_request = 0 != fr.unsigned_8() ? true : false;
+ militarysite.soldier_upgrade_requirements_ = RequireAttribute(atrTotal, reqmin, reqmax);
+ militarysite.soldier_preference_ = static_cast<MilitarySite::SoldierPreference>(fr.unsigned_8());
+ militarysite.next_swap_soldiers_time_ = fr.signed_32();
+ militarysite.soldier_upgrade_try_ = 0 != fr.unsigned_8() ? true : false;
+ militarysite.doing_upgrade_request_ = 0 != fr.unsigned_8() ? true : false;
} else {
throw UnhandledVersionError("MapBuildingdataPacket - Militarysite",
@@ -582,22 +582,22 @@
// Cmd_ChangeSoldierCapacity to the beginning of the game's command
// queue. But that would not work because the command queue is not read
// yet and will be cleared before it is read.
- if (militarysite.m_capacity < militarysite.min_soldier_capacity()) {
+ if (militarysite.capacity_ < militarysite.min_soldier_capacity()) {
log
("WARNING: militarysite %u of player %u at (%i, %i) has capacity "
"set to %u but it must be at least %u. Changing to that value.\n",
militarysite.serial(), militarysite.owner().player_number(),
militarysite.get_position().x, militarysite.get_position().y,
- militarysite.m_capacity, militarysite.min_soldier_capacity());
- militarysite.m_capacity = militarysite.min_soldier_capacity();
- } else if (militarysite.max_soldier_capacity() < militarysite.m_capacity) {
+ militarysite.capacity_, militarysite.min_soldier_capacity());
+ militarysite.capacity_ = militarysite.min_soldier_capacity();
+ } else if (militarysite.max_soldier_capacity() < militarysite.capacity_) {
log
("WARNING: militarysite %u of player %u at (%i, %i) has capacity "
"set to %u but it can be at most %u. Changing to that value.\n",
militarysite.serial(), militarysite.owner().player_number(),
militarysite.get_position().x, militarysite.get_position().y,
- militarysite.m_capacity, militarysite.max_soldier_capacity());
- militarysite.m_capacity = militarysite.max_soldier_capacity();
+ militarysite.capacity_, militarysite.max_soldier_capacity());
+ militarysite.capacity_ = militarysite.max_soldier_capacity();
}
} catch (const WException & e) {
throw GameDataError("militarysite: %s", e.what());
@@ -898,16 +898,16 @@
// player immovable owner is already in existence packet
// write the general stuff
- if (building->m_anim) {
+ if (building->anim_) {
fw.unsigned_8(1);
- fw.string(building->descr().get_animation_name(building->m_anim));
+ fw.string(building->descr().get_animation_name(building->anim_));
} else
fw.unsigned_8(0);
- fw.unsigned_32(building->m_animstart);
+ fw.unsigned_32(building->animstart_);
{
- const Building::LeaveQueue & leave_queue = building->m_leave_queue;
+ const Building::LeaveQueue & leave_queue = building->leave_queue_;
fw.unsigned_16(leave_queue.size());
for (const OPtr<Worker >& temp_queue: leave_queue) {
assert(mos.is_object_known(*temp_queue.get(egbase)));
@@ -915,8 +915,8 @@
(mos.get_object_file_index(*temp_queue.get(egbase)));
}
}
- fw.unsigned_32(building->m_leave_time);
- if (MapObject const * const o = building->m_leave_allow.get(egbase))
+ fw.unsigned_32(building->leave_time_);
+ if (MapObject const * const o = building->leave_allow_.get(egbase))
{
assert(mos.is_object_known(*o));
fw.unsigned_32(mos.get_object_file_index(*o));
@@ -925,7 +925,7 @@
}
{
const TribeDescr& td = building->owner().tribe();
- for (DescriptionIndex b_idx : building->m_old_buildings) {
+ for (DescriptionIndex b_idx : building->old_buildings_) {
const BuildingDescr* b_descr = td.get_building_descr(b_idx);
fw.unsigned_8(1);
fw.string(b_descr->name());
@@ -976,31 +976,31 @@
fw.unsigned_16(kCurrentPacketPFBuilding);
// descriptions
- fw.string(pfb.m_building->name());
+ fw.string(pfb.building_->name());
// builder request
- if (pfb.m_builder_request) {
+ if (pfb.builder_request_) {
fw.unsigned_8(1);
- pfb.m_builder_request->write(fw, game, mos);
+ pfb.builder_request_->write(fw, game, mos);
} else
fw.unsigned_8(0);
// builder
- if (Worker const * builder = pfb.m_builder.get(game)) {
+ if (Worker const * builder = pfb.builder_.get(game)) {
assert(mos.is_object_known(*builder));
fw.unsigned_32(mos.get_object_file_index(*builder));
} else
fw.unsigned_32(0);
- const uint16_t wares_size = pfb.m_wares.size();
+ const uint16_t wares_size = pfb.wares_.size();
fw.unsigned_16(wares_size);
for (uint16_t i = 0; i < wares_size; ++i)
- pfb.m_wares[i]->write(fw, game, mos);
+ pfb.wares_[i]->write(fw, game, mos);
- fw.unsigned_8 (pfb.m_working);
- fw.unsigned_32(pfb.m_work_steptime);
- fw.unsigned_32(pfb.m_work_completed);
- fw.unsigned_32(pfb.m_work_steps);
+ fw.unsigned_8 (pfb.working_);
+ fw.unsigned_32(pfb.work_steptime_);
+ fw.unsigned_32(pfb.work_completed_);
+ fw.unsigned_32(pfb.work_steps_);
}
void MapBuildingdataPacket::write_constructionsite
@@ -1014,7 +1014,7 @@
write_partially_finished_building(constructionsite, fw, game, mos);
- fw.signed_32(constructionsite.m_fetchfromflag);
+ fw.signed_32(constructionsite.fetchfromflag_);
}
void MapBuildingdataPacket::write_dismantlesite
@@ -1134,40 +1134,40 @@
{
fw.unsigned_16(kCurrentPacketVersionMilitarysite);
- if (militarysite.m_normal_soldier_request) {
+ if (militarysite.normal_soldier_request_) {
fw.unsigned_8(1);
- militarysite.m_normal_soldier_request->write(fw, game, mos);
+ militarysite.normal_soldier_request_->write(fw, game, mos);
} else {
fw.unsigned_8(0);
}
- if (militarysite.m_upgrade_soldier_request)
+ if (militarysite.upgrade_soldier_request_)
{
fw.unsigned_8(1);
- militarysite.m_upgrade_soldier_request->write(fw, game, mos);
+ militarysite.upgrade_soldier_request_->write(fw, game, mos);
}
else
fw.unsigned_8(0);
- fw.unsigned_8(militarysite.m_didconquer);
- fw.unsigned_8(militarysite.m_capacity);
- fw.signed_32(militarysite.m_nexthealtime);
+ fw.unsigned_8(militarysite.didconquer_);
+ fw.unsigned_8(militarysite.capacity_);
+ fw.signed_32(militarysite.nexthealtime_);
- if (militarysite.m_normal_soldier_request)
+ if (militarysite.normal_soldier_request_)
{
- if (militarysite.m_upgrade_soldier_request)
+ if (militarysite.upgrade_soldier_request_)
{
throw GameDataError
("Internal error in a MilitarySite -- cannot continue. Use previous autosave.");
}
}
- fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_min());
- fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_max());
- fw.unsigned_8(militarysite.m_soldier_preference);
- fw.signed_32(militarysite.m_next_swap_soldiers_time);
- fw.unsigned_8(militarysite.m_soldier_upgrade_try ? 1 : 0);
- fw.unsigned_8(militarysite.m_doing_upgrade_request ? 1 : 0);
+ fw.unsigned_16(militarysite.soldier_upgrade_requirements_.get_min());
+ fw.unsigned_16(militarysite.soldier_upgrade_requirements_.get_max());
+ fw.unsigned_8(militarysite.soldier_preference_);
+ fw.signed_32(militarysite.next_swap_soldiers_time_);
+ fw.unsigned_8(militarysite.soldier_upgrade_try_ ? 1 : 0);
+ fw.unsigned_8(militarysite.doing_upgrade_request_ ? 1 : 0);
}
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2016-01-31 15:31:00 +0000
+++ src/scripting/lua_map.cc 2016-02-08 18:17:36 +0000
@@ -1638,7 +1638,7 @@
(RO) the workarea_radius of the building as an int.
*/
int LuaBuildingDescription::get_workarea_radius(lua_State * L) {
- lua_pushinteger(L, get()->m_workarea_info.begin()->first);
+ lua_pushinteger(L, get()->workarea_info_.begin()->first);
return 1;
}
=== modified file 'src/wui/building_ui.cc'
--- src/wui/building_ui.cc 2015-11-28 22:29:26 +0000
+++ src/wui/building_ui.cc 2016-02-08 18:17:36 +0000
@@ -33,21 +33,21 @@
*/
void Building::show_options(InteractiveGameBase & igbase, bool avoid_fastclick, Point pos)
{
- if (m_optionswindow) {
- if (m_optionswindow->is_minimal())
- m_optionswindow->restore();
- m_optionswindow->move_to_top();
+ if (optionswindow_) {
+ if (optionswindow_->is_minimal())
+ optionswindow_->restore();
+ optionswindow_->move_to_top();
} else {
- create_options_window(igbase, m_optionswindow);
- if (upcast(BuildingWindow, bw, m_optionswindow)) {
+ create_options_window(igbase, optionswindow_);
+ if (upcast(BuildingWindow, bw, optionswindow_)) {
bw->set_avoid_fastclick(avoid_fastclick);
}
// Run a first think here so that certain things like caps buttons
// get properly initialized
- m_optionswindow->think();
+ optionswindow_->think();
}
if (pos.x >= 0 && pos.y >= 0) {
- m_optionswindow->set_pos(pos);
+ optionswindow_->set_pos(pos);
}
}
@@ -58,8 +58,8 @@
{
for (boost::signals2::connection& c : options_window_connections)
c.disconnect();
- delete m_optionswindow;
- m_optionswindow = nullptr;
+ delete optionswindow_;
+ optionswindow_ = nullptr;
}
/**
@@ -67,10 +67,10 @@
*/
void Building::refresh_options(InteractiveGameBase & igb) {
// Only do something if there is actually a window
- if (m_optionswindow) {
- Point window_position = m_optionswindow->get_pos();
+ if (optionswindow_) {
+ Point window_position = optionswindow_->get_pos();
hide_options();
show_options(igb, true);
- m_optionswindow->set_pos(window_position);
+ optionswindow_->set_pos(window_position);
}
}
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2016-01-29 08:37:22 +0000
+++ src/wui/buildingwindow.cc 2016-02-08 18:17:36 +0000
@@ -304,9 +304,9 @@
if (can_see) {
WorkareaInfo wa_info;
if (upcast(Widelands::ConstructionSite, csite, &building_)) {
- wa_info = csite->building().m_workarea_info;
+ wa_info = csite->building().workarea_info_;
} else {
- wa_info = building_.descr().m_workarea_info;
+ wa_info = building_.descr().workarea_info_;
}
if (!wa_info.empty()) {
toggle_workarea_ = new UI::Button
@@ -471,9 +471,9 @@
}
WorkareaInfo workarea_info;
if (upcast(Widelands::ConstructionSite, csite, &building_)) {
- workarea_info = csite->building().m_workarea_info;
+ workarea_info = csite->building().workarea_info_;
} else {
- workarea_info = building_.descr().m_workarea_info;
+ workarea_info = building_.descr().workarea_info_;
}
if (workarea_info.empty()) {
return;
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2016-01-29 08:37:22 +0000
+++ src/wui/fieldaction.cc 2016-02-08 18:17:36 +0000
@@ -821,7 +821,7 @@
{
if (ibase().show_workarea_preview_ && !m_workarea_preview_overlay_id) {
const WorkareaInfo& workarea_info =
- m_plr->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->m_workarea_info;
+ m_plr->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->workarea_info_;
m_workarea_preview_overlay_id = ibase().show_work_area(workarea_info, m_node);
}
}
=== modified file 'src/wui/soldiercapacitycontrol.cc'
--- src/wui/soldiercapacitycontrol.cc 2016-01-29 08:37:22 +0000
+++ src/wui/soldiercapacitycontrol.cc 2016-02-08 18:17:36 +0000
@@ -46,7 +46,7 @@
void click_increase();
InteractiveGameBase & m_igb;
- Widelands::Building & m_building;
+ Widelands::Building & building_;
UI::Button m_decrease;
UI::Button m_increase;
@@ -59,7 +59,7 @@
:
Box(parent, 0, 0, Horizontal),
m_igb(igb),
-m_building(building),
+building_(building),
m_decrease
(this, "decrease", 0, 0, 32, 32,
g_gr->images().get("images/ui_basic/but4.png"),
@@ -86,21 +86,21 @@
void SoldierCapacityControl::think()
{
- SoldierControl * soldiers = dynamic_cast<SoldierControl *>(&m_building);
+ SoldierControl * soldiers = dynamic_cast<SoldierControl *>(&building_);
uint32_t const capacity = soldiers->soldier_capacity();
char buffer[sizeof("4294967295")];
sprintf(buffer, "%2u", capacity);
m_value.set_text(buffer);
- bool const can_act = m_igb.can_act(m_building.owner().player_number());
+ bool const can_act = m_igb.can_act(building_.owner().player_number());
m_decrease.set_enabled(can_act && soldiers->min_soldier_capacity() < capacity);
m_increase.set_enabled(can_act && soldiers->max_soldier_capacity() > capacity);
}
void SoldierCapacityControl::change_soldier_capacity(int delta)
{
- m_igb.game().send_player_change_soldier_capacity(m_building, delta);
+ m_igb.game().send_player_change_soldier_capacity(building_, delta);
}
void SoldierCapacityControl::click_decrease()
=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc 2016-01-31 21:03:15 +0000
+++ src/wui/soldierlist.cc 2016-02-08 18:17:36 +0000
@@ -371,7 +371,7 @@
void think() override;
InteractiveGameBase & m_igb;
- Widelands::Building & m_building;
+ Widelands::Building & building_;
SoldierPanel m_soldierpanel;
UI::Radiogroup m_soldier_preference;
UI::Textarea m_infotext;
@@ -385,7 +385,7 @@
UI::Box(&parent, 0, 0, UI::Box::Vertical),
m_igb(igb),
-m_building(building),
+building_(building),
m_soldierpanel(*this, igb.egbase(), building),
m_infotext(this, _("Click soldier to send away"))
{
@@ -413,7 +413,7 @@
UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
- bool can_act = m_igb.can_act(m_building.owner().player_number());
+ bool can_act = m_igb.can_act(building_.owner().player_number());
if (upcast(Widelands::MilitarySite, ms, &building)) {
m_soldier_preference.add_button
(buttons, Point(0, 0),
@@ -450,16 +450,16 @@
SoldierControl & SoldierList::soldiers() const
{
- return *dynamic_cast<SoldierControl *>(&m_building);
+ return *dynamic_cast<SoldierControl *>(&building_);
}
void SoldierList::think()
{
// Only update the soldiers pref radio if player is spectator
- if (m_igb.can_act(m_building.owner().player_number())) {
+ if (m_igb.can_act(building_.owner().player_number())) {
return;
}
- if (upcast(Widelands::MilitarySite, ms, &m_building)) {
+ if (upcast(Widelands::MilitarySite, ms, &building_)) {
switch (ms->get_soldier_preference()) {
case Widelands::MilitarySite::kPrefersRookies:
m_soldier_preference.set_state(0);
@@ -495,20 +495,20 @@
void SoldierList::eject(const Soldier * soldier)
{
uint32_t const capacity_min = soldiers().min_soldier_capacity();
- bool can_act = m_igb.can_act(m_building.owner().player_number());
+ bool can_act = m_igb.can_act(building_.owner().player_number());
bool over_min = capacity_min < soldiers().present_soldiers().size();
if (can_act && over_min)
- m_igb.game().send_player_drop_soldier(m_building, soldier->serial());
+ m_igb.game().send_player_drop_soldier(building_, soldier->serial());
}
void SoldierList::set_soldier_preference(int32_t changed_to) {
#ifndef NDEBUG
- upcast(Widelands::MilitarySite, ms, &m_building);
+ upcast(Widelands::MilitarySite, ms, &building_);
assert(ms);
#endif
m_igb.game().send_player_militarysite_set_soldier_preference
- (m_building, changed_to == 0 ?
+ (building_, changed_to == 0 ?
Widelands::MilitarySite::kPrefersRookies:
Widelands::MilitarySite::kPrefersHeroes);
}
Follow ups