widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #06550
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands.
Commit message:
Refactored member variable names in src/map_io.
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-map_io/+merge/288859
The neverending story...
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands.
=== modified file 'src/logic/map_revision.cc'
--- src/logic/map_revision.cc 2016-02-22 07:25:15 +0000
+++ src/logic/map_revision.cc 2016-03-12 16:30:56 +0000
@@ -25,11 +25,11 @@
MapVersion::MapVersion() :
-map_version_major_(0),
-map_version_minor_(0)
+map_version_major(0),
+map_version_minor(0)
{
- map_creator_version_ = build_id();
- 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 2016-02-22 07:25:15 +0000
+++ src/logic/map_revision.h 2016-03-12 16:30:56 +0000
@@ -34,12 +34,12 @@
struct MapVersion {
- 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_;
+ 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/map_io/map_elemental_packet.h'
--- src/map_io/map_elemental_packet.h 2014-09-19 12:54:54 +0000
+++ src/map_io/map_elemental_packet.h 2016-03-12 16:30:56 +0000
@@ -42,7 +42,7 @@
/// properly configured EditorGameBase object.
void pre_read(FileSystem &, Map *);
- uint32_t get_version() {return m_version;}
+ uint32_t get_version() {return version_;}
/// If this map was created before the one_world merge was done, this returns
/// the old world name, otherwise "".
@@ -52,7 +52,7 @@
private:
std::string old_world_name_;
- uint32_t m_version;
+ uint32_t version_;
};
}
=== modified file 'src/map_io/map_loader.h'
--- src/map_io/map_loader.h 2016-01-29 13:43:56 +0000
+++ src/map_io/map_loader.h 2016-03-12 16:30:56 +0000
@@ -43,13 +43,13 @@
};
MapLoader(const std::string& filename, Map & M)
- : m_map(M), m_s(STATE_INIT) {m_map.set_filename(filename);}
+ : map_(M), state_(STATE_INIT) {map_.set_filename(filename);}
virtual ~MapLoader() {}
virtual int32_t preload_map(bool as_scenario) = 0;
virtual int32_t load_map_complete(EditorGameBase &, MapLoader::LoadType) = 0;
- Map & map() {return m_map;}
+ Map & map() {return map_;}
protected:
enum State {
@@ -57,12 +57,12 @@
STATE_PRELOADED,
STATE_LOADED
};
- void set_state(State const s) {m_s = s;}
- State get_state() const {return m_s;}
- Map & m_map;
+ void set_state(State const s) {state_ = s;}
+ State get_state() const {return state_;}
+ Map & map_;
private:
- State m_s;
+ State state_;
};
}
=== modified file 'src/map_io/map_object_loader.cc'
--- src/map_io/map_object_loader.cc 2015-11-29 09:43:15 +0000
+++ src/map_io/map_object_loader.cc 2016-03-12 16:30:56 +0000
@@ -29,7 +29,7 @@
* Returns true if this object has already been inserted
*/
bool MapObjectLoader::is_object_known(Serial const n) {
- return m_objects.find(n) != m_objects.end();
+ return objects_.find(n) != objects_.end();
}
@@ -38,7 +38,7 @@
*/
void MapObjectLoader::mark_object_as_loaded(MapObject & obj)
{
- m_loaded_obj[&obj] = true;
+ loaded_objects_[&obj] = true;
}
/*
@@ -48,9 +48,9 @@
{
int32_t result = 0;
std::map<MapObject *, bool>::const_iterator const loaded_obj_end =
- m_loaded_obj.end();
+ loaded_objects_.end();
for
- (std::map<MapObject *, bool>::const_iterator it = m_loaded_obj.begin();
+ (std::map<MapObject *, bool>::const_iterator it = loaded_objects_.begin();
it != loaded_obj_end;
++it)
if (!it->second)
@@ -65,7 +65,7 @@
*/
void MapObjectLoader::schedule_destroy(MapObject & obj)
{
- m_schedule_destroy.push_back(&obj);
+ schedule_destroy_.push_back(&obj);
}
/**
@@ -76,7 +76,7 @@
*/
void MapObjectLoader::schedule_act(Bob & bob)
{
- m_schedule_act.push_back(&bob);
+ schedule_act_.push_back(&bob);
}
/**
@@ -86,14 +86,14 @@
*/
void MapObjectLoader::load_finish_game(Game & g)
{
- while (!m_schedule_destroy.empty()) {
- m_schedule_destroy.back()->schedule_destroy(g);
- m_schedule_destroy.pop_back();
+ while (!schedule_destroy_.empty()) {
+ schedule_destroy_.back()->schedule_destroy(g);
+ schedule_destroy_.pop_back();
}
- while (!m_schedule_act.empty()) {
- m_schedule_act.back()->schedule_act(g, 1);
- m_schedule_act.pop_back();
+ while (!schedule_act_.empty()) {
+ schedule_act_.back()->schedule_act(g, 1);
+ schedule_act_.pop_back();
}
}
=== modified file 'src/map_io/map_object_loader.h'
--- src/map_io/map_object_loader.h 2016-02-18 18:27:52 +0000
+++ src/map_io/map_object_loader.h 2016-03-12 16:30:56 +0000
@@ -60,19 +60,19 @@
// kinds of map objects have suitable default constructors.
template<typename T> T & register_object(Serial const n, T & object) {
ReverseMapObjectMap::const_iterator const existing =
- m_objects.find(n);
- if (existing != m_objects.end()) {
+ objects_.find(n);
+ if (existing != objects_.end()) {
// delete &object; can not do this
throw GameDataError("already loaded (%s)", to_string(existing->second->descr().type()).c_str());
}
- m_objects.insert(std::pair<Serial, MapObject *>(n, &object));
- m_loaded_obj[&object] = false;
+ objects_.insert(std::pair<Serial, MapObject *>(n, &object));
+ loaded_objects_[&object] = false;
return object;
}
template<typename T> T & get(Serial const serial) {
- ReverseMapObjectMap::iterator const it = m_objects.find(serial);
- if (it == m_objects.end())
+ ReverseMapObjectMap::iterator const it = objects_.find(serial);
+ if (it == objects_.end())
throw GameDataError("not found");
else if (upcast(T, result, it->second))
return *result;
@@ -83,7 +83,7 @@
}
int32_t get_nr_unloaded_objects();
- bool is_object_loaded(MapObject & obj) {return m_loaded_obj[&obj];}
+ bool is_object_loaded(MapObject & obj) {return loaded_objects_[&obj];}
void mark_object_as_loaded(MapObject &);
@@ -95,11 +95,11 @@
private:
using ReverseMapObjectMap = std::map<Serial, MapObject *>;
- std::map<MapObject *, bool> m_loaded_obj;
- ReverseMapObjectMap m_objects;
+ std::map<MapObject *, bool> loaded_objects_;
+ ReverseMapObjectMap objects_;
- std::vector<MapObject *> m_schedule_destroy;
- std::vector<Bob *> m_schedule_act;
+ std::vector<MapObject *> schedule_destroy_;
+ std::vector<Bob *> schedule_act_;
};
}
=== modified file 'src/map_io/map_object_saver.cc'
--- src/map_io/map_object_saver.cc 2016-03-08 21:14:48 +0000
+++ src/map_io/map_object_saver.cc 2016-03-12 16:30:56 +0000
@@ -33,16 +33,16 @@
namespace Widelands {
MapObjectSaver::MapObjectSaver() :
-m_nr_roads (0),
-m_nr_flags (0),
-m_nr_buildings (0),
-m_nr_bobs (0),
-m_nr_wares (0),
-m_nr_immovables(0),
-m_nr_battles (0),
-m_nr_fleets (0),
-m_nr_portdocks (0),
-m_lastserial (0)
+nr_roads_ (0),
+nr_flags_ (0),
+nr_buildings_ (0),
+nr_bobs_ (0),
+nr_wares_ (0),
+nr_immovables_(0),
+nr_battles_ (0),
+nr_fleets_ (0),
+nr_portdocks_ (0),
+lastserial_ (0)
{}
@@ -53,9 +53,9 @@
MapObjectSaver::MapObjectRec &
MapObjectSaver::get_object_record(const MapObject & obj)
{
- MapObjectRecordMap::iterator it = m_objects.find(&obj);
+ MapObjectRecordMap::iterator it = objects_.find(&obj);
- if (it != m_objects.end())
+ if (it != objects_.end())
return it->second;
MapObjectRec rec;
@@ -65,11 +65,11 @@
rec.description += obj.serial();
rec.description += ')';
#endif
- rec.fileserial = ++m_lastserial;
+ rec.fileserial = ++lastserial_;
rec.registered = false;
rec.saved = false;
return
- m_objects.insert(std::pair<MapObject const *, MapObjectRec>(&obj, rec))
+ objects_.insert(std::pair<MapObject const *, MapObjectRec>(&obj, rec))
.first->second;
}
@@ -80,9 +80,9 @@
*/
bool MapObjectSaver::is_object_known(const MapObject & obj) const
{
- MapObjectRecordMap::const_iterator it = m_objects.find(&obj);
+ MapObjectRecordMap::const_iterator it = objects_.find(&obj);
- if (it == m_objects.end())
+ if (it == objects_.end())
return false;
return it->second.registered;
@@ -102,15 +102,15 @@
assert(!rec.registered);
- if (dynamic_cast<Flag const *>(&obj)) ++m_nr_flags;
- else if (dynamic_cast<Road const *>(&obj)) ++m_nr_roads;
- else if (dynamic_cast<Building const *>(&obj)) ++m_nr_buildings;
- else if (dynamic_cast<Immovable const *>(&obj)) ++m_nr_immovables;
- else if (dynamic_cast<WareInstance const *>(&obj)) ++m_nr_wares;
- else if (dynamic_cast<Bob const *>(&obj)) ++m_nr_bobs;
- else if (dynamic_cast<Battle const *>(&obj)) ++m_nr_battles;
- else if (dynamic_cast<Fleet const *>(&obj)) ++m_nr_fleets;
- else if (dynamic_cast<PortDock const *>(&obj)) ++m_nr_portdocks;
+ if (dynamic_cast<Flag const *>(&obj)) ++nr_flags_;
+ else if (dynamic_cast<Road const *>(&obj)) ++nr_roads_;
+ else if (dynamic_cast<Building const *>(&obj)) ++nr_buildings_;
+ else if (dynamic_cast<Immovable const *>(&obj)) ++nr_immovables_;
+ else if (dynamic_cast<WareInstance const *>(&obj)) ++nr_wares_;
+ else if (dynamic_cast<Bob const *>(&obj)) ++nr_bobs_;
+ else if (dynamic_cast<Battle const *>(&obj)) ++nr_battles_;
+ else if (dynamic_cast<Fleet const *>(&obj)) ++nr_fleets_;
+ else if (dynamic_cast<PortDock const *>(&obj)) ++nr_portdocks_;
else
throw wexception("MapObjectSaver: Unknown MapObject type");
@@ -152,7 +152,7 @@
* Return the number of unsaved objects
*/
void MapObjectSaver::detect_unsaved_objects() const {
- for (const auto& temp_map : m_objects) {
+ for (const auto& temp_map : objects_) {
if (!temp_map.second.saved) {
throw wexception
("%s has not been saved", temp_map.second.description.c_str());
=== modified file 'src/map_io/map_object_saver.h'
--- src/map_io/map_object_saver.h 2014-09-14 11:31:58 +0000
+++ src/map_io/map_object_saver.h 2016-03-12 16:30:56 +0000
@@ -51,13 +51,13 @@
#ifndef NDEBUG
void detect_unsaved_objects() const;
#endif
- uint32_t get_nr_roads () const {return m_nr_roads;}
- uint32_t get_nr_flags () const {return m_nr_flags;}
- uint32_t get_nr_buildings () const {return m_nr_buildings;}
- uint32_t get_nr_wares () const {return m_nr_wares;}
- uint32_t get_nr_bobs () const {return m_nr_bobs;}
- uint32_t get_nr_immovables () const {return m_nr_immovables;}
- uint32_t get_nr_battles () const {return m_nr_battles;}
+ uint32_t get_nr_roads () const {return nr_roads_;}
+ uint32_t get_nr_flags () const {return nr_flags_;}
+ uint32_t get_nr_buildings () const {return nr_buildings_;}
+ uint32_t get_nr_wares () const {return nr_wares_;}
+ uint32_t get_nr_bobs () const {return nr_bobs_;}
+ uint32_t get_nr_immovables () const {return nr_immovables_;}
+ uint32_t get_nr_battles () const {return nr_battles_;}
bool is_object_saved(const MapObject &);
@@ -77,17 +77,17 @@
MapObjectRec & get_object_record(const MapObject &);
- MapObjectRecordMap m_objects;
- uint32_t m_nr_roads;
- uint32_t m_nr_flags;
- uint32_t m_nr_buildings;
- uint32_t m_nr_bobs;
- uint32_t m_nr_wares;
- uint32_t m_nr_immovables;
- uint32_t m_nr_battles;
- uint32_t m_nr_fleets;
- uint32_t m_nr_portdocks;
- uint32_t m_lastserial;
+ MapObjectRecordMap objects_;
+ uint32_t nr_roads_;
+ uint32_t nr_flags_;
+ uint32_t nr_buildings_;
+ uint32_t nr_bobs_;
+ uint32_t nr_wares_;
+ uint32_t nr_immovables_;
+ uint32_t nr_battles_;
+ uint32_t nr_fleets_;
+ uint32_t nr_portdocks_;
+ uint32_t lastserial_;
};
}
=== modified file 'src/map_io/map_saver.cc'
--- src/map_io/map_saver.cc 2016-02-20 11:29:55 +0000
+++ src/map_io/map_saver.cc 2016-03-12 16:30:56 +0000
@@ -63,54 +63,54 @@
namespace Widelands {
MapSaver::MapSaver(FileSystem & fs, EditorGameBase & egbase)
- : m_egbase(egbase), m_fs(fs), m_mos(nullptr)
+ : egbase_(egbase), fs_(fs), mos_(nullptr)
{}
-MapSaver::~MapSaver() {delete m_mos;}
+MapSaver::~MapSaver() {delete mos_;}
void MapSaver::save() {
std::string timer_message = "MapSaver::save() for '";
- timer_message += m_egbase.map().get_name();
+ timer_message += egbase_.map().get_name();
timer_message += "' took %ums";
ScopedTimer timer(timer_message);
- delete m_mos;
- m_mos = new MapObjectSaver();
+ delete mos_;
+ mos_ = new MapObjectSaver();
- bool is_game = is_a(Game, &m_egbase);
+ bool is_game = is_a(Game, &egbase_);
// The binary data is saved in an own directory
// to keep it hidden from the poor debuggers
- m_fs.ensure_directory_exists("binary");
+ fs_.ensure_directory_exists("binary");
// MANDATORY PACKETS
// Start with writing the map out, first Elemental data
// PRELOAD DATA BEGIN
log("Writing Elemental Data ... ");
- {MapElementalPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapElementalPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Player Names And Tribe Data ... ");
- {MapPlayerNamesAndTribesPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapPlayerNamesAndTribesPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
// PRELOAD DATA END
log("Writing Port Spaces Data ... ");
- {MapPortSpacesPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapPortSpacesPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Heights Data ... ");
- {MapHeightsPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapHeightsPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Terrain Data ... ");
- {MapTerrainPacket p; p.write(m_fs, m_egbase);}
+ {MapTerrainPacket p; p.write(fs_, egbase_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Player Start Position Data ... ");
- {MapPlayerPositionPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapPlayerPositionPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
// We don't save these when saving a map in the editor.
@@ -119,38 +119,38 @@
// * command queue (PlayerMessageCommand, inherited by
// Cmd_MessageSetStatusRead and Cmd_MessageSetStatusArchived)
log("Writing Player Message Data ... ");
- {MapPlayersMessagesPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapPlayersMessagesPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
log("Writing Resources Data ... ");
- {MapResourcesPacket p; p.write(m_fs, m_egbase);}
+ {MapResourcesPacket p; p.write(fs_, egbase_);}
log("took %ums\n ", timer.ms_since_last_query());
// NON MANDATORY PACKETS BELOW THIS POINT
log("Writing Map Version ... ");
- {MapVersionPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapVersionPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
// We don't save these when saving a map in the editor.
if (is_game) {
- const Map & map = m_egbase.map();
+ const Map & map = egbase_.map();
PlayerNumber const nr_players = map.get_nrplayers();
// allowed worker types
log("Writing Allowed Worker Types Data ... ");
- {MapAllowedWorkerTypesPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapAllowedWorkerTypesPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
// allowed building types
- iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
- for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
+ iterate_players_existing_const(plnum, nr_players, egbase_, player) {
+ for (DescriptionIndex i = 0; i < egbase_.tribes().nrbuildings(); ++i) {
if (!player->is_building_type_allowed(i)) {
log("Writing Allowed Building Types Data ... ");
MapAllowedBuildingTypesPacket p;
- p .write(m_fs, m_egbase, *m_mos);
+ p .write(fs_, egbase_, *mos_);
log("took %ums\n ", timer.ms_since_last_query());
goto end_find_a_forbidden_building_type_loop;
}
@@ -162,83 +162,83 @@
// change this order unless you know what you are doing
// EXISTING PACKETS
log("Writing Flag Data ... ");
- {MapFlagPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapFlagPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Road Data ... ");
- {MapRoadPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapRoadPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Building Data ... ");
- {MapBuildingPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapBuildingPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
// We do need to save this one in the editor!
log("Writing Map Objects ... ");
- {MapObjectPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapObjectPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
if (is_game) {
// DATA PACKETS
- if (m_mos->get_nr_flags()) {
+ if (mos_->get_nr_flags()) {
log("Writing Flagdata Data ... ");
- {MapFlagdataPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapFlagdataPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
- if (m_mos->get_nr_roads()) {
+ if (mos_->get_nr_roads()) {
log("Writing Roaddata Data ... ");
- {MapRoaddataPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapRoaddataPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
- if (m_mos->get_nr_buildings()) {
+ if (mos_->get_nr_buildings()) {
log("Writing Buildingdata Data ... ");
- {MapBuildingdataPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapBuildingdataPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
log("Writing Node Ownership Data ... ");
- {MapNodeOwnershipPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapNodeOwnershipPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Exploration Data ... ");
- {MapExplorationPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapExplorationPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Players Unseen Data ... ");
- {MapPlayersViewPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapPlayersViewPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
}
// We also want to write these in the editor.
log("Writing Scripting Data ... ");
- {MapScriptingPacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapScriptingPacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing Objective Data ... ");
- {MapObjectivePacket p; p.write(m_fs, m_egbase, *m_mos);}
+ {MapObjectivePacket p; p.write(fs_, egbase_, *mos_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Writing map images ... ");
- save_map_images(&m_fs, m_egbase.map().filesystem());
+ save_map_images(&fs_, egbase_.map().filesystem());
log("took %ums\n ", timer.ms_since_last_query());
if (is_game) {
#ifndef NDEBUG
- m_mos->detect_unsaved_objects();
+ mos_->detect_unsaved_objects();
#endif
}
// Write minimap
{
std::unique_ptr<Texture> minimap(
- draw_minimap(m_egbase, nullptr, Point(0, 0), MiniMapLayer::Terrain));
+ draw_minimap(egbase_, nullptr, Point(0, 0), MiniMapLayer::Terrain));
FileWrite fw;
save_to_png(minimap.get(), &fw, ColorType::RGBA);
- fw.write(m_fs, "minimap.png");
+ fw.write(fs_, "minimap.png");
}
}
=== modified file 'src/map_io/map_saver.h'
--- src/map_io/map_saver.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_saver.h 2016-03-12 16:30:56 +0000
@@ -46,12 +46,12 @@
~MapSaver();
void save();
- MapObjectSaver * get_map_object_saver() {return m_mos;}
+ MapObjectSaver * get_map_object_saver() {return mos_;}
private:
- EditorGameBase & m_egbase;
- FileSystem & m_fs;
- MapObjectSaver * m_mos;
+ EditorGameBase & egbase_;
+ FileSystem & fs_;
+ MapObjectSaver * mos_;
};
}
=== modified file 'src/map_io/map_version_packet.cc'
--- src/map_io/map_version_packet.cc 2016-02-22 07:25:15 +0000
+++ src/map_io/map_version_packet.cc 2016-03-12 16:30:56 +0000
@@ -44,8 +44,8 @@
try {prof.read("version", nullptr, fs);} catch (...)
{
Map & map = egbase.map();
- map.map_version_.map_version_timestamp_ = 0;
- map.map_version_.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_.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");
+ 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_.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_.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_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);
=== modified file 'src/map_io/s2map.cc'
--- src/map_io/s2map.cc 2016-02-15 23:26:42 +0000
+++ src/map_io/s2map.cc 2016-03-12 16:30:56 +0000
@@ -308,7 +308,7 @@
} // namespace
S2MapLoader::S2MapLoader(const std::string& filename, Widelands::Map& M)
-: Widelands::MapLoader(filename, M), m_filename(filename)
+: Widelands::MapLoader(filename, M), filename_(filename)
{
}
@@ -317,10 +317,10 @@
int32_t S2MapLoader::preload_map(bool const scenario) {
assert(get_state() != STATE_LOADED);
- m_map.cleanup();
+ map_.cleanup();
FileRead fr;
- fr.open(*g_fs, m_filename.c_str());
+ fr.open(*g_fs, filename_.c_str());
load_s2mf_header(fr);
@@ -339,12 +339,12 @@
"Rufus",
};
- Widelands::PlayerNumber const nr_players = m_map.get_nrplayers();
+ Widelands::PlayerNumber const nr_players = map_.get_nrplayers();
iterate_player_numbers(i, nr_players) {
- m_map.set_scenario_player_tribe(i, "empire");
- m_map.set_scenario_player_name(i, names[i - 1]);
- m_map.set_scenario_player_ai(i, "");
- m_map.set_scenario_player_closeable(i, false);
+ map_.set_scenario_player_tribe(i, "empire");
+ map_.set_scenario_player_name(i, names[i - 1]);
+ map_.set_scenario_player_ai(i, "");
+ map_.set_scenario_player_closeable(i, false);
}
}
@@ -362,13 +362,13 @@
(Widelands::EditorGameBase& egbase, MapLoader::LoadType)
{
std::string timer_message = "S2MapLoader::load_map_complete() for '";
- timer_message += m_map.get_name();
+ timer_message += map_.get_name();
timer_message += "' took %ums";
ScopedTimer timer(timer_message);
load_s2mf(egbase);
- m_map.recalc_whole_map(egbase.world());
+ map_.recalc_whole_map(egbase.world());
postload_fix_conversion(egbase);
@@ -396,15 +396,15 @@
#endif
// don't really set size, but make the structures valid
- m_map.width_ = header.w;
- m_map.height_ = header.h;
-
- m_map.set_author(header.author);
- m_map.set_name(header.name);
- m_map.set_nrplayers(header.nplayers);
- m_map.set_description(_("Bluebyte Settlers II Map. No comment defined!"));
-
- m_worldtype = static_cast<WorldType>(header.uses_world);
+ map_.width_ = header.w;
+ map_.height_ = header.h;
+
+ map_.set_author(header.author);
+ map_.set_name(header.name);
+ map_.set_nrplayers(header.nplayers);
+ map_.set_description(_("Bluebyte Settlers II Map. No comment defined!"));
+
+ worldtype_ = static_cast<WorldType>(header.uses_world);
}
@@ -416,15 +416,15 @@
uint8_t * pc;
FileRead fr;
- fr.open(*g_fs, m_filename.c_str());
+ fr.open(*g_fs, filename_.c_str());
load_s2mf_header(fr);
- m_map.set_size(m_map.width_, m_map.height_);
+ map_.set_size(map_.width_, map_.height_);
// The header must already have been processed.
- assert(m_map.fields_.get());
- int16_t const mapwidth = m_map.get_width ();
- int16_t const mapheight = m_map.get_height();
+ assert(map_.fields_.get());
+ int16_t const mapwidth = map_.get_width ();
+ int16_t const mapheight = map_.get_height();
assert(mapwidth > 0 && mapheight > 0);
egbase.allocate_player_maps(); // initializes player_fields.vision
@@ -433,7 +433,7 @@
if (!section)
throw wexception("Section 1 (Heights) not found");
- Widelands::Field * f = m_map.fields_.get();
+ Widelands::Field * f = map_.fields_.get();
pc = section.get();
for (int16_t y = 0; y < mapheight; ++y)
for (int16_t x = 0; x < mapwidth; ++x, ++f, ++pc)
@@ -445,20 +445,20 @@
throw wexception("Section 2 (Terrain 1) not found");
std::unique_ptr<WorldLegacyLookupTable> lookup_table(
- create_world_legacy_lookup_table(get_world_name(m_worldtype)));
+ create_world_legacy_lookup_table(get_world_name(worldtype_)));
const Widelands::World& world = egbase.world();
TerrainConverter terrain_converter(world, *lookup_table);
- f = m_map.fields_.get();
+ f = map_.fields_.get();
pc = section.get();
for (int16_t y = 0; y < mapheight; ++y)
for (int16_t x = 0; x < mapwidth; ++x, ++f, ++pc) {
uint8_t c = *pc;
// Harbour buildspace & textures - Information taken from:
if (c & 0x40)
- m_map.set_port_space(Widelands::Coords(x, y), true);
- f->set_terrain_d(terrain_converter.lookup(m_worldtype, c & 0x1f));
+ map_.set_port_space(Widelands::Coords(x, y), true);
+ f->set_terrain_d(terrain_converter.lookup(worldtype_, c & 0x1f));
}
// SWD-SECTION 3: Terrain 2
@@ -466,7 +466,7 @@
if (!section)
throw wexception("Section 3 (Terrain 2) not found");
- f = m_map.fields_.get();
+ f = map_.fields_.get();
pc = section.get();
for (int16_t y = 0; y < mapheight; ++y)
for (int16_t x = 0; x < mapwidth; ++x, ++f, ++pc) {
@@ -474,8 +474,8 @@
// Harbour buildspace & textures - Information taken from:
// http://bazaar.launchpad.net/~xaser/s25rttr/s25edit/view/head:/WLD_reference.txt
if (c & 0x40)
- m_map.set_port_space(Widelands::Coords(x, y), true);
- f->set_terrain_r(terrain_converter.lookup(m_worldtype, c & 0x1f));
+ map_.set_port_space(Widelands::Coords(x, y), true);
+ f->set_terrain_r(terrain_converter.lookup(worldtype_, c & 0x1f));
}
@@ -513,8 +513,8 @@
for (int16_t x = 0; x < mapwidth; ++x, ++i) {
// ignore everything but HQs
if (section[i] == 0x80) {
- if (bobs[i] < m_map.get_nrplayers())
- m_map.set_starting_pos
+ if (bobs[i] < map_.get_nrplayers())
+ map_.set_starting_pos
(bobs[i] + 1, Widelands::Coords(x, y));
}
}
@@ -624,7 +624,7 @@
int32_t amount = 0;
for (uint16_t y = 0; y < mapheight; ++y) {
for (uint16_t x = 0; x < mapwidth; ++x, ++pc) {
- auto c = m_map.get_fcoords(Widelands::Coords(x, y));
+ auto c = map_.get_fcoords(Widelands::Coords(x, y));
uint8_t value = *pc;
switch (value & 0xF8) {
@@ -646,7 +646,7 @@
}
const int32_t real_amount = static_cast<int32_t>
(2.86 * static_cast<float>(amount));
- m_map.initialize_resources(c, nres, real_amount);
+ map_.initialize_resources(c, nres, real_amount);
}
}
@@ -794,10 +794,10 @@
case BOB_SKELETON3: bobname = "skeleton3"; break;
case BOB_CACTUS1:
- bobname = m_worldtype != S2MapLoader::WINTERLAND ? "cactus1" : "snowman";
+ bobname = worldtype_ != S2MapLoader::WINTERLAND ? "cactus1" : "snowman";
break;
case BOB_CACTUS2:
- bobname = m_worldtype != S2MapLoader::WINTERLAND ? "cactus2" : "track";
+ bobname = worldtype_ != S2MapLoader::WINTERLAND ? "cactus2" : "track";
break;
case BOB_BUSH1: bobname = "bush1"; break;
@@ -822,14 +822,14 @@
// loading of Settlers 2 maps in the majority of cases, check all
// starting positions and try to make it Widelands compatible, if its
// size is too small.
- m_map.recalc_whole_map(world); // to initialize buildcaps
+ map_.recalc_whole_map(world); // to initialize buildcaps
- const Widelands::PlayerNumber nr_players = m_map.get_nrplayers();
+ const Widelands::PlayerNumber nr_players = map_.get_nrplayers();
log("Checking starting position for all %u players:\n", nr_players);
iterate_player_numbers(p, nr_players) {
log("-> Player %u: ", p);
- Widelands::Coords starting_pos = m_map.get_starting_pos(p);
+ Widelands::Coords starting_pos = map_.get_starting_pos(p);
if (!starting_pos) {
// Do not throw exception, else map will not be loadable in the
// editor. Player initialization will keep track of wrong starting
@@ -837,25 +837,25 @@
log("Has no starting position.\n");
continue;
}
- Widelands::FCoords fpos = m_map.get_fcoords(starting_pos);
+ Widelands::FCoords fpos = map_.get_fcoords(starting_pos);
- if (!(m_map.get_max_nodecaps(world, fpos) & Widelands::BUILDCAPS_BIG)) {
+ if (!(map_.get_max_nodecaps(world, fpos) & Widelands::BUILDCAPS_BIG)) {
log("wrong size - trying to fix it: ");
bool fixed = false;
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> >
- mr(m_map, Widelands::Area<Widelands::FCoords>(fpos, 3));
+ mr(map_, Widelands::Area<Widelands::FCoords>(fpos, 3));
do {
if
- (m_map.get_max_nodecaps(world, const_cast<Widelands::FCoords &>(mr.location()))
+ (map_.get_max_nodecaps(world, const_cast<Widelands::FCoords &>(mr.location()))
&
Widelands::BUILDCAPS_BIG)
{
- m_map.set_starting_pos(p, mr.location());
+ map_.set_starting_pos(p, mr.location());
fixed = true;
break;
}
- } while (mr.advance(m_map));
+ } while (mr.advance(map_));
// check whether starting position was fixed.
@@ -881,39 +881,39 @@
/*
* 1: Try to fix port spaces
*/
- const Widelands::Map::PortSpacesSet ports(m_map.get_port_spaces());
+ const Widelands::Map::PortSpacesSet ports(map_.get_port_spaces());
uint16_t num_failed = 0;
const Widelands::World& world = egbase.world();
// Check if port spaces are valid
for (const Widelands::Coords& c : ports) {
- Widelands::FCoords fc = m_map.get_fcoords(c);
- Widelands::NodeCaps nc = m_map.get_max_nodecaps(world, fc);
+ Widelands::FCoords fc = map_.get_fcoords(c);
+ Widelands::NodeCaps nc = map_.get_max_nodecaps(world, fc);
if
((nc & Widelands::BUILDCAPS_SIZEMASK) != Widelands::BUILDCAPS_BIG
||
- m_map.find_portdock(fc).empty())
+ map_.find_portdock(fc).empty())
{
log("Invalid port build space: ");
- m_map.set_port_space(c, false);
+ map_.set_port_space(c, false);
bool fixed = false;
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> >
- mr(m_map, Widelands::Area<Widelands::FCoords>(fc, 3));
+ mr(map_, Widelands::Area<Widelands::FCoords>(fc, 3));
do {
// Check whether the maximum theoretical possible NodeCap of the field is big + port
Widelands::NodeCaps nc2 =
- m_map.get_max_nodecaps(world, const_cast<Widelands::FCoords&>(mr.location()));
+ map_.get_max_nodecaps(world, const_cast<Widelands::FCoords&>(mr.location()));
if
((nc2 & Widelands::BUILDCAPS_SIZEMASK) == Widelands::BUILDCAPS_BIG
&&
- (!m_map.find_portdock(mr.location()).empty()))
+ (!map_.find_portdock(mr.location()).empty()))
{
- m_map.set_port_space(Widelands::Coords(mr.location().x, mr.location().y), true);
+ map_.set_port_space(Widelands::Coords(mr.location().x, mr.location().y), true);
fixed = true;
}
- } while (mr.advance(m_map) && !fixed);
+ } while (mr.advance(map_) && !fixed);
if (!fixed) {
++num_failed;
log("FAILED! No alternative port buildspace for (%i, %i) found!\n", fc.x, fc.y);
=== modified file 'src/map_io/s2map.h'
--- src/map_io/s2map.h 2016-02-03 09:16:24 +0000
+++ src/map_io/s2map.h 2016-03-12 16:30:56 +0000
@@ -40,8 +40,8 @@
int32_t load_map_complete(Widelands::EditorGameBase&, Widelands::MapLoader::LoadType) override;
private:
- const std::string m_filename;
- WorldType m_worldtype;
+ const std::string filename_;
+ WorldType worldtype_;
void load_s2mf_header(FileRead&);
void load_s2mf(Widelands::EditorGameBase &);
=== modified file 'src/map_io/widelands_map_loader.cc'
--- src/map_io/widelands_map_loader.cc 2016-02-21 18:02:23 +0000
+++ src/map_io/widelands_map_loader.cc 2016-03-12 16:30:56 +0000
@@ -61,7 +61,7 @@
namespace Widelands {
WidelandsMapLoader::WidelandsMapLoader(FileSystem* fs, Map * const m)
- : MapLoader("", *m), m_fs(fs)
+ : MapLoader("", *m), fs_(fs)
{
m->filesystem_.reset(fs);
}
@@ -77,25 +77,25 @@
int32_t WidelandsMapLoader::preload_map(bool const scenario) {
assert(get_state() != STATE_LOADED);
- m_map.cleanup();
+ map_.cleanup();
{
MapElementalPacket mp;
- mp.pre_read(*m_fs, &m_map);
- m_old_world_name = mp.old_world_name();
+ mp.pre_read(*fs_, &map_);
+ old_world_name_ = mp.old_world_name();
}
{
MapPlayerNamesAndTribesPacket p;
- p.pre_read(*m_fs, &m_map, !scenario);
+ p.pre_read(*fs_, &map_, !scenario);
}
// No scripting/init.lua file -> not playable as scenario
Map::ScenarioTypes m = Map::NO_SCENARIO;
- if (m_fs->file_exists("scripting/init.lua"))
+ if (fs_->file_exists("scripting/init.lua"))
m |= Map::SP_SCENARIO;
- if (m_fs->file_exists("scripting/multiplayer_init.lua"))
+ if (fs_->file_exists("scripting/multiplayer_init.lua"))
m |= Map::MP_SCENARIO;
- m_map.set_scenario_types(m);
+ map_.set_scenario_types(m);
set_state(STATE_PRELOADED);
@@ -109,21 +109,21 @@
(EditorGameBase & egbase, MapLoader::LoadType load_type)
{
std::string timer_message = "WidelandsMapLoader::load_map_complete() for '";
- timer_message += m_map.get_name();
+ timer_message += map_.get_name();
timer_message += "' took %ums";
ScopedTimer timer(timer_message);
bool is_game = load_type == MapLoader::LoadType::kGame;
preload_map(!is_game);
- m_map.set_size(m_map.width_, m_map.height_);
- m_mol.reset(new MapObjectLoader());
+ map_.set_size(map_.width_, map_.height_);
+ mol_.reset(new MapObjectLoader());
// MANDATORY PACKETS
// PRELOAD DATA BEGIN
log("Reading Elemental Data ... ");
MapElementalPacket elemental_data_packet;
- elemental_data_packet.read(*m_fs, egbase, is_game, *m_mol);
+ elemental_data_packet.read(*fs_, egbase, is_game, *mol_);
log("took %ums\n ", timer.ms_since_last_query());
egbase.allocate_player_maps(); // Can do this now that map size is known.
@@ -132,88 +132,88 @@
log("Reading Player Names And Tribe Data ... ");
{
MapPlayerNamesAndTribesPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
}
log("took %ums\n ", timer.ms_since_last_query());
// PRELOAD DATA END
- if (m_fs->file_exists("port_spaces")) {
+ if (fs_->file_exists("port_spaces")) {
log("Reading Port Spaces Data ... ");
MapPortSpacesPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
log("took %ums\n ", timer.ms_since_last_query());
}
log("Reading Heights Data ... ");
- {MapHeightsPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapHeightsPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
std::unique_ptr<WorldLegacyLookupTable> world_lookup_table
- (create_world_legacy_lookup_table(m_old_world_name));
+ (create_world_legacy_lookup_table(old_world_name_));
std::unique_ptr<TribesLegacyLookupTable> tribe_lookup_table(new TribesLegacyLookupTable());
log("Reading Terrain Data ... ");
- {MapTerrainPacket p; p.read(*m_fs, egbase, *world_lookup_table);}
+ {MapTerrainPacket p; p.read(*fs_, egbase, *world_lookup_table);}
log("took %ums\n ", timer.ms_since_last_query());
MapObjectPacket mapobjects;
log("Reading Map Objects ... ");
- mapobjects.read(*m_fs, egbase, *m_mol, *world_lookup_table, *tribe_lookup_table);
+ mapobjects.read(*fs_, egbase, *mol_, *world_lookup_table, *tribe_lookup_table);
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Player Start Position Data ... ");
{
MapPlayerPositionPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
}
log("took %ums\n ", timer.ms_since_last_query());
// This call must stay around forever since this was the way critters have
// been saved into the map before 2010. Most of the maps we ship are still
// old in that sense and most maps on the homepage too.
- if (m_fs->file_exists("binary/bob")) {
+ if (fs_->file_exists("binary/bob")) {
log("Reading (legacy) Bob Data ... ");
{
MapBobPacket p;
- p.read(*m_fs, egbase, *m_mol, *world_lookup_table);
+ p.read(*fs_, egbase, *mol_, *world_lookup_table);
}
log("took %ums\n ", timer.ms_since_last_query());
}
log("Reading Resources Data ... ");
- {MapResourcesPacket p; p.read(*m_fs, egbase, *world_lookup_table);}
+ {MapResourcesPacket p; p.read(*fs_, egbase, *world_lookup_table);}
log("took %ums\n ", timer.ms_since_last_query());
// NON MANDATORY PACKETS BELOW THIS POINT
// Do not load unneeded packages in the editor
if (load_type != MapLoader::LoadType::kEditor) {
log("Reading Map Version Data ... ");
- {MapVersionPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapVersionPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Allowed Worker Types Data ... ");
{
MapAllowedWorkerTypesPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Allowed Building Types Data ... ");
{
MapAllowedBuildingTypesPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Node Ownership Data ... ");
- {MapNodeOwnershipPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapNodeOwnershipPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Exploration Data ... ");
- {MapExplorationPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapExplorationPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
// !!!!!!!!!! NOTE
@@ -221,28 +221,28 @@
// this order without knowing what you do
// EXISTENT PACKETS
log("Reading Flag Data ... ");
- {MapFlagPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapFlagPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Road Data ... ");
- {MapRoadPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapRoadPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Building Data ... ");
- {MapBuildingPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapBuildingPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
// DATA PACKETS
log("Reading Flagdata Data ... ");
- {MapFlagdataPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapFlagdataPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Roaddata Data ... ");
- {MapRoaddataPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapRoaddataPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Buildingdata Data ... ");
- {MapBuildingdataPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapBuildingdataPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Second and third phase loading Map Objects ... ");
@@ -263,7 +263,7 @@
// NOTE DO NOT CHANGE THE PLACE UNLESS YOU KNOW WHAT ARE YOU DOING
// Must be loaded after every kind of object that can see.
log("Reading Players View Data ... ");
- {MapPlayersViewPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapPlayersViewPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
// This must come before anything that references messages, such as:
@@ -272,36 +272,36 @@
log("Reading Player Message Data ... ");
{
MapPlayersMessagesPacket p;
- p.read(*m_fs, egbase, is_game, *m_mol);
+ p.read(*fs_, egbase, is_game, *mol_);
}
log("took %ums\n ", timer.ms_since_last_query());
} // load_type != MapLoader::LoadType::kEditor
// Objectives
log("Reading Objective Data ... ");
- {MapObjectivePacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapObjectivePacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading Scripting Data ... ");
- {MapScriptingPacket p; p.read(*m_fs, egbase, is_game, *m_mol);}
+ {MapScriptingPacket p; p.read(*fs_, egbase, is_game, *mol_);}
log("took %ums\n ", timer.ms_since_last_query());
log("Reading map images ... ");
- load_map_images(*m_fs);
+ load_map_images(*fs_);
log("took %ums\n ", timer.ms_since_last_query());
if (load_type != MapLoader::LoadType::kEditor) {
- if (m_mol->get_nr_unloaded_objects()) {
+ if (mol_->get_nr_unloaded_objects()) {
log
("WARNING: There are %i unloaded objects. This is a bug, please "
"consider committing!\n",
- m_mol->get_nr_unloaded_objects());
+ mol_->get_nr_unloaded_objects());
}
} // load_type != MapLoader::LoadType::kEditor
- m_map.recalc_whole_map(egbase.world());
+ map_.recalc_whole_map(egbase.world());
- m_map.ensure_resource_consistency(egbase.world());
+ map_.ensure_resource_consistency(egbase.world());
set_state(STATE_LOADED);
=== modified file 'src/map_io/widelands_map_loader.h'
--- src/map_io/widelands_map_loader.h 2016-01-29 13:43:56 +0000
+++ src/map_io/widelands_map_loader.h 2016-03-12 16:30:56 +0000
@@ -43,7 +43,7 @@
int32_t preload_map(bool) override;
int32_t load_map_complete(EditorGameBase &, MapLoader::LoadType load_type) override;
- MapObjectLoader * get_map_object_loader() {return m_mol.get();}
+ MapObjectLoader * get_map_object_loader() {return mol_.get();}
static bool is_widelands_map(const std::string & filename) {
return boost::iends_with(filename, WLMF_SUFFIX);
@@ -51,14 +51,14 @@
// If this was made pre one-world, the name of the world.
const std::string& old_world_name() const {
- return m_old_world_name;
+ return old_world_name_;
}
private:
- FileSystem* m_fs; // not owned (owned by Map).
- std::string m_filename;
- std::unique_ptr<MapObjectLoader> m_mol;
- std::string m_old_world_name;
+ FileSystem* fs_; // not owned (owned by Map).
+ std::string filename_;
+ std::unique_ptr<MapObjectLoader> mol_;
+ std::string old_world_name_;
};
}
Follow ups
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: noreply, 2016-03-15
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: GunChleoc, 2016-03-15
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-15
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-14
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
[Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: bunnybot, 2016-03-13
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1395278-map_io into lp:widelands
From: Klaus Halfmann, 2016-03-13