Klaus Halfmann has proposed merging lp:~widelands-dev/widelands/bug-1395278-logic2 into lp:widelands.
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-logic2/+merge/287687 Review is ok for me, pure renaming, nothing else, will play some open network game now... -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-logic2 into lp:widelands.
=== modified file 'src/game_io/game_player_economies_packet.cc' --- src/game_io/game_player_economies_packet.cc 2015-11-28 22:29:26 +0000 +++ src/game_io/game_player_economies_packet.cc 2016-03-01 18:23:35 +0000 @@ -48,7 +48,7 @@ if (packet_version == kCurrentPacketVersion) { iterate_players_existing(p, nr_players, game, player) try { - Player::Economies & economies = player->m_economies; + Player::Economies & economies = player->economies_; for (uint32_t i = 0; i < economies.size(); ++i) { uint32_t value = fr.unsigned_32(); if (value < 0xffffffff) { @@ -106,7 +106,7 @@ const Field & field_0 = map[0]; PlayerNumber const nr_players = map.get_nrplayers(); iterate_players_existing_const(p, nr_players, game, player) { - const Player::Economies & economies = player->m_economies; + const Player::Economies & economies = player->economies_; for (Economy * temp_economy : economies) { bool wrote_this_economy = false; === modified file 'src/game_io/game_player_info_packet.cc' --- src/game_io/game_player_info_packet.cc 2016-01-22 19:53:32 +0000 +++ src/game_io/game_player_info_packet.cc 2016-03-01 18:23:35 +0000 @@ -64,12 +64,12 @@ player.read_statistics(fr); player.read_remaining_shipnames(fr); - player.m_casualties = fr.unsigned_32(); - player.m_kills = fr.unsigned_32(); - player.m_msites_lost = fr.unsigned_32(); - player.m_msites_defeated = fr.unsigned_32(); - player.m_civil_blds_lost = fr.unsigned_32(); - player.m_civil_blds_defeated = fr.unsigned_32(); + player.casualties_ = fr.unsigned_32(); + player.kills_ = fr.unsigned_32(); + player.msites_lost_ = fr.unsigned_32(); + player.msites_defeated_ = fr.unsigned_32(); + player.civil_blds_lost_ = fr.unsigned_32(); + player.civil_blds_defeated_ = fr.unsigned_32(); } } game.read_statistics(fr); @@ -95,9 +95,9 @@ iterate_players_existing_const(p, nr_players, game, plr) { fw.unsigned_8(1); // Player is in game. - fw.unsigned_8(plr->m_see_all); + fw.unsigned_8(plr->see_all_); - fw.unsigned_8(plr->m_plnum); + fw.unsigned_8(plr->player_number_); fw.unsigned_8(plr->team_number()); fw.c_string(plr->tribe().name().c_str()); @@ -107,8 +107,8 @@ // Economies are in a packet after map loading - fw.c_string(plr->m_name.c_str()); - fw.c_string(plr->m_ai.c_str()); + fw.c_string(plr->name_.c_str()); + fw.c_string(plr->ai_.c_str()); plr->write_statistics(fw); plr->write_remaining_shipnames(fw); === modified file 'src/logic/editor_game_base.cc' --- src/logic/editor_game_base.cc 2016-02-08 20:44:17 +0000 +++ src/logic/editor_game_base.cc 2016-03-01 18:23:35 +0000 @@ -184,7 +184,7 @@ (MapIndex const i, PlayerNumber const new_owner) { iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) { - Player::Field & player_field = p->m_fields[i]; + Player::Field & player_field = p->fields_[i]; if (1 < player_field.vision) { player_field.owner = new_owner; } @@ -195,7 +195,7 @@ { if (!Road::is_road_descr(descr)) iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) { - Player::Field & player_field = p->m_fields[i]; + Player::Field & player_field = p->fields_[i]; if (1 < player_field.vision) { player_field.map_object_descr[TCoords<>::None] = descr; } @@ -523,7 +523,7 @@ MapIndex const i = f .field - &first_field; MapIndex const neighbour_i = neighbour.field - &first_field; iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) { - Player::Field & first_player_field = *p->m_fields; + Player::Field & first_player_field = *p->fields_; Player::Field & player_field = (&first_player_field)[i]; if (1 < player_field .vision === modified file 'src/logic/map.cc' --- src/logic/map.cc 2016-02-22 08:50:04 +0000 +++ src/logic/map.cc 2016-03-01 18:23:35 +0000 @@ -1694,12 +1694,12 @@ start = FCoords(instart, &operator[](instart)); end = FCoords(inend, &operator[](inend)); - path.m_path.clear(); + path.path_.clear(); // Some stupid cases... if (start == end) { - path.m_start = start; - path.m_end = end; + path.start_ = start; + path.end_ = end; return 0; // duh... } @@ -1798,13 +1798,13 @@ // Now unwind the taken route (even if we couldn't find a complete one!) int32_t const result = cur == end ? curpf->real_cost : -1; - path.m_start = start; - path.m_end = cur; + path.start_ = start; + path.end_ = cur; - path.m_path.clear(); + path.path_.clear(); while (curpf->backlink != IDLE) { - path.m_path.push_back(curpf->backlink); + path.path_.push_back(curpf->backlink); // Reverse logic! (WALK_NW needs to find the SE neighbour) get_neighbour(cur, get_reverse_dir(curpf->backlink), &cur); === modified file 'src/logic/mapastar.cc' --- src/logic/mapastar.cc 2015-11-29 09:43:15 +0000 +++ src/logic/mapastar.cc 2016-03-01 18:23:35 +0000 @@ -31,8 +31,8 @@ */ void MapAStarBase::pathto(Coords dest, Path & path) const { - path.m_end = dest; - path.m_path.clear(); + path.end_ = dest; + path.path_.clear(); Coords cur = dest; for (;;) { @@ -43,12 +43,12 @@ if (pf.backlink == IDLE) break; - path.m_path.push_back(pf.backlink); + path.path_.push_back(pf.backlink); map.get_neighbour(cur, get_reverse_dir(pf.backlink), &cur); } - path.m_start = cur; + path.start_ = cur; } } // namespace Widelands === modified file 'src/logic/objective.h' --- src/logic/objective.h 2015-08-04 07:49:23 +0000 +++ src/logic/objective.h 2016-03-01 18:23:35 +0000 @@ -33,57 +33,57 @@ class Objective { public: Objective(const std::string& init_name) - : m_name(init_name), - m_descname(init_name), - m_descr(_("This objective has no description.")), - m_visible(true), - m_done(false) { + : name_(init_name), + descname_(init_name), + descr_(_("This objective has no description.")), + visible_(true), + done_(false) { } // Unique internal name of the objective. const std::string& name() const { - return m_name; + return name_; } // User facing (translated) descriptive name. const std::string& descname() const { - return m_descname; + return descname_; } void set_descname(const std::string& new_name) { - m_descname = new_name; + descname_ = new_name; } // Description text of this name. const std::string& descr() const { - return m_descr; + return descr_; } void set_descr(const std::string& new_descr) { - m_descr = new_descr; + descr_ = new_descr; } // True, if this objective is fulfilled. bool done() const { - return m_done; + return done_; } void set_done(bool t) { - m_done = t; + done_ = t; } // True, if this objective is visible to the user. bool visible() const { - return m_visible; + return visible_; } void set_visible(const bool t) { - m_visible = t; + visible_ = t; } private: - const std::string m_name; - std::string m_descname; - std::string m_descr; - bool m_visible; - bool m_done; + const std::string name_; + std::string descname_; + std::string descr_; + bool visible_; + bool done_; }; } === modified file 'src/logic/path.cc' --- src/logic/path.cc 2015-11-29 09:43:15 +0000 +++ src/logic/path.cc 2016-03-01 18:23:35 +0000 @@ -33,9 +33,9 @@ constexpr uint8_t kCurrentPacketVersion = 1; Path::Path(CoordPath & o) - : m_start(o.get_start()), m_end(o.get_end()), m_path(o.steps()) + : start_(o.get_start()), end_(o.get_end()), path_(o.steps()) { - std::reverse(m_path.begin(), m_path.end()); // path stored in reverse order + std::reverse(path_.begin(), path_.end()); // path stored in reverse order } /* @@ -45,11 +45,11 @@ */ void Path::reverse() { - std::swap(m_start, m_end); - std::reverse(m_path.begin(), m_path.end()); + std::swap(start_, end_); + std::reverse(path_.begin(), path_.end()); - for (uint32_t i = 0; i < m_path.size(); ++i) - m_path[i] = get_reverse_dir(m_path[i]); + for (uint32_t i = 0; i < path_.size(); ++i) + path_[i] = get_reverse_dir(path_[i]); } /* @@ -58,8 +58,8 @@ =============== */ void Path::append(const Map & map, const Direction dir) { - m_path.insert(m_path.begin(), dir); // stores in reversed order! - map.get_neighbour(m_end, dir, &m_end); + path_.insert(path_.begin(), dir); // stores in reversed order! + map.get_neighbour(end_, dir, &end_); } /** @@ -68,13 +68,13 @@ void Path::save(FileWrite & fw) const { fw.unsigned_8(kCurrentPacketVersion); - write_coords_32(&fw, m_start); + write_coords_32(&fw, start_); // Careful: steps are stored in the reverse order in m_path // However, we save them in the forward order, to make loading easier - fw.unsigned_32(m_path.size()); - for (uint32_t i = m_path.size(); i > 0; --i) - write_direction_8(&fw, m_path[i - 1]); + fw.unsigned_32(path_.size()); + for (uint32_t i = path_.size(); i > 0; --i) + write_direction_8(&fw, path_[i - 1]); } /** @@ -89,8 +89,8 @@ uint8_t packet_version = fr.unsigned_8(); if (packet_version == kCurrentPacketVersion) { - m_start = m_end = read_coords_32(&fr, map.extent()); - m_path.clear(); + start_ = end_ = read_coords_32(&fr, map.extent()); + path_.clear(); uint32_t steps = fr.unsigned_32(); while (steps--) append(map, read_direction_8(&fr)); @@ -108,10 +108,10 @@ =============== */ CoordPath::CoordPath(const Map & map, const Path & path) { - m_coords.clear(); - m_path.clear(); + coords_.clear(); + path_.clear(); - m_coords.push_back(path.get_start()); + coords_.push_back(path.get_start()); Coords c = path.get_start(); @@ -119,9 +119,9 @@ for (Path::StepVector::size_type i = 0; i < nr_steps; ++i) { const char dir = path[i]; - m_path.push_back(dir); + path_.push_back(dir); map.get_neighbour(c, dir, &c); - m_coords.push_back(c); + coords_.push_back(c); } } @@ -130,8 +130,8 @@ /// \return -1 if node is not part of this path. int32_t CoordPath::get_index(Coords const c) const { - for (uint32_t i = 0; i < m_coords.size(); ++i) - if (m_coords[i] == c) + for (uint32_t i = 0; i < coords_.size(); ++i) + if (coords_[i] == c) return i; return -1; @@ -145,11 +145,11 @@ */ void CoordPath::reverse() { - std::reverse(m_path.begin(), m_path.end()); - std::reverse(m_coords.begin(), m_coords.end()); + std::reverse(path_.begin(), path_.end()); + std::reverse(coords_.begin(), coords_.end()); - for (uint32_t i = 0; i < m_path.size(); ++i) - m_path[i] = get_reverse_dir(m_path[i]); + for (uint32_t i = 0; i < path_.size(); ++i) + path_[i] = get_reverse_dir(path_[i]); } @@ -159,10 +159,10 @@ =============== */ void CoordPath::truncate(const std::vector<char>::size_type after) { - assert(after <= m_path.size()); + assert(after <= path_.size()); - m_path.erase(m_path.begin() + after, m_path.end()); - m_coords.erase(m_coords.begin() + after + 1, m_coords.end()); + path_.erase(path_.begin() + after, path_.end()); + coords_.erase(coords_.begin() + after + 1, coords_.end()); } /* @@ -171,10 +171,10 @@ =============== */ void CoordPath::trim_start(const std::vector<char>::size_type before) { - assert(before <= m_path.size()); + assert(before <= path_.size()); - m_path.erase(m_path.begin(), m_path.begin() + before); - m_coords.erase(m_coords.begin(), m_coords.begin() + before); + path_.erase(path_.begin(), path_.begin() + before); + coords_.erase(coords_.begin(), coords_.begin() + before); } /* @@ -192,8 +192,8 @@ const char dir = tail[i]; map.get_neighbour(c, dir, &c); - m_path.push_back(dir); - m_coords.push_back(c); + path_.push_back(dir); + coords_.push_back(c); } } @@ -206,9 +206,9 @@ { assert(tail.get_start() == get_end()); - m_path.insert(m_path.end(), tail.m_path.begin(), tail.m_path.end()); - m_coords.insert - (m_coords.end(), tail.m_coords.begin() + 1, tail.m_coords.end()); + path_.insert(path_.end(), tail.path_.begin(), tail.path_.end()); + coords_.insert + (coords_.end(), tail.coords_.begin() + 1, tail.coords_.end()); } } === modified file 'src/logic/path.h' --- src/logic/path.h 2014-09-19 12:54:54 +0000 +++ src/logic/path.h 2016-03-01 18:23:35 +0000 @@ -42,54 +42,54 @@ friend struct MapAStarBase; Path() {} - Path(const Coords & c) : m_start(c), m_end(c) {} + Path(const Coords & c) : start_(c), end_(c) {} Path(CoordPath &); void reverse(); - Coords get_start() const {return m_start;} - Coords get_end () const {return m_end;} + Coords get_start() const {return start_;} + Coords get_end () const {return end_;} using StepVector = std::vector<Direction>; - StepVector::size_type get_nsteps() const {return m_path.size();} + StepVector::size_type get_nsteps() const {return path_.size();} Direction operator[](StepVector::size_type const i) const { - assert(i < m_path.size()); - return m_path[m_path.size() - i - 1]; + assert(i < path_.size()); + return path_[path_.size() - i - 1]; } void append(const Map & map, Direction); void reorigin(const Coords & new_origin, const Extent & extent) { - m_start.reorigin(new_origin, extent); - m_end .reorigin(new_origin, extent); + start_.reorigin(new_origin, extent); + end_ .reorigin(new_origin, extent); } void save(FileWrite & fw) const; void load(FileRead & fr, const Map & map); private: - Coords m_start; - Coords m_end; - StepVector m_path; + Coords start_; + Coords end_; + StepVector path_; }; // CoordPath is an extended path that also caches related Coords struct CoordPath { CoordPath() {} - CoordPath(Coords c) {m_coords.push_back(c);} + CoordPath(Coords c) {coords_.push_back(c);} CoordPath(const Map & map, const Path & path); - Coords get_start() const {return m_coords.front();} - Coords get_end () const {return m_coords.back ();} - const std::vector<Coords> &get_coords() const {return m_coords;} + Coords get_start() const {return coords_.front();} + Coords get_end () const {return coords_.back ();} + const std::vector<Coords> &get_coords() const {return coords_;} using StepVector = std::vector<Direction>; - StepVector::size_type get_nsteps() const {return m_path.size();} + StepVector::size_type get_nsteps() const {return path_.size();} Direction operator[](StepVector::size_type const i) const { - assert(i < m_path.size()); - return m_path[i]; + assert(i < path_.size()); + return path_[i]; } - const StepVector & steps() const {return m_path;} + const StepVector & steps() const {return path_;} int32_t get_index(Coords field) const; @@ -100,8 +100,8 @@ void append(const CoordPath & tail); private: - StepVector m_path; // directions - std::vector<Coords> m_coords; // m_coords.size() == m_path.size() + 1 + StepVector path_; // directions + std::vector<Coords> coords_; // coords_.size() == path_.size() + 1 }; } === modified file 'src/logic/pathfield.cc' --- src/logic/pathfield.cc 2014-11-28 16:40:55 +0000 +++ src/logic/pathfield.cc 2016-03-01 18:23:35 +0000 @@ -28,20 +28,20 @@ {} -PathfieldManager::PathfieldManager() : m_nrfields(0) {} +PathfieldManager::PathfieldManager() : nrfields_(0) {} void PathfieldManager::set_size(uint32_t const nrfields) { - if (m_nrfields != nrfields) - m_list.clear(); + if (nrfields_ != nrfields) + list_.clear(); - m_nrfields = nrfields; + nrfields_ = nrfields; } boost::shared_ptr<Pathfields> PathfieldManager::allocate() { - for (boost::shared_ptr<Pathfields>& pathfield : m_list) { + for (boost::shared_ptr<Pathfields>& pathfield : list_) { if (pathfield.use_count() == 1) { ++pathfield->cycle; if (!pathfield->cycle) { @@ -51,18 +51,18 @@ } } - if (m_list.size() >= 8) + if (list_.size() >= 8) throw wexception("PathfieldManager::allocate: unbounded nesting?"); - boost::shared_ptr<Pathfields> pf(new Pathfields(m_nrfields)); + boost::shared_ptr<Pathfields> pf(new Pathfields(nrfields_)); clear(pf); - m_list.push_back(pf); + list_.push_back(pf); return pf; } void PathfieldManager::clear(const boost::shared_ptr<Pathfields> & pf) { - for (uint32_t i = 0; i < m_nrfields; ++i) + for (uint32_t i = 0; i < nrfields_; ++i) pf->fields[i].cycle = 0; pf->cycle = 1; } === modified file 'src/logic/pathfield.h' --- src/logic/pathfield.h 2014-09-19 12:54:54 +0000 +++ src/logic/pathfield.h 2016-03-01 18:23:35 +0000 @@ -82,8 +82,8 @@ using List = std::vector<boost::shared_ptr<Pathfields>>; - uint32_t m_nrfields; - List m_list; + uint32_t nrfields_; + List list_; }; } === modified file 'src/logic/player.cc' --- src/logic/player.cc 2016-02-18 08:42:46 +0000 +++ src/logic/player.cc 2016-03-01 18:23:35 +0000 @@ -140,45 +140,45 @@ const TribeDescr & tribe_descr, const std::string & name) : - m_egbase (the_egbase), - m_initialization_index(initialization_index), - m_team_number(0), - m_team_player_uptodate(false), - m_see_all (false), - m_plnum (plnum), - m_tribe (tribe_descr), - m_casualties (0), - m_kills (0), - m_msites_lost (0), - m_msites_defeated (0), - m_civil_blds_lost (0), - m_civil_blds_defeated(0), - m_fields (nullptr), - m_allowed_worker_types(the_egbase.tribes().nrworkers(), true), - m_allowed_building_types(the_egbase.tribes().nrbuildings(), true), - m_ai(""), - m_current_produced_statistics(the_egbase.tribes().nrwares()), - m_current_consumed_statistics(the_egbase.tribes().nrwares()), - m_ware_productions(the_egbase.tribes().nrwares()), - m_ware_consumptions(the_egbase.tribes().nrwares()), - m_ware_stocks(the_egbase.tribes().nrwares()) + egbase_ (the_egbase), + initialization_index_(initialization_index), + team_number_(0), + team_player_uptodate_(false), + see_all_ (false), + player_number_ (plnum), + tribe_ (tribe_descr), + casualties_ (0), + kills_ (0), + msites_lost_ (0), + msites_defeated_ (0), + civil_blds_lost_ (0), + civil_blds_defeated_(0), + fields_ (nullptr), + allowed_worker_types_(the_egbase.tribes().nrworkers(), true), + allowed_building_types_(the_egbase.tribes().nrbuildings(), true), + ai_(""), + current_produced_statistics_(the_egbase.tribes().nrwares()), + current_consumed_statistics_(the_egbase.tribes().nrwares()), + ware_productions_(the_egbase.tribes().nrwares()), + ware_consumptions_(the_egbase.tribes().nrwares()), + ware_stocks_(the_egbase.tribes().nrwares()) { set_name(name); // Disallow workers that the player's tribe doesn't have. - for (size_t worker_index = 0; worker_index < m_allowed_worker_types.size(); ++worker_index) { + for (size_t worker_index = 0; worker_index < allowed_worker_types_.size(); ++worker_index) { if (!tribe().has_worker(static_cast<DescriptionIndex>(worker_index))) { - m_allowed_worker_types[worker_index] = false; + allowed_worker_types_[worker_index] = false; } } // Disallow buildings that the player's tribe doesn't have and // that aren't militarysites that the tribe could conquer. - for (size_t i = 0; i < m_allowed_building_types.size(); ++i) { + for (size_t i = 0; i < allowed_building_types_.size(); ++i) { const DescriptionIndex& building_index = static_cast<DescriptionIndex>(i); const BuildingDescr& descr = *tribe().get_building_descr(building_index); if (!tribe().has_building(building_index) && descr.type() != MapObjectType::MILITARYSITE) { - m_allowed_building_types[i] = false; + allowed_building_types_[i] = false; } } @@ -201,22 +201,22 @@ //Populating remaining_shipnames vector for (const auto& shipname : tribe_descr.get_ship_names()) { - m_remaining_shipnames.insert(shipname); + remaining_shipnames_.insert(shipname); } } Player::~Player() { - delete[] m_fields; + delete[] fields_; } void Player::create_default_infrastructure() { const Map & map = egbase().map(); - if (map.get_starting_pos(m_plnum)) { + if (map.get_starting_pos(player_number_)) { const TribeBasicInfo::Initialization & initialization = - tribe().initialization(m_initialization_index); + tribe().initialization(initialization_index_); Game & game = dynamic_cast<Game&>(egbase()); @@ -228,13 +228,13 @@ game.enqueue_command(new CmdLuaCoroutine(game.get_gametime(), cr.release())); // Check if other starting positions are shared in and initialize them as well - for (uint8_t n = 0; n < m_further_shared_in_player.size(); ++n) { - Coords const further_pos = map.get_starting_pos(m_further_shared_in_player.at(n)); + for (uint8_t n = 0; n < further_shared_in_player_.size(); ++n) { + Coords const further_pos = map.get_starting_pos(further_shared_in_player_.at(n)); // Run the corresponding script std::unique_ptr<LuaCoroutine> ncr = game.lua() - .run_script(tribe().initialization(m_further_initializations.at(n)).script) + .run_script(tribe().initialization(further_initializations_.at(n)).script) ->get_coroutine("func"); ncr->push_arg(this); ncr->push_arg(further_pos); @@ -248,7 +248,7 @@ "no starting position.\n" "You can manually add a starting position with the Widelands " "Editor to fix this problem."), - static_cast<unsigned int>(m_plnum)); + static_cast<unsigned int>(player_number_)); } @@ -260,7 +260,7 @@ const Map & map = egbase().map(); assert(map.get_width ()); assert(map.get_height()); - m_fields = new Field[map.max_index()]; + fields_ = new Field[map.max_index()]; } /** @@ -268,8 +268,8 @@ */ void Player::set_team_number(TeamNumber team) { - m_team_number = team; - m_team_player_uptodate = false; + team_number_ = team; + team_player_uptodate_ = false; } /** @@ -280,17 +280,17 @@ { return &other != this && - (!m_team_number || m_team_number != other.m_team_number); + (!team_number_ || team_number_ != other.team_number_); } /** * Updates the vector containing allied players */ void Player::update_team_players() { - m_team_player.clear(); - m_team_player_uptodate = true; + team_player_.clear(); + team_player_uptodate_ = true; - if (!m_team_number) + if (!team_number_) return; for (PlayerNumber i = 1; i <= MAX_PLAYERS; ++i) { @@ -299,8 +299,8 @@ continue; if (other == this) continue; - if (m_team_number == other->m_team_number) - m_team_player.push_back(other); + if (team_number_ == other->team_number_) + team_player_.push_back(other); } } @@ -370,14 +370,14 @@ void Player::message_object_removed(MessageId m_id) const { // Send delete command - upcast(Game, game, &m_egbase); + upcast(Game, game, &egbase_); if (!game) { return; } game->cmdqueue().enqueue (new CmdDeleteMessage - (game->get_gametime(), m_plnum, m_id)); + (game->get_gametime(), player_number_, m_id)); } @@ -391,25 +391,25 @@ const Map & map = egbase().map(); uint8_t buildcaps = fc.field->nodecaps(); - if (!fc.field->is_interior(m_plnum)) + if (!fc.field->is_interior(player_number_)) buildcaps = 0; // Check if a building's flag can't be build due to ownership else if (buildcaps & BUILDCAPS_BUILDINGMASK) { FCoords flagcoords; map.get_brn(fc, &flagcoords); - if (!flagcoords.field->is_interior(m_plnum)) + if (!flagcoords.field->is_interior(player_number_)) buildcaps &= ~BUILDCAPS_BUILDINGMASK; // Prevent big buildings that would swell over borders. if ((buildcaps & BUILDCAPS_BIG) == BUILDCAPS_BIG && - (!map.tr_n(fc).field->is_interior(m_plnum) - || - !map.tl_n(fc).field->is_interior(m_plnum) - || - !map. l_n(fc).field->is_interior(m_plnum))) + (!map.tr_n(fc).field->is_interior(player_number_) + || + !map.tl_n(fc).field->is_interior(player_number_) + || + !map. l_n(fc).field->is_interior(player_number_))) buildcaps &= ~BUILDCAPS_SMALL; } @@ -553,7 +553,7 @@ eg, pn, location, tribes.get_building_descr(b_idx)); return eg.warp_constructionsite( - map.get_fcoords(location), m_plnum, b_idx, false, former_buildings); + map.get_fcoords(location), player_number_, b_idx, false, former_buildings); } @@ -596,7 +596,7 @@ } if (constructionsite) - return &egbase().warp_constructionsite(c, m_plnum, idx, false, former_buildings); + return &egbase().warp_constructionsite(c, player_number_, idx, false, former_buildings); else { return &descr->create(egbase(), *this, c, false, false, former_buildings); } @@ -722,11 +722,11 @@ } } -void Player::military_site_set_soldier_preference(PlayerImmovable & imm, uint8_t m_soldier_preference) +void Player::military_site_set_soldier_preference(PlayerImmovable & imm, uint8_t soldier_preference) { if (&imm.owner() == this) if (upcast(MilitarySite, milsite, &imm)) - milsite->set_soldier_preference(static_cast<MilitarySite::SoldierPreference>(m_soldier_preference)); + milsite->set_soldier_preference(static_cast<MilitarySite::SoldierPreference>(soldier_preference)); } @@ -773,11 +773,11 @@ if (index_of_new_building != INVALID_INDEX) building = &egbase().warp_constructionsite - (position, m_plnum, index_of_new_building, false, former_buildings); + (position, player_number_, index_of_new_building, false, former_buildings); else building = &egbase().warp_dismantlesite - (position, m_plnum, false, former_buildings); + (position, player_number_, false, former_buildings); // Hereafter building points to the new building. // Reassign the workers and soldiers. @@ -806,9 +806,9 @@ void Player::allow_worker_type(DescriptionIndex const i, bool const allow) { - assert(i < static_cast<int>(m_allowed_worker_types.size())); + assert(i < static_cast<int>(allowed_worker_types_.size())); assert(!allow || tribe().get_worker_descr(i)->is_buildable()); - m_allowed_worker_types[i] = allow; + allowed_worker_types_[i] = allow; } @@ -818,8 +818,8 @@ * Disable or enable a building for a player */ void Player::allow_building_type(DescriptionIndex const i, bool const allow) { - assert(i < m_allowed_building_types.size()); - m_allowed_building_types[i] = allow; + assert(i < allowed_building_types_.size()); + allowed_building_types_[i] = allow; } /* @@ -828,21 +828,21 @@ void Player::add_economy(Economy & economy) { if (!has_economy(economy)) - m_economies.push_back(&economy); + economies_.push_back(&economy); } void Player::remove_economy(Economy & economy) { - for (std::vector<Economy *>::iterator economy_iter = m_economies.begin(); - economy_iter != m_economies.end(); ++economy_iter) + for (std::vector<Economy *>::iterator economy_iter = economies_.begin(); + economy_iter != economies_.end(); ++economy_iter) if (*economy_iter == &economy) { - m_economies.erase(economy_iter); + economies_.erase(economy_iter); return; } } bool Player::has_economy(Economy & economy) const { - for (Economy * temp_economy : m_economies) { + for (Economy * temp_economy : economies_) { if (temp_economy == &economy) { return true; } @@ -854,7 +854,7 @@ (Economy const * const economy) const { Economies::const_iterator const - economies_end = m_economies.end(), economies_begin = m_economies.begin(); + economies_end = economies_.end(), economies_begin = economies_.begin(); for (Economies::const_iterator it = economies_begin; it != economies_end; @@ -994,10 +994,10 @@ assert(&map[0] <= f.field); assert(f.field < &map[0] + map.max_index()); - Field & field = m_fields[f.field - &first_map_field]; + Field & field = fields_[f.field - &first_map_field]; - assert(m_fields <= &field); - assert(&field < m_fields + map.max_index()); + assert(fields_ <= &field); + assert(&field < fields_ + map.max_index()); { // discover everything (above the ground) in this field field.terrains = f.field->get_terrains(); @@ -1073,7 +1073,7 @@ } { // discover the D triangle and the SW edge of the top right neighbour FCoords tr = map.tr_n(f); - Field & tr_field = m_fields[tr.field - &first_map_field]; + Field & tr_field = fields_[tr.field - &first_map_field]; if (tr_field.vision <= 1) { tr_field.terrains.d = tr.field->terrain_d(); tr_field.roads &= ~(RoadType::kMask << RoadType::kSouthWest); @@ -1082,7 +1082,7 @@ } { // discover both triangles and the SE edge of the top left neighbour FCoords tl = map.tl_n(f); - Field & tl_field = m_fields[tl.field - &first_map_field]; + Field & tl_field = fields_[tl.field - &first_map_field]; if (tl_field.vision <= 1) { tl_field.terrains = tl.field->get_terrains(); tl_field.roads &= ~(RoadType::kMask << RoadType::kSouthEast); @@ -1091,7 +1091,7 @@ } { // discover the R triangle and the E edge of the left neighbour FCoords l = map.l_n(f); - Field & l_field = m_fields[l.field - &first_map_field]; + Field & l_field = fields_[l.field - &first_map_field]; if (l_field.vision <= 1) { l_field.terrains.r = l.field->terrain_r(); l_field.roads &= ~(RoadType::kMask << RoadType::kEast); @@ -1116,16 +1116,16 @@ // If this is not already a forwarded call, we should inform allied players // as well of this change. - if (!m_team_player_uptodate) + if (!team_player_uptodate_) update_team_players(); - if (!forward && !m_team_player.empty()) { - for (uint8_t j = 0; j < m_team_player.size(); ++j) - m_team_player[j]->see_node(map, first_map_field, f, gametime, true); + if (!forward && !team_player_.empty()) { + for (uint8_t j = 0; j < team_player_.size(); ++j) + team_player_[j]->see_node(map, first_map_field, f, gametime, true); } - Field & field = m_fields[f.field - &first_map_field]; - assert(m_fields <= &field); - assert (&field < m_fields + map.max_index()); + Field & field = fields_[f.field - &first_map_field]; + assert(fields_ <= &field); + assert (&field < fields_ + map.max_index()); Vision fvision = field.vision; if (fvision == 0) fvision = 1; @@ -1138,17 +1138,17 @@ void Player::unsee_node (MapIndex const i, Time const gametime, bool const forward) { - Field & field = m_fields[i]; + Field & field = fields_[i]; if (field.vision <= 1) // Already does not see this return; // If this is not already a forwarded call, we should inform allied players // as well of this change. - if (!m_team_player_uptodate) + if (!team_player_uptodate_) update_team_players(); - if (!forward && !m_team_player.empty()) { - for (uint8_t j = 0; j < m_team_player.size(); ++j) - m_team_player[j]->unsee_node(i, gametime, true); + if (!forward && !team_player_.empty()) { + for (uint8_t j = 0; j < team_player_.size(); ++j) + team_player_[j]->unsee_node(i, gametime, true); } --field.vision; @@ -1163,9 +1163,9 @@ */ void Player::sample_statistics() { - assert (m_ware_productions.size() == egbase().tribes().nrwares()); - assert (m_ware_consumptions.size() == egbase().tribes().nrwares()); - assert (m_ware_stocks.size() == egbase().tribes().nrwares()); + assert (ware_productions_.size() == egbase().tribes().nrwares()); + assert (ware_consumptions_.size() == egbase().tribes().nrwares()); + assert (ware_stocks_.size() == egbase().tribes().nrwares()); //calculate stocks std::vector<uint32_t> stocks(egbase().tribes().nrwares()); @@ -1185,14 +1185,14 @@ //update statistics - for (uint32_t i = 0; i < m_ware_productions.size(); ++i) { - m_ware_productions[i].push_back(m_current_produced_statistics[i]); - m_current_produced_statistics[i] = 0; - - m_ware_consumptions[i].push_back(m_current_consumed_statistics[i]); - m_current_consumed_statistics[i] = 0; - - m_ware_stocks[i].push_back(stocks[i]); + for (uint32_t i = 0; i < ware_productions_.size(); ++i) { + ware_productions_[i].push_back(current_produced_statistics_[i]); + current_produced_statistics_[i] = 0; + + ware_consumptions_[i].push_back(current_consumed_statistics_[i]); + current_consumed_statistics_[i] = 0; + + ware_stocks_[i].push_back(stocks[i]); } } @@ -1201,10 +1201,10 @@ * A ware was produced. Update the corresponding statistics. */ void Player::ware_produced(DescriptionIndex const wareid) { - assert (m_ware_productions.size() == egbase().tribes().nrwares()); + assert (ware_productions_.size() == egbase().tribes().nrwares()); assert(egbase().tribes().ware_exists(wareid)); - ++m_current_produced_statistics[wareid]; + ++current_produced_statistics_[wareid]; } @@ -1216,10 +1216,10 @@ * \param count the number of consumed wares */ void Player::ware_consumed(DescriptionIndex const wareid, uint8_t const count) { - assert (m_ware_consumptions.size() == egbase().tribes().nrwares()); + assert (ware_consumptions_.size() == egbase().tribes().nrwares()); assert(egbase().tribes().ware_exists(wareid)); - m_current_consumed_statistics[wareid] += count; + current_consumed_statistics_[wareid] += count; } @@ -1229,8 +1229,8 @@ const std::vector<uint32_t> * Player::get_ware_production_statistics (DescriptionIndex const ware) const { - assert(ware < static_cast<int>(m_ware_productions.size())); - return &m_ware_productions[ware]; + assert(ware < static_cast<int>(ware_productions_.size())); + return &ware_productions_[ware]; } @@ -1240,17 +1240,17 @@ const std::vector<uint32_t> * Player::get_ware_consumption_statistics (DescriptionIndex const ware) const { - assert(ware < static_cast<int>(m_ware_consumptions.size())); + assert(ware < static_cast<int>(ware_consumptions_.size())); - return &m_ware_consumptions[ware]; + return &ware_consumptions_[ware]; } const std::vector<uint32_t> * Player::get_ware_stock_statistics (DescriptionIndex const ware) const { - assert(ware < static_cast<int>(m_ware_stocks.size())); + assert(ware < static_cast<int>(ware_stocks_.size())); - return &m_ware_stocks[ware]; + return &ware_stocks_[ware]; } const Player::BuildingStatsVector& Player::get_building_statistics(const DescriptionIndex& i) const { @@ -1310,25 +1310,25 @@ */ void Player::set_ai(const std::string & ai) { - m_ai = ai; + ai_ = ai; } const std::string & Player::get_ai() const { - return m_ai; + return ai_; } /** * Pick random name from remaining names (if any) */ const std::string Player::pick_shipname() { - if (!m_remaining_shipnames.empty()) { + if (!remaining_shipnames_.empty()) { Game & game = dynamic_cast<Game&>(egbase()); assert (is_a(Game, &egbase())); - const uint32_t index = game.logic_rand() % m_remaining_shipnames.size(); - std::unordered_set<std::string>::iterator it = m_remaining_shipnames.begin(); + const uint32_t index = game.logic_rand() % remaining_shipnames_.size(); + std::unordered_set<std::string>::iterator it = remaining_shipnames_.begin(); std::advance(it, index); std::string new_name = *it; - m_remaining_shipnames.erase(it); + remaining_shipnames_.erase(it); return new_name; } return "Ship"; @@ -1342,7 +1342,7 @@ void Player::read_remaining_shipnames(FileRead & fr) { const uint16_t count = fr.unsigned_16(); for (uint16_t i = 0; i < count; ++i) { - m_remaining_shipnames.insert(fr.string()); + remaining_shipnames_.insert(fr.string()); } } @@ -1356,8 +1356,8 @@ uint16_t nr_wares = fr.unsigned_16(); uint16_t nr_entries = fr.unsigned_16(); - for (uint32_t i = 0; i < m_current_produced_statistics.size(); ++i) - m_ware_productions[i].resize(nr_entries); + for (uint32_t i = 0; i < current_produced_statistics_.size(); ++i) + ware_productions_[i].resize(nr_entries); for (uint16_t i = 0; i < nr_wares; ++i) { std::string name = fr.c_string(); @@ -1369,18 +1369,18 @@ continue; } - m_current_produced_statistics[idx] = fr.unsigned_32(); + current_produced_statistics_[idx] = fr.unsigned_32(); for (uint32_t j = 0; j < nr_entries; ++j) - m_ware_productions[idx][j] = fr.unsigned_32(); + ware_productions_[idx][j] = fr.unsigned_32(); } //read consumption statistics nr_wares = fr.unsigned_16(); nr_entries = fr.unsigned_16(); - for (uint32_t i = 0; i < m_current_consumed_statistics.size(); ++i) - m_ware_consumptions[i].resize(nr_entries); + for (uint32_t i = 0; i < current_consumed_statistics_.size(); ++i) + ware_consumptions_[i].resize(nr_entries); for (uint16_t i = 0; i < nr_wares; ++i) { std::string name = fr.c_string(); @@ -1392,18 +1392,18 @@ continue; } - m_current_consumed_statistics[idx] = fr.unsigned_32(); + current_consumed_statistics_[idx] = fr.unsigned_32(); for (uint32_t j = 0; j < nr_entries; ++j) - m_ware_consumptions[idx][j] = fr.unsigned_32(); + ware_consumptions_[idx][j] = fr.unsigned_32(); } //read stock statistics nr_wares = fr.unsigned_16(); nr_entries = fr.unsigned_16(); - for (uint32_t i = 0; i < m_ware_stocks.size(); ++i) - m_ware_stocks[i].resize(nr_entries); + for (uint32_t i = 0; i < ware_stocks_.size(); ++i) + ware_stocks_[i].resize(nr_entries); for (uint16_t i = 0; i < nr_wares; ++i) { std::string name = fr.c_string(); @@ -1416,23 +1416,23 @@ } for (uint32_t j = 0; j < nr_entries; ++j) - m_ware_stocks[idx][j] = fr.unsigned_32(); + ware_stocks_[idx][j] = fr.unsigned_32(); } //all statistics should have the same size - assert(m_ware_productions.size() == m_ware_consumptions.size()); - assert(m_ware_productions[0].size() == m_ware_consumptions[0].size()); + assert(ware_productions_.size() == ware_consumptions_.size()); + assert(ware_productions_[0].size() == ware_consumptions_[0].size()); - assert(m_ware_productions.size() == m_ware_stocks.size()); - assert(m_ware_productions[0].size() == m_ware_stocks[0].size()); + assert(ware_productions_.size() == ware_stocks_.size()); + assert(ware_productions_[0].size() == ware_stocks_[0].size()); } /** * Write remaining ship indexes to the give file */ void Player::write_remaining_shipnames(FileWrite & fw) const { - fw.unsigned_16(m_remaining_shipnames.size()); - for (const auto& shipname : m_remaining_shipnames) { + fw.unsigned_16(remaining_shipnames_.size()); + for (const auto& shipname : remaining_shipnames_) { fw.string(shipname); } } @@ -1442,37 +1442,37 @@ */ void Player::write_statistics(FileWrite & fw) const { //write produce statistics - fw.unsigned_16(m_current_produced_statistics.size()); - fw.unsigned_16(m_ware_productions[0].size()); + fw.unsigned_16(current_produced_statistics_.size()); + fw.unsigned_16(ware_productions_[0].size()); - for (uint8_t i = 0; i < m_current_produced_statistics.size(); ++i) { + for (uint8_t i = 0; i < current_produced_statistics_.size(); ++i) { fw.c_string (egbase().tribes().get_ware_descr(i)->name()); - fw.unsigned_32(m_current_produced_statistics[i]); - for (uint32_t j = 0; j < m_ware_productions[i].size(); ++j) - fw.unsigned_32(m_ware_productions[i][j]); + fw.unsigned_32(current_produced_statistics_[i]); + for (uint32_t j = 0; j < ware_productions_[i].size(); ++j) + fw.unsigned_32(ware_productions_[i][j]); } //write consume statistics - fw.unsigned_16(m_current_consumed_statistics.size()); - fw.unsigned_16(m_ware_consumptions[0].size()); + fw.unsigned_16(current_consumed_statistics_.size()); + fw.unsigned_16(ware_consumptions_[0].size()); - for (uint8_t i = 0; i < m_current_consumed_statistics.size(); ++i) { + for (uint8_t i = 0; i < current_consumed_statistics_.size(); ++i) { fw.c_string (egbase().tribes().get_ware_descr(i)->name()); - fw.unsigned_32(m_current_consumed_statistics[i]); - for (uint32_t j = 0; j < m_ware_consumptions[i].size(); ++j) - fw.unsigned_32(m_ware_consumptions[i][j]); + fw.unsigned_32(current_consumed_statistics_[i]); + for (uint32_t j = 0; j < ware_consumptions_[i].size(); ++j) + fw.unsigned_32(ware_consumptions_[i][j]); } //write stock statistics - fw.unsigned_16(m_ware_stocks.size()); - fw.unsigned_16(m_ware_stocks[0].size()); + fw.unsigned_16(ware_stocks_.size()); + fw.unsigned_16(ware_stocks_[0].size()); - for (uint8_t i = 0; i < m_ware_stocks.size(); ++i) { + for (uint8_t i = 0; i < ware_stocks_.size(); ++i) { fw.c_string(egbase().tribes().get_ware_descr(i)->name()); - for (uint32_t j = 0; j < m_ware_stocks[i].size(); ++j) - fw.unsigned_32(m_ware_stocks[i][j]); + for (uint32_t j = 0; j < ware_stocks_[i].size(); ++j) + fw.unsigned_32(ware_stocks_[i][j]); } } === modified file 'src/logic/player.h' --- src/logic/player.h 2016-02-18 08:42:46 +0000 +++ src/logic/player.h 2016-03-01 18:23:35 +0000 @@ -92,8 +92,8 @@ void allocate_map(); - const MessageQueue & messages() const {return m_messages;} - MessageQueue & messages() {return m_messages;} + const MessageQueue & messages() const {return messages_;} + MessageQueue & messages() {return messages_;} /// Adds the message to the queue. Takes ownership of the message. Assumes /// that it has been allocated in a separate memory block (not as a @@ -115,15 +115,15 @@ messages().set_message_status(id, status); } - const EditorGameBase & egbase() const {return m_egbase;} - EditorGameBase & egbase() {return m_egbase;} - PlayerNumber player_number() const {return m_plnum;} - TeamNumber team_number() const {return m_team_number;} - const RGBColor & get_playercolor() const {return Colors[m_plnum - 1];} - const TribeDescr & tribe() const {return m_tribe;} + const EditorGameBase & egbase() const {return egbase_;} + EditorGameBase & egbase() {return egbase_;} + PlayerNumber player_number() const {return player_number_;} + TeamNumber team_number() const {return team_number_;} + const RGBColor & get_playercolor() const {return Colors[player_number_ - 1];} + const TribeDescr & tribe() const {return tribe_;} - const std::string & get_name() const {return m_name;} - void set_name(const std::string & name) {m_name = name;} + const std::string & get_name() const {return name_;} + void set_name(const std::string & name) {name_ = name;} void set_team_number(TeamNumber team); void create_default_infrastructure(); @@ -133,8 +133,8 @@ bool is_hostile(const Player &) const; // For cheating - void set_see_all(bool const t) {m_see_all = t; m_view_changed = true;} - bool see_all() const {return m_see_all;} + void set_see_all(bool const t) {see_all_ = t; view_changed_ = true;} + bool see_all() const {return see_all_;} /// Data that are used and managed by AI. They are here to have it saved as a port of player's data struct AiPersistentState { @@ -380,17 +380,17 @@ DISALLOW_COPY_AND_ASSIGN(Field); }; - const Field * fields() const {return m_fields;} + const Field * fields() const {return fields_;} // See area Vision vision(MapIndex const i) const { // Node visible if > 1 - return (m_see_all ? 2 : 0) + m_fields[i].vision; + return (see_all_ ? 2 : 0) + fields_[i].vision; } bool has_view_changed() { - bool t = m_view_changed; - m_view_changed = false; + bool t = view_changed_; + view_changed_ = false; return t; } @@ -422,7 +422,7 @@ do { see_node(map, first_map_field, mr.location(), gametime); } while (mr.advance(map)); - m_view_changed = true; + view_changed_ = true; } /// Decrement this player's vision for each node in an area. @@ -433,25 +433,25 @@ MapRegion<Area<FCoords> > mr(map, area); do unsee_node(mr.location().field - &first_map_field, gametime); while (mr.advance(map)); - m_view_changed = true; + view_changed_ = true; } MilitaryInfluence military_influence(MapIndex const i) const { - return m_fields[i].military_influence; + return fields_[i].military_influence; } MilitaryInfluence & military_influence(MapIndex const i) { - return m_fields[i].military_influence; + return fields_[i].military_influence; } bool is_worker_type_allowed(const DescriptionIndex& i) const { - return m_allowed_worker_types.at(i); + return allowed_worker_types_.at(i); } void allow_worker_type(DescriptionIndex, bool allow); // Allowed buildings bool is_building_type_allowed(const DescriptionIndex& i) const { - return m_allowed_building_types[i]; + return allowed_building_types_[i]; } void allow_building_type(DescriptionIndex, bool allow); @@ -470,7 +470,7 @@ void bulldoze(PlayerImmovable &, bool recurse = false); void flagaction(Flag &); void start_stop_building(PlayerImmovable &); - void military_site_set_soldier_preference(PlayerImmovable &, uint8_t m_soldier_preference); + void military_site_set_soldier_preference(PlayerImmovable &, uint8_t soldier_preference); void start_or_cancel_expedition(Warehouse &); void enhance_building (Building *, DescriptionIndex index_of_new_building); @@ -483,9 +483,9 @@ using Economies = std::vector<Economy *>; Economies::size_type get_economy_number(Economy const *) const; Economy * get_economy_by_number(Economies::size_type const i) const { - return m_economies[i]; + return economies_[i]; } - uint32_t get_nr_economies() const {return m_economies.size();} + uint32_t get_nr_economies() const {return economies_.size();} // Military stuff void drop_soldier(PlayerImmovable &, Soldier &); @@ -498,18 +498,18 @@ void enemyflagaction (Flag &, PlayerNumber attacker, uint32_t count); - uint32_t casualties() const {return m_casualties;} - uint32_t kills () const {return m_kills;} - uint32_t msites_lost () const {return m_msites_lost;} - uint32_t msites_defeated () const {return m_msites_defeated;} - uint32_t civil_blds_lost () const {return m_civil_blds_lost;} - uint32_t civil_blds_defeated() const {return m_civil_blds_defeated;} - void count_casualty () {++m_casualties;} - void count_kill () {++m_kills;} - void count_msite_lost () {++m_msites_lost;} - void count_msite_defeated () {++m_msites_defeated;} - void count_civil_bld_lost () {++m_civil_blds_lost;} - void count_civil_bld_defeated() {++m_civil_blds_defeated;} + uint32_t casualties() const {return casualties_;} + uint32_t kills () const {return kills_;} + uint32_t msites_lost () const {return msites_lost_;} + uint32_t msites_defeated () const {return msites_defeated_;} + uint32_t civil_blds_lost () const {return civil_blds_lost_;} + uint32_t civil_blds_defeated() const {return civil_blds_defeated_;} + void count_casualty () {++casualties_;} + void count_kill () {++kills_;} + void count_msite_lost () {++msites_lost_;} + void count_msite_defeated () {++msites_defeated_;} + void count_civil_bld_lost () {++civil_blds_lost_;} + void count_civil_bld_defeated() {++civil_blds_defeated_;} // Statistics const BuildingStatsVector& get_building_statistics(const DescriptionIndex& i) const; @@ -538,8 +538,8 @@ // used in shared kingdom mode void add_further_starting_position(uint8_t plr, uint8_t init) { - m_further_shared_in_player.push_back(plr); - m_further_initializations .push_back(init); + further_shared_in_player_.push_back(plr); + further_initializations_ .push_back(init); } const std::string pick_shipname(); @@ -560,59 +560,59 @@ std::unique_ptr<Notifications::Subscriber<NoteFieldTerrainChanged>> field_terrain_changed_subscriber_; - MessageQueue m_messages; - - EditorGameBase & m_egbase; - uint8_t m_initialization_index; - std::vector<uint8_t> m_further_initializations; // used in shared kingdom mode - std::vector<uint8_t> m_further_shared_in_player; // '' '' '' '' '' - TeamNumber m_team_number; - std::vector<Player *> m_team_player; - bool m_team_player_uptodate; - bool m_see_all; - bool m_view_changed; - const PlayerNumber m_plnum; - const TribeDescr & m_tribe; // buildings, wares, workers, sciences - uint32_t m_casualties, m_kills; - uint32_t m_msites_lost, m_msites_defeated; - uint32_t m_civil_blds_lost, m_civil_blds_defeated; - std::unordered_set<std::string> m_remaining_shipnames; - - Field * m_fields; - std::vector<bool> m_allowed_worker_types; - std::vector<bool> m_allowed_building_types; - Economies m_economies; - std::string m_name; // Player name - std::string m_ai; /**< Name of preferred AI implementation */ + MessageQueue messages_; + + EditorGameBase & egbase_; + uint8_t initialization_index_; + std::vector<uint8_t> further_initializations_; // used in shared kingdom mode + std::vector<uint8_t> further_shared_in_player_; // '' '' '' '' '' + TeamNumber team_number_; + std::vector<Player *> team_player_; + bool team_player_uptodate_; + bool see_all_; + bool view_changed_; + const PlayerNumber player_number_; + const TribeDescr & tribe_; // buildings, wares, workers, sciences + uint32_t casualties_, kills_; + uint32_t msites_lost_, msites_defeated_; + uint32_t civil_blds_lost_, civil_blds_defeated_; + std::unordered_set<std::string> remaining_shipnames_; + + Field * fields_; + std::vector<bool> allowed_worker_types_; + std::vector<bool> allowed_building_types_; + Economies economies_; + std::string name_; // Player name + std::string ai_; /**< Name of preferred AI implementation */ /** * Wares produced (by ware id) since the last call to @ref sample_statistics */ - std::vector<uint32_t> m_current_produced_statistics; + std::vector<uint32_t> current_produced_statistics_; /** * Wares consumed (by ware id) since the last call to @ref sample_statistics */ - std::vector<uint32_t> m_current_consumed_statistics; + std::vector<uint32_t> current_consumed_statistics_; /** * Statistics of wares produced over the life of the game, indexed as - * m_ware_productions[ware id][time index] + * ware_productions_[ware id][time index] */ - std::vector< std::vector<uint32_t> > m_ware_productions; + std::vector< std::vector<uint32_t> > ware_productions_; /** * Statistics of wares consumed over the life of the game, indexed as - * m_ware_consumptions[ware_id][time_index] + * ware_consumptions_[ware_id][time_index] */ - std::vector< std::vector<uint32_t> > m_ware_consumptions; + std::vector< std::vector<uint32_t> > ware_consumptions_; /** * Statistics of wares stored inside of warehouses over the * life of the game, indexed as - * m_ware_stocks[ware_id][time_index] + * ware_stocks_[ware_id][time_index] */ - std::vector< std::vector<uint32_t> > m_ware_stocks; + std::vector< std::vector<uint32_t> > ware_stocks_; PlayerBuildingStats building_stats_; === modified file 'src/logic/playercommand.cc' --- src/logic/playercommand.cc 2016-02-09 16:29:48 +0000 +++ src/logic/playercommand.cc 2016-03-01 18:23:35 +0000 @@ -94,7 +94,7 @@ /*** class PlayerCommand ***/ PlayerCommand::PlayerCommand (const uint32_t time, const PlayerNumber s) - : GameLogicCommand (time), m_sender(s), m_cmdserial(0) + : GameLogicCommand (time), sender_(s), cmdserial_(0) {} PlayerCommand * PlayerCommand::deserialize (StreamRead & des) @@ -159,10 +159,10 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionPlayerCommand) { GameLogicCommand::read(fr, egbase, mol); - m_sender = fr.unsigned_8 (); - if (!egbase.get_player(m_sender)) - throw GameDataError("player %u does not exist", m_sender); - m_cmdserial = fr.unsigned_32(); + sender_ = fr.unsigned_8 (); + if (!egbase.get_player(sender_)) + throw GameDataError("player %u does not exist", sender_); + cmdserial_ = fr.unsigned_32(); } else { throw UnhandledVersionError("PlayerCommand", packet_version, kCurrentPacketVersionPlayerCommand); } @@ -1127,22 +1127,22 @@ const int32_t init_type, const DescriptionIndex i, const int32_t init_priority) : PlayerCommand(init_duetime, init_sender), - m_serial (imm.serial()), - m_type (init_type), - m_index (i), - m_priority (init_priority) + serial_ (imm.serial()), + type_ (init_type), + index_ (i), + priority_ (init_priority) {} void CmdSetWarePriority::execute(Game & game) { - upcast(Building, psite, game.objects().get_object(m_serial)); + upcast(Building, psite, game.objects().get_object(serial_)); if (!psite) return; if (psite->owner().player_number() != sender()) return; - psite->set_priority(m_type, m_index, m_priority); + psite->set_priority(type_, index_, priority_); } constexpr uint16_t kCurrentPacketVersionCmdSetWarePriority = 1; @@ -1154,10 +1154,10 @@ PlayerCommand::write(fw, egbase, mos); - fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial))); - fw.unsigned_8(m_type); - fw.signed_32(m_index); - fw.signed_32(m_priority); + fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial_))); + fw.unsigned_8(type_); + fw.signed_32(index_); + fw.signed_32(priority_); } void CmdSetWarePriority::read @@ -1167,10 +1167,10 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionCmdSetWarePriority) { PlayerCommand::read(fr, egbase, mol); - m_serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol); - m_type = fr.unsigned_8(); - m_index = fr.signed_32(); - m_priority = fr.signed_32(); + serial_ = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol); + type_ = fr.unsigned_8(); + index_ = fr.signed_32(); + priority_ = fr.signed_32(); } else { throw UnhandledVersionError("CmdSetWarePriority", packet_version, kCurrentPacketVersionCmdSetWarePriority); @@ -1183,20 +1183,20 @@ CmdSetWarePriority::CmdSetWarePriority(StreamRead & des) : PlayerCommand(0, des.unsigned_8()), - m_serial (des.unsigned_32()), - m_type (des.unsigned_8()), - m_index (des.signed_32()), - m_priority (des.signed_32()) + serial_ (des.unsigned_32()), + type_ (des.unsigned_8()), + index_ (des.signed_32()), + priority_ (des.signed_32()) {} void CmdSetWarePriority::serialize(StreamWrite & ser) { ser.unsigned_8(PLCMD_SETWAREPRIORITY); ser.unsigned_8(sender()); - ser.unsigned_32(m_serial); - ser.unsigned_8(m_type); - ser.signed_32(m_index); - ser.signed_32(m_priority); + ser.unsigned_32(serial_); + ser.unsigned_8(type_); + ser.signed_32(index_); + ser.signed_32(priority_); } /*** class Cmd_SetWareMaxFill ***/ @@ -1206,21 +1206,21 @@ const DescriptionIndex index, const uint32_t max_fill) : PlayerCommand(init_duetime, init_sender), - m_serial (imm.serial()), - m_index (index), - m_max_fill (max_fill) + serial_ (imm.serial()), + index_ (index), + max_fill_ (max_fill) {} void CmdSetWareMaxFill::execute(Game & game) { - upcast(Building, b, game.objects().get_object(m_serial)); + upcast(Building, b, game.objects().get_object(serial_)); if (!b) return; if (b->owner().player_number() != sender()) return; - b->waresqueue(m_index).set_max_fill(m_max_fill); + b->waresqueue(index_).set_max_fill(max_fill_); } constexpr uint16_t kCurrentPacketVersionCmdSetWareMaxFill = 1; @@ -1232,9 +1232,9 @@ PlayerCommand::write(fw, egbase, mos); - fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial))); - fw.signed_32(m_index); - fw.unsigned_32(m_max_fill); + fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial_))); + fw.signed_32(index_); + fw.unsigned_32(max_fill_); } void CmdSetWareMaxFill::read @@ -1244,9 +1244,9 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionCmdSetWareMaxFill) { PlayerCommand::read(fr, egbase, mol); - m_serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol); - m_index = fr.signed_32(); - m_max_fill = fr.unsigned_32(); + serial_ = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol); + index_ = fr.signed_32(); + max_fill_ = fr.unsigned_32(); } else { throw UnhandledVersionError("CmdSetWareMaxFill", packet_version, kCurrentPacketVersionCmdSetWareMaxFill); @@ -1258,18 +1258,18 @@ CmdSetWareMaxFill::CmdSetWareMaxFill(StreamRead & des) : PlayerCommand(0, des.unsigned_8()), - m_serial (des.unsigned_32()), - m_index (des.signed_32()), - m_max_fill(des.unsigned_32()) + serial_ (des.unsigned_32()), + index_ (des.signed_32()), + max_fill_(des.unsigned_32()) {} void CmdSetWareMaxFill::serialize(StreamWrite & ser) { ser.unsigned_8(PLCMD_SETWAREMAXFILL); ser.unsigned_8(sender()); - ser.unsigned_32(m_serial); - ser.signed_32(m_index); - ser.unsigned_32(m_max_fill); + ser.unsigned_32(serial_); + ser.signed_32(index_); + ser.unsigned_32(max_fill_); } @@ -1278,7 +1278,7 @@ const uint32_t init_economy, const DescriptionIndex init_ware_type) : PlayerCommand(init_duetime, init_sender), - m_economy (init_economy), m_ware_type(init_ware_type) + economy_(init_economy), ware_type_(init_ware_type) {} void CmdChangeTargetQuantity::write @@ -1295,8 +1295,8 @@ { try { PlayerCommand::read(fr, egbase, mol); - m_economy = fr.unsigned_32(); - m_ware_type = + economy_ = fr.unsigned_32(); + ware_type_ = egbase.player(sender()).tribe().ware_index(fr.c_string()); } catch (const WException & e) { throw GameDataError("change target quantity: %s", e.what()); @@ -1306,8 +1306,8 @@ CmdChangeTargetQuantity::CmdChangeTargetQuantity(StreamRead & des) : PlayerCommand(0, des.unsigned_8()), - m_economy (des.unsigned_32()), - m_ware_type (des.unsigned_8()) + economy_ (des.unsigned_32()), + ware_type_ (des.unsigned_8()) {} void CmdChangeTargetQuantity::serialize(StreamWrite & ser) @@ -1325,7 +1325,7 @@ const uint32_t init_permanent) : CmdChangeTargetQuantity(init_duetime, init_sender, init_economy, init_ware_type), - m_permanent(init_permanent) + permanent_(init_permanent) {} void CmdSetWareTargetQuantity::execute(Game & game) @@ -1333,7 +1333,7 @@ Player & player = game.player(sender()); if (economy() < player.get_nr_economies() && game.tribes().ware_exists(ware_type())) { player.get_economy_by_number(economy())->set_ware_target_quantity - (ware_type(), m_permanent, duetime()); + (ware_type(), permanent_, duetime()); } } @@ -1344,7 +1344,7 @@ { fw.unsigned_16(kCurrentPacketVersionSetWareTargetQuantity); CmdChangeTargetQuantity::write(fw, egbase, mos); - fw.unsigned_32(m_permanent); + fw.unsigned_32(permanent_); } void CmdSetWareTargetQuantity::read @@ -1354,7 +1354,7 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionSetWareTargetQuantity) { CmdChangeTargetQuantity::read(fr, egbase, mol); - m_permanent = fr.unsigned_32(); + permanent_ = fr.unsigned_32(); } else { throw UnhandledVersionError("CmdSetWareTargetQuantity", packet_version, kCurrentPacketVersionSetWareTargetQuantity); @@ -1367,7 +1367,7 @@ CmdSetWareTargetQuantity::CmdSetWareTargetQuantity(StreamRead & des) : CmdChangeTargetQuantity(des), - m_permanent (des.unsigned_32()) + permanent_ (des.unsigned_32()) { if (cmdserial() == 1) des.unsigned_32(); } @@ -1376,7 +1376,7 @@ { ser.unsigned_8 (PLCMD_SETWARETARGETQUANTITY); CmdChangeTargetQuantity::serialize(ser); - ser.unsigned_32(m_permanent); + ser.unsigned_32(permanent_); } @@ -1443,7 +1443,7 @@ const uint32_t init_permanent) : CmdChangeTargetQuantity(init_duetime, init_sender, init_economy, init_ware_type), - m_permanent(init_permanent) + permanent_(init_permanent) {} void CmdSetWorkerTargetQuantity::execute(Game & game) @@ -1451,7 +1451,7 @@ Player & player = game.player(sender()); if (economy() < player.get_nr_economies() && game.tribes().ware_exists(ware_type())) { player.get_economy_by_number(economy())->set_worker_target_quantity - (ware_type(), m_permanent, duetime()); + (ware_type(), permanent_, duetime()); } } @@ -1462,7 +1462,7 @@ { fw.unsigned_16(kCurrentPacketVersionSetWorkerTargetQuantity); CmdChangeTargetQuantity::write(fw, egbase, mos); - fw.unsigned_32(m_permanent); + fw.unsigned_32(permanent_); } void CmdSetWorkerTargetQuantity::read @@ -1472,7 +1472,7 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionSetWorkerTargetQuantity) { CmdChangeTargetQuantity::read(fr, egbase, mol); - m_permanent = fr.unsigned_32(); + permanent_ = fr.unsigned_32(); } else { throw UnhandledVersionError("CmdSetWorkerTargetQuantity", packet_version, kCurrentPacketVersionSetWorkerTargetQuantity); @@ -1485,7 +1485,7 @@ CmdSetWorkerTargetQuantity::CmdSetWorkerTargetQuantity(StreamRead & des) : CmdChangeTargetQuantity(des), - m_permanent (des.unsigned_32()) + permanent_ (des.unsigned_32()) { if (cmdserial() == 1) des.unsigned_32(); } @@ -1494,7 +1494,7 @@ { ser.unsigned_8 (PLCMD_SETWORKERTARGETQUANTITY); CmdChangeTargetQuantity::serialize(ser); - ser.unsigned_32(m_permanent); + ser.unsigned_32(permanent_); } @@ -1827,7 +1827,7 @@ /*** struct PlayerMessageCommand ***/ PlayerMessageCommand::PlayerMessageCommand(StreamRead & des) : -PlayerCommand (0, des.unsigned_8()), m_message_id(des.unsigned_32()) +PlayerCommand (0, des.unsigned_8()), message_id_(des.unsigned_32()) {} constexpr uint16_t kCurrentPacketVersionPlayerMessageCommand = 1; @@ -1839,8 +1839,8 @@ const uint16_t packet_version = fr.unsigned_16(); if (packet_version == kCurrentPacketVersionPlayerMessageCommand) { PlayerCommand::read(fr, egbase, mol); - m_message_id = MessageId(fr.unsigned_32()); - if (!m_message_id) + message_id_ = MessageId(fr.unsigned_32()); + if (!message_id_) throw GameDataError ("(player %u): message id is null", sender()); } else { @@ -1899,14 +1899,14 @@ Warehouse::StockPolicy policy) : PlayerCommand(time, p) { - m_warehouse = wh.serial(); - m_isworker = isworker; - m_ware = ware; - m_policy = policy; + warehouse_ = wh.serial(); + isworker_ = isworker; + ware_ = ware; + policy_ = policy; } CmdSetStockPolicy::CmdSetStockPolicy() -: PlayerCommand(), m_warehouse(0), m_isworker(false), m_policy() +: PlayerCommand(), warehouse_(0), isworker_(false), policy_() { } @@ -1914,7 +1914,7 @@ { // Sanitize data that could have come from the network if (Player * plr = game.get_player(sender())) { - if (upcast(Warehouse, warehouse, game.objects().get_object(m_warehouse))) + if (upcast(Warehouse, warehouse, game.objects().get_object(warehouse_))) { if (&warehouse->owner() != plr) { log @@ -1923,7 +1923,7 @@ return; } - switch (m_policy) { + switch (policy_) { case Warehouse::SP_Normal: case Warehouse::SP_Prefer: case Warehouse::SP_DontStock: @@ -1931,22 +1931,22 @@ break; } - if (m_isworker) { - if (!(game.tribes().worker_exists(m_ware))) { + if (isworker_) { + if (!(game.tribes().worker_exists(ware_))) { log ("Cmd_SetStockPolicy: sender %u, worker %u does not exist\n", - sender(), m_ware); + sender(), ware_); return; } - warehouse->set_worker_policy(m_ware, m_policy); + warehouse->set_worker_policy(ware_, policy_); } else { - if (!(game.tribes().ware_exists(m_ware))) { + if (!(game.tribes().ware_exists(ware_))) { log ("Cmd_SetStockPolicy: sender %u, ware %u does not exist\n", - sender(), m_ware); + sender(), ware_); return; } - warehouse->set_ware_policy(m_ware, m_policy); + warehouse->set_ware_policy(ware_, policy_); } } } @@ -1955,20 +1955,20 @@ CmdSetStockPolicy::CmdSetStockPolicy(StreamRead & des) : PlayerCommand(0, des.unsigned_8()) { - m_warehouse = des.unsigned_32(); - m_isworker = des.unsigned_8(); - m_ware = DescriptionIndex(des.unsigned_8()); - m_policy = static_cast<Warehouse::StockPolicy>(des.unsigned_8()); + warehouse_ = des.unsigned_32(); + isworker_ = des.unsigned_8(); + ware_ = DescriptionIndex(des.unsigned_8()); + policy_ = static_cast<Warehouse::StockPolicy>(des.unsigned_8()); } void CmdSetStockPolicy::serialize(StreamWrite & ser) { ser.unsigned_8(PLCMD_SETSTOCKPOLICY); ser.unsigned_8(sender()); - ser.unsigned_32(m_warehouse); - ser.unsigned_8(m_isworker); - ser.unsigned_8(m_ware); - ser.unsigned_8(m_policy); + ser.unsigned_32(warehouse_); + ser.unsigned_8(isworker_); + ser.unsigned_8(ware_); + ser.unsigned_8(policy_); } constexpr uint8_t kCurrentPacketVersionCmdSetStockPolicy = 1; @@ -1980,10 +1980,10 @@ uint8_t packet_version = fr.unsigned_8(); if (packet_version == kCurrentPacketVersionCmdSetStockPolicy) { PlayerCommand::read(fr, egbase, mol); - m_warehouse = fr.unsigned_32(); - m_isworker = fr.unsigned_8(); - m_ware = DescriptionIndex(fr.unsigned_8()); - m_policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); + warehouse_ = fr.unsigned_32(); + isworker_ = fr.unsigned_8(); + ware_ = DescriptionIndex(fr.unsigned_8()); + policy_ = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); } else { throw UnhandledVersionError("CmdSetStockPolicy", packet_version, kCurrentPacketVersionCmdSetStockPolicy); @@ -1998,10 +1998,10 @@ { fw.unsigned_8(kCurrentPacketVersionCmdSetStockPolicy); PlayerCommand::write(fw, egbase, mos); - fw.unsigned_32(m_warehouse); - fw.unsigned_8(m_isworker); - fw.unsigned_8(m_ware); - fw.unsigned_8(m_policy); + fw.unsigned_32(warehouse_); + fw.unsigned_8(isworker_); + fw.unsigned_8(ware_); + fw.unsigned_8(policy_); } } === modified file 'src/logic/playercommand.h' --- src/logic/playercommand.h 2016-02-09 16:29:48 +0000 +++ src/logic/playercommand.h 2016-03-01 18:23:35 +0000 @@ -47,11 +47,11 @@ PlayerCommand (uint32_t time, PlayerNumber); /// For savegame loading - PlayerCommand() : GameLogicCommand(0), m_sender(0), m_cmdserial(0) {} + PlayerCommand() : GameLogicCommand(0), sender_(0), cmdserial_(0) {} - PlayerNumber sender () const {return m_sender;} - uint32_t cmdserial() const {return m_cmdserial;} - void set_cmdserial(const uint32_t s) {m_cmdserial = s;} + PlayerNumber sender () const {return sender_;} + uint32_t cmdserial() const {return cmdserial_;} + void set_cmdserial(const uint32_t s) {cmdserial_ = s;} virtual void serialize (StreamWrite &) = 0; static Widelands::PlayerCommand * deserialize (StreamRead &); @@ -61,8 +61,8 @@ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; private: - PlayerNumber m_sender; - uint32_t m_cmdserial; + PlayerNumber sender_; + uint32_t cmdserial_; }; struct CmdBulldoze:public PlayerCommand { @@ -422,10 +422,10 @@ // For savegame loading CmdSetWarePriority() : PlayerCommand(), - m_serial(0), - m_type(0), - m_index(), - m_priority(0) + serial_(0), + type_(0), + index_(), + priority_(0) {} CmdSetWarePriority (uint32_t duetime, PlayerNumber sender, @@ -444,14 +444,14 @@ void serialize (StreamWrite &) override; private: - Serial m_serial; - int32_t m_type; ///< this is always WARE right now - DescriptionIndex m_index; - int32_t m_priority; + Serial serial_; + int32_t type_; ///< this is always WARE right now + DescriptionIndex index_; + int32_t priority_; }; struct CmdSetWareMaxFill : public PlayerCommand { - CmdSetWareMaxFill() : PlayerCommand(), m_serial(0), m_index(), m_max_fill(0) {} // For savegame loading + CmdSetWareMaxFill() : PlayerCommand(), serial_(0), index_(), max_fill_(0) {} // For savegame loading CmdSetWareMaxFill (uint32_t duetime, PlayerNumber, PlayerImmovable &, @@ -469,13 +469,13 @@ void serialize (StreamWrite &) override; private: - Serial m_serial; - DescriptionIndex m_index; - uint32_t m_max_fill; + Serial serial_; + DescriptionIndex index_; + uint32_t max_fill_; }; struct CmdChangeTargetQuantity : public PlayerCommand { - CmdChangeTargetQuantity() : PlayerCommand(), m_economy(0), m_ware_type() {} // For savegame loading. + CmdChangeTargetQuantity() : PlayerCommand(), economy_(0), ware_type_() {} // For savegame loading. CmdChangeTargetQuantity (uint32_t duetime, PlayerNumber sender, uint32_t economy, DescriptionIndex index); @@ -489,17 +489,17 @@ void serialize (StreamWrite &) override; protected: - uint32_t economy () const {return m_economy;} - DescriptionIndex ware_type() const {return m_ware_type;} + uint32_t economy () const {return economy_;} + DescriptionIndex ware_type() const {return ware_type_;} private: - uint32_t m_economy; - DescriptionIndex m_ware_type; + uint32_t economy_; + DescriptionIndex ware_type_; }; struct CmdSetWareTargetQuantity : public CmdChangeTargetQuantity { - CmdSetWareTargetQuantity() : CmdChangeTargetQuantity(), m_permanent(0) {} + CmdSetWareTargetQuantity() : CmdChangeTargetQuantity(), permanent_(0) {} CmdSetWareTargetQuantity (uint32_t duetime, PlayerNumber sender, uint32_t economy, DescriptionIndex index, @@ -517,7 +517,7 @@ void serialize (StreamWrite &) override; private: - uint32_t m_permanent; + uint32_t permanent_; }; struct CmdResetWareTargetQuantity : public CmdChangeTargetQuantity { @@ -539,7 +539,7 @@ }; struct CmdSetWorkerTargetQuantity : public CmdChangeTargetQuantity { - CmdSetWorkerTargetQuantity() : CmdChangeTargetQuantity(), m_permanent(0) {} + CmdSetWorkerTargetQuantity() : CmdChangeTargetQuantity(), permanent_(0) {} CmdSetWorkerTargetQuantity (uint32_t duetime, PlayerNumber sender, uint32_t economy, DescriptionIndex index, @@ -557,7 +557,7 @@ void serialize (StreamWrite &) override; private: - uint32_t m_permanent; + uint32_t permanent_; }; struct CmdResetWorkerTargetQuantity : public CmdChangeTargetQuantity { @@ -683,7 +683,7 @@ PlayerMessageCommand () : PlayerCommand() {} // for savegames PlayerMessageCommand (const uint32_t t, const PlayerNumber p, const MessageId i) - : PlayerCommand(t, p), m_message_id(i) + : PlayerCommand(t, p), message_id_(i) {} void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; @@ -691,10 +691,10 @@ PlayerMessageCommand(StreamRead &); - MessageId message_id() const {return m_message_id;} + MessageId message_id() const {return message_id_;} private: - MessageId m_message_id; + MessageId message_id_; }; struct CmdMessageSetStatusRead : public PlayerMessageCommand { @@ -751,10 +751,10 @@ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override; private: - Serial m_warehouse; - bool m_isworker; - DescriptionIndex m_ware; - Warehouse::StockPolicy m_policy; + Serial warehouse_; + bool isworker_; + DescriptionIndex ware_; + Warehouse::StockPolicy policy_; }; } === modified file 'src/logic/playersmanager.cc' --- src/logic/playersmanager.cc 2015-10-18 15:41:10 +0000 +++ src/logic/playersmanager.cc 2016-03-01 18:23:35 +0000 @@ -31,10 +31,10 @@ namespace Widelands { PlayersManager::PlayersManager(EditorGameBase& egbase) : -m_egbase(egbase), -m_number_of_players(0) +egbase_(egbase), +number_of_players_(0) { - memset(m_players, 0, sizeof(m_players)); + memset(players_, 0, sizeof(players_)); } PlayersManager::~PlayersManager() @@ -44,12 +44,12 @@ void PlayersManager::cleanup() { - const Player * const * const players_end = m_players + MAX_PLAYERS; - for (Player * * p = m_players; p < players_end; ++p) { + const Player * const * const players_end = players_ + MAX_PLAYERS; + for (Player * * p = players_; p < players_end; ++p) { delete *p; *p = nullptr; } - m_number_of_players = 0; + number_of_players_ = 0; } @@ -58,12 +58,12 @@ assert(1 <= plnum); assert(plnum <= MAX_PLAYERS); - Player * & p = m_players[plnum - 1]; + Player * & p = players_[plnum - 1]; if (p) { delete p; p = nullptr; if (plnum <= UserSettings::highest_playernum()) { - m_number_of_players--; + number_of_players_--; } } } @@ -78,22 +78,22 @@ assert(1 <= player_number); assert(player_number <= MAX_PLAYERS); - Player * & p = m_players[player_number - 1]; + Player * & p = players_[player_number - 1]; if (p) { delete p; if (player_number <= UserSettings::highest_playernum()) { - m_number_of_players--; + number_of_players_--; } } p = new Player - (m_egbase, + (egbase_, player_number, initialization_index, - *m_egbase.tribes().get_tribe_descr(m_egbase.tribes().tribe_index(tribe)), + *egbase_.tribes().get_tribe_descr(egbase_.tribes().tribe_index(tribe)), name); p->set_team_number(team); if (player_number <= UserSettings::highest_playernum()) { - m_number_of_players++; + number_of_players_++; } return p; } @@ -102,21 +102,21 @@ { // Ensure we don't have a status for it yet std::vector<PlayerEndStatus>::iterator it; - for (it = m_players_end_status.begin(); it != m_players_end_status.end(); ++it) { + for (it = players_end_status_.begin(); it != players_end_status_.end(); ++it) { PlayerEndStatus pes = *it; if (pes.player == status.player) { throw wexception("Player End status for player %d already reported", pes.player); } } - m_players_end_status.push_back(status); + players_end_status_.push_back(status); // If all results have been gathered, save game and show summary screen - if (m_players_end_status.size() < m_number_of_players) { + if (players_end_status_.size() < number_of_players_) { return; } - if (m_egbase.get_igbase()) { - m_egbase.get_igbase()->show_game_summary(); + if (egbase_.get_igbase()) { + egbase_.get_igbase()->show_game_summary(); } } === modified file 'src/logic/playersmanager.h' --- src/logic/playersmanager.h 2014-09-10 13:03:40 +0000 +++ src/logic/playersmanager.h 2016-03-01 18:23:35 +0000 @@ -74,20 +74,20 @@ Player * get_player(int32_t n) const { assert(1 <= n); assert (n <= MAX_PLAYERS); - return m_players[n - 1]; + return players_[n - 1]; } Player & player(int32_t n) const { assert(1 <= n); assert (n <= MAX_PLAYERS); - return *m_players[n - 1]; + return *players_[n - 1]; } /** * \return the number of players (human or ai) */ - uint8_t get_number_of_players() {return m_number_of_players;} + uint8_t get_number_of_players() {return number_of_players_;} - const std::vector<PlayerEndStatus> & get_players_end_status() {return m_players_end_status;} + const std::vector<PlayerEndStatus> & get_players_end_status() {return players_end_status_;} /** * Adds a new player status for a player that left the game. @@ -95,10 +95,10 @@ void add_player_end_status(const PlayerEndStatus & status); private: - Player * m_players[MAX_PLAYERS]; - EditorGameBase & m_egbase; - uint8_t m_number_of_players; - std::vector<PlayerEndStatus> m_players_end_status; + Player* players_[MAX_PLAYERS]; + EditorGameBase& egbase_; + uint8_t number_of_players_; + std::vector<PlayerEndStatus> players_end_status_; }; } === modified file 'src/logic/replay.cc' --- src/logic/replay.cc 2016-02-09 16:29:48 +0000 +++ src/logic/replay.cc 2016-03-01 18:23:35 +0000 @@ -83,17 +83,17 @@ */ ReplayReader::ReplayReader(Game & game, const std::string & filename) { - m_replaytime = 0; + replaytime_ = 0; { GameLoader gl(filename + WLGF_SUFFIX, game); gl.load_game(); } - m_cmdlog = g_fs->open_stream_read(filename); + cmdlog_ = g_fs->open_stream_read(filename); try { - const uint32_t magic = m_cmdlog->unsigned_32(); + const uint32_t magic = cmdlog_->unsigned_32(); if (magic == 0x2E21A100) // Note: This was never released as part of a build throw wexception @@ -104,14 +104,14 @@ throw wexception ("%s apparently not a valid replay file", filename.c_str()); - const uint8_t packet_version = m_cmdlog->unsigned_8(); + const uint8_t packet_version = cmdlog_->unsigned_8(); if (packet_version != kCurrentPacketVersion) { throw UnhandledVersionError("ReplayReader", packet_version, kCurrentPacketVersion); } - game.rng().read_state(*m_cmdlog); + game.rng().read_state(*cmdlog_); } catch (...) { - delete m_cmdlog; + delete cmdlog_; throw; } } @@ -122,7 +122,7 @@ */ ReplayReader::~ReplayReader() { - delete m_cmdlog; + delete cmdlog_; } @@ -135,22 +135,22 @@ */ Command * ReplayReader::get_next_command(const uint32_t time) { - if (!m_cmdlog) + if (!cmdlog_) return nullptr; - if (static_cast<int32_t>(m_replaytime - time) > 0) + if (static_cast<int32_t>(replaytime_ - time) > 0) return nullptr; try { - uint8_t pkt = m_cmdlog->unsigned_8(); + uint8_t pkt = cmdlog_->unsigned_8(); switch (pkt) { case pkt_playercommand: { - m_replaytime = m_cmdlog->unsigned_32(); + replaytime_ = cmdlog_->unsigned_32(); - uint32_t duetime = m_cmdlog->unsigned_32(); - uint32_t cmdserial = m_cmdlog->unsigned_32(); - PlayerCommand & cmd = *PlayerCommand::deserialize(*m_cmdlog); + uint32_t duetime = cmdlog_->unsigned_32(); + uint32_t cmdserial = cmdlog_->unsigned_32(); + PlayerCommand & cmd = *PlayerCommand::deserialize(*cmdlog_); cmd.set_duetime (duetime); cmd.set_cmdserial(cmdserial); @@ -158,18 +158,18 @@ } case pkt_syncreport: { - uint32_t duetime = m_cmdlog->unsigned_32(); + uint32_t duetime = cmdlog_->unsigned_32(); Md5Checksum hash; - m_cmdlog->data(hash.data, sizeof(hash.data)); + cmdlog_->data(hash.data, sizeof(hash.data)); return new CmdReplaySyncRead(duetime, hash); } case pkt_end: { - uint32_t endtime = m_cmdlog->unsigned_32(); + uint32_t endtime = cmdlog_->unsigned_32(); log("REPLAY: End of replay (gametime: %u)\n", endtime); - delete m_cmdlog; - m_cmdlog = nullptr; + delete cmdlog_; + cmdlog_ = nullptr; return nullptr; } @@ -178,8 +178,8 @@ } } catch (const WException & e) { log("REPLAY: Caught exception %s\n", e.what()); - delete m_cmdlog; - m_cmdlog = nullptr; + delete cmdlog_; + cmdlog_ = nullptr; } return nullptr; @@ -191,7 +191,7 @@ */ bool ReplayReader::end_of_replay() { - return m_cmdlog == nullptr; + return cmdlog_ == nullptr; } @@ -223,20 +223,20 @@ * and the game has changed into running state. */ ReplayWriter::ReplayWriter(Game & game, const std::string & filename) - : m_game(game), m_filename(filename) + : game_(game), filename_(filename) { g_fs->ensure_directory_exists(REPLAY_DIR); - SaveHandler & save_handler = m_game.save_handler(); + SaveHandler & save_handler = game_.save_handler(); std::string error; - if (!save_handler.save_game(m_game, m_filename + WLGF_SUFFIX, &error)) + if (!save_handler.save_game(game_, filename_ + WLGF_SUFFIX, &error)) throw wexception("Failed to save game for replay: %s", error.c_str()); log("Reloading the game from replay\n"); game.cleanup_for_load(); { - GameLoader gl(m_filename + WLGF_SUFFIX, game); + GameLoader gl(filename_ + WLGF_SUFFIX, game); gl.load_game(); } game.postload(); @@ -245,11 +245,11 @@ game.enqueue_command (new CmdReplaySyncWrite(game.get_gametime() + kSyncInterval)); - m_cmdlog = g_fs->open_stream_write(filename); - m_cmdlog->unsigned_32(kReplayMagic); - m_cmdlog->unsigned_8(kCurrentPacketVersion); + cmdlog_ = g_fs->open_stream_write(filename); + cmdlog_->unsigned_32(kReplayMagic); + cmdlog_->unsigned_8(kCurrentPacketVersion); - game.rng().write_state(*m_cmdlog); + game.rng().write_state(*cmdlog_); } @@ -258,10 +258,10 @@ */ ReplayWriter::~ReplayWriter() { - m_cmdlog->unsigned_8(pkt_end); - m_cmdlog->unsigned_32(m_game.get_gametime()); + cmdlog_->unsigned_8(pkt_end); + cmdlog_->unsigned_32(game_.get_gametime()); - delete m_cmdlog; + delete cmdlog_; } @@ -270,16 +270,16 @@ */ void ReplayWriter::send_player_command(PlayerCommand * cmd) { - m_cmdlog->unsigned_8(pkt_playercommand); + cmdlog_->unsigned_8(pkt_playercommand); // The semantics of the timestamp is // "There will be no more player commands that are due *before* the // given time". - m_cmdlog->unsigned_32(m_game.get_gametime()); - m_cmdlog->unsigned_32(cmd->duetime()); - m_cmdlog->unsigned_32(cmd->cmdserial()); - cmd->serialize(*m_cmdlog); + cmdlog_->unsigned_32(game_.get_gametime()); + cmdlog_->unsigned_32(cmd->duetime()); + cmdlog_->unsigned_32(cmd->cmdserial()); + cmd->serialize(*cmdlog_); - m_cmdlog->flush(); + cmdlog_->flush(); } @@ -288,10 +288,10 @@ */ void ReplayWriter::send_sync(const Md5Checksum & hash) { - m_cmdlog->unsigned_8(pkt_syncreport); - m_cmdlog->unsigned_32(m_game.get_gametime()); - m_cmdlog->data(hash.data, sizeof(hash.data)); - m_cmdlog->flush(); + cmdlog_->unsigned_8(pkt_syncreport); + cmdlog_->unsigned_32(game_.get_gametime()); + cmdlog_->data(hash.data, sizeof(hash.data)); + cmdlog_->flush(); } } === modified file 'src/logic/replay.h' --- src/logic/replay.h 2014-09-19 12:54:54 +0000 +++ src/logic/replay.h 2016-03-01 18:23:35 +0000 @@ -58,9 +58,9 @@ bool end_of_replay(); private: - StreamRead * m_cmdlog; + StreamRead * cmdlog_; - uint32_t m_replaytime; + uint32_t replaytime_; }; /** @@ -75,9 +75,9 @@ void send_sync(const Md5Checksum &); private: - Game & m_game; - StreamWrite * m_cmdlog; - std::string m_filename; + Game & game_; + StreamWrite* cmdlog_; + std::string filename_; }; } === modified file 'src/logic/replay_game_controller.cc' --- src/logic/replay_game_controller.cc 2015-11-21 11:59:00 +0000 +++ src/logic/replay_game_controller.cc 2016-03-01 18:23:35 +0000 @@ -27,23 +27,23 @@ ReplayGameController::ReplayGameController(Widelands::Game & game, const std::string & filename) : - m_game(game), - m_lastframe(SDL_GetTicks()), - m_time(m_game.get_gametime()), - m_speed(1000), - m_paused(false) + game_(game), + lastframe_(SDL_GetTicks()), + time_(game_.get_gametime()), + speed_(1000), + paused_(false) { - m_game.set_game_controller(this); + game_.set_game_controller(this); // We have to create an empty map, otherwise nothing will load properly game.set_map(new Widelands::Map); - m_replayreader.reset(new Widelands::ReplayReader(m_game, filename)); + replayreader_.reset(new Widelands::ReplayReader(game_, filename)); } void ReplayGameController::think() { uint32_t curtime = SDL_GetTicks(); - int32_t frametime = curtime - m_lastframe; - m_lastframe = curtime; + int32_t frametime = curtime - lastframe_; + lastframe_ = curtime; // prevent crazy frametimes if (frametime < 0) @@ -53,18 +53,18 @@ frametime = frametime * real_speed() / 1000; - m_time = m_game.get_gametime() + frametime; + time_ = game_.get_gametime() + frametime; - if (m_replayreader) { + if (replayreader_) { while (Widelands::Command * const cmd = - m_replayreader->get_next_command(m_time)) - m_game.enqueue_command(cmd); + replayreader_->get_next_command(time_)) + game_.enqueue_command(cmd); - if (m_replayreader->end_of_replay()) { - m_replayreader.reset(nullptr); - m_game.enqueue_command - (new CmdReplayEnd(m_time = m_game.get_gametime())); + if (replayreader_->end_of_replay()) { + replayreader_.reset(nullptr); + game_.enqueue_command + (new CmdReplayEnd(time_ = game_.get_gametime())); } } } @@ -74,7 +74,7 @@ } int32_t ReplayGameController::get_frametime() { - return m_time - m_game.get_gametime(); + return time_ - game_.get_gametime(); } GameController::GameType ReplayGameController::get_game_type() { @@ -82,23 +82,23 @@ } uint32_t ReplayGameController::real_speed() { - return m_paused ? 0 : m_speed; + return paused_ ? 0 : speed_; } uint32_t ReplayGameController::desired_speed() { - return m_speed; + return speed_; } void ReplayGameController::set_desired_speed(uint32_t const speed) { - m_speed = speed; + speed_ = speed; } bool ReplayGameController::is_paused() { - return m_paused; + return paused_; } void ReplayGameController::set_paused(bool const paused) { - m_paused = paused; + paused_ = paused; } void ReplayGameController::CmdReplayEnd::execute (Widelands::Game & game) { === modified file 'src/logic/replay_game_controller.h' --- src/logic/replay_game_controller.h 2016-02-09 16:29:48 +0000 +++ src/logic/replay_game_controller.h 2016-03-01 18:23:35 +0000 @@ -51,12 +51,12 @@ virtual Widelands::QueueCommandTypes id() const; }; - Widelands::Game & m_game; - std::unique_ptr<Widelands::ReplayReader> m_replayreader; - int32_t m_lastframe; - int32_t m_time; - uint32_t m_speed; - bool m_paused; + Widelands::Game & game_; + std::unique_ptr<Widelands::ReplayReader> replayreader_; + int32_t lastframe_; + int32_t time_; + uint32_t speed_; + bool paused_; }; #endif // end of include guard: WL_LOGIC_REPLAY_GAME_CONTROLLER_H === modified file 'src/logic/save_handler.cc' --- src/logic/save_handler.cc 2016-02-21 10:13:05 +0000 +++ src/logic/save_handler.cc 2016-03-01 18:23:35 +0000 @@ -46,21 +46,21 @@ initialize(realtime); std::string filename = autosave_filename_; - if (!m_allow_saving) { + if (!allow_saving_) { return; } if (game.is_replay()) { return; } - if (m_save_requested) { - if (!m_save_filename.empty()) { - filename = m_save_filename; + if (save_requested_) { + if (!save_filename_.empty()) { + filename = save_filename_; } log("Autosave: save requested : %s\n", filename.c_str()); - m_save_requested = false; - m_save_filename = ""; + save_requested_ = false; + save_filename_ = ""; } else { const int32_t autosave_interval_in_seconds = g_options.pull_section("global").get_int("autosave", DEFAULT_AUTOSAVE_INTERVAL * 60); @@ -68,14 +68,14 @@ return; // no autosave requested } - const int32_t elapsed = (realtime - m_last_saved_realtime) / 1000; + const int32_t elapsed = (realtime - last_saved_realtime_) / 1000; if (elapsed < autosave_interval_in_seconds) { return; } if (game.game_controller()->is_paused()) { // check if game is paused // Wait 30 seconds until next save try - m_last_saved_realtime = m_last_saved_realtime + 30000; + last_saved_realtime_ = last_saved_realtime_ + 30000; return; } //roll autosaves @@ -132,7 +132,7 @@ g_fs->fs_rename(backup_filename, complete_filename); } // Wait 30 seconds until next save try - m_last_saved_realtime = m_last_saved_realtime + 30000; + last_saved_realtime_ = last_saved_realtime_ + 30000; return; } else { // if backup file was created, time to remove it @@ -142,18 +142,18 @@ log("Autosave: save took %d ms\n", SDL_GetTicks() - realtime); game.get_ibase()->log_message(_("Game saved")); - m_last_saved_realtime = realtime; + last_saved_realtime_ = realtime; } /** * Initialize autosave timer */ void SaveHandler::initialize(uint32_t realtime) { - if (m_initialized) + if (initialized_) return; - m_last_saved_realtime = realtime; - m_initialized = true; + last_saved_realtime_ = realtime; + initialized_ = true; } /* === modified file 'src/logic/save_handler.h' --- src/logic/save_handler.h 2016-02-18 18:12:48 +0000 +++ src/logic/save_handler.h 2016-03-01 18:23:35 +0000 @@ -32,8 +32,8 @@ class SaveHandler { public: - SaveHandler() : m_last_saved_realtime(0), m_initialized(false), m_allow_saving(true), - m_save_requested(false), m_save_filename(""), autosave_filename_("wl_autosave") {} + SaveHandler() : last_saved_realtime_(0), initialized_(false), allow_saving_(true), + save_requested_(false), save_filename_(""), autosave_filename_("wl_autosave") {} void think(Widelands::Game &); std::string create_file_name(const std::string& dir, const std::string& filename) const; bool save_game @@ -42,24 +42,24 @@ std::string * error = nullptr); static std::string get_base_dir() {return "save";} - const std::string get_cur_filename() {return m_current_filename;} - void set_current_filename(const std::string& filename) {m_current_filename = filename;} + const std::string get_cur_filename() {return current_filename_;} + void set_current_filename(const std::string& filename) {current_filename_ = filename;} void set_autosave_filename(const std::string& filename) {autosave_filename_ = filename;} - void set_allow_saving(bool t) {m_allow_saving = t;} - bool get_allow_saving() {return m_allow_saving;} + void set_allow_saving(bool t) {allow_saving_ = t;} + bool get_allow_saving() {return allow_saving_;} void request_save(const std::string& filename = "") { - m_save_requested = true; - m_save_filename = filename; + save_requested_ = true; + save_filename_ = filename; } private: - uint32_t m_last_saved_realtime; - bool m_initialized; - bool m_allow_saving; - bool m_save_requested; - std::string m_save_filename; - std::string m_current_filename; + uint32_t last_saved_realtime_; + bool initialized_; + bool allow_saving_; + bool save_requested_; + std::string save_filename_; + std::string current_filename_; std::string autosave_filename_; void initialize(uint32_t gametime); === modified file 'src/logic/single_player_game_controller.cc' --- src/logic/single_player_game_controller.cc 2015-11-08 17:31:06 +0000 +++ src/logic/single_player_game_controller.cc 2016-03-01 18:23:35 +0000 @@ -32,31 +32,31 @@ (Widelands::Game & game, bool const useai, Widelands::PlayerNumber const local) - : m_game (game), - m_useai (useai), - m_lastframe (SDL_GetTicks()), - m_time (m_game.get_gametime()), - m_speed + : game_ (game), + use_ai_ (useai), + lastframe_ (SDL_GetTicks()), + time_ (game_.get_gametime()), + speed_ (g_options.pull_section("global").get_natural ("speed_of_new_game", 1000)), - m_paused(false), - m_player_cmdserial(0), - m_local (local) + paused_(false), + player_cmdserial_(0), + local_ (local) { } SinglePlayerGameController::~SinglePlayerGameController() { - for (uint32_t i = 0; i < m_computerplayers.size(); ++i) - delete m_computerplayers[i]; - m_computerplayers.clear(); + for (uint32_t i = 0; i < computerplayers_.size(); ++i) + delete computerplayers_[i]; + computerplayers_.clear(); } void SinglePlayerGameController::think() { uint32_t const curtime = SDL_GetTicks(); - int32_t frametime = curtime - m_lastframe; - m_lastframe = curtime; + int32_t frametime = curtime - lastframe_; + lastframe_ = curtime; // prevent crazy frametimes if (frametime < 0) @@ -66,20 +66,20 @@ frametime = frametime * real_speed() / 1000; - m_time = m_game.get_gametime() + frametime; - - if (m_useai && m_game.is_loaded()) { - const Widelands::PlayerNumber nr_players = m_game.map().get_nrplayers(); - iterate_players_existing(p, nr_players, m_game, plr) - if (p != m_local) { - - if (p > m_computerplayers.size()) - m_computerplayers.resize(p); - if (!m_computerplayers[p - 1]) - m_computerplayers[p - 1] = + time_ = game_.get_gametime() + frametime; + + if (use_ai_ && game_.is_loaded()) { + const Widelands::PlayerNumber nr_players = game_.map().get_nrplayers(); + iterate_players_existing(p, nr_players, game_, plr) + if (p != local_) { + + if (p > computerplayers_.size()) + computerplayers_.resize(p); + if (!computerplayers_[p - 1]) + computerplayers_[p - 1] = ComputerPlayer::get_implementation - (plr->get_ai())->instantiate(m_game, p); - m_computerplayers[p - 1]->think(); + (plr->get_ai())->instantiate(game_, p); + computerplayers_[p - 1]->think(); } } } @@ -87,13 +87,13 @@ void SinglePlayerGameController::send_player_command (Widelands::PlayerCommand & pc) { - pc.set_cmdserial(++m_player_cmdserial); - m_game.enqueue_command (&pc); + pc.set_cmdserial(++player_cmdserial_); + game_.enqueue_command (&pc); } int32_t SinglePlayerGameController::get_frametime() { - return m_time - m_game.get_gametime(); + return time_ - game_.get_gametime(); } GameController::GameType SinglePlayerGameController::get_game_type() @@ -103,41 +103,41 @@ uint32_t SinglePlayerGameController::real_speed() { - if (m_paused) + if (paused_) return 0; else - return m_speed; + return speed_; } uint32_t SinglePlayerGameController::desired_speed() { - return m_speed; + return speed_; } void SinglePlayerGameController::set_desired_speed(uint32_t const speed) { - m_speed = speed; + speed_ = speed; } bool SinglePlayerGameController::is_paused() { - return m_paused; + return paused_; } void SinglePlayerGameController::set_paused(bool paused) { - m_paused = paused; + paused_ = paused; } void SinglePlayerGameController::report_result (uint8_t p_nr, Widelands::PlayerEndResult result, const std::string & info) { Widelands::PlayerEndStatus pes; - Widelands::Player* player = m_game.get_player(p_nr); + Widelands::Player* player = game_.get_player(p_nr); assert(player); pes.player = player->player_number(); - pes.time = m_game.get_gametime(); + pes.time = game_.get_gametime(); pes.result = result; pes.info = info; - m_game.player_manager()->add_player_end_status(pes); + game_.player_manager()->add_player_end_status(pes); } === modified file 'src/logic/single_player_game_controller.h' --- src/logic/single_player_game_controller.h 2015-03-01 09:21:20 +0000 +++ src/logic/single_player_game_controller.h 2016-03-01 18:23:35 +0000 @@ -42,15 +42,15 @@ void report_result(uint8_t player, Widelands::PlayerEndResult result, const std::string & info) override; private: - Widelands::Game & m_game; - bool m_useai; - int32_t m_lastframe; - int32_t m_time; - uint32_t m_speed; ///< current game speed, in milliseconds per second - bool m_paused; - uint32_t m_player_cmdserial; - Widelands::PlayerNumber m_local; - std::vector<ComputerPlayer *> m_computerplayers; + Widelands::Game & game_; + bool use_ai_; + int32_t lastframe_; + int32_t time_; + uint32_t speed_; ///< current game speed, in milliseconds per second + bool paused_; + uint32_t player_cmdserial_; + Widelands::PlayerNumber local_; + std::vector<ComputerPlayer *> computerplayers_; }; #endif // end of include guard: WL_LOGIC_SINGLE_PLAYER_GAME_CONTROLLER_H === modified file 'src/map_io/map_buildingdata_packet.cc' --- src/map_io/map_buildingdata_packet.cc 2016-02-17 16:20:45 +0000 +++ src/map_io/map_buildingdata_packet.cc 2016-03-01 18:23:35 +0000 @@ -477,7 +477,7 @@ Area<FCoords> a (map.get_fcoords(warehouse.get_position()), conquer_radius); const Field & first_map_field = map[0]; - Player::Field * const player_fields = player.m_fields; + Player::Field * const player_fields = player.fields_; MapRegion<Area<FCoords> > mr(map, a); do player_fields[mr.location().field - &first_map_field] @@ -547,7 +547,7 @@ militarysite.descr().get_conquers()); const Field & first_map_field = map[0]; Player::Field * const player_fields = - militarysite.owner().m_fields; + militarysite.owner().fields_; MapRegion<Area<FCoords> > mr(map, a); do player_fields[mr.location().field - &first_map_field] === modified file 'src/map_io/map_exploration_packet.cc' --- src/map_io/map_exploration_packet.cc 2015-10-24 15:42:37 +0000 +++ src/map_io/map_exploration_packet.cc 2016-03-01 18:23:35 +0000 @@ -64,7 +64,7 @@ for (uint8_t j = 0; j < nr_players; ++j) { bool see = data & (1 << j); if (Player * const player = egbase.get_player(j + 1)) - player->m_fields[i].vision = see ? 1 : 0; + player->fields_[i].vision = see ? 1 : 0; else if (see) log ("MapExplorationPacket::read: WARNING: Player %u, " === modified file 'src/map_io/map_players_view_packet.cc' --- src/map_io/map_players_view_packet.cc 2016-01-18 19:35:25 +0000 +++ src/map_io/map_players_view_packet.cc 2016-03-01 18:23:35 +0000 @@ -305,7 +305,7 @@ Field & first_field = map[0]; const PlayerNumber nr_players = map.get_nrplayers(); iterate_players_existing_const(plnum, nr_players, egbase, player) { - Player::Field * const player_fields = player->m_fields; + Player::Field * const player_fields = player->fields_; uint32_t const gametime = egbase.get_gametime(); char unseen_times_filename[FILENAME_SIZE]; @@ -903,7 +903,7 @@ Field & first_field = map[0]; const PlayerNumber nr_players = map.get_nrplayers(); iterate_players_existing_const(plnum, nr_players, egbase, player) - if (const Player::Field * const player_fields = player->m_fields) { + if (const Player::Field * const player_fields = player->fields_) { FileWrite unseen_times_file; FileWrite node_immovable_kinds_file; FileWrite node_immovables_file;
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp