widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #06024
[Merge] lp:~widelands-dev/widelands/bug-1395278-tribes-p-r into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1395278-tribes-p-r into lp:widelands.
Commit message:
Renamed member variables in src/logic/map_objects/tribes for partially_finished_building - requirements.
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-p-r/+merge/285497
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-tribes-p-r into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc 2016-02-08 17:25:17 +0000
+++ src/logic/map_objects/tribes/building.cc 2016-02-09 15:10:44 +0000
@@ -649,7 +649,7 @@
{
if (coords == position_) { // draw big buildings only once
dst.blit_animation(
- pos, anim_, game.get_gametime() - animstart_, get_owner()->get_playercolor());
+ pos, anim_, game.get_gametime() - animstart_, get_owner()->get_playercolor());
// door animation?
=== modified file 'src/logic/map_objects/tribes/partially_finished_building.h'
--- src/logic/map_objects/tribes/partially_finished_building.h 2016-02-08 17:25:17 +0000
+++ src/logic/map_objects/tribes/partially_finished_building.h 2016-02-09 15:10:44 +0000
@@ -76,7 +76,6 @@
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-08 17:25:17 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2016-02-09 15:10:44 +0000
@@ -441,7 +441,7 @@
bool ProductionProgram::ActReturn::WorkersNeedExperience::evaluate
(const ProductionSite & ps) const
{
- ProductionSite::WorkingPosition const * const wp = ps.m_working_positions;
+ ProductionSite::WorkingPosition const * const wp = ps.working_positions_;
for (uint32_t i = ps.descr().nr_working_positions(); i;)
if (wp[--i].worker->needs_experience())
return true;
@@ -489,9 +489,9 @@
(char* parameters, const ProductionSiteDescr& descr, const Tribes& tribes)
{
try {
- if (match(parameters, "failed")) m_result = Failed;
- else if (match(parameters, "completed")) m_result = Completed;
- else if (match(parameters, "skipped")) m_result = Skipped;
+ if (match(parameters, "failed")) result_ = Failed;
+ else if (match(parameters, "completed")) result_ = Completed;
+ else if (match(parameters, "skipped")) result_ = Skipped;
else
throw GameDataError
("expected %s but found \"%s\"",
@@ -499,9 +499,9 @@
if (skip(parameters)) {
if (match_force_skip(parameters, "when")) {
- m_is_when = true;
+ is_when_ = true;
for (;;) {
- m_conditions.push_back(create_condition(parameters, descr, tribes));
+ conditions_.push_back(create_condition(parameters, descr, tribes));
if (*parameters) {
skip(parameters);
if (!match_force_skip(parameters, "and"))
@@ -511,12 +511,12 @@
break;
}
} else if (match_force_skip(parameters, "unless")) {
- m_is_when = false;
+ is_when_ = false;
for (;;) {
if (!*parameters)
throw GameDataError
("expected condition at end of input");
- m_conditions.push_back(create_condition(parameters, descr, tribes));
+ conditions_.push_back(create_condition(parameters, descr, tribes));
if (*parameters) {
skip(parameters);
if (!match_force_skip(parameters, "or"))
@@ -534,7 +534,7 @@
("expected %s but found \"%s\"",
("space or end of input"), parameters);
else
- m_is_when = true;
+ is_when_ = true;
} catch (const WException & e) {
throw GameDataError("return: %s", e.what());
@@ -542,7 +542,7 @@
}
ProductionProgram::ActReturn::~ActReturn() {
- for (Condition * condition : m_conditions) {
+ for (Condition * condition : conditions_) {
delete condition;
}
}
@@ -550,17 +550,17 @@
void ProductionProgram::ActReturn::execute
(Game & game, ProductionSite & ps) const
{
- if (!m_conditions.empty()) {
+ if (!conditions_.empty()) {
std::vector<std::string> condition_list;
- if (m_is_when) { // 'when a and b and ...' (all conditions must be true)
- for (const Condition * condition : m_conditions) {
+ if (is_when_) { // 'when a and b and ...' (all conditions must be true)
+ for (const Condition * condition : conditions_) {
if (!condition->evaluate(ps)) { // A condition is false,
return ps.program_step(game); // continue program.
}
condition_list.push_back(condition->description(game.tribes()));
}
} else { // "unless a or b or ..." (all conditions must be false)
- for (const Condition * condition : m_conditions) {
+ for (const Condition * condition : conditions_) {
if (condition->evaluate(ps)) { // A condition is true,
return ps.program_step(game); // continue program.
}
@@ -570,14 +570,14 @@
std::string condition_string = i18n::localize_list(condition_list, i18n::ConcatenateWith::AND);
std::string result_string = "";
- if (m_result == Failed) {
+ if (result_ == Failed) {
/** TRANSLATORS: "Did not start working because the economy needs the ware ‘%s’" */
result_string = (boost::format(_("Did not start %1$s because %2$s"))
% ps.top_state().program->descname()
% condition_string)
.str();
}
- else if (m_result == Completed) {
+ else if (result_ == Completed) {
/** TRANSLATORS: "Completed working because the economy needs the ware ‘%s’" */
result_string = (boost::format(_("Completed %1$s because %2$s"))
% ps.top_state().program->descname()
@@ -593,7 +593,7 @@
}
ps.set_production_result(result_string);
}
- return ps.program_end(game, m_result);
+ return ps.program_end(game, result_);
}
@@ -601,9 +601,9 @@
(char * parameters, const ProductionSiteDescr & descr)
{
// Initialize with default handling methods.
- m_handling_methods[Failed - 1] = Continue;
- m_handling_methods[Completed - 1] = Continue;
- m_handling_methods[Skipped - 1] = Continue;
+ handling_methods_[Failed - 1] = Continue;
+ handling_methods_[Completed - 1] = Continue;
+ handling_methods_[Skipped - 1] = Continue;
try {
bool reached_end;
@@ -618,7 +618,7 @@
"the program \"%s\" has not (yet) been declared in %s "
"(wrong declaration order?)",
program_name, descr.descname().c_str());
- m_program = it->second.get();
+ program_ = it->second.get();
}
// Override with specified handling methods.
@@ -629,17 +629,17 @@
ProgramResult result_to_set_method_for;
if (match_force_skip(parameters, "failure")) {
- if (m_handling_methods[Failed - 1] != Continue)
+ if (handling_methods_[Failed - 1] != Continue)
throw GameDataError
("%s handling method already defined", "failure");
result_to_set_method_for = Failed;
} else if (match_force_skip(parameters, "completion")) {
- if (m_handling_methods[Completed - 1] != Continue)
+ if (handling_methods_[Completed - 1] != Continue)
throw GameDataError
("%s handling method already defined", "completion");
result_to_set_method_for = Completed;
} else if (match_force_skip(parameters, "skip")) {
- if (m_handling_methods[Skipped - 1] != Continue)
+ if (handling_methods_[Skipped - 1] != Continue)
throw GameDataError
("%s handling method already defined", "skip");
result_to_set_method_for = Skipped;
@@ -662,7 +662,7 @@
("expected %s but found \"%s\"",
"{\"fail\"|\"complete\"|\"skip\"|\"repeat\"}",
parameters);
- m_handling_methods[result_to_set_method_for - 1] = handling_method;
+ handling_methods_[result_to_set_method_for - 1] = handling_method;
reached_end = !*parameters;
log
("read handling method for result %u: %u, parameters = \"%s\", "
@@ -681,12 +681,11 @@
ProgramResult const program_result =
static_cast<ProgramResult>(ps.top_state().phase);
- if (program_result == None) // The program has not yet been called.
- //ps.molog("%s Call %s\n", ps.descname().c_str(),
- // m_program->get_name().c_str());
- return ps.program_start(game, m_program->name());
+ if (program_result == None) { // The program has not yet been called.
+ return ps.program_start(game, program_->name());
+ }
- switch (m_handling_methods[program_result - 1]) {
+ switch (handling_methods_[program_result - 1]) {
case Fail:
case Complete:
case Skip:
@@ -695,8 +694,8 @@
return ps.program_step(game);
case Repeat:
ps.top_state().phase = None;
- ps.m_program_timer = true;
- ps.m_program_time = ps.schedule_act(game, 10);
+ ps.program_timer_ = true;
+ ps.program_time_ = ps.schedule_act(game, 10);
break;
}
}
@@ -708,7 +707,7 @@
const Tribes& tribes)
{
try {
- m_program = parameters;
+ program_ = parameters;
// Quote form "void ProductionSite::program_act(Game &)":
// "Always main worker is doing stuff"
@@ -718,7 +717,7 @@
// This will fail unless the main worker has a program with the given
// name, so it also validates the parameter.
const WorkareaInfo & worker_workarea_info =
- main_worker_descr.get_program(m_program)->get_workarea_info();
+ main_worker_descr.get_program(program_)->get_workarea_info();
for (const std::pair<uint32_t, std::set<std::string> >& area_info : worker_workarea_info) {
std::set<std::string> & building_radius_infos =
@@ -743,7 +742,7 @@
(Game& game, ProductionSite& ps) const
{
// Always main worker is doing stuff
- ps.m_working_positions[0].worker->update_task_buildingwork(game);
+ ps.working_positions_[0].worker->update_task_buildingwork(game);
}
bool ProductionProgram::ActWorker::get_building_work
@@ -771,13 +770,13 @@
if (*parameters) {
char * endp;
long long int const value = strtoll(parameters, &endp, 0);
- m_duration = value;
- if (*endp || value <= 0 || m_duration != value)
+ duration_ = value;
+ if (*endp || value <= 0 || duration_ != value)
throw GameDataError
("expected %s but found \"%s\"",
"duration in ms", parameters);
} else
- m_duration = 0; // Get duration from the result of a previous action.
+ duration_ = 0; // Get duration from the result of a previous action.
} catch (const WException & e) {
throw GameDataError("sleep: %s", e.what());
}
@@ -786,7 +785,7 @@
void ProductionProgram::ActSleep::execute(Game & game, ProductionSite & ps) const
{
return
- ps.program_step(game, m_duration ? m_duration : ps.top_state().phase);
+ ps.program_step(game, duration_ ? duration_ : ps.top_state().phase);
}
@@ -795,7 +794,7 @@
try {
if (*parameters) {
if (!strcmp(parameters, "seafaring"))
- m_feature = SEAFARING;
+ feature_ = SEAFARING;
else
throw GameDataError("Unknown parameter \"%s\"", parameters);
} else
@@ -807,7 +806,7 @@
void ProductionProgram::ActCheckMap::execute(Game& game, ProductionSite& ps) const
{
- switch (m_feature) {
+ switch (feature_) {
case SEAFARING: {
if (game.map().get_port_spaces().size() > 1)
return ps.program_step(game, 0);
@@ -830,20 +829,20 @@
throw GameDataError
("idle animation is default; calling is not allowed");
if (descr->is_animation_known(animation_name))
- m_id = descr->get_animation(animation_name);
+ id_ = descr->get_animation(animation_name);
else {
throw GameDataError("Unknown animation '%s'", animation_name);
}
if (!reached_end) { // The next parameter is the duration.
char * endp;
long long int const value = strtoll(parameters, &endp, 0);
- m_duration = value;
- if (*endp || value <= 0 || m_duration != value)
+ duration_ = value;
+ if (*endp || value <= 0 || duration_ != value)
throw GameDataError
("expected %s but found \"%s\"",
"duration in ms", parameters);
} else
- m_duration = 0; // Get duration from the result of a previous action.
+ duration_ = 0; // Get duration from the result of a previous action.
} catch (const WException & e) {
throw GameDataError("animate: %s", e.what());
}
@@ -852,9 +851,9 @@
void ProductionProgram::ActAnimate::execute
(Game& game, ProductionSite & ps) const
{
- ps.start_animation(game, m_id);
+ ps.start_animation(game, id_);
return
- ps.program_step(game, m_duration ? m_duration : ps.top_state().phase);
+ ps.program_step(game, duration_ ? duration_ : ps.top_state().phase);
}
@@ -1040,9 +1039,9 @@
(Game & game, ProductionSite & ps) const
{
//ps.molog(" Produce\n");
- assert(ps.m_produced_wares.empty());
- ps.m_produced_wares = produced_wares_;
- ps.m_working_positions[0].worker->update_task_buildingwork(game);
+ assert(ps.produced_wares_.empty());
+ ps.produced_wares_ = produced_wares_;
+ ps.working_positions_[0].worker->update_task_buildingwork(game);
const TribeDescr & tribe = ps.owner().tribe();
assert(produced_wares_.size());
@@ -1137,9 +1136,9 @@
void ProductionProgram::ActRecruit::execute
(Game & game, ProductionSite & ps) const
{
- assert(ps.m_recruited_workers.empty());
- ps.m_recruited_workers = recruited_workers_;
- ps.m_working_positions[0].worker->update_task_buildingwork(game);
+ assert(ps.recruited_workers_.empty());
+ ps.recruited_workers_ = recruited_workers_;
+ ps.working_positions_[0].worker->update_task_buildingwork(game);
const TribeDescr & tribe = ps.owner().tribe();
assert(recruited_workers_.size());
@@ -1181,13 +1180,13 @@
{
try {
bool reached_end;
- m_resource = world.safe_resource_index(next_word(parameters, reached_end));
+ resource_ = world.safe_resource_index(next_word(parameters, reached_end));
{
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
- m_distance = value;
- if (*endp != ' ' || m_distance != value)
+ distance_ = value;
+ if (*endp != ' ' || distance_ != value)
throw GameDataError
("expected %s but found \"%s\"", "distance", parameters);
parameters = endp;
@@ -1196,7 +1195,7 @@
{
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
- m_max = value;
+ max_ = value;
if (*endp != ' ' || value < 1 || 100 < value)
throw GameDataError
("expected %s but found \"%s\"",
@@ -1207,7 +1206,7 @@
{
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
- m_chance = value;
+ chance_ = value;
if (*endp != ' ' || value < 1 || 100 < value)
throw GameDataError
("expected %s but found \"%s\"",
@@ -1217,7 +1216,7 @@
{
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
- m_training = value;
+ training_ = value;
if (*endp || value < 1 || 100 < value)
throw GameDataError
("expected %s but found \"%s\"",
@@ -1225,10 +1224,10 @@
}
std::string description =
(boost::format("%1$s %2$s mine %3$s") % descr->descname() % production_program_name
- % world.get_resource(m_resource)->descname())
+ % world.get_resource(resource_)->descname())
.str();
- descr->workarea_info_[m_distance].insert(description);
+ descr->workarea_info_[distance_].insert(description);
} catch (const WException & e) {
throw GameDataError("mine: %s", e.what());
}
@@ -1246,14 +1245,14 @@
{
MapRegion<Area<FCoords> > mr
- (map, Area<FCoords> (map.get_fcoords(ps.get_position()), m_distance));
+ (map, Area<FCoords> (map.get_fcoords(ps.get_position()), distance_));
do {
uint8_t fres = mr.location().field->get_resources();
uint32_t amount = mr.location().field->get_resources_amount();
uint32_t start_amount =
mr.location().field->get_initial_res_amount();
- if (fres != m_resource) {
+ if (fres != resource_) {
amount = 0;
start_amount = 0;
}
@@ -1282,7 +1281,7 @@
if (!totalres)
digged_percentage = 100;
- if (digged_percentage < m_max) {
+ if (digged_percentage < max_) {
// mine can produce normally
if (totalres == 0)
return ps.program_end(game, Failed);
@@ -1294,12 +1293,12 @@
{
MapRegion<Area<FCoords> > mr
(map,
- Area<FCoords>(map.get_fcoords(ps.get_position()), m_distance));
+ Area<FCoords>(map.get_fcoords(ps.get_position()), distance_));
do {
uint8_t fres = mr.location().field->get_resources();
uint32_t amount = mr.location().field->get_resources_amount();
- if (fres != m_resource)
+ if (fres != resource_)
amount = 0;
pick -= 8 * amount;
@@ -1321,8 +1320,8 @@
// Inform the player about an empty mine, unless
// there is a sufficiently high chance, that the mine
// will still produce enough.
- // e.g. mines have m_chance=5, wells have 65
- if (m_chance <= 20) {
+ // e.g. mines have chance=5, wells have 65
+ if (chance_ <= 20) {
ps.notify_player(game, 60);
// and change the default animation
ps.set_default_anim("empty");
@@ -1331,10 +1330,10 @@
// Mine has reached its limits, still try to produce something but
// independent of sourrunding resources. Do not decrease resources
// further.
- if (m_chance <= game.logic_rand() % 100) {
+ if (chance_ <= game.logic_rand() % 100) {
// Gain experience
- if (m_training >= game.logic_rand() % 100) {
+ if (training_ >= game.logic_rand() % 100) {
ps.train_workers(game);
}
return ps.program_end(game, Failed);
@@ -1614,7 +1613,7 @@
{
state.objvar = immovables[0].object;
- psite.m_working_positions[0].worker->update_task_buildingwork(game);
+ psite.working_positions_[0].worker->update_task_buildingwork(game);
return;
}
@@ -1654,7 +1653,7 @@
state.coord = best_coords;
- psite.m_working_positions[0].worker->update_task_buildingwork(game);
+ psite.working_positions_[0].worker->update_task_buildingwork(game);
return;
}
=== modified file 'src/logic/map_objects/tribes/production_program.h'
--- src/logic/map_objects/tribes/production_program.h 2015-12-11 19:06:50 +0000
+++ src/logic/map_objects/tribes/production_program.h 2016-02-09 15:10:44 +0000
@@ -214,9 +214,9 @@
};
using Conditions = std::vector<Condition *>;
- ProgramResult m_result;
- bool m_is_when; // otherwise it is "unless"
- Conditions m_conditions;
+ ProgramResult result_;
+ bool is_when_; // otherwise it is "unless"
+ Conditions conditions_;
};
@@ -254,8 +254,8 @@
ActCall(char* parameters, const ProductionSiteDescr&);
void execute(Game &, ProductionSite &) const override;
private:
- ProductionProgram * m_program;
- ProgramResultHandlingMethod m_handling_methods[3];
+ ProductionProgram * program_;
+ ProgramResultHandlingMethod handling_methods_[3];
};
/// Calls a program of the productionsite's main worker.
@@ -272,9 +272,9 @@
void execute(Game &, ProductionSite &) const override;
bool get_building_work(Game &, ProductionSite &, Worker &) const override;
void building_work_failed(Game &, ProductionSite &, Worker &) const override;
- const std::string & program() const {return m_program;}
+ const std::string & program() const {return program_;}
private:
- std::string m_program;
+ std::string program_;
};
/// Does nothing.
@@ -291,7 +291,7 @@
ActSleep(char * parameters);
void execute(Game &, ProductionSite &) const override;
private:
- Duration m_duration;
+ Duration duration_;
};
/// Checks whether the map has a certain feature enabled.
@@ -311,7 +311,7 @@
enum {
SEAFARING = 1
};
- uint8_t m_feature;
+ uint8_t feature_;
};
/// Runs an animation.
@@ -334,8 +334,8 @@
ActAnimate(char* parameters, ProductionSiteDescr*);
void execute(Game &, ProductionSite &) const override;
private:
- uint32_t m_id;
- Duration m_duration;
+ uint32_t id_;
+ Duration duration_;
};
/// Consumes wares from the input storages.
@@ -436,11 +436,11 @@
void execute(Game &, ProductionSite &) const override;
private:
- DescriptionIndex m_resource;
- uint8_t m_distance; // width/radius of mine
- uint8_t m_max; // Can work up to this percent (of total mountain resources)
- uint8_t m_chance; // odds of finding resources from empty mine
- uint8_t m_training; // probability of training in _empty_ mines
+ DescriptionIndex resource_;
+ uint8_t distance_; // width/radius of mine
+ uint8_t max_; // Can work up to this percent (of total mountain resources)
+ uint8_t chance_; // odds of finding resources from empty mine
+ uint8_t training_; // probability of training in _empty_ mines
};
struct ActCheckSoldier : public Action {
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc 2016-02-08 17:25:17 +0000
+++ src/logic/map_objects/tribes/productionsite.cc 2016-02-09 15:10:44 +0000
@@ -58,9 +58,9 @@
(const std::string& init_descname, const std::string& msgctxt, MapObjectType _type,
const LuaTable& table, const EditorGameBase& egbase)
: BuildingDescr(init_descname, _type, table, egbase),
- m_out_of_resource_title(""),
- m_out_of_resource_heading(""),
- m_out_of_resource_message(""),
+ out_of_resource_title_(""),
+ out_of_resource_heading_(""),
+ out_of_resource_message_(""),
out_of_resource_productivity_threshold_(100)
{
i18n::Textdomain td("tribes");
@@ -68,9 +68,9 @@
if (table.has_key("out_of_resource_notification")) {
items_table = table.get_table("out_of_resource_notification");
- m_out_of_resource_title = _(items_table->get_string("title"));
- m_out_of_resource_heading = _(items_table->get_string("heading"));
- m_out_of_resource_message = pgettext_expr(msgctxt.c_str(), items_table->get_string("message").c_str());
+ out_of_resource_title_ = _(items_table->get_string("title"));
+ out_of_resource_heading_ = _(items_table->get_string("heading"));
+ out_of_resource_message_ = pgettext_expr(msgctxt.c_str(), items_table->get_string("message").c_str());
if (items_table->has_key("productivity_threshold")) {
out_of_resource_productivity_threshold_ = items_table->get_int("productivity_threshold");
}
@@ -83,17 +83,17 @@
try {
DescriptionIndex idx = egbase.tribes().ware_index(output);
if (egbase.tribes().ware_exists(idx)) {
- if (m_output_ware_types.count(idx)) {
+ if (output_ware_types_.count(idx)) {
throw wexception("this ware type has already been declared as an output");
}
- m_output_ware_types.insert(idx);
+ output_ware_types_.insert(idx);
} else {
idx = egbase.tribes().worker_index(output);
if (egbase.tribes().worker_exists(idx)) {
- if (m_output_worker_types.count(idx)) {
+ if (output_worker_types_.count(idx)) {
throw wexception("this worker type has already been declared as an output");
}
- m_output_worker_types.insert(idx);
+ output_worker_types_.insert(idx);
} else {
throw wexception("tribes do not define a ware or worker type with this name");
}
@@ -119,7 +119,7 @@
throw wexception("duplicated");
}
}
- m_inputs.push_back(WareAmount(idx, amount));
+ inputs_.push_back(WareAmount(idx, amount));
} else {
throw wexception
("tribes do not define a ware type with this name");
@@ -148,7 +148,7 @@
throw wexception("duplicated");
}
}
- m_working_positions.push_back(std::pair<DescriptionIndex, uint32_t>(woi, amount));
+ working_positions_.push_back(std::pair<DescriptionIndex, uint32_t>(woi, amount));
} else {
throw wexception("invalid");
}
@@ -172,11 +172,11 @@
(program_name.begin(), program_name.end(), program_name.begin(),
tolower);
try {
- if (m_programs.count(program_name)) {
+ if (programs_.count(program_name)) {
throw wexception("this program has already been declared");
}
std::unique_ptr<LuaTable> program_table = items_table->get_table(program_name);
- m_programs[program_name] =
+ programs_[program_name] =
std::unique_ptr<ProductionProgram>(
new ProductionProgram(program_name,
program_table->get_string("descname"),
@@ -206,7 +206,7 @@
(const std::string & program_name) const
{
Programs::const_iterator const it = programs().find(program_name);
- if (it == m_programs.end())
+ if (it == programs_.end())
throw wexception
("%s has no program '%s'", name().c_str(), program_name.c_str());
return it->second.get();
@@ -230,24 +230,24 @@
ProductionSite::ProductionSite(const ProductionSiteDescr & ps_descr) :
Building (ps_descr),
- m_working_positions (new WorkingPosition[ps_descr.nr_working_positions()]),
- m_fetchfromflag (0),
- m_program_timer (false),
- m_program_time (0),
- m_post_timer (50),
- m_statistics (STATISTICS_VECTOR_LENGTH, false),
- m_last_stat_percent (0),
- m_crude_percent (0),
- m_is_stopped (false),
- m_default_anim ("idle"),
- m_production_result ("")
+ working_positions_ (new WorkingPosition[ps_descr.nr_working_positions()]),
+ fetchfromflag_ (0),
+ program_timer_ (false),
+ program_time_ (0),
+ post_timer_ (50),
+ statistics_ (STATISTICS_VECTOR_LENGTH, false),
+ last_stat_percent_ (0),
+ crude_percent_ (0),
+ is_stopped_ (false),
+ default_anim_ ("idle"),
+ production_result_ ("")
{
calc_statistics();
}
ProductionSite::~ProductionSite() {
// TODO(sirver): Use std::vector<std::unique_ptr<>> to avoid naked delete.
- delete[] m_working_positions;
+ delete[] working_positions_;
}
void ProductionSite::load_finish(EditorGameBase & egbase) {
@@ -263,7 +263,7 @@
uint32_t const nr_working_positions = descr().nr_working_positions();
uint32_t nr_workers = 0;
for (uint32_t i = nr_working_positions; i;)
- nr_workers += m_working_positions[--i].worker ? 1 : 0;
+ nr_workers += working_positions_[--i].worker ? 1 : 0;
if (nr_workers == 0) {
*s = (boost::format("<font color=%s>%s</font>") % UI_FONT_CLR_BAD.hex_value() % _("(not occupied)"))
@@ -277,12 +277,12 @@
return;
}
- if (m_is_stopped) {
+ if (is_stopped_) {
*s = (boost::format("<font color=%s>%s</font>") % UI_FONT_CLR_BRIGHT.hex_value() % _("(stopped)"))
.str();
return;
}
- *s = m_statistics_string_on_changed_statistics;
+ *s = statistics_string_on_changed_statistics_;
}
/**
@@ -338,7 +338,7 @@
}
WaresQueue & ProductionSite::waresqueue(DescriptionIndex const wi) {
- for (WaresQueue * ip_queue : m_input_queues) {
+ for (WaresQueue * ip_queue : input_queues_) {
if (ip_queue->get_ware() == wi) {
return *ip_queue;
}
@@ -360,7 +360,7 @@
uint8_t lastOk = 0;
for (pos = 0; pos < STATISTICS_VECTOR_LENGTH; ++pos) {
- if (m_statistics[pos]) {
+ if (statistics_[pos]) {
++ok;
if (pos >= STATISTICS_VECTOR_LENGTH / 2)
++lastOk;
@@ -368,7 +368,7 @@
}
// boost::format would treat uint8_t as char
const unsigned int percOk = (ok * 100) / STATISTICS_VECTOR_LENGTH;
- m_last_stat_percent = percOk;
+ last_stat_percent_ = percOk;
const unsigned int lastPercOk = (lastOk * 100) / (STATISTICS_VECTOR_LENGTH / 2);
@@ -401,9 +401,9 @@
if (0 < percOk && percOk < 100) {
// TODO(GunChleoc): We might need to reverse the order here for RTL languages
- m_statistics_string_on_changed_statistics = (boost::format("%s %s") % perc_str % trend_str).str();
+ statistics_string_on_changed_statistics_ = (boost::format("%s %s") % perc_str % trend_str).str();
} else {
- m_statistics_string_on_changed_statistics = perc_str;
+ statistics_string_on_changed_statistics_ = perc_str;
}
}
@@ -416,16 +416,16 @@
Building::init(egbase);
const BillOfMaterials & inputs = descr().inputs();
- m_input_queues.resize(inputs.size());
+ input_queues_.resize(inputs.size());
for (WareRange i(inputs); i; ++i)
- m_input_queues[i.i] =
+ input_queues_[i.i] =
new WaresQueue
(*this,
i.current->first,
i.current->second);
// Request missing workers.
- WorkingPosition * wp = m_working_positions;
+ WorkingPosition * wp = working_positions_;
for (const WareAmount& temp_wp : descr().working_positions()) {
DescriptionIndex const worker_index = temp_wp.first;
for (uint32_t j = temp_wp.second; j; --j, ++wp)
@@ -447,18 +447,18 @@
void ProductionSite::set_economy(Economy * const e)
{
if (Economy * const old = get_economy()) {
- for (WaresQueue * ip_queue : m_input_queues) {
+ for (WaresQueue * ip_queue : input_queues_) {
ip_queue->remove_from_economy(*old);
}
}
Building::set_economy(e);
for (uint32_t i = descr().nr_working_positions(); i;)
- if (Request * const r = m_working_positions[--i].worker_request)
+ if (Request * const r = working_positions_[--i].worker_request)
r->set_economy(e);
if (e) {
- for (WaresQueue * ip_queue : m_input_queues) {
+ for (WaresQueue * ip_queue : input_queues_) {
ip_queue->add_to_economy(*e);
}
}
@@ -471,12 +471,12 @@
{
for (uint32_t i = descr().nr_working_positions(); i;) {
--i;
- delete m_working_positions[i].worker_request;
- m_working_positions[i].worker_request = nullptr;
- Worker * const w = m_working_positions[i].worker;
+ delete working_positions_[i].worker_request;
+ working_positions_[i].worker_request = nullptr;
+ Worker * const w = working_positions_[i].worker;
// Ensure we do not re-request the worker when remove_worker is called.
- m_working_positions[i].worker = nullptr;
+ working_positions_[i].worker = nullptr;
// Actually remove the worker
if (egbase.objects().object_still_available(w))
@@ -484,11 +484,11 @@
}
// Cleanup the wares queues
- for (uint32_t i = 0; i < m_input_queues.size(); ++i) {
- m_input_queues[i]->cleanup();
- delete m_input_queues[i];
+ for (uint32_t i = 0; i < input_queues_.size(); ++i) {
+ input_queues_[i]->cleanup();
+ delete input_queues_[i];
}
- m_input_queues.clear();
+ input_queues_.clear();
Building::cleanup(egbase);
@@ -503,7 +503,7 @@
(EditorGameBase & egbase, const WorkerDescr & wdes)
{
bool assigned = false;
- WorkingPosition * current = m_working_positions;
+ WorkingPosition * current = working_positions_;
for
(WorkingPosition * const end = current + descr().nr_working_positions();
current < end;
@@ -541,7 +541,7 @@
void ProductionSite::remove_worker(Worker & w)
{
molog("%s leaving\n", w.descr().descname().c_str());
- WorkingPosition * wp = m_working_positions;
+ WorkingPosition * wp = working_positions_;
for (const WareAmount& temp_wp : descr().working_positions()) {
DescriptionIndex const worker_index = temp_wp.first;
@@ -599,7 +599,7 @@
// placed on the slot that originally requested the arrived worker.
bool worker_placed = false;
DescriptionIndex idx = w->descr().worker_index();
- for (WorkingPosition * wp = psite.m_working_positions;; ++wp) {
+ for (WorkingPosition * wp = psite.working_positions_;; ++wp) {
if (wp->worker_request == &rq) {
if (wp->worker_request->get_index() == idx) {
// Place worker
@@ -619,7 +619,7 @@
{
uint8_t nwp = psite.descr().nr_working_positions();
uint8_t pos = 0;
- WorkingPosition * wp = psite.m_working_positions;
+ WorkingPosition * wp = psite.working_positions_;
for (; pos < nwp; ++wp, ++pos) {
// Find a fitting slot
if (!wp->worker && !worker_placed)
@@ -669,18 +669,18 @@
Building::act(game, data);
if
- (m_program_timer
+ (program_timer_
&&
- static_cast<int32_t>(game.get_gametime() - m_program_time) >= 0)
+ static_cast<int32_t>(game.get_gametime() - program_time_) >= 0)
{
- m_program_timer = false;
+ program_timer_ = false;
if (!can_start_working()) {
- while (!m_stack.empty())
+ while (!stack_.empty())
program_end(game, Failed);
} else {
- if (m_stack.empty()) {
- m_working_positions[0].worker->update_task_buildingwork(game);
+ if (stack_.empty()) {
+ working_positions_[0].worker->update_task_buildingwork(game);
return;
}
@@ -688,9 +688,9 @@
if (state.program->size() <= state.ip)
return program_end(game, Completed);
- if (anim_ != descr().get_animation(m_default_anim)) {
+ if (anim_ != descr().get_animation(default_anim_)) {
// Restart idle animation, which is the default
- start_animation(game, descr().get_animation(m_default_anim));
+ start_animation(game, descr().get_animation(default_anim_));
}
return program_act(game);
@@ -718,10 +718,10 @@
// 'Stop' of building is considered only when starting
// new productions cycle. Otherwise it can lead to consumption
// of input wares without producing anything
- if (m_is_stopped && state.ip == 0) {
+ if (is_stopped_ && state.ip == 0) {
program_end(game, Failed);
- m_program_timer = true;
- m_program_time = schedule_act(game, 20000);
+ program_timer_ = true;
+ program_time_ = schedule_act(game, 20000);
} else
(*state.program)[state.ip].execute(game, *this);
}
@@ -732,10 +732,10 @@
*/
bool ProductionSite::fetch_from_flag(Game & game)
{
- ++m_fetchfromflag;
+ ++fetchfromflag_;
if (can_start_working())
- m_working_positions[0].worker->update_task_buildingwork(game);
+ working_positions_[0].worker->update_task_buildingwork(game);
return true;
}
@@ -744,12 +744,12 @@
void ProductionSite::log_general_info(const EditorGameBase & egbase) {
Building::log_general_info(egbase);
- molog("m_is_stopped: %u\n", m_is_stopped);
+ molog("is_stopped: %u\n", is_stopped_);
}
void ProductionSite::set_stopped(bool const stopped) {
- m_is_stopped = stopped;
+ is_stopped_ = stopped;
get_economy()->rebalance_supply();
}
@@ -760,7 +760,7 @@
bool ProductionSite::can_start_working() const
{
for (uint32_t i = descr().nr_working_positions(); i;)
- if (m_working_positions[--i].worker_request)
+ if (working_positions_[--i].worker_request)
return false;
return true;
}
@@ -768,7 +768,7 @@
void ProductionSite::try_start_working(Game & game) {
if (can_start_working() && descr().working_positions().size()) {
- Worker & main_worker = *m_working_positions[0].worker;
+ Worker & main_worker = *working_positions_[0].worker;
main_worker.reset_tasks(game);
main_worker.start_task_buildingwork(game);
}
@@ -783,7 +783,7 @@
(Game & game, Worker & worker, bool const success)
{
assert(descr().working_positions().size());
- assert(&worker == m_working_positions[0].worker);
+ assert(&worker == working_positions_[0].worker);
// If unsuccessful: Check if we need to abort current program
if (!success) {
@@ -798,16 +798,16 @@
return true;
}
- if (m_fetchfromflag) {
- --m_fetchfromflag;
+ if (fetchfromflag_) {
+ --fetchfromflag_;
worker.start_task_fetchfromflag(game);
return true;
}
- if (!m_produced_wares.empty()) {
+ if (!produced_wares_.empty()) {
// There is still a produced ware waiting for delivery. Carry it out
// before continuing with the program.
- WareAmount& ware_type_with_count = *m_produced_wares.rbegin();
+ WareAmount& ware_type_with_count = *produced_wares_.rbegin();
{
DescriptionIndex const ware_index = ware_type_with_count.first;
const WareDescr & ware_ware_descr =
@@ -822,14 +822,14 @@
}
assert(ware_type_with_count.second);
if (--ware_type_with_count.second == 0)
- m_produced_wares.pop_back();
+ produced_wares_.pop_back();
return true;
}
- if (!m_recruited_workers.empty()) {
+ if (!recruited_workers_.empty()) {
// There is still a recruited worker waiting to be released. Send it
// out.
- WareAmount& worker_type_with_count = *m_recruited_workers.rbegin();
+ WareAmount& worker_type_with_count = *recruited_workers_.rbegin();
{
const WorkerDescr & worker_descr =
*owner().tribe().get_worker_descr(worker_type_with_count.first);
@@ -846,12 +846,12 @@
}
assert(worker_type_with_count.second);
if (--worker_type_with_count.second == 0)
- m_recruited_workers.pop_back();
+ recruited_workers_.pop_back();
return true;
}
// Drop all the wares that are too much out to the flag.
- for (WaresQueue * queue : m_input_queues) {
+ for (WaresQueue * queue : input_queues_) {
if (queue->get_filled() > queue->get_max_fill()) {
queue->set_filled(queue->get_filled() - 1);
const WareDescr & wd = *owner().tribe().get_ware_descr(queue->get_ware());
@@ -869,9 +869,7 @@
// Start program if we haven't already done so
State * state = get_state();
if (!state) {
- //m_program_timer = true;
find_and_start_next_program(game);
- // m_program_time = schedule_act(game, 10);
} else if (state->ip < state->program->size()) {
const ProductionProgram::Action & action = (*state->program)[state->ip];
return action.get_building_work(game, *this, worker);
@@ -890,8 +888,8 @@
State & state = top_state();
++state.ip;
state.phase = phase;
- m_program_timer = true;
- m_program_time = schedule_act(game, delay);
+ program_timer_ = true;
+ program_time_ = schedule_act(game, delay);
}
@@ -907,18 +905,18 @@
state.ip = 0;
state.phase = 0;
- m_stack.push_back(state);
+ stack_.push_back(state);
- m_program_timer = true;
+ program_timer_ = true;
uint32_t tdelta = 10;
- SkippedPrograms::const_iterator i = m_skipped_programs.find(program_name);
- if (i != m_skipped_programs.end()) {
+ SkippedPrograms::const_iterator i = skipped_programs_.find(program_name);
+ if (i != skipped_programs_.end()) {
uint32_t const gametime = game.get_gametime();
uint32_t const earliest_allowed_start_time = i->second + 10000;
if (gametime + tdelta < earliest_allowed_start_time)
tdelta = earliest_allowed_start_time - gametime;
}
- m_program_time = schedule_act(game, tdelta);
+ program_time_ = schedule_act(game, tdelta);
}
@@ -930,57 +928,57 @@
*/
void ProductionSite::program_end(Game & game, ProgramResult const result)
{
- assert(m_stack.size());
+ assert(stack_.size());
const std::string & program_name = top_state().program->name();
- m_stack.pop_back();
- if (!m_stack.empty())
+ stack_.pop_back();
+ if (!stack_.empty())
top_state().phase = result;
switch (result) {
case Failed:
//changed by TB below
- m_statistics.erase(m_statistics.begin(), m_statistics.begin() + 1);
- m_statistics.push_back(false);
+ statistics_.erase(statistics_.begin(), statistics_.begin() + 1);
+ statistics_.push_back(false);
calc_statistics();
- m_crude_percent = m_crude_percent * 8 / 10;
+ crude_percent_ = crude_percent_ * 8 / 10;
break;
//end of changed by TB
case Completed:
- m_skipped_programs.erase(program_name);
- m_statistics.erase(m_statistics.begin(), m_statistics.begin() + 1);
- m_statistics.push_back(true);
+ skipped_programs_.erase(program_name);
+ statistics_.erase(statistics_.begin(), statistics_.begin() + 1);
+ statistics_.push_back(true);
train_workers(game);
- m_crude_percent = m_crude_percent * 8 / 10 + 1000000 * 2 / 10;
+ crude_percent_ = crude_percent_ * 8 / 10 + 1000000 * 2 / 10;
calc_statistics();
break;
case Skipped:
- m_skipped_programs[program_name] = game.get_gametime();
+ skipped_programs_[program_name] = game.get_gametime();
//changed by TB below
- m_crude_percent = m_crude_percent * 98 / 100;
+ crude_percent_ = crude_percent_ * 98 / 100;
//end of changed by TB
break;
case None:
break;
}
- m_program_timer = true;
- m_program_time = schedule_act(game, m_post_timer);
+ program_timer_ = true;
+ program_time_ = schedule_act(game, post_timer_);
}
void ProductionSite::train_workers(Game & game)
{
for (uint32_t i = descr().nr_working_positions(); i;)
- m_working_positions[--i].worker->gain_experience(game);
+ working_positions_[--i].worker->gain_experience(game);
Building::workers_changed();
}
void ProductionSite::notify_player(Game & game, uint8_t minutes)
{
- if (m_last_stat_percent == 0 ||
- (m_last_stat_percent <= descr().out_of_resource_productivity_threshold()
+ if (last_stat_percent_ == 0 ||
+ (last_stat_percent_ <= descr().out_of_resource_productivity_threshold()
&& trend_ == Trend::kFalling)) {
if (descr().out_of_resource_heading().empty())
{
@@ -1016,13 +1014,13 @@
/// Changes the default anim string to \li anim
void ProductionSite::set_default_anim(std::string anim)
{
- if (m_default_anim == anim)
+ if (default_anim_ == anim)
return;
if (!descr().is_animation_known(anim))
return;
- m_default_anim = anim;
+ default_anim_ = anim;
}
=== modified file 'src/logic/map_objects/tribes/productionsite.h'
--- src/logic/map_objects/tribes/productionsite.h 2016-01-23 16:35:30 +0000
+++ src/logic/map_objects/tribes/productionsite.h 2016-02-09 15:10:44 +0000
@@ -73,46 +73,46 @@
return result;
}
const BillOfMaterials & working_positions() const {
- return m_working_positions;
+ return working_positions_;
}
bool is_output_ware_type (const DescriptionIndex& i) const {
- return m_output_ware_types .count(i);
+ return output_ware_types_ .count(i);
}
bool is_output_worker_type(const DescriptionIndex& i) const {
- return m_output_worker_types.count(i);
+ return output_worker_types_.count(i);
}
- const BillOfMaterials & inputs() const {return m_inputs;}
+ const BillOfMaterials & inputs() const {return inputs_;}
using Output = std::set<DescriptionIndex>;
- const Output & output_ware_types () const {return m_output_ware_types;}
- const Output & output_worker_types() const {return m_output_worker_types;}
+ const Output & output_ware_types () const {return output_ware_types_;}
+ const Output & output_worker_types() const {return output_worker_types_;}
const ProductionProgram * get_program(const std::string &) const;
using Programs = std::map<std::string, std::unique_ptr<ProductionProgram>>;
- const Programs & programs() const {return m_programs;}
+ const Programs & programs() const {return programs_;}
const std::string& out_of_resource_title() const {
- return m_out_of_resource_title;
+ return out_of_resource_title_;
}
const std::string& out_of_resource_heading() const {
- return m_out_of_resource_heading;
+ return out_of_resource_heading_;
}
const std::string& out_of_resource_message() const {
- return m_out_of_resource_message;
+ return out_of_resource_message_;
}
uint32_t out_of_resource_productivity_threshold() const {
return out_of_resource_productivity_threshold_;
}
private:
- BillOfMaterials m_working_positions;
- BillOfMaterials m_inputs;
- Output m_output_ware_types;
- Output m_output_worker_types;
- Programs m_programs;
- std::string m_out_of_resource_title;
- std::string m_out_of_resource_heading;
- std::string m_out_of_resource_message;
+ BillOfMaterials working_positions_;
+ BillOfMaterials inputs_;
+ Output output_ware_types_;
+ Output output_worker_types_;
+ Programs programs_;
+ std::string out_of_resource_title_;
+ std::string out_of_resource_heading_;
+ std::string out_of_resource_message_;
int out_of_resource_productivity_threshold_;
DISALLOW_COPY_AND_ASSIGN(ProductionSiteDescr);
@@ -143,7 +143,7 @@
void log_general_info(const EditorGameBase &) override;
- bool is_stopped() const {return m_is_stopped;}
+ bool is_stopped() const {return is_stopped_;}
void set_stopped(bool);
struct WorkingPosition {
@@ -155,21 +155,21 @@
};
WorkingPosition const * working_positions() const {
- return m_working_positions;
+ return working_positions_;
}
virtual bool has_workers(DescriptionIndex targetSite, Game & game);
- uint8_t get_statistics_percent() {return m_last_stat_percent;}
- uint8_t get_crude_statistics() {return (m_crude_percent + 5000) / 10000;}
-
-
- const std::string& production_result() const {return m_production_result;}
+ uint8_t get_statistics_percent() {return last_stat_percent_;}
+ uint8_t get_crude_statistics() {return (crude_percent_ + 5000) / 10000;}
+
+
+ const std::string& production_result() const {return production_result_;}
// Production and worker programs set this to explain the current
// state of the production. This string is shown as a tooltip
// when the mouse hovers over the building.
void set_production_result(const std::string& text) {
- m_production_result = text;
+ production_result_ = text;
}
WaresQueue & waresqueue(DescriptionIndex) override;
@@ -187,7 +187,7 @@
void set_economy(Economy *) override;
using InputQueues = std::vector<WaresQueue *>;
- const InputQueues & warequeues() const {return m_input_queues;}
+ const InputQueues & warequeues() const {return input_queues_;}
const std::vector<Worker *>& workers() const;
bool can_start_working() const;
@@ -240,8 +240,8 @@
*/
virtual void find_and_start_next_program(Game &);
- State & top_state() {assert(m_stack.size()); return *m_stack.rbegin();}
- State * get_state() {return m_stack.size() ? &*m_stack.rbegin() : nullptr;}
+ State & top_state() {assert(stack_.size()); return *stack_.rbegin();}
+ State * get_state() {return stack_.size() ? &*stack_.rbegin() : nullptr;}
void program_act(Game &);
/// \param phase can be used to pass a value on to the next step in the
@@ -257,12 +257,12 @@
void calc_statistics();
void try_start_working(Game &);
- void set_post_timer (int32_t const t) {m_post_timer = t;}
+ void set_post_timer (int32_t const t) {post_timer_ = t;}
protected: // TrainingSite must have access to this stuff
- WorkingPosition * m_working_positions;
+ WorkingPosition * working_positions_;
- int32_t m_fetchfromflag; ///< Number of wares to fetch from flag
+ int32_t fetchfromflag_; ///< Number of wares to fetch from flag
/// If a program has ended with the result Skipped, that program may not
/// start again until a certain time has passed. This is a map from program
@@ -270,28 +270,28 @@
/// is added to this map, with the current game time. (When the program ends
/// with any other result, its name is removed from the map.)
using SkippedPrograms = std::map<std::string, Time>;
- SkippedPrograms m_skipped_programs;
+ SkippedPrograms skipped_programs_;
using Stack = std::vector<State>;
- Stack m_stack; ///< program stack
- bool m_program_timer; ///< execute next instruction based on pointer
- int32_t m_program_time; ///< timer time
- int32_t m_post_timer; ///< Time to schedule after ends
+ Stack stack_; ///< program stack
+ bool program_timer_; ///< execute next instruction based on pointer
+ int32_t program_time_; ///< timer time
+ int32_t post_timer_; ///< Time to schedule after ends
- BillOfMaterials m_produced_wares;
- BillOfMaterials m_recruited_workers;
- InputQueues m_input_queues; ///< input queues for all inputs
- std::vector<bool> m_statistics;
- uint8_t m_last_stat_percent;
- uint32_t m_crude_percent; //integer0-10000000, to be shirink to range 0-10
- bool m_is_stopped;
- std::string m_default_anim; // normally "idle", "empty", if empty mine.
+ BillOfMaterials produced_wares_;
+ BillOfMaterials recruited_workers_;
+ InputQueues input_queues_; ///< input queues for all inputs
+ std::vector<bool> statistics_;
+ uint8_t last_stat_percent_;
+ uint32_t crude_percent_; //integer0-10000000, to be shirink to range 0-10
+ bool is_stopped_;
+ std::string default_anim_; // normally "idle", "empty", if empty mine.
private:
enum class Trend {kUnchanged, kRising, kFalling};
Trend trend_;
- std::string m_statistics_string_on_changed_statistics;
- std::string m_production_result; // hover tooltip text
+ std::string statistics_string_on_changed_statistics_;
+ std::string production_result_; // hover tooltip text
DISALLOW_COPY_AND_ASSIGN(ProductionSite);
};
@@ -303,16 +303,16 @@
* releasing some wares out of a building
*/
struct Input {
- Input(const DescriptionIndex& Ware, uint8_t const Max) : m_ware(Ware), m_max(Max)
+ Input(const DescriptionIndex& Ware, uint8_t const Max) : ware_(Ware), max_(Max)
{}
~Input() {}
- DescriptionIndex ware() const {return m_ware;}
- uint8_t max() const {return m_max;}
+ DescriptionIndex ware() const {return ware_;}
+ uint8_t max() const {return max_;}
private:
- DescriptionIndex m_ware;
- uint8_t m_max;
+ DescriptionIndex ware_;
+ uint8_t max_;
};
/**
=== modified file 'src/logic/map_objects/tribes/requirements.cc'
--- src/logic/map_objects/tribes/requirements.cc 2015-11-29 09:43:15 +0000
+++ src/logic/map_objects/tribes/requirements.cc 2016-02-09 15:10:44 +0000
@@ -68,7 +68,7 @@
RequirementsStorage::RequirementsStorage
(uint32_t const _id, Reader const reader)
- : m_id(_id), m_reader(reader)
+ : id_(_id), reader_(reader)
{
StorageMap & s = storageMap();
@@ -81,7 +81,7 @@
uint32_t RequirementsStorage::id() const
{
- return m_id;
+ return id_;
}
Requirements RequirementsStorage::read
@@ -98,7 +98,7 @@
if (it == s.end())
throw GameDataError("unknown requirement id %u", id);
- return it->second->m_reader(fr, egbase, mol);
+ return it->second->reader_(fr, egbase, mol);
}
RequirementsStorage::StorageMap & RequirementsStorage::storageMap()
=== modified file 'src/logic/map_objects/tribes/requirements.h'
--- src/logic/map_objects/tribes/requirements.h 2016-01-06 19:11:20 +0000
+++ src/logic/map_objects/tribes/requirements.h 2016-02-09 15:10:44 +0000
@@ -125,8 +125,8 @@
private:
using StorageMap = std::map<uint32_t, RequirementsStorage *>;
- uint32_t m_id;
- Reader m_reader;
+ uint32_t id_;
+ Reader reader_;
static StorageMap & storageMap();
};
=== modified file 'src/map_io/map_buildingdata_packet.cc'
--- src/map_io/map_buildingdata_packet.cc 2016-02-08 17:25:17 +0000
+++ src/map_io/map_buildingdata_packet.cc 2016-02-09 15:10:44 +0000
@@ -614,7 +614,7 @@
uint16_t const packet_version = fr.unsigned_16();
if (packet_version == kCurrentPacketVersionProductionsite) {
ProductionSite::WorkingPosition & wp_begin =
- *productionsite.m_working_positions;
+ *productionsite.working_positions_;
const ProductionSiteDescr & pr_descr = productionsite.descr();
const BillOfMaterials & working_positions = pr_descr.working_positions();
@@ -702,7 +702,7 @@
"number of working positions");
// items from flags
- productionsite.m_fetchfromflag = fr.signed_32();
+ productionsite.fetchfromflag_ = fr.signed_32();
// skipped programs
uint32_t const gametime = game.get_gametime();
@@ -716,7 +716,7 @@
"program %s was skipped at time %u, but time is only "
"%u",
program_name, skip_time, gametime);
- productionsite.m_skipped_programs[program_name] = skip_time;
+ productionsite.skipped_programs_[program_name] = skip_time;
} else {
fr.unsigned_32(); // eat skip time
log
@@ -728,29 +728,29 @@
// state
uint16_t const nr_progs = fr.unsigned_16();
- productionsite.m_stack.resize(nr_progs);
+ productionsite.stack_.resize(nr_progs);
for (uint16_t i = 0; i < nr_progs; ++i) {
std::string program_name = fr.c_string();
std::transform
(program_name.begin(), program_name.end(), program_name.begin(),
tolower);
- productionsite.m_stack[i].program =
+ productionsite.stack_[i].program =
productionsite.descr().get_program(program_name);
- productionsite.m_stack[i].ip = fr. signed_32();
- productionsite.m_stack[i].phase = fr. signed_32();
- productionsite.m_stack[i].flags = fr.unsigned_32();
+ productionsite.stack_[i].ip = fr. signed_32();
+ productionsite.stack_[i].phase = fr. signed_32();
+ productionsite.stack_[i].flags = fr.unsigned_32();
uint32_t serial = fr.unsigned_32();
if (serial)
- productionsite.m_stack[i].objvar = &mol.get<MapObject>(serial);
- productionsite.m_stack[i].coord = read_coords_32_allow_null(&fr, game.map().extent());
+ productionsite.stack_[i].objvar = &mol.get<MapObject>(serial);
+ productionsite.stack_[i].coord = read_coords_32_allow_null(&fr, game.map().extent());
}
- productionsite.m_program_timer = fr.unsigned_8();
- productionsite.m_program_time = fr.signed_32();
+ productionsite.program_timer_ = fr.unsigned_8();
+ productionsite.program_time_ = fr.signed_32();
uint16_t nr_queues = fr.unsigned_16();
- assert(!productionsite.m_input_queues.size());
+ assert(!productionsite.input_queues_.size());
for (uint16_t i = 0; i < nr_queues; ++i) {
WaresQueue * wq = new WaresQueue(productionsite, INVALID_INDEX, 0);
wq->read(fr, game, mol);
@@ -758,16 +758,16 @@
if (!game.tribes().ware_exists(wq->get_ware())) {
delete wq;
} else {
- productionsite.m_input_queues.push_back(wq);
+ productionsite.input_queues_.push_back(wq);
}
}
uint16_t const stats_size = fr.unsigned_16();
- productionsite.m_statistics.resize(stats_size);
- for (uint32_t i = 0; i < productionsite.m_statistics.size(); ++i)
- productionsite.m_statistics[i] = fr.unsigned_8();
- productionsite.m_statistics_string_on_changed_statistics = fr.c_string();
- productionsite.m_production_result = fr.c_string();
+ productionsite.statistics_.resize(stats_size);
+ for (uint32_t i = 0; i < productionsite.statistics_.size(); ++i)
+ productionsite.statistics_[i] = fr.unsigned_8();
+ productionsite.statistics_string_on_changed_statistics_ = fr.c_string();
+ productionsite.production_result_ = fr.c_string();
} else {
throw UnhandledVersionError("MapBuildingdataPacket - Productionsite",
packet_version, kCurrentPacketVersionProductionsite);
@@ -1183,7 +1183,7 @@
uint32_t const nr_working_positions =
productionsite.descr().nr_working_positions();
const ProductionSite::WorkingPosition & begin =
- productionsite.m_working_positions[0];
+ productionsite.working_positions_[0];
const ProductionSite::WorkingPosition & end =
(&begin)[nr_working_positions];
uint32_t nr_workers = 0;
@@ -1205,44 +1205,44 @@
fw.unsigned_32(mos.get_object_file_index(*w));
}
- fw.signed_32(productionsite.m_fetchfromflag);
+ fw.signed_32(productionsite.fetchfromflag_);
// skipped programs
assert
- (productionsite.m_skipped_programs.size()
+ (productionsite.skipped_programs_.size()
<=
std::numeric_limits<uint8_t>::max());
- fw.unsigned_8(productionsite.m_skipped_programs.size());
+ fw.unsigned_8(productionsite.skipped_programs_.size());
- for (const std::pair<std::string, Time>& temp_program : productionsite.m_skipped_programs) {
+ for (const std::pair<std::string, Time>& temp_program : productionsite.skipped_programs_) {
fw.string (temp_program.first);
fw.unsigned_32(temp_program.second);
}
// state
- uint16_t const program_size = productionsite.m_stack.size();
+ uint16_t const program_size = productionsite.stack_.size();
fw.unsigned_16(program_size);
for (uint16_t i = 0; i < program_size; ++i) {
- fw.string (productionsite.m_stack[i].program->name());
- fw. signed_32(productionsite.m_stack[i].ip);
- fw. signed_32(productionsite.m_stack[i].phase);
- fw.unsigned_32(productionsite.m_stack[i].flags);
- fw.unsigned_32(mos.get_object_file_index_or_zero(productionsite.m_stack[i].objvar.get(game)));
- write_coords_32(&fw, productionsite.m_stack[i].coord);
+ fw.string (productionsite.stack_[i].program->name());
+ fw. signed_32(productionsite.stack_[i].ip);
+ fw. signed_32(productionsite.stack_[i].phase);
+ fw.unsigned_32(productionsite.stack_[i].flags);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(productionsite.stack_[i].objvar.get(game)));
+ write_coords_32(&fw, productionsite.stack_[i].coord);
}
- fw.unsigned_8(productionsite.m_program_timer);
- fw. signed_32(productionsite.m_program_time);
+ fw.unsigned_8(productionsite.program_timer_);
+ fw. signed_32(productionsite.program_time_);
- const uint16_t input_queues_size = productionsite.m_input_queues.size();
+ const uint16_t input_queues_size = productionsite.input_queues_.size();
fw.unsigned_16(input_queues_size);
for (uint16_t i = 0; i < input_queues_size; ++i)
- productionsite.m_input_queues[i]->write(fw, game, mos);
+ productionsite.input_queues_[i]->write(fw, game, mos);
- const uint16_t statistics_size = productionsite.m_statistics.size();
+ const uint16_t statistics_size = productionsite.statistics_.size();
fw.unsigned_16(statistics_size);
for (uint32_t i = 0; i < statistics_size; ++i)
- fw.unsigned_8(productionsite.m_statistics[i]);
- fw.string(productionsite.m_statistics_string_on_changed_statistics);
+ fw.unsigned_8(productionsite.statistics_[i]);
+ fw.string(productionsite.statistics_string_on_changed_statistics_);
fw.string(productionsite.production_result());
}
Follow ups