← Back to team overview

widelands-dev team mailing list archive

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

 

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

Commit message:
Refactored member variable and function names in src/scripting.

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-scripting/+merge/288975

Refactored remaining member variable and function names in src/scripting.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-scripting into lp:widelands.
=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc	2016-03-08 21:14:48 +0000
+++ src/scripting/lua_game.cc	2016-03-14 19:59:23 +0000
@@ -525,7 +525,7 @@
 		:returns: :const:`nil`
 */
 int LuaPlayer::allow_buildings(lua_State * L) {
-	return m_allow_forbid_buildings(L, true);
+	return allow_forbid_buildings(L, true);
 }
 
 /* RST
@@ -538,7 +538,7 @@
 		:returns: :const:`nil`
 */
 int LuaPlayer::forbid_buildings(lua_State * L) {
-	return m_allow_forbid_buildings(L, false);
+	return allow_forbid_buildings(L, false);
 }
 
 /* RST
@@ -733,7 +733,7 @@
 	Player & p = get(L, egbase);
 
 	// if only one string, convert to array so that we can use
-	// m_parse_building_list
+	// parse_building_list
 	bool return_array = true;
 	if (lua_isstring(L, -1)) {
 		const char * name = luaL_checkstring(L, -1);
@@ -746,7 +746,7 @@
 	}
 
 	std::vector<DescriptionIndex> houses;
-	m_parse_building_list(L, p.tribe(), houses);
+	parse_building_list(L, p.tribe(), houses);
 
 	lua_newtable(L);
 
@@ -883,7 +883,7 @@
  C METHODS
  ==========================================================
  */
-void LuaPlayer::m_parse_building_list
+void LuaPlayer::parse_building_list
 	(lua_State * L, const TribeDescr & tribe, std::vector<DescriptionIndex> & rv)
 {
 	EditorGameBase& egbase = get_egbase(L);
@@ -919,12 +919,12 @@
 		}
 	}
 }
-int LuaPlayer::m_allow_forbid_buildings(lua_State * L, bool allow)
+int LuaPlayer::allow_forbid_buildings(lua_State * L, bool allow)
 {
 	Player & p = get(L, get_egbase(L));
 
 	std::vector<DescriptionIndex> houses;
-	m_parse_building_list(L, p.tribe(), houses);
+	parse_building_list(L, p.tribe(), houses);
 
 	for (const DescriptionIndex& house : houses) {
 		p.allow_building_type(house, allow);

=== modified file 'src/scripting/lua_game.h'
--- src/scripting/lua_game.h	2016-02-12 16:58:41 +0000
+++ src/scripting/lua_game.h	2016-03-14 19:59:23 +0000
@@ -94,10 +94,10 @@
 	 * C methods
 	 */
 private:
-	void m_parse_building_list
+	void parse_building_list
 		(lua_State *, const Widelands::TribeDescr &,
 		 std::vector<Widelands::DescriptionIndex> &);
-	int m_allow_forbid_buildings(lua_State * L, bool);
+	int allow_forbid_buildings(lua_State * L, bool);
 
 };
 

=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc	2016-03-12 07:07:12 +0000
+++ src/scripting/lua_map.cc	2016-03-14 19:59:23 +0000
@@ -155,7 +155,7 @@
 // parses the get argument for all classes that can be asked for their
 // current wares. Returns a set with all DescriptionIndices that must be considered.
 #define GET_INDEX(type) \
-	DescriptionIndex m_get_ ## type ## _index \
+	DescriptionIndex get_ ## type ## _index \
 		(lua_State * L, const TribeDescr& tribe,  const std::string & what) \
 	{ \
 		DescriptionIndex idx = tribe. type ## _index(what); \
@@ -168,7 +168,7 @@
 #undef GET_INDEX
 
 #define PARSERS(type, btype) \
-btype ##sSet m_parse_get_##type##s_arguments \
+btype ##sSet parse_get_##type##s_arguments \
 		(lua_State * L, const TribeDescr& tribe, bool * return_number) \
 { \
 	 /* takes either "all", a name or an array of names */ \
@@ -185,7 +185,7 @@
 			} \
 		} else { \
 			/* Only one item requested */ \
-			rv.insert(m_get_##type##_index(L, tribe, what)); \
+			rv.insert(get_##type##_index(L, tribe, what)); \
 			*return_number = true; \
 		} \
 	} else { \
@@ -193,14 +193,14 @@
 		luaL_checktype(L, 2, LUA_TTABLE); \
 		lua_pushnil(L); \
 		while (lua_next(L, 2) != 0) { \
-			rv.insert(m_get_##type##_index(L, tribe, luaL_checkstring(L, -1))); \
+			rv.insert(get_##type##_index(L, tribe, luaL_checkstring(L, -1))); \
 			lua_pop(L, 1); \
 		} \
 	} \
 	return rv; \
 } \
 \
-btype##sMap m_parse_set_##type##s_arguments \
+btype##sMap parse_set_##type##s_arguments \
 	(lua_State * L, const TribeDescr& tribe) \
 { \
 	int32_t nargs = lua_gettop(L); \
@@ -210,7 +210,7 @@
 	if (nargs == 3) { \
 		/* name amount */ \
 		rv.insert(btype##Amount( \
-			m_get_##type##_index(L, tribe, luaL_checkstring(L, 2)), \
+			get_##type##_index(L, tribe, luaL_checkstring(L, 2)), \
 			luaL_checkuint32(L, 3) \
 		)); \
 	} else { \
@@ -219,7 +219,7 @@
 		lua_pushnil(L); \
 		while (lua_next(L, 2) != 0) { \
 			rv.insert(btype##Amount( \
-				m_get_##type##_index(L, tribe, luaL_checkstring(L, -2)), \
+				get_##type##_index(L, tribe, luaL_checkstring(L, -2)), \
 				luaL_checkuint32(L, -1) \
 			)); \
 			lua_pop(L, 1); \
@@ -286,7 +286,7 @@
 	const TribeDescr& tribe = pi.owner().tribe();
 
 	bool return_number = false;
-	WorkersSet set = m_parse_get_workers_arguments(L, tribe, &return_number);
+	WorkersSet set = parse_get_workers_arguments(L, tribe, &return_number);
 
 	WorkersMap c_workers;
 	for (const Worker* w : pi.get_workers()) {
@@ -331,7 +331,7 @@
 	EditorGameBase& egbase = get_egbase(L);
 	const TribeDescr& tribe = pi->owner().tribe();
 
-	WorkersMap setpoints = m_parse_set_workers_arguments(L, tribe);
+	WorkersMap setpoints = parse_set_workers_arguments(L, tribe);
 
 	WorkersMap c_workers;
 	for (const Worker* w : pi->get_workers()) {
@@ -418,7 +418,7 @@
 
 // Parser the arguments of set_soldiers() into a setpoint. See the
 // documentation in HasSoldiers to understand the valid arguments.
-SoldiersMap m_parse_set_soldiers_arguments(lua_State* L, const SoldierDescr& soldier_descr) {
+SoldiersMap parse_set_soldiers_arguments(lua_State* L, const SoldierDescr& soldier_descr) {
 	SoldiersMap rv;
 	if (lua_gettop(L) > 2) {
 		// STACK: cls, descr, count
@@ -507,7 +507,7 @@
 	const SoldierDescr& soldier_descr =  //  soldiers
 		dynamic_cast<const SoldierDescr&>
 			(*tribe.get_worker_descr(tribe.soldier()));
-	SoldiersMap setpoints = m_parse_set_soldiers_arguments(L, soldier_descr);
+	SoldiersMap setpoints = parse_set_soldiers_arguments(L, soldier_descr);
 
 	// Get information about current soldiers
 	const std::vector<Soldier*> curs = sc->stationed_soldiers();
@@ -3157,8 +3157,8 @@
 	EditorGameBase & egbase = get_egbase(L);
 	LuaMapObject * other = *get_base_user_class<LuaMapObject>(L, -1);
 
-	MapObject * me = m_get_or_zero(egbase);
-	MapObject * you = other->m_get_or_zero(egbase);
+	MapObject * me = get_or_zero(egbase);
+	MapObject * you = other->get_or_zero(egbase);
 
 	// Both objects are destroyed (nullptr) or equal: they are equal
 	if (me == you) {
@@ -3213,7 +3213,7 @@
 */
 int LuaMapObject::has_attribute(lua_State * L) {
 	EditorGameBase & egbase = get_egbase(L);
-	MapObject * obj = m_get_or_zero(egbase);
+	MapObject * obj = get_or_zero(egbase);
 	if (!obj) {
 		lua_pushboolean(L, false);
 		return 1;
@@ -3234,12 +3234,12 @@
  ==========================================================
  */
 MapObject* LuaMapObject::get(lua_State* L, EditorGameBase& egbase, std::string name) {
-	MapObject* o = m_get_or_zero(egbase);
+	MapObject* o = get_or_zero(egbase);
 	if (!o)
 		report_error(L, "%s no longer exists!", name.c_str());
 	return o;
 }
-MapObject* LuaMapObject::m_get_or_zero(EditorGameBase& egbase) {
+MapObject* LuaMapObject::get_or_zero(EditorGameBase& egbase) {
 	return ptr_.get(egbase);
 }
 
@@ -3446,7 +3446,7 @@
 	Flag * f = get(L, egbase);
 	const Tribes& tribes = egbase.tribes();
 
-	WaresMap setpoints = m_parse_set_wares_arguments(L, f->owner().tribe());
+	WaresMap setpoints = parse_set_wares_arguments(L, f->owner().tribe());
 	WaresMap c_wares = count_wares_on_flag_(*f, tribes);
 
 	uint32_t nwares = 0;
@@ -3502,7 +3502,7 @@
 	Flag * flag = get(L, egbase);
 
 	bool return_number = false;
-	WaresSet wares_set = m_parse_get_wares_arguments(L, flag->owner().tribe(), &return_number);
+	WaresSet wares_set = parse_get_wares_arguments(L, flag->owner().tribe(), &return_number);
 
 	WaresMap wares = count_wares_on_flag_(*flag, tribes);
 
@@ -3895,7 +3895,7 @@
 #define WH_SET(type, btype) \
 int LuaWarehouse::set_##type##s(lua_State * L) { \
 	Warehouse * wh = get(L, get_egbase(L)); \
-	btype##sMap setpoints = m_parse_set_##type##s_arguments(L, wh->owner().tribe()); \
+	btype##sMap setpoints = parse_set_##type##s_arguments(L, wh->owner().tribe()); \
  \
 	for (btype##sMap::iterator i = setpoints.begin(); i != setpoints.end(); ++i) { \
 		int32_t d = i->second - \
@@ -3918,7 +3918,7 @@
 	Warehouse * wh = get(L, get_egbase(L)); \
 	const Tribes& tribes = get_egbase(L).tribes(); \
 	bool return_number = false; \
-	btype##sSet set = m_parse_get_##type##s_arguments \
+	btype##sSet set = parse_get_##type##s_arguments \
 		(L, wh->owner().tribe(), &return_number); \
 	lua_newtable(L); \
 	if (return_number) \
@@ -4079,7 +4079,7 @@
 int LuaProductionSite::set_wares(lua_State * L) {
 	ProductionSite * ps = get(L, get_egbase(L));
 	const TribeDescr& tribe = ps->owner().tribe();
-	WaresMap setpoints = m_parse_set_wares_arguments(L, tribe);
+	WaresMap setpoints = parse_set_wares_arguments(L, tribe);
 
 	WaresSet valid_wares;
 	for (const auto& input_ware : ps->descr().inputs()) {
@@ -4109,7 +4109,7 @@
 	const TribeDescr& tribe = ps->owner().tribe();
 
 	bool return_number = false;
-	WaresSet wares_set = m_parse_get_wares_arguments(L, tribe, &return_number);
+	WaresSet wares_set = parse_get_wares_arguments(L, tribe, &return_number);
 
 	WaresSet valid_wares;
 	for (const auto& input_ware : ps->descr().inputs()) {
@@ -5285,11 +5285,11 @@
 	if (n == 3) {
 		uint32_t radius = luaL_checkuint32(L, -2);
 		uint32_t inner_radius = luaL_checkuint32(L, -1);
-		return m_hollow_region(L, radius, inner_radius);
+		return hollow_region(L, radius, inner_radius);
 	}
 
 	uint32_t radius = luaL_checkuint32(L, -1);
-	return m_region(L, radius);
+	return region(L, radius);
 }
 
 
@@ -5342,7 +5342,7 @@
  C METHODS
  ==========================================================
  */
-int LuaField::m_region(lua_State * L, uint32_t radius)
+int LuaField::region(lua_State * L, uint32_t radius)
 {
 	Map & map = get_egbase(L).map();
 	MapRegion<Area<FCoords> > mr
@@ -5360,7 +5360,7 @@
 	return 1;
 }
 
-int LuaField::m_hollow_region
+int LuaField::hollow_region
 	(lua_State * L, uint32_t radius, uint32_t inner_radius)
 {
 	Map & map = get_egbase(L).map();

=== modified file 'src/scripting/lua_map.h'
--- src/scripting/lua_map.h	2016-03-02 17:13:06 +0000
+++ src/scripting/lua_map.h	2016-03-14 19:59:23 +0000
@@ -711,7 +711,7 @@
 	 */
 	Widelands::MapObject * get
 		(lua_State *, Widelands::EditorGameBase &, std::string = "MapObject");
-	Widelands::MapObject * m_get_or_zero(Widelands::EditorGameBase &);
+	Widelands::MapObject * get_or_zero(Widelands::EditorGameBase &);
 };
 
 
@@ -1204,8 +1204,8 @@
 	const Widelands::FCoords fcoords(lua_State * L);
 
 private:
-	int m_region(lua_State * L, uint32_t radius);
-	int m_hollow_region(lua_State * L, uint32_t radius, uint32_t inner_radius);
+	int region(lua_State * L, uint32_t radius);
+	int hollow_region(lua_State * L, uint32_t radius, uint32_t inner_radius);
 };
 
 class LuaPlayerSlot : public LuaMapModuleClass {

=== modified file 'src/scripting/luna.h'
--- src/scripting/luna.h	2016-02-12 16:58:41 +0000
+++ src/scripting/luna.h	2016-03-14 19:59:23 +0000
@@ -99,14 +99,14 @@
 		to_pop ++;
 	}
 
-	m_add_constructor_to_lua<T>(L);
-	m_add_instantiator_to_lua<T>(L);
+	add_constructor_to_lua<T>(L);
+	add_instantiator_to_lua<T>(L);
 	lua_pop(L, to_pop); // Pop everything we used so far.
 
-	m_create_metatable_for_class<T>(L);
+	create_metatable_for_class<T>(L);
 
-	m_register_properties_in_metatable<T, T>(L);
-	m_register_methods_in_metatable<T, T>(L);
+	register_properties_in_metatable<T, T>(L);
+	register_methods_in_metatable<T, T>(L);
 
 	if (!return_metatable)
 		lua_pop(L, 1); // remove the Metatable
@@ -119,8 +119,8 @@
 template <class T, class PT>
 void add_parent(lua_State * L)
 {
-	m_register_properties_in_metatable<T, PT>(L);
-	m_register_methods_in_metatable<T, PT>(L);
+	register_properties_in_metatable<T, PT>(L);
+	register_methods_in_metatable<T, PT>(L);
 }
 
 /*
@@ -169,7 +169,7 @@
  */
 template <class T>
 T ** get_user_class(lua_State * const L, int narg) {
-	m_extract_userdata_from_user_class<T>(L, narg);
+	extract_userdata_from_user_class<T>(L, narg);
 
 	T ** rv = static_cast<T **>(luaL_checkudata(L, -1, T::className));
 	lua_pop(L, 1);
@@ -182,7 +182,7 @@
  */
 template <class T>
 T ** get_base_user_class(lua_State * const L, int narg) {
-	m_extract_userdata_from_user_class<T>(L, narg);
+	extract_userdata_from_user_class<T>(L, narg);
 
 	T ** rv = static_cast<T * *>(lua_touserdata(L, -1));
 	lua_pop(L, 1);

=== modified file 'src/scripting/luna_impl.cc'
--- src/scripting/luna_impl.cc	2015-01-31 16:03:59 +0000
+++ src/scripting/luna_impl.cc	2016-03-14 19:59:23 +0000
@@ -30,7 +30,7 @@
  * Private Functions
  * =======================================
  */
-static void m_instantiate_new_lua_class(lua_State * L) {
+static void instantiate_new_lua_class(lua_State * L) {
 	assert(lua_gettop(L) == 0);  // S:
 
 	std::string module, klass;
@@ -58,10 +58,10 @@
 	assert(lua_gettop(L) == 1);
 }
 
-static LunaClass** m_get_new_empty_user_data(lua_State * L) {
+static LunaClass** get_new_empty_user_data(lua_State * L) {
 	assert(lua_gettop(L) == 0);  // S:
 
-	m_instantiate_new_lua_class(L); // S: luna_obj
+	instantiate_new_lua_class(L); // S: luna_obj
 
 	lua_pushint32(L, 0); // luna_obj int
 	lua_gettable(L, -2); // luna_obj userdata
@@ -95,7 +95,7 @@
 int luna_unpersisting_closure(lua_State * L) {
 	assert(lua_gettop(L) == 0);
 
-	LunaClass ** obj = m_get_new_empty_user_data(L); // S: luna_obj
+	LunaClass ** obj = get_new_empty_user_data(L); // S: luna_obj
 
 	(*obj)->__unpersist(L);
 

=== modified file 'src/scripting/luna_impl.h'
--- src/scripting/luna_impl.h	2016-02-12 16:58:41 +0000
+++ src/scripting/luna_impl.h	2016-03-14 19:59:23 +0000
@@ -57,7 +57,7 @@
 bool luna_table_has_key(lua_State* L, const std::string& key);
 
 template <class T>
-int m_dispatch_property_in_metatable(lua_State * const L, bool setter) {
+int dispatch_property_in_metatable(lua_State * const L, bool setter) {
 	// stack for getter: table name
 	// stack for setter: table name value
 	int ret = 0;
@@ -109,7 +109,7 @@
  *   idx 1: table  - current objects table
  */
 template <class T>
-int m_property_getter(lua_State * const L) {
+int property_getter(lua_State * const L) {
 	// Try a normal get on the table
 	lua_pushvalue(L, 2); // table name name
 	lua_rawget   (L, 1); // table name val?
@@ -120,13 +120,13 @@
 	}
 	lua_pop(L, 1); // table name
 
-	return m_dispatch_property_in_metatable<T>(L, false);
+	return dispatch_property_in_metatable<T>(L, false);
 }
 
 template <class T>
-int m_property_setter(lua_State * const L) {
+int property_setter(lua_State * const L) {
 	// stack: table name value
-	return  m_dispatch_property_in_metatable<T>(L, true);
+	return  dispatch_property_in_metatable<T>(L, true);
 }
 
 /**
@@ -136,7 +136,7 @@
  * obj:method(). We also check that we are not called with another object
  */
 template <class T, class PT>
-int m_property_dispatch(lua_State * const L) {
+int property_dispatch(lua_State * const L) {
 	// Check for invalid: obj.method()
 	int const n = lua_gettop(L);
 	if (!n)
@@ -167,7 +167,7 @@
  * obj:method(). We also check that we are not called with another object
  */
 template <class T, class PT>
-int m_method_dispatch(lua_State * const L) {
+int method_dispatch(lua_State * const L) {
 	// Check for invalid: obj.method()
 	int const n = lua_gettop(L);
 	if (!n)
@@ -191,7 +191,7 @@
  * Deletes a given object, as soon as Lua wants to get rid of it
  */
 template <class T>
-int m_garbage_collect(lua_State* const L) {
+int garbage_collect(lua_State* const L) {
 	// This method is called in two cases - either the userdata that we store at
 	// key 0 in all of our objects is deleted or the table that represents our
 	// classes itself is deleted. If it is the table, the following check will
@@ -212,13 +212,13 @@
  * use report_error in the constructor to tell this the user
  */
 template <class T>
-int m_constructor(lua_State * const L) {
+int constructor(lua_State * const L) {
 	return to_lua<T>(L, new T(L));
 }
 
 template <class T>
-void m_add_constructor_to_lua(lua_State * const L) {
-	lua_pushcfunction (L, &m_constructor<T>);
+void add_constructor_to_lua(lua_State * const L) {
+	lua_pushcfunction (L, &constructor<T>);
 	lua_setfield(L, -2, T::className);
 }
 
@@ -229,19 +229,19 @@
  *   __ClassName == Instantiator
  */
 template <class T>
-int m_instantiator(lua_State * const L) {
+int instantiator(lua_State * const L) {
 	return to_lua<T>(L, new T());
 }
 
 template <class T>
-void m_add_instantiator_to_lua(lua_State * const L) {
+void add_instantiator_to_lua(lua_State * const L) {
 	std::string s = std::string("__") + T::className;
-	lua_pushcfunction (L, &m_instantiator<T>);
+	lua_pushcfunction (L, &instantiator<T>);
 	lua_setfield(L, -2, s.c_str());
 }
 
 template <class T>
-int m_persist(lua_State * const L) {
+int persist(lua_State * const L) {
 	assert(lua_gettop(L) == 1);  // S: lightuserdata
 	T * * const obj = get_user_class<T>(L, 1);
 
@@ -265,32 +265,32 @@
 
 
 template <class T>
-int m_create_metatable_for_class(lua_State * const L) {
+int create_metatable_for_class(lua_State * const L) {
 	luaL_newmetatable(L, T::className);
 	int const metatable = lua_gettop(L);
 
 	// OVERLOAD LUA TABLE FUNCTIONS
 	lua_pushstring(L, "__gc");
-	lua_pushcfunction(L, &m_garbage_collect<T>);
+	lua_pushcfunction(L, &garbage_collect<T>);
 	lua_settable  (L, metatable);
 
 	lua_pushstring(L, "__index");
-	lua_pushcfunction(L, &m_property_getter<T>);
+	lua_pushcfunction(L, &property_getter<T>);
 	lua_settable  (L, metatable);
 
 	lua_pushstring(L, "__newindex");
-	lua_pushcfunction(L, &m_property_setter<T>);
+	lua_pushcfunction(L, &property_setter<T>);
 	lua_settable  (L, metatable);
 
 	lua_pushstring(L, "__persist");
-	lua_pushcfunction(L, &m_persist<T>);
+	lua_pushcfunction(L, &persist<T>);
 	lua_settable  (L, metatable);
 
 	return metatable;
 }
 
 template <class T, class PT>
-void m_register_properties_in_metatable
+void register_properties_in_metatable
 	(lua_State * const L)
 {
 	for (int i = 0; PT::Properties[i].name; ++i) {
@@ -320,7 +320,7 @@
 		lua_settable(L, -3);
 
 		lua_pushstring(L, "dispatcher");
-		lua_pushcfunction(L, &(m_property_dispatch<T, PT>));
+		lua_pushcfunction(L, &(property_dispatch<T, PT>));
 		lua_settable(L, -3);
 
 		lua_settable(L, -3); // Metatable is directly before our pushed stuff
@@ -328,7 +328,7 @@
 }
 
 template <class T, class PT>
-void m_register_methods_in_metatable(lua_State * const L)
+void register_methods_in_metatable(lua_State * const L)
 {
 	// We add a lua C closure around the call, the closure gets the pointer to
 	// the c method to call as its only argument. We can then use
@@ -345,7 +345,7 @@
 			(L,
 			 const_cast<void *>
 			 	(reinterpret_cast<void const *>(&PT::Methods[i].method)));
-		lua_pushcclosure(L, &(m_method_dispatch<T, PT>), 1);
+		lua_pushcclosure(L, &(method_dispatch<T, PT>), 1);
 		lua_settable(L, -3); // Metatable is directly before our pushed stuff
 	}
 }
@@ -354,7 +354,7 @@
  * Get the userdata in a given stack object
  */
 template <class T>
-void m_extract_userdata_from_user_class(lua_State * const L, int narg) {
+void extract_userdata_from_user_class(lua_State * const L, int narg) {
 	luaL_checktype(L, narg, LUA_TTABLE);
 
 	//  GET table[0]

=== modified file 'src/scripting/persistence.cc'
--- src/scripting/persistence.cc	2015-07-27 11:29:15 +0000
+++ src/scripting/persistence.cc	2016-03-14 19:59:23 +0000
@@ -61,7 +61,7 @@
  * be touched. Returns true if the object was non nil and
  * therefore stored, false otherwise.
  */
-static bool m_add_object_to_not_persist
+static bool add_object_to_not_persist
 	(lua_State * L, std::string name, uint32_t nidx)
 {
 	// Search for a dot. If one is found, we first have
@@ -99,7 +99,7 @@
 // Special handling for the upvalues of pairs and ipairs which are iterator
 // functions, but always the same and therefor need not be persisted (in fact
 // they are c functions, so they can't be persisted all the same)
-static void m_add_iterator_function_to_not_persist
+static void add_iterator_function_to_not_persist
 	(lua_State * L, std::string global, uint32_t idx)
 {
 	lua_getglobal(L, global.c_str());
@@ -109,7 +109,7 @@
 	lua_settable(L, 1); //  table[function] = integer
 }
 
-static bool m_add_object_to_not_unpersist
+static bool add_object_to_not_unpersist
 	(lua_State * L, std::string name, uint32_t idx) {
 	// S: ... globals
 
@@ -139,7 +139,7 @@
 	return true;
 }
 
-static void m_add_iterator_function_to_not_unpersist
+static void add_iterator_function_to_not_unpersist
 	(lua_State * L, std::string global, uint32_t idx)
 {
 	lua_pushuint32(L, idx); // S: ... globals idx
@@ -158,7 +158,7 @@
 // Those are the globals that will be regenerated (not by the persistence engine),
 // e.g. C-functions or automatically populated fields. Changing the ordering here will
 // break safe game compatibility.
-static const char * m_persistent_globals[] = {
+static const char * kPersistentGlobals[] = {
 	"_VERSION", "assert", "collectgarbage", "coroutine", "debug", "dofile",
 	"error", "gcinfo", "getfenv", "getmetatable", "io", "ipairs", "load",
 	"loadfile", "loadstring", "math", "module", "newproxy", "next", "os",
@@ -193,12 +193,12 @@
 	lua_settable(L, 1);
 
 	// Now the iterators functions.
-	m_add_iterator_function_to_not_persist(L, "pairs", i++);
-	m_add_iterator_function_to_not_persist(L, "ipairs", i++);
+	add_iterator_function_to_not_persist(L, "pairs", i++);
+	add_iterator_function_to_not_persist(L, "ipairs", i++);
 
 	// And finally the globals.
-	for (int j = 0; m_persistent_globals[j]; ++j) {
-		m_add_object_to_not_persist(L, m_persistent_globals[j], i++);
+	for (int j = 0; kPersistentGlobals[j]; ++j) {
+		add_object_to_not_persist(L, kPersistentGlobals[j], i++);
 	}
 
 	// The next few lines make eris error messages much more useful, but make
@@ -240,11 +240,11 @@
 	lua_pushcfunction(L, &luna_unpersisting_closure);
 	lua_settable(L, 1);
 
-	m_add_iterator_function_to_not_unpersist(L, "pairs", i++);
-	m_add_iterator_function_to_not_unpersist(L, "ipairs", i++);
+	add_iterator_function_to_not_unpersist(L, "pairs", i++);
+	add_iterator_function_to_not_unpersist(L, "ipairs", i++);
 
-	for (int j = 0; m_persistent_globals[j]; ++j) {
-		m_add_object_to_not_unpersist(L, m_persistent_globals[j], i++);
+	for (int j = 0; kPersistentGlobals[j]; ++j) {
+		add_object_to_not_unpersist(L, kPersistentGlobals[j], i++);
 	}
 
 	LuaReaderHelper helper;


Follow ups