added type init

develop
doomchild 2010-04-12 14:47:55 -05:00
parent 524d4f6025
commit 32cbdea87b
1 changed files with 9 additions and 4 deletions

@ -27,7 +27,7 @@ distribution.
#include "Python.h" #include "Python.h"
#include "structmember.h" #include "structmember.h"
#include "DF_Imports.cpp" //#include "DF_Imports.cpp"
#include "DF_Helpers.cpp" #include "DF_Helpers.cpp"
#include "modules/Creatures.h" #include "modules/Creatures.h"
@ -102,6 +102,11 @@ static PyObject* DF_Creature_Base_new(PyTypeObject* type, PyObject* args, PyObje
return (PyObject*)self; return (PyObject*)self;
} }
static int DF_Creature_Base_init(DF_Creature_Base* self, PyObject* args, PyObject* kwd)
{
return 0;
}
static void DF_Creature_Base_dealloc(DF_Creature_Base* self) static void DF_Creature_Base_dealloc(DF_Creature_Base* self)
{ {
if(self != NULL) if(self != NULL)
@ -193,7 +198,7 @@ static PyTypeObject DF_Creature_Base_type =
0, /* tp_descr_get */ 0, /* tp_descr_get */
0, /* tp_descr_set */ 0, /* tp_descr_set */
0, /* tp_dictoffset */ 0, /* tp_dictoffset */
0, /* tp_init */ (initproc)DF_Creature_Base_init, /* tp_init */
0, /* tp_alloc */ 0, /* tp_alloc */
DF_Creature_Base_new, /* tp_new */ DF_Creature_Base_new, /* tp_new */
}; };
@ -234,7 +239,7 @@ static PyObject* BuildCreature(DFHack::t_creature& creature)
obj->labor_list = PyList_New(NUM_CREATURE_LABORS); obj->labor_list = PyList_New(NUM_CREATURE_LABORS);
for(int i = 0; i < NUM_CREATURE_LABORS; i++) for(int i = 0; i < NUM_CREATURE_LABORS; i++)
PyList_SetItem(obj->labor_list, i, PyInt_FromLong(creature.labors[i])); PyList_SET_ITEM(obj->labor_list, i, PyInt_FromLong(creature.labors[i]));
return (PyObject*)obj; return (PyObject*)obj;
} }