Author: silene
Date: Sun Apr 19 21:20:56 2009
New Revision: 35066
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35066&view=rev
Log:
Added a few more Lua accessors for team data.
Modified:
trunk/src/scripting/lua.cpp
Modified: trunk/src/scripting/lua.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=35066&r1=35065&r2=35066&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Sun Apr 19 21:20:56 2009
@@ -316,6 +316,12 @@
return 0; \
}
+#define modify_string_attrib(name, accessor) \
+ if (strcmp(m, name) == 0) { \
+ const char *value = luaL_checkstring(L, -1); \
+ accessor; \
+ return 0; \
+ }
#define modify_int_attrib(name, accessor) \
if (strcmp(m, name) == 0) { \
@@ -635,6 +641,8 @@
return_int_attrib("base_income", t.base_income());
return_int_attrib("total_income", t.total_income());
return_bool_attrib("objectives_changed", t.objectives_changed());
+ return_tstring_attrib("user_team_name", t.user_team_name());
+ return_string_attrib("team_name", t.team_name());
return 0;
}
@@ -655,7 +663,10 @@
modify_int_attrib("gold", t.set_gold(value));
modify_tstring_attrib("objectives", t.set_objectives(value, true));
modify_int_attrib("village_gold", t.set_village_gold(value));
+ modify_int_attrib("base_income", t.base_income());
modify_bool_attrib("objectives_changed",
t.set_objectives_changed(value));
+ modify_tstring_attrib("user_team_name", t.change_team(t.team_name(),
value));
+ modify_string_attrib("team_name", t.change_team(value,
t.user_team_name()));
return 0;
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits