widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #06427
[Merge] lp:~widelands-dev/widelands/bug-1395278-logic3 into lp:widelands
Klaus Halfmann has proposed merging lp:~widelands-dev/widelands/bug-1395278-logic3 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-logic3/+merge/287827
Did a code review, found pure renaming only,
will continue to play the game from the last review (bug-1395278-logic2) now.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-logic3 into lp:widelands.
=== modified file 'src/game_io/game_cmd_queue_packet.cc'
--- src/game_io/game_cmd_queue_packet.cc 2016-02-15 23:26:42 +0000
+++ src/game_io/game_cmd_queue_packet.cc 2016-03-02 18:10:45 +0000
@@ -41,7 +41,7 @@
if (packet_version == kCurrentPacketVersion) {
CmdQueue & cmdq = game.cmdqueue();
- // nothing to be done for m_game
+ // nothing to be done for game_
// Next serial
cmdq.nextserial_ = fr.unsigned_32();
@@ -86,7 +86,7 @@
const CmdQueue & cmdq = game.cmdqueue();
- // nothing to be done for m_game
+ // nothing to be done for game_
// Next serial
fw.unsigned_32(cmdq.nextserial_);
=== modified file 'src/game_io/game_loader.cc'
--- src/game_io/game_loader.cc 2016-01-20 20:12:00 +0000
+++ src/game_io/game_loader.cc 2016-03-02 18:10:45 +0000
@@ -40,7 +40,7 @@
namespace Widelands {
GameLoader::GameLoader(const std::string & path, Game & game) :
- m_fs(*g_fs->make_sub_file_system(path)), m_game(game)
+ m_fs(*g_fs->make_sub_file_system(path)), game_(game)
{}
@@ -53,7 +53,7 @@
*/
int32_t GameLoader::preload_game(GamePreloadPacket & mp) {
// Load elemental data block
- mp.read(m_fs, m_game, nullptr);
+ mp.read(m_fs, game_, nullptr);
return 0;
}
@@ -65,43 +65,43 @@
ScopedTimer timer("GameLoader::load() took %ums");
log("Game: Reading Preload Data ... ");
- {GamePreloadPacket p; p.read(m_fs, m_game);}
+ {GamePreloadPacket p; p.read(m_fs, game_);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Game Class Data ... ");
- {GameClassPacket p; p.read(m_fs, m_game);}
+ {GameClassPacket p; p.read(m_fs, game_);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Map Data ... ");
- GameMapPacket M; M.read(m_fs, m_game);
+ GameMapPacket M; M.read(m_fs, game_);
log("Game: Reading Map Data took %ums\n", timer.ms_since_last_query());
log("Game: Reading Player Info ... ");
- {GamePlayerInfoPacket p; p.read(m_fs, m_game);}
+ {GamePlayerInfoPacket p; p.read(m_fs, game_);}
log("Game: Reading Player Info took %ums\n", timer.ms_since_last_query());
log("Game: Calling read_complete()\n");
- M.read_complete(m_game);
+ M.read_complete(game_);
log("Game: read_complete took: %ums\n", timer.ms_since_last_query());
MapObjectLoader * const mol = M.get_map_object_loader();
log("Game: Reading Player Economies Info ... ");
- {GamePlayerEconomiesPacket p; p.read(m_fs, m_game, mol);}
+ {GamePlayerEconomiesPacket p; p.read(m_fs, game_, mol);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading ai persistent data ... ");
- {GamePlayerAiPersistentPacket p; p.read(m_fs, m_game, mol);}
+ {GamePlayerAiPersistentPacket p; p.read(m_fs, game_, mol);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Command Queue Data ... ");
- {GameCmdQueuePacket p; p.read(m_fs, m_game, mol);}
+ {GameCmdQueuePacket p; p.read(m_fs, game_, mol);}
log("took %ums\n", timer.ms_since_last_query());
// This must be after the command queue has been read.
log("Game: Parsing messages ... ");
- PlayerNumber const nr_players = m_game.map().get_nrplayers();
- iterate_players_existing_const(p, nr_players, m_game, player) {
+ PlayerNumber const nr_players = game_.map().get_nrplayers();
+ iterate_players_existing_const(p, nr_players, game_, player) {
const MessageQueue & messages = player->messages();
for (std::pair<MessageId, Message *> temp_message : messages) {
Message* m = temp_message.second;
@@ -109,7 +109,7 @@
// Renew MapObject connections
if (m->serial() > 0) {
- MapObject* mo = m_game.objects().get_object(m->serial());
+ MapObject* mo = game_.objects().get_object(m->serial());
mo->removed.connect
(boost::bind(&Player::message_object_removed, player, m_id));
}
@@ -118,14 +118,14 @@
log("took %ums\n", timer.ms_since_last_query());
// For compatibility hacks only
- mol->load_finish_game(m_game);
+ mol->load_finish_game(game_);
// Only read and use interactive player data, if we load a singleplayer game.
// In multiplayer games every client needs to create a new interactive
// player.
if (!multiplayer) {
log("Game: Reading Interactive Player Data ... ");
- {GameInteractivePlayerPacket p; p.read(m_fs, m_game, mol);}
+ {GameInteractivePlayerPacket p; p.read(m_fs, game_, mol);}
log("took %ums\n", timer.ms_since_last_query());
}
=== modified file 'src/game_io/game_loader.h'
--- src/game_io/game_loader.h 2014-09-10 07:57:29 +0000
+++ src/game_io/game_loader.h 2016-03-02 18:10:45 +0000
@@ -44,7 +44,7 @@
private:
FileSystem & m_fs;
- Game & m_game;
+ Game & game_;
};
}
=== modified file 'src/game_io/game_saver.cc'
--- src/game_io/game_saver.cc 2016-01-20 20:12:00 +0000
+++ src/game_io/game_saver.cc 2016-03-02 18:10:45 +0000
@@ -34,7 +34,7 @@
namespace Widelands {
-GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), m_game(game) {
+GameSaver::GameSaver(FileSystem & fs, Game & game) : m_fs(fs), game_(game) {
}
@@ -47,37 +47,37 @@
m_fs.ensure_directory_exists("binary");
log("Game: Writing Preload Data ... ");
- {GamePreloadPacket p; p.write(m_fs, m_game, nullptr);}
+ {GamePreloadPacket p; p.write(m_fs, game_, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Game Class Data ... ");
- {GameClassPacket p; p.write(m_fs, m_game, nullptr);}
+ {GameClassPacket p; p.write(m_fs, game_, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Player Info ... ");
- {GamePlayerInfoPacket p; p.write(m_fs, m_game, nullptr);}
+ {GamePlayerInfoPacket p; p.write(m_fs, game_, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Map Data!\n");
- GameMapPacket M; M.write(m_fs, m_game, nullptr);
+ GameMapPacket M; M.write(m_fs, game_, nullptr);
log("Game: Writing Map Data took %ums\n", timer.ms_since_last_query());
MapObjectSaver * const mos = M.get_map_object_saver();
log("Game: Writing Player Economies Info ... ");
- {GamePlayerEconomiesPacket p; p.write(m_fs, m_game, mos);}
+ {GamePlayerEconomiesPacket p; p.write(m_fs, game_, mos);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing ai persistent data ... ");
- {GamePlayerAiPersistentPacket p; p.write(m_fs, m_game, mos);}
+ {GamePlayerAiPersistentPacket p; p.write(m_fs, game_, mos);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Command Queue Data ... ");
- {GameCmdQueuePacket p; p.write(m_fs, m_game, mos);}
+ {GameCmdQueuePacket p; p.write(m_fs, game_, mos);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Interactive Player Data ... ");
- {GameInteractivePlayerPacket p; p.write(m_fs, m_game, mos);}
+ {GameInteractivePlayerPacket p; p.write(m_fs, game_, mos);}
log("took %ums\n", timer.ms_since_last_query());
}
=== modified file 'src/game_io/game_saver.h'
--- src/game_io/game_saver.h 2014-09-10 07:57:29 +0000
+++ src/game_io/game_saver.h 2016-03-02 18:10:45 +0000
@@ -44,7 +44,7 @@
private:
FileSystem & m_fs;
- Game & m_game;
+ Game & game_;
};
}
=== modified file 'src/logic/game.cc'
--- src/logic/game.cc 2016-02-21 18:02:23 +0000
+++ src/logic/game.cc 2016-03-02 18:10:45 +0000
@@ -89,8 +89,8 @@
void Game::SyncWrapper::data(void const * const sync_data, size_t const size) {
#ifdef SYNC_DEBUG
- uint32_t time = m_game.get_gametime();
- log("[sync:%08u t=%6u]", m_counter, time);
+ uint32_t time = game_.get_gametime();
+ log("[sync:%08u t=%6u]", counter_, time);
for (size_t i = 0; i < size; ++i)
log(" %02x", (static_cast<uint8_t const *>(sync_data))[i]);
log("\n");
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2016-03-02 10:04:54 +0000
+++ src/logic/map.cc 2016-03-02 18:10:45 +0000
@@ -664,7 +664,7 @@
*/
struct FindBobsCallback {
FindBobsCallback(std::vector<Bob *> * const list, const FindBob & functor)
- : m_list(list), m_functor(functor), m_found(0) {}
+ : list_(list), functor_(functor), found_(0) {}
void operator()(const Map &, const FCoords cur) {
for
@@ -673,22 +673,22 @@
bob = bob->get_next_bob())
{
if
- (m_list &&
- std::find(m_list->begin(), m_list->end(), bob) != m_list->end())
+ (list_ &&
+ std::find(list_->begin(), list_->end(), bob) != list_->end())
continue;
- if (m_functor.accept(bob)) {
- if (m_list)
- m_list->push_back(bob);
+ if (functor_.accept(bob)) {
+ if (list_)
+ list_->push_back(bob);
- ++m_found;
+ ++found_;
}
}
}
- std::vector<Bob *> * m_list;
- const FindBob & m_functor;
- uint32_t m_found;
+ std::vector<Bob*>* list_;
+ const FindBob& functor_;
+ uint32_t found_;
};
@@ -711,7 +711,7 @@
find(area, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -737,7 +737,7 @@
find_reachable(area, checkstep, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -751,7 +751,7 @@
struct FindImmovablesCallback {
FindImmovablesCallback
(std::vector<ImmovableFound> * const list, const FindImmovable & functor)
- : m_list(list), m_functor(functor), m_found(0) {}
+ : list_(list), functor_(functor), found_(0) {}
void operator()(const Map &, const FCoords cur) {
BaseImmovable * const imm = cur.field->get_immovable();
@@ -759,21 +759,21 @@
if (!imm)
return;
- if (m_functor.accept(*imm)) {
- if (m_list) {
+ if (functor_.accept(*imm)) {
+ if (list_) {
ImmovableFound imf;
imf.object = imm;
imf.coords = cur;
- m_list->push_back(imf);
+ list_->push_back(imf);
}
- ++m_found;
+ ++found_;
}
}
- std::vector<ImmovableFound> * m_list;
- const FindImmovable & m_functor;
- uint32_t m_found;
+ std::vector<ImmovableFound>* list_;
+ const FindImmovable& functor_;
+ uint32_t found_;
};
@@ -794,7 +794,7 @@
find(area, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -818,7 +818,7 @@
find_reachable(area, checkstep, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -862,20 +862,20 @@
struct FindNodesCallback {
FindNodesCallback
(std::vector<Coords> * const list, const FindNode & functor)
- : m_list(list), m_functor(functor), m_found(0) {}
+ : list_(list), functor_(functor), found_(0) {}
void operator()(const Map & map, const FCoords cur) {
- if (m_functor.accept(map, cur)) {
- if (m_list)
- m_list->push_back(cur);
+ if (functor_.accept(map, cur)) {
+ if (list_)
+ list_->push_back(cur);
- ++m_found;
+ ++found_;
}
}
- std::vector<Coords> * m_list;
- const FindNode & m_functor;
- uint32_t m_found;
+ std::vector<Coords>* list_;
+ const FindNode & functor_;
+ uint32_t found_;
};
@@ -897,7 +897,7 @@
find(area, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -920,7 +920,7 @@
find_reachable(area, checkstep, cb);
- return cb.m_found;
+ return cb.found_;
}
@@ -1424,7 +1424,7 @@
rx = lx + dist;
// Allow for wrap-around
- // Yes, the second is an else if; see the above if (dist >= m_width)
+ // Yes, the second is an else if; see the above if (dist >= width_)
if (lx < 0)
lx += width_;
else if (rx >= static_cast<int32_t>(width_))
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc 2016-02-21 18:02:23 +0000
+++ src/logic/map_objects/tribes/ship.cc 2016-03-02 18:10:45 +0000
@@ -748,9 +748,9 @@
uint32_t Ship::calculate_sea_route(Game& game, PortDock& pd, Path* finalpath) {
Map& map = game.map();
StepEvalAStar se(pd.get_warehouse()->get_position());
- se.m_swim = true;
- se.m_conservative = false;
- se.m_estimator_bias = -5 * map.calc_cost(0);
+ se.swim_ = true;
+ se.conservative_ = false;
+ se.estimator_bias_ = -5 * map.calc_cost(0);
MapAStar<StepEvalAStar> astar(map, se);
=== modified file 'src/logic/map_objects/tribes/soldier.cc'
--- src/logic/map_objects/tribes/soldier.cc 2016-02-16 13:15:29 +0000
+++ src/logic/map_objects/tribes/soldier.cc 2016-03-02 18:10:45 +0000
@@ -425,7 +425,7 @@
/// Calculates the actual position to draw on from the base node position.
/// This function takes battling into account.
///
-/// pos is the location, in pixels, of the node m_position (height is already
+/// pos is the location, in pixels, of the node position_ (height is already
/// taken into account).
Point Soldier::calc_drawpos
(const EditorGameBase & game, const Point pos) const
@@ -695,13 +695,13 @@
}
struct FindNodeOwned {
- FindNodeOwned(PlayerNumber owner) : m_owner(owner)
+ FindNodeOwned(PlayerNumber owner) : owner_(owner)
{}
bool accept(const Map&, const FCoords& coords) const {
- return (coords.field->get_owned_by() == m_owner);
+ return (coords.field->get_owned_by() == owner_);
}
private:
- PlayerNumber m_owner;
+ PlayerNumber owner_;
};
/**
=== modified file 'src/logic/map_revision.cc'
--- src/logic/map_revision.cc 2014-02-22 18:04:02 +0000
+++ src/logic/map_revision.cc 2016-03-02 18:10:45 +0000
@@ -25,11 +25,11 @@
MapVersion::MapVersion() :
-m_map_version_major(0),
-m_map_version_minor(0)
+map_version_major_(0),
+map_version_minor_(0)
{
- m_map_creator_version = build_id();
- m_map_version_timestamp = static_cast<uint32_t>(time(nullptr));
+ map_creator_version_ = build_id();
+ map_version_timestamp_ = static_cast<uint32_t>(time(nullptr));
}
}
=== modified file 'src/logic/map_revision.h'
--- src/logic/map_revision.h 2014-07-05 16:41:51 +0000
+++ src/logic/map_revision.h 2016-03-02 18:10:45 +0000
@@ -34,12 +34,12 @@
struct MapVersion {
- std::string m_map_source_url;
- std::string m_map_source_release;
- std::string m_map_creator_version;
- int32_t m_map_version_major;
- int32_t m_map_version_minor;
- uint32_t m_map_version_timestamp;
+ std::string map_source_url_;
+ std::string map_source_release_;
+ std::string map_creator_version_;
+ int32_t map_version_major_;
+ int32_t map_version_minor_;
+ uint32_t map_version_timestamp_;
MapVersion();
=== modified file 'src/logic/mapastar.h'
--- src/logic/mapastar.h 2016-02-15 23:26:42 +0000
+++ src/logic/mapastar.h 2016-03-02 18:10:45 +0000
@@ -53,37 +53,37 @@
struct StepEvalAStar {
StepEvalAStar(Coords target) :
- m_target(target),
- m_estimator_bias(0),
- m_conservative(true),
- m_swim(false)
+ target_(target),
+ estimator_bias_(0),
+ conservative_(true),
+ swim_(false)
{
}
int32_t estimate(Map & map, FCoords pos) const
{
- int32_t est = m_estimator_bias;
- if (m_conservative)
- est += map.calc_cost_lowerbound(pos, m_target);
+ int32_t est = estimator_bias_;
+ if (conservative_)
+ est += map.calc_cost_lowerbound(pos, target_);
else
- est += map.calc_cost_estimate(pos, m_target);
+ est += map.calc_cost_estimate(pos, target_);
return est;
}
int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const
{
if
- ((m_swim && !(to.field->nodecaps() & MOVECAPS_SWIM)) ||
- (!m_swim && !(to.field->nodecaps() & MOVECAPS_WALK)))
+ ((swim_ && !(to.field->nodecaps() & MOVECAPS_SWIM)) ||
+ (!swim_ && !(to.field->nodecaps() & MOVECAPS_WALK)))
return -1;
return map.calc_cost(from, dir);
}
- Coords m_target;
- int32_t m_estimator_bias;
- bool m_conservative;
- bool m_swim;
+ Coords target_;
+ int32_t estimator_bias_;
+ bool conservative_;
+ bool swim_;
};
=== modified file 'src/logic/mapdifferenceregion.cc'
--- src/logic/mapdifferenceregion.cc 2016-01-18 19:35:25 +0000
+++ src/logic/mapdifferenceregion.cc 2016-03-02 18:10:45 +0000
@@ -25,17 +25,17 @@
template <> bool MapDifferenceRegion<Area<FCoords> >::advance(const Map & map)
{
- assert(1 <= m_direction);
- assert (m_direction <= 6);
- if (m_remaining_in_edge) {
- map.get_neighbour(m_area, m_direction, &m_area);
- --m_remaining_in_edge;
+ assert(1 <= direction_);
+ assert (direction_ <= 6);
+ if (remaining_in_edge_) {
+ map.get_neighbour(area_, direction_, &area_);
+ --remaining_in_edge_;
return true;
} else {
- if (!m_passed_corner) {
- m_passed_corner = true;
- --m_direction; if (!m_direction) m_direction = 6;
- m_remaining_in_edge = m_area.radius;
+ if (!passed_corner_) {
+ passed_corner_ = true;
+ --direction_; if (!direction_) direction_ = 6;
+ remaining_in_edge_ = area_.radius;
return advance(map);
}
}
@@ -45,16 +45,16 @@
template <>
void MapDifferenceRegion<Area<FCoords> >::move_to_other_side(const Map & map)
{
- assert(1 <= m_direction);
- assert (m_direction <= 6);
- assert(m_passed_corner);
- --m_direction; if (!m_direction) m_direction = 6;
- Area<FCoords>::RadiusType steps_left = m_area.radius + 1;
- switch (m_direction) {
+ assert(1 <= direction_);
+ assert (direction_ <= 6);
+ assert(passed_corner_);
+ --direction_; if (!direction_) direction_ = 6;
+ Area<FCoords>::RadiusType steps_left = area_.radius + 1;
+ switch (direction_) {
#define DIRECTION_CASE(dir, neighbour_function) \
case dir: \
for (; steps_left; --steps_left) \
- map.neighbour_function(m_area, &m_area); \
+ map.neighbour_function(area_, &area_); \
break; \
DIRECTION_CASE(WALK_NW, get_tln);
@@ -66,9 +66,9 @@
default:
NEVER_HERE();
}
- --m_direction; if (!m_direction) m_direction = 6;
- m_remaining_in_edge = m_area.radius;
- m_passed_corner = false;
+ --direction_; if (!direction_) direction_ = 6;
+ remaining_in_edge_ = area_.radius;
+ passed_corner_ = false;
}
}
=== modified file 'src/logic/mapdifferenceregion.h'
--- src/logic/mapdifferenceregion.h 2014-09-10 08:55:04 +0000
+++ src/logic/mapdifferenceregion.h 2016-03-02 18:10:45 +0000
@@ -40,7 +40,7 @@
template <typename AreaType = Area<> > struct MapDifferenceRegion {
MapDifferenceRegion
(const Map & map, AreaType area, Direction direction)
- : m_area(area), m_remaining_in_edge(area.radius), m_passed_corner(false)
+ : area_(area), remaining_in_edge_(area.radius), passed_corner_(false)
{
assert(1 <= direction);
assert (direction <= 6);
@@ -50,7 +50,7 @@
#define DIRECTION_CASE(dir, neighbour_function) \
case dir: \
for (; area.radius; --area.radius) \
- map.neighbour_function(m_area, &m_area); \
+ map.neighbour_function(area_, &area_); \
break; \
DIRECTION_CASE(WALK_NW, get_tln);
@@ -63,10 +63,10 @@
}
--direction; if (!direction) direction = 6;
--direction; if (!direction) direction = 6;
- m_direction = direction;
+ direction_ = direction;
}
- typename AreaType::CoordsType & location() const {return m_area;}
+ typename AreaType::CoordsType & location() const {return area_;}
/**
* Moves on to the next location. The return value indicates whether the new
@@ -80,12 +80,12 @@
void move_to_other_side(const Map & map);
- typename AreaType::RadiusType radius() const {return m_area.radius;}
+ typename AreaType::RadiusType radius() const {return area_.radius;}
private:
- AreaType m_area;
- typename AreaType::RadiusType m_remaining_in_edge;
- bool m_passed_corner;
- Direction m_direction;
+ AreaType area_;
+ typename AreaType::RadiusType remaining_in_edge_;
+ bool passed_corner_;
+ Direction direction_;
};
}
=== modified file 'src/logic/mapfringeregion.cc'
--- src/logic/mapfringeregion.cc 2016-01-18 19:35:25 +0000
+++ src/logic/mapfringeregion.cc 2016-03-02 18:10:45 +0000
@@ -25,56 +25,56 @@
template <>
bool MapFringeRegion<Area<FCoords> >::advance(const Map & map) {
- switch (m_phase) {
+ switch (phase_) {
case 0:
- if (m_area.radius) {
- m_remaining_in_phase = m_area.radius;
- m_phase = 6;
+ if (area_.radius) {
+ remaining_in_phase_ = area_.radius;
+ phase_ = 6;
}
else
return false;
/* no break */
- case 1: map.get_trn(m_area, &m_area); break;
- case 2: map.get_tln(m_area, &m_area); break;
- case 3: map. get_ln(m_area, &m_area); break;
- case 4: map.get_bln(m_area, &m_area); break;
- case 5: map.get_brn(m_area, &m_area); break;
- case 6: map. get_rn(m_area, &m_area); break;
+ case 1: map.get_trn(area_, &area_); break;
+ case 2: map.get_tln(area_, &area_); break;
+ case 3: map. get_ln(area_, &area_); break;
+ case 4: map.get_bln(area_, &area_); break;
+ case 5: map.get_brn(area_, &area_); break;
+ case 6: map. get_rn(area_, &area_); break;
default:
NEVER_HERE();
}
- if (--m_remaining_in_phase == 0) {
- m_remaining_in_phase = m_area.radius;
- --m_phase;
+ if (--remaining_in_phase_ == 0) {
+ remaining_in_phase_ = area_.radius;
+ --phase_;
}
- return m_phase;
+ return phase_;
}
template <>
bool MapFringeRegion<Area<> >::advance(const Map & map) {
- switch (m_phase) {
+ switch (phase_) {
case 0:
- if (m_area.radius) {
- m_remaining_in_phase = m_area.radius;
- m_phase = 6;
+ if (area_.radius) {
+ remaining_in_phase_ = area_.radius;
+ phase_ = 6;
}
else
return false;
/* no break */
- case 1: map.get_trn(m_area, &m_area); break;
- case 2: map.get_tln(m_area, &m_area); break;
- case 3: map. get_ln(m_area, &m_area); break;
- case 4: map.get_bln(m_area, &m_area); break;
- case 5: map.get_brn(m_area, &m_area); break;
- case 6: map. get_rn(m_area, &m_area); break;
+ case 1: map.get_trn(area_, &area_); break;
+ case 2: map.get_tln(area_, &area_); break;
+ case 3: map. get_ln(area_, &area_); break;
+ case 4: map.get_bln(area_, &area_); break;
+ case 5: map.get_brn(area_, &area_); break;
+ case 6: map. get_rn(area_, &area_); break;
default:
NEVER_HERE();
}
- if (--m_remaining_in_phase == 0) {
- m_remaining_in_phase = m_area.radius;
- --m_phase;
+ if (--remaining_in_phase_ == 0) {
+ remaining_in_phase_ = area_.radius;
+ --phase_;
}
- return m_phase;
+ return phase_;
}
}
=== modified file 'src/logic/mapfringeregion.h'
--- src/logic/mapfringeregion.h 2014-09-10 08:55:04 +0000
+++ src/logic/mapfringeregion.h 2016-03-02 18:10:45 +0000
@@ -34,16 +34,16 @@
*/
template <typename AreaType = Area<> > struct MapFringeRegion {
MapFringeRegion(const Map & map, AreaType area) :
- m_area (area),
- m_remaining_in_phase(area.radius),
- m_phase (area.radius ? 6 : 0)
+ area_ (area),
+ remaining_in_phase_(area.radius),
+ phase_ (area.radius ? 6 : 0)
{
for (typename AreaType::RadiusType r = area.radius; r; --r)
- map.get_tln(m_area, &m_area);
+ map.get_tln(area_, &area_);
}
- const typename AreaType::CoordsType & location() const {return m_area;}
+ const typename AreaType::CoordsType & location() const {return area_;}
/**
* Moves on to the next location. The return value indicates whether the new
@@ -64,17 +64,17 @@
* the region ready to iterate over the next layer of nodes.
*/
void extend(const Map & map) {
- map.get_tln(m_area, &m_area);
- ++m_area.radius;
- m_remaining_in_phase = m_area.radius;
- m_phase = 6;
+ map.get_tln(area_, &area_);
+ ++area_.radius;
+ remaining_in_phase_ = area_.radius;
+ phase_ = 6;
}
- typename AreaType::RadiusType radius() const {return m_area.radius;}
+ typename AreaType::RadiusType radius() const {return area_.radius;}
private:
- AreaType m_area;
- typename AreaType::RadiusType m_remaining_in_phase;
- uint8_t m_phase;
+ AreaType area_;
+ typename AreaType::RadiusType remaining_in_phase_;
+ uint8_t phase_;
};
}
=== modified file 'src/logic/maphollowregion.cc'
--- src/logic/maphollowregion.cc 2014-07-20 07:45:17 +0000
+++ src/logic/maphollowregion.cc 2016-03-02 18:10:45 +0000
@@ -24,63 +24,63 @@
template <> MapHollowRegion<Area<> >::MapHollowRegion
(const Map & map, HollowArea<Area<> > const hollow_area)
:
-m_hollow_area (hollow_area),
-m_phase (Top),
-m_delta_radius(hollow_area.radius - hollow_area.hole_radius),
-m_row (0),
-m_rowwidth (hollow_area.radius + 1),
-m_rowpos (0),
-m_left (hollow_area)
+hollow_area_ (hollow_area),
+phase_ (Top),
+delta_radius_(hollow_area.radius - hollow_area.hole_radius),
+row_ (0),
+rowwidth_ (hollow_area.radius + 1),
+rowpos_ (0),
+left_ (hollow_area)
{
assert(hollow_area.hole_radius < hollow_area.radius);
for (uint16_t r = hollow_area.radius; r; --r)
- map.get_tln(m_hollow_area, &m_hollow_area);
- m_left = m_hollow_area;
+ map.get_tln(hollow_area_, &hollow_area_);
+ left_ = hollow_area_;
}
template <> bool MapHollowRegion<Area<> >::advance(const Map & map) {
- if (m_phase == None)
+ if (phase_ == None)
return false;
- ++m_rowpos;
- if (m_rowpos < m_rowwidth) {
- map.get_rn(m_hollow_area, &m_hollow_area);
- if ((m_phase & (Upper|Lower)) && m_rowpos == m_delta_radius) {
+ ++rowpos_;
+ if (rowpos_ < rowwidth_) {
+ map.get_rn(hollow_area_, &hollow_area_);
+ if ((phase_ & (Upper|Lower)) && rowpos_ == delta_radius_) {
// Jump over the hole.
- const uint32_t holewidth = m_rowwidth - 2 * m_delta_radius;
+ const uint32_t holewidth = rowwidth_ - 2 * delta_radius_;
for (uint32_t i = 0; i < holewidth; ++i)
- map.get_rn(m_hollow_area, &m_hollow_area);
- m_rowpos += holewidth;
+ map.get_rn(hollow_area_, &hollow_area_);
+ rowpos_ += holewidth;
}
} else {
- ++m_row;
- if (m_phase == Top && m_row == m_delta_radius)
- m_phase = Upper;
+ ++row_;
+ if (phase_ == Top && row_ == delta_radius_)
+ phase_ = Upper;
// If we completed the widest, center line, switch into lower mode
- // There are m_radius+1 lines in the upper "half", because the upper
+ // There are radius_+1 lines in the upper "half", because the upper
// half includes the center line.
- else if (m_phase == Upper && m_row > m_hollow_area.radius) {
- m_row = 1;
- m_phase = Lower;
+ else if (phase_ == Upper && row_ > hollow_area_.radius) {
+ row_ = 1;
+ phase_ = Lower;
}
- if (m_phase & (Top|Upper)) {
- map.get_bln(m_left, &m_hollow_area);
- ++m_rowwidth;
+ if (phase_ & (Top|Upper)) {
+ map.get_bln(left_, &hollow_area_);
+ ++rowwidth_;
} else {
- if (m_row > m_hollow_area.radius) {
- m_phase = None;
+ if (row_ > hollow_area_.radius) {
+ phase_ = None;
return true; // early out
- } else if (m_phase == Lower && m_row > m_hollow_area.hole_radius)
- m_phase = Bottom;
+ } else if (phase_ == Lower && row_ > hollow_area_.hole_radius)
+ phase_ = Bottom;
- map.get_brn(m_left, &m_hollow_area);
- --m_rowwidth;
+ map.get_brn(left_, &hollow_area_);
+ --rowwidth_;
}
- m_left = m_hollow_area;
- m_rowpos = 0;
+ left_ = hollow_area_;
+ rowpos_ = 0;
}
return true;
=== modified file 'src/logic/maphollowregion.h'
--- src/logic/maphollowregion.h 2014-09-10 08:55:04 +0000
+++ src/logic/maphollowregion.h 2016-03-02 18:10:45 +0000
@@ -35,7 +35,7 @@
MapHollowRegion(const Map & map, const HollowArea<AreaType> hollow_area);
const typename AreaType::CoordsType& location() const {
- return m_hollow_area;
+ return hollow_area_;
}
/**
@@ -64,13 +64,13 @@
Bottom = 8, // below the hole
};
- HollowArea<AreaType> m_hollow_area;
- Phase m_phase;
- const uint32_t m_delta_radius;
- uint32_t m_row; // # of rows completed in this phase
- uint32_t m_rowwidth; // # of fields to return per row
- uint32_t m_rowpos; // # of fields we have returned in this row
- typename AreaType::CoordsType m_left; // left-most node of current row
+ HollowArea<AreaType> hollow_area_;
+ Phase phase_;
+ const uint32_t delta_radius_;
+ uint32_t row_; // # of rows completed in this phase
+ uint32_t rowwidth_; // # of fields to return per row
+ uint32_t rowpos_; // # of fields we have returned in this row
+ typename AreaType::CoordsType left_; // left-most node of current row
};
}
=== modified file 'src/logic/mapregion.h'
--- src/logic/mapregion.h 2014-09-10 08:55:04 +0000
+++ src/logic/mapregion.h 2016-03-02 18:10:45 +0000
@@ -31,17 +31,17 @@
*/
template <typename AreaType = Area<> > struct MapRegion {
MapRegion(const Map & map, AreaType area) :
- m_area (area),
- m_rowwidth (area.radius + 1),
- m_remaining_in_row(m_rowwidth),
- m_remaining_rows (m_rowwidth + area.radius)
+ area_ (area),
+ rowwidth_ (area.radius + 1),
+ remaining_in_row_(rowwidth_),
+ remaining_rows_ (rowwidth_ + area.radius)
{
for (typename AreaType::RadiusType r = area.radius; r; --r)
- map.get_tln(m_area, &m_area);
- m_left = m_area;
+ map.get_tln(area_, &area_);
+ left_ = area_;
}
- const typename AreaType::CoordsType & location() const {return m_area;}
+ const typename AreaType::CoordsType & location() const {return area_;}
/// Moves on to the next location. The return value indicates whether the
/// new location has not yet been reached during this iteration. Note that
@@ -50,25 +50,25 @@
/// while advance keeps returning true. When finally advance returns false,
/// it means that the iteration is done.
bool advance(const Map & map) {
- if (--m_remaining_in_row)
- map.get_rn(m_area, &m_area);
- else if (m_area.radius < --m_remaining_rows) {
- map.get_bln(m_left, &m_area); m_left = m_area;
- m_remaining_in_row = ++m_rowwidth;
- } else if (m_remaining_rows) {
- map.get_brn(m_left, &m_area); m_left = m_area;
- m_remaining_in_row = --m_rowwidth;
+ if (--remaining_in_row_)
+ map.get_rn(area_, &area_);
+ else if (area_.radius < --remaining_rows_) {
+ map.get_bln(left_, &area_); left_ = area_;
+ remaining_in_row_ = ++rowwidth_;
+ } else if (remaining_rows_) {
+ map.get_brn(left_, &area_); left_ = area_;
+ remaining_in_row_ = --rowwidth_;
} else return false;
return true;
}
- typename AreaType::RadiusType radius() const {return m_area.radius;}
+ typename AreaType::RadiusType radius() const {return area_.radius;}
private:
- AreaType m_area;
- typename AreaType::CoordsType m_left;
- typename AreaType::RadiusType m_rowwidth;
- typename AreaType::RadiusType m_remaining_in_row;
- typename AreaType::RadiusType m_remaining_rows;
+ AreaType area_;
+ typename AreaType::CoordsType left_;
+ typename AreaType::RadiusType rowwidth_;
+ typename AreaType::RadiusType remaining_in_row_;
+ typename AreaType::RadiusType remaining_rows_;
};
}
=== modified file 'src/logic/maptriangleregion.cc'
--- src/logic/maptriangleregion.cc 2016-01-17 08:29:59 +0000
+++ src/logic/maptriangleregion.cc 2016-03-02 18:10:45 +0000
@@ -23,175 +23,175 @@
template <> MapTriangleRegion<>::MapTriangleRegion
(const Map & map, Area<TCoords<> > area)
-: m_radius_is_odd(area.radius & 1)
+: radius_is_odd_(area.radius & 1)
{
assert(area.t == TCoords<>::R || area.t == TCoords<>::D);
const uint16_t radius_plus_1 = area.radius + 1;
const uint16_t half_radius_rounded_down = area.radius / 2;
- m_row_length = radius_plus_1;
+ row_length_ = radius_plus_1;
for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area);
if (area.t == TCoords<>::R) {
- m_left = area;
+ left_ = area;
if (area.radius) {
- m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1;
- m_remaining_rows_in_lower_phase = (area.radius - 1) / 2;
- if (m_radius_is_odd) {
+ remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1;
+ remaining_rows_in_lower_phase_ = (area.radius - 1) / 2;
+ if (radius_is_odd_) {
map.get_trn(area, &area);
- m_phase = Top;
- m_row_length = area.radius + 2;
- m_remaining_in_row = radius_plus_1 / 2;
+ phase_ = Top;
+ row_length_ = area.radius + 2;
+ remaining_in_row_ = radius_plus_1 / 2;
area.t = TCoords<>::D;
} else {
- m_phase = Upper;
- m_remaining_in_row = m_row_length = radius_plus_1;
+ phase_ = Upper;
+ remaining_in_row_ = row_length_ = radius_plus_1;
area.t = TCoords<>::R;
}
} else {
assert(area.radius == 0);
- m_phase = Bottom;
- m_remaining_in_row = 0;
+ phase_ = Bottom;
+ remaining_in_row_ = 0;
area.t = TCoords<>::R;
}
} else {
- m_remaining_rows_in_upper_phase = radius_plus_1 / 2;
- m_remaining_rows_in_lower_phase = half_radius_rounded_down;
- if (m_radius_is_odd) {
+ remaining_rows_in_upper_phase_ = radius_plus_1 / 2;
+ remaining_rows_in_lower_phase_ = half_radius_rounded_down;
+ if (radius_is_odd_) {
map.get_ln(area, &area);
- m_left = area;
- m_phase = Upper;
- m_remaining_in_row = m_row_length = area.radius + 2;
+ left_ = area;
+ phase_ = Upper;
+ remaining_in_row_ = row_length_ = area.radius + 2;
area.t = TCoords<>::R;
} else {
- map.get_bln(area, &m_left);
- m_phase = Top;
- m_row_length = area.radius + 3;
- m_remaining_in_row = half_radius_rounded_down + (0 < area.radius);
+ map.get_bln(area, &left_);
+ phase_ = Top;
+ row_length_ = area.radius + 3;
+ remaining_in_row_ = half_radius_rounded_down + (0 < area.radius);
area.t = TCoords<>::D;
}
}
- m_location = area;
+ location_ = area;
}
template <> bool MapTriangleRegion<>::advance(const Map & map) {
- assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow)
- if (m_remaining_in_row == 0)
+ assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow)
+ if (remaining_in_row_ == 0)
return false;
- --m_remaining_in_row;
- switch (m_phase) {
+ --remaining_in_row_;
+ switch (phase_) {
case Top:
- if (m_remaining_in_row)
- map.get_rn(m_location, &m_location);
- else if (m_remaining_rows_in_upper_phase) {
- m_phase = Upper;
- m_remaining_in_row = m_row_length;
- assert(m_remaining_in_row);
- m_location = TCoords<>(m_left, m_location.t);
+ if (remaining_in_row_)
+ map.get_rn(location_, &location_);
+ else if (remaining_rows_in_upper_phase_) {
+ phase_ = Upper;
+ remaining_in_row_ = row_length_;
+ assert(remaining_in_row_);
+ location_ = TCoords<>(left_, location_.t);
}
break;
case Upper:
- if (m_remaining_in_row) {
- if (m_location.t == TCoords<>::D)
- m_location.t = TCoords<>::R;
+ if (remaining_in_row_) {
+ if (location_.t == TCoords<>::D)
+ location_.t = TCoords<>::R;
else
- m_location = TCoords<>(map.r_n(m_location), TCoords<>::D);
+ location_ = TCoords<>(map.r_n(location_), TCoords<>::D);
} else {
- if (--m_remaining_rows_in_upper_phase) {
- m_row_length += 2;
- m_left = map.bl_n(m_left);
+ if (--remaining_rows_in_upper_phase_) {
+ row_length_ += 2;
+ left_ = map.bl_n(left_);
} else {
- if (m_remaining_rows_in_lower_phase) {
- m_phase = Lower;
- assert(m_row_length >= 2);
- m_row_length -= 2;
- } else if (m_location.t == TCoords<>::R) {
- m_phase = Bottom;
- m_row_length /= 2;
+ if (remaining_rows_in_lower_phase_) {
+ phase_ = Lower;
+ assert(row_length_ >= 2);
+ row_length_ -= 2;
+ } else if (location_.t == TCoords<>::R) {
+ phase_ = Bottom;
+ row_length_ /= 2;
} else return false;
- m_left = map.br_n(m_left);
+ left_ = map.br_n(left_);
}
- m_remaining_in_row = m_row_length;
- m_location = TCoords<>(m_left, m_location.t);
+ remaining_in_row_ = row_length_;
+ location_ = TCoords<>(left_, location_.t);
}
break;
case Lower:
- if (m_remaining_in_row) {
- if (m_location.t == TCoords<>::D)
- m_location.t = TCoords<>::R;
+ if (remaining_in_row_) {
+ if (location_.t == TCoords<>::D)
+ location_.t = TCoords<>::R;
else
- m_location = TCoords<>(map.r_n(m_location), TCoords<>::D);
+ location_ = TCoords<>(map.r_n(location_), TCoords<>::D);
} else {
- if (--m_remaining_rows_in_lower_phase) {
- assert(m_row_length >= 2);
- m_remaining_in_row = m_row_length -= 2;
- m_left = map.br_n(m_left);
- }
- else if (m_location.t == TCoords<>::R) {
- m_phase = Bottom;
- m_remaining_in_row = m_row_length / 2;
- m_left = map.br_n(m_left);
- }
- m_location = TCoords<>(m_left, m_location.t);
+ if (--remaining_rows_in_lower_phase_) {
+ assert(row_length_ >= 2);
+ remaining_in_row_ = row_length_ -= 2;
+ left_ = map.br_n(left_);
+ }
+ else if (location_.t == TCoords<>::R) {
+ phase_ = Bottom;
+ remaining_in_row_ = row_length_ / 2;
+ left_ = map.br_n(left_);
+ }
+ location_ = TCoords<>(left_, location_.t);
}
break;
case Bottom:
- if (m_remaining_in_row)
- map.get_rn(m_location, &m_location);
+ if (remaining_in_row_)
+ map.get_rn(location_, &location_);
break;
}
- assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow)
+ assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow)
return true;
}
template <> MapTriangleRegion<TCoords<FCoords> >::MapTriangleRegion
(const Map & map, Area<TCoords<FCoords> > area)
-: m_radius_is_odd(area.radius & 1)
+: radius_is_odd_(area.radius & 1)
{
assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D);
const uint16_t radius_plus_1 = area.radius + 1;
const uint16_t half_radius_rounded_down = area.radius / 2;
- m_row_length = radius_plus_1;
+ row_length_ = radius_plus_1;
for (uint32_t i = half_radius_rounded_down; i; --i) map.get_tln(area, &area);
if (area.t == TCoords<FCoords>::R) {
- m_left = area;
+ left_ = area;
if (area.radius) {
- m_remaining_rows_in_upper_phase = half_radius_rounded_down + 1;
- m_remaining_rows_in_lower_phase = (area.radius - 1) / 2;
- if (m_radius_is_odd) {
+ remaining_rows_in_upper_phase_ = half_radius_rounded_down + 1;
+ remaining_rows_in_lower_phase_ = (area.radius - 1) / 2;
+ if (radius_is_odd_) {
map.get_trn(area, &area);
- m_phase = Top;
- m_row_length = area.radius + 2;
- m_remaining_in_row = radius_plus_1 / 2;
+ phase_ = Top;
+ row_length_ = area.radius + 2;
+ remaining_in_row_ = radius_plus_1 / 2;
area.t = TCoords<FCoords>::D;
} else {
- m_phase = Upper;
- m_remaining_in_row = m_row_length = radius_plus_1;
+ phase_ = Upper;
+ remaining_in_row_ = row_length_ = radius_plus_1;
area.t = TCoords<FCoords>::R;
}
} else {
- m_phase = Bottom;
- m_remaining_in_row = 0;
+ phase_ = Bottom;
+ remaining_in_row_ = 0;
area.t = TCoords<FCoords>::R;
}
} else {
- m_remaining_rows_in_upper_phase = radius_plus_1 / 2;
- m_remaining_rows_in_lower_phase = half_radius_rounded_down;
- if (m_radius_is_odd) {
+ remaining_rows_in_upper_phase_ = radius_plus_1 / 2;
+ remaining_rows_in_lower_phase_ = half_radius_rounded_down;
+ if (radius_is_odd_) {
map.get_ln(area, &area);
- m_left = area;
- m_phase = Upper;
- m_remaining_in_row = m_row_length = area.radius + 2;
+ left_ = area;
+ phase_ = Upper;
+ remaining_in_row_ = row_length_ = area.radius + 2;
area.t = TCoords<FCoords>::R;
} else {
- map.get_bln(area, &m_left);
- m_phase = Top;
- m_row_length = area.radius + 3;
- m_remaining_in_row = half_radius_rounded_down + (0 < area.radius);
+ map.get_bln(area, &left_);
+ phase_ = Top;
+ row_length_ = area.radius + 3;
+ remaining_in_row_ = half_radius_rounded_down + (0 < area.radius);
area.t = TCoords<FCoords>::D;
}
}
- m_location = area;
+ location_ = area;
}
@@ -199,75 +199,75 @@
template <>
bool MapTriangleRegion<TCoords<FCoords> >::advance(const Map & map)
{
- assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow)
- if (m_remaining_in_row == 0)
+ assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow)
+ if (remaining_in_row_ == 0)
return false;
- --m_remaining_in_row;
- switch (m_phase) {
+ --remaining_in_row_;
+ switch (phase_) {
case Top:
- if (m_remaining_in_row)
- map.get_rn(m_location, &m_location);
- else if (m_remaining_rows_in_upper_phase) {
- m_phase = Upper;
- m_remaining_in_row = m_row_length;
- assert(m_remaining_in_row);
- m_location = TCoords<FCoords>(m_left, m_location.t);
+ if (remaining_in_row_)
+ map.get_rn(location_, &location_);
+ else if (remaining_rows_in_upper_phase_) {
+ phase_ = Upper;
+ remaining_in_row_ = row_length_;
+ assert(remaining_in_row_);
+ location_ = TCoords<FCoords>(left_, location_.t);
}
break;
case Upper:
- if (m_remaining_in_row) {
- if (m_location.t == TCoords<FCoords>::D)
- m_location.t = TCoords<FCoords>::R;
+ if (remaining_in_row_) {
+ if (location_.t == TCoords<FCoords>::D)
+ location_.t = TCoords<FCoords>::R;
else
- m_location =
- TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D);
+ location_ =
+ TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D);
} else {
- if (--m_remaining_rows_in_upper_phase) {
- m_row_length += 2;
- m_left = map.bl_n(m_left);
+ if (--remaining_rows_in_upper_phase_) {
+ row_length_ += 2;
+ left_ = map.bl_n(left_);
} else {
- if (m_remaining_rows_in_lower_phase) {
- m_phase = Lower;
- assert(m_row_length >= 2);
- m_row_length -= 2;
- } else if (m_location.t == TCoords<FCoords>::R) {
- m_phase = Bottom;
- m_row_length /= 2;
+ if (remaining_rows_in_lower_phase_) {
+ phase_ = Lower;
+ assert(row_length_ >= 2);
+ row_length_ -= 2;
+ } else if (location_.t == TCoords<FCoords>::R) {
+ phase_ = Bottom;
+ row_length_ /= 2;
} else
return false;
- m_left = map.br_n(m_left);
+ left_ = map.br_n(left_);
}
- m_remaining_in_row = m_row_length;
- m_location = TCoords<FCoords>(m_left, m_location.t);
+ remaining_in_row_ = row_length_;
+ location_ = TCoords<FCoords>(left_, location_.t);
}
break;
case Lower:
- if (m_remaining_in_row) {
- if (m_location.t == TCoords<FCoords>::D)
- m_location.t = TCoords<FCoords>::R;
+ if (remaining_in_row_) {
+ if (location_.t == TCoords<FCoords>::D)
+ location_.t = TCoords<FCoords>::R;
else
- m_location =
- TCoords<FCoords>(map.r_n(m_location), TCoords<FCoords>::D);
+ location_ =
+ TCoords<FCoords>(map.r_n(location_), TCoords<FCoords>::D);
} else {
- if (--m_remaining_rows_in_lower_phase) {
- assert(m_row_length >= 2);
- m_remaining_in_row = m_row_length -= 2;
- m_left = map.br_n(m_left);
- }
- else if (m_location.t == TCoords<FCoords>::R) {
- m_phase = Bottom;
- m_remaining_in_row = m_row_length / 2;
- m_left = map.br_n(m_left);
- }
- m_location = TCoords<FCoords>(m_left, m_location.t);
+ if (--remaining_rows_in_lower_phase_) {
+ assert(row_length_ >= 2);
+ remaining_in_row_ = row_length_ -= 2;
+ left_ = map.br_n(left_);
+ }
+ else if (location_.t == TCoords<FCoords>::R) {
+ phase_ = Bottom;
+ remaining_in_row_ = row_length_ / 2;
+ left_ = map.br_n(left_);
+ }
+ location_ = TCoords<FCoords>(left_, location_.t);
}
break;
case Bottom:
- if (m_remaining_in_row)
- map.get_rn(m_location, &m_location);
+ if (remaining_in_row_)
+ map.get_rn(location_, &location_);
break;
}
- assert(m_remaining_in_row < 10000); // Catch wrapping (integer underflow)
+ assert(remaining_in_row_ < 10000); // Catch wrapping (integer underflow)
return true;
}
=== modified file 'src/logic/maptriangleregion.h'
--- src/logic/maptriangleregion.h 2014-09-10 08:55:04 +0000
+++ src/logic/maptriangleregion.h 2016-03-02 18:10:45 +0000
@@ -65,60 +65,60 @@
};
template <> struct MapTriangleRegion<FCoords> {
MapTriangleRegion(const Map & map, const Area<FCoords> area) :
- m_area(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1),
- m_rowwidth (m_area.radius * 2 + 1),
- m_remaining_in_row(m_rowwidth),
- m_remaining_rows (m_area.radius * 2)
+ area_(TCoords<FCoords>(area, TCoords<FCoords>::D), area.radius + 1),
+ rowwidth_ (area_.radius * 2 + 1),
+ remaining_in_row_(rowwidth_),
+ remaining_rows_ (area_.radius * 2)
{
- for (uint8_t r = m_area.radius; r; --r) map.get_tln(m_area, &m_area);
- m_left = m_area;
+ for (uint8_t r = area_.radius; r; --r) map.get_tln(area_, &area_);
+ left_ = area_;
}
- const TCoords<FCoords> & location() const {return m_area;}
+ const TCoords<FCoords> & location() const {return area_;}
bool advance(const Map & map) {
- if (--m_remaining_in_row) {
- if (m_area.t == TCoords<FCoords>::D)
- m_area.t = TCoords<FCoords>::R;
+ if (--remaining_in_row_) {
+ if (area_.t == TCoords<FCoords>::D)
+ area_.t = TCoords<FCoords>::R;
else {
- m_area.t = TCoords<FCoords>::D;
- map.get_rn(m_area, &m_area);
+ area_.t = TCoords<FCoords>::D;
+ map.get_rn(area_, &area_);
}
- } else if (m_area.radius < --m_remaining_rows) {
- map.get_bln(m_left, &m_area); m_left = m_area;
- m_area.t = TCoords<FCoords>::D;
- m_remaining_in_row = m_rowwidth += 2;
- } else if (m_remaining_rows) {
- map.get_brn(m_left, &m_area); m_left = m_area;
- m_area.t = TCoords<FCoords>::D;
- m_remaining_in_row = m_rowwidth -= 2;
+ } else if (area_.radius < --remaining_rows_) {
+ map.get_bln(left_, &area_); left_ = area_;
+ area_.t = TCoords<FCoords>::D;
+ remaining_in_row_ = rowwidth_ += 2;
+ } else if (remaining_rows_) {
+ map.get_brn(left_, &area_); left_ = area_;
+ area_.t = TCoords<FCoords>::D;
+ remaining_in_row_ = rowwidth_ -= 2;
} else return false;
return true;
}
private:
- Area<TCoords<FCoords> > m_area;
- FCoords m_left;
- uint16_t m_rowwidth;
- uint16_t m_remaining_in_row;
- uint16_t m_remaining_rows;
+ Area<TCoords<FCoords> > area_;
+ FCoords left_;
+ uint16_t rowwidth_;
+ uint16_t remaining_in_row_;
+ uint16_t remaining_rows_;
};
template <typename CoordsType> struct MapTriangleRegion<TCoords<CoordsType> >
{
MapTriangleRegion(const Map &, Area<TCoords<CoordsType>, uint16_t>);
- const TCoords<CoordsType> & location() const {return m_location;}
+ const TCoords<CoordsType> & location() const {return location_;}
bool advance(const Map &);
private:
- const bool m_radius_is_odd;
- enum {Top, Upper, Lower, Bottom} m_phase;
- uint16_t m_remaining_rows_in_upper_phase;
- uint16_t m_remaining_rows_in_lower_phase;
- uint16_t m_row_length, m_remaining_in_row;
- CoordsType m_left;
- TCoords<CoordsType> m_location;
+ const bool radius_is_odd_;
+ enum {Top, Upper, Lower, Bottom} phase_;
+ uint16_t remaining_rows_in_upper_phase_;
+ uint16_t remaining_rows_in_lower_phase_;
+ uint16_t row_length_, remaining_in_row_;
+ CoordsType left_;
+ TCoords<CoordsType> location_;
};
}
=== modified file 'src/logic/message_queue.h'
--- src/logic/message_queue.h 2014-09-30 07:55:22 +0000
+++ src/logic/message_queue.h 2016-03-02 18:10:45 +0000
@@ -33,9 +33,9 @@
friend class MapPlayersMessagesPacket;
MessageQueue() {
- m_counts[static_cast<int>(Message::Status::kNew)] = 0; // C++0x:
- m_counts[static_cast<int>(Message::Status::kRead)] = 0; // C++0x:
- m_counts[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x:
+ counts_[static_cast<int>(Message::Status::kNew)] = 0; // C++0x:
+ counts_[static_cast<int>(Message::Status::kRead)] = 0; // C++0x:
+ counts_[static_cast<int>(Message::Status::kArchived)] = 0; // C++0x:
} // C++0x:
~MessageQueue() {
@@ -68,7 +68,7 @@
uint32_t nr_messages(Message::Status const status) const {
assert_counts();
assert(static_cast<int>(status) < 3);
- return m_counts[static_cast<int>(status)];
+ return counts_[static_cast<int>(status)];
}
/// Adds the message. Takes ownership of the message. Assumes that it has
@@ -82,12 +82,12 @@
MessageId add_message(Message & message) {
assert_counts();
assert(static_cast<int>(message.status()) < 3);
- ++m_counts[static_cast<int>(message.status())];
+ ++counts_[static_cast<int>(message.status())];
insert
(std::map<MessageId, Message *>::end(),
- std::pair<MessageId, Message *>(++m_current_message_id, &message));
+ std::pair<MessageId, Message *>(++current_message_id_, &message));
assert_counts();
- return m_current_message_id;
+ return current_message_id_;
}
/// Sets the status of the message with the given id, if it exists.
@@ -98,9 +98,9 @@
if (it != end()) {
Message & message = *it->second;
assert(static_cast<int>(it->second->status()) < 3);
- assert(m_counts[static_cast<int>(message.status())]);
- --m_counts[static_cast<int>(message.status())];
- ++m_counts[static_cast<int>(message.set_status(status))];
+ assert(counts_[static_cast<int>(message.status())]);
+ --counts_[static_cast<int>(message.status())];
+ ++counts_[static_cast<int>(message.set_status(status))];
}
assert_counts();
}
@@ -118,14 +118,14 @@
}
Message & message = *it->second;
assert(static_cast<int>(message.status()) < 3);
- assert(m_counts[static_cast<int>(message.status())]);
- --m_counts[static_cast<int>(message.status())];
+ assert(counts_[static_cast<int>(message.status())]);
+ --counts_[static_cast<int>(message.status())];
delete &message;
erase(it);
assert_counts();
}
- MessageId current_message_id() const {return m_current_message_id;}
+ MessageId current_message_id() const {return current_message_id_;}
/// \returns whether all messages with id 1, 2, 3, ..., current_message_id
/// exist. This should be the case when messages have been loaded from a map
@@ -142,28 +142,28 @@
/// it.
void clear() {
assert_counts();
- m_current_message_id = MessageId::null();
- m_counts[static_cast<int>(Message::Status::kNew)] = 0;
- m_counts[static_cast<int>(Message::Status::kRead)] = 0;
- m_counts[static_cast<int>(Message::Status::kArchived)] = 0;
+ current_message_id_ = MessageId::null();
+ counts_[static_cast<int>(Message::Status::kNew)] = 0;
+ counts_[static_cast<int>(Message::Status::kRead)] = 0;
+ counts_[static_cast<int>(Message::Status::kArchived)] = 0;
std::map<MessageId, Message *>::clear();
assert_counts();
}
/// The id of the most recently added message, or null if none has been
/// added yet.
- MessageId m_current_message_id;
+ MessageId current_message_id_;
/// Number of messages with each status (new, read, deleted).
/// Indexed by Message::Status.
- uint32_t m_counts[3];
+ uint32_t counts_[3];
void assert_counts() const {
assert
(size() ==
- m_counts[static_cast<int>(Message::Status::kNew)] +
- m_counts[static_cast<int>(Message::Status::kRead)] +
- m_counts[static_cast<int>(Message::Status::kArchived)]);
+ counts_[static_cast<int>(Message::Status::kNew)] +
+ counts_[static_cast<int>(Message::Status::kRead)] +
+ counts_[static_cast<int>(Message::Status::kArchived)]);
}
DISALLOW_COPY_AND_ASSIGN(MessageQueue);
=== modified file 'src/logic/path.cc'
--- src/logic/path.cc 2016-02-16 10:27:23 +0000
+++ src/logic/path.cc 2016-03-02 18:10:45 +0000
@@ -70,7 +70,7 @@
fw.unsigned_8(kCurrentPacketVersion);
write_coords_32(&fw, start_);
- // Careful: steps are stored in the reverse order in m_path
+ // Careful: steps are stored in the reverse order in path_
// However, we save them in the forward order, to make loading easier
fw.unsigned_32(path_.size());
for (uint32_t i = path_.size(); i > 0; --i)
=== modified file 'src/logic/player.cc'
--- src/logic/player.cc 2016-02-21 20:02:09 +0000
+++ src/logic/player.cc 2016-03-02 18:10:45 +0000
@@ -367,7 +367,7 @@
return add_message(game, m);
}
-void Player::message_object_removed(MessageId m_id) const
+void Player::message_object_removed(MessageId message_id) const
{
// Send delete command
upcast(Game, game, &egbase_);
@@ -377,7 +377,7 @@
game->cmdqueue().enqueue
(new CmdDeleteMessage
- (game->get_gametime(), player_number_, m_id));
+ (game->get_gametime(), player_number_, message_id));
}
=== modified file 'src/logic/replay.cc'
--- src/logic/replay.cc 2016-02-16 13:18:59 +0000
+++ src/logic/replay.cc 2016-03-02 18:10:45 +0000
@@ -49,7 +49,7 @@
class CmdReplaySyncRead : public Command {
public:
CmdReplaySyncRead(const uint32_t init_duetime, const Md5Checksum & hash)
- : Command(init_duetime), m_hash(hash)
+ : Command(init_duetime), hash_(hash)
{}
QueueCommandTypes id() const override {return QueueCommandTypes::kReplaySyncRead;}
@@ -58,12 +58,12 @@
{
const Md5Checksum myhash = game.get_sync_hash();
- if (m_hash != myhash) {
+ if (hash_ != myhash) {
log
("REPLAY: Lost synchronization at time %u\n"
"I have: %s\n"
"Replay has: %s\n",
- duetime(), myhash.str().c_str(), m_hash.str().c_str());
+ duetime(), myhash.str().c_str(), hash_.str().c_str());
// In case syncstream logging is on, save it for analysis
game.save_syncstream(true);
@@ -74,7 +74,7 @@
}
private:
- Md5Checksum m_hash;
+ Md5Checksum hash_;
};
=== modified file 'src/map_io/map_version_packet.cc'
--- src/map_io/map_version_packet.cc 2016-02-15 23:26:42 +0000
+++ src/map_io/map_version_packet.cc 2016-03-02 18:10:45 +0000
@@ -44,8 +44,8 @@
try {prof.read("version", nullptr, fs);} catch (...)
{
Map & map = egbase.map();
- map.map_version_.m_map_version_timestamp = 0;
- map.map_version_.m_map_creator_version = "unknown";
+ map.map_version_.map_version_timestamp_ = 0;
+ map.map_version_.map_creator_version_ = "unknown";
return;
}
@@ -60,13 +60,13 @@
|| (packet_version > kCurrentPacketVersion && forward_compatibility <= kCurrentPacketVersion))
{
Map & map = egbase.map();
- map.map_version_.m_map_source_url = globv.get_safe_string("map_source_url");
- map.map_version_.m_map_source_release = globv.get_safe_string("map_release");
- map.map_version_.m_map_creator_version = globv.get_safe_string("map_creator_version");
- map.map_version_.m_map_version_major = globv.get_safe_int("map_version_major");
- map.map_version_.m_map_version_minor = globv.get_safe_int("map_version_minor");
+ map.map_version_.map_source_url_ = globv.get_safe_string("map_source_url");
+ map.map_version_.map_source_release_ = globv.get_safe_string("map_release");
+ map.map_version_.map_creator_version_ = globv.get_safe_string("map_creator_version");
+ map.map_version_.map_version_major_ = globv.get_safe_int("map_version_major");
+ map.map_version_.map_version_minor_ = globv.get_safe_int("map_version_minor");
uint32_t ts = static_cast<uint32_t>(globv.get_safe_int("map_version_timestamp"));
- map.map_version_.m_map_version_timestamp = ts;
+ map.map_version_.map_version_timestamp_ = ts;
} else {
throw UnhandledVersionError("MapVersionPacket", packet_version, kCurrentPacketVersion);
}
@@ -116,11 +116,11 @@
// There seems to be a get_safe_natural method, but not corresponding setter.
Map & map = egbase.map();
- globs.set_string("map_source_url", map.map_version_.m_map_source_url);
- globs.set_string("map_release", map.map_version_.m_map_source_release);
- globs.set_string("map_creator_version", map.map_version_.m_map_creator_version);
- globs.set_int("map_version_major", map.map_version_.m_map_version_major);
- globs.set_int("map_version_minor", 1 + map.map_version_.m_map_version_minor);
+ globs.set_string("map_source_url", map.map_version_.map_source_url_);
+ globs.set_string("map_release", map.map_version_.map_source_release_);
+ globs.set_string("map_creator_version", map.map_version_.map_creator_version_);
+ globs.set_int("map_version_major", map.map_version_.map_version_major_);
+ globs.set_int("map_version_minor", 1 + map.map_version_.map_version_minor_);
globs.set_int("map_version_timestamp", static_cast<uint32_t>(time(nullptr)));
globs.set_int("packet_version", kCurrentPacketVersion);
globs.set_int("packet_compatibility", kCurrentPacketVersion);
Follow ups