← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1395278-world into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1395278-world into lp:widelands.

Commit message:
Refactored member variable names in src/logic/map_objects/world.

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-world/+merge/285386

Refactored member variable names in src/logic/map_objects/world.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-world into lp:widelands.
=== modified file 'src/logic/map_objects/world/critter.cc'
--- src/logic/map_objects/world/critter.cc	2016-02-02 12:38:05 +0000
+++ src/logic/map_objects/world/critter.cc	2016-02-08 17:36:44 +0000
@@ -59,7 +59,7 @@
 				throw wexception("unknown command type \"%s\"", cmd[0].c_str());
 			}
 
-			m_actions.push_back(act);
+			actions_.push_back(act);
 		}
 		catch (const std::exception& e) {
 			throw wexception("Line '%s': %s", line.c_str(), e.what());
@@ -105,7 +105,7 @@
 CritterDescr::CritterDescr(const std::string& init_descname, const LuaTable& table)
 	: BobDescr(init_descname, MapObjectType::CRITTER, MapObjectDescr::OwnerType::kWorld, table)
 {
-	add_directional_animation(&m_walk_anims, "walk");
+	add_directional_animation(&walk_anims_, "walk");
 
 	add_attributes(
 	   table.get_table("attributes")->array_entries<std::string>(), std::set<uint32_t>());
@@ -115,7 +115,7 @@
 		try {
 			std::unique_ptr<CritterProgram> prog(new CritterProgram(program_name));
 			prog->parse(programs->get_table(program_name)->array_entries<std::string>());
-			m_programs[program_name] = prog.release();
+			programs_[program_name] = prog.release();
 		} catch (const std::exception& e) {
 			throw wexception("Parse error in program %s: %s", program_name.c_str(), e.what());
 		}
@@ -123,7 +123,7 @@
 }
 
 CritterDescr::~CritterDescr() {
-	for (std::pair<std::string, CritterProgram *> program : m_programs) {
+	for (std::pair<std::string, CritterProgram *> program : programs_) {
 		delete program.second;
 	}
 }
@@ -142,8 +142,8 @@
 CritterProgram const * CritterDescr::get_program
 	(const std::string & programname) const
 {
-	Programs::const_iterator const it = m_programs.find(programname);
-	if (it == m_programs.end())
+	Programs::const_iterator const it = programs_.find(programname);
+	if (it == programs_.end())
 		throw wexception
 			("%s has no program '%s'", name().c_str(), programname.c_str());
 	return it->second;

=== modified file 'src/logic/map_objects/world/critter.h'
--- src/logic/map_objects/world/critter.h	2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/world/critter.h	2016-02-08 17:36:44 +0000
@@ -43,15 +43,15 @@
 
 	bool is_swimming() const;
 	uint32_t movecaps() const override;
-	const DirAnimations & get_walk_anims() const {return m_walk_anims;}
+	const DirAnimations& get_walk_anims() const {return walk_anims_;}
 
 	CritterProgram const * get_program(const std::string &) const;
 
 
 private:
-	DirAnimations m_walk_anims;
+	DirAnimations walk_anims_;
 	using Programs = std::map<std::string, CritterProgram *>;
-	Programs      m_programs;
+	Programs      programs_;
 	DISALLOW_COPY_AND_ASSIGN(CritterDescr);
 };
 

=== modified file 'src/logic/map_objects/world/critter_program.h'
--- src/logic/map_objects/world/critter_program.h	2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/world/critter_program.h	2016-02-08 17:36:44 +0000
@@ -43,21 +43,21 @@
 };
 
 struct CritterProgram : public BobProgramBase {
-	CritterProgram(const std::string & name) : m_name(name) {}
+	CritterProgram(const std::string & name) : name_(name) {}
 	virtual ~CritterProgram() {}
 
-	std::string get_name() const override {return m_name;}
-	int32_t get_size() const {return m_actions.size();}
+	std::string get_name() const override {return name_;}
+	int32_t get_size() const {return actions_.size();}
 	const CritterAction & operator[] (size_t const idx) const {
-		assert(idx < m_actions.size());
-		return m_actions[idx];
+		assert(idx < actions_.size());
+		return actions_[idx];
 	}
 
 	void parse(const std::vector<std::string>& lines);
 
 private:
-	std::string                    m_name;
-	std::vector<CritterAction> m_actions;
+	std::string name_;
+	std::vector<CritterAction> actions_;
 };
 
 }


Follow ups