[Wesnoth-commits] r10192 - /trunk/src/ai_python.cpp (February 19, 2006 - 09:50)

Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Headers

 

Author: ryo
Date: Sun Feb 19 09:49:25 2006
New Revision: 10192

URL: http://svn.gna.org/viewcvs/wesnoth?rev=10192&view=rev
Log:
Apply patch #504 courtesy Allefant to expose a unit's side and movement left

Modified:
    trunk/src/ai_python.cpp

Modified: trunk/src/ai_python.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_python.cpp?rev=10192&r1=10191&r2=10192&view=diff
==============================================================================
--- trunk/src/ai_python.cpp (original)
+++ trunk/src/ai_python.cpp Sun Feb 19 09:49:25 2006
@@ -352,6 +352,20 @@
 	return Py_BuildValue("i",unit->unit_->can_recruit() == true ? 1 : 0);
 }
 
+static PyObject* unit_side(wesnoth_unit* unit, void* /*closure*/)
+{
+	if (!running_instance->is_unit_valid(unit->unit_))
+		return NULL;
+	return Py_BuildValue("i",unit->unit_->side());
+}
+
+static PyObject* unit_movement_left(wesnoth_unit* unit, void* /*closure*/)
+{
+	if (!running_instance->is_unit_valid(unit->unit_))
+		return NULL;
+	return Py_BuildValue("i",unit->unit_->movement_left());
+}
+
 static PyObject* unit_query_valid(wesnoth_unit* unit, void* /*closure*/)
 {
 	return Py_BuildValue("i",running_instance->is_unit_valid(unit->unit_) == true ? 1 : 0);
@@ -362,6 +376,8 @@
 	{ "is_enemy",		(getter)unit_is_enemy,		NULL,	NULL,	NULL },
 	{ "can_recruit",	(getter)unit_can_recruit,	NULL,	NULL,	NULL },
 	{ "is_valid",		(getter)unit_query_valid,	NULL,	NULL,	NULL },
+	{ "side",		(getter)unit_side,	NULL,	NULL,	NULL },
+	{ "movement_left",	(getter)unit_movement_left,	NULL,	NULL,	NULL },
 	{ NULL,				NULL,						NULL,	NULL,	NULL }
 };
 



Related Mails




Powered by MHonArc, Updated Sun Feb 19 13:00:28 2006