added empty initializers for strings

develop
doomchild 2010-04-08 13:16:41 -05:00
parent 4b70268840
commit e536374aa7
1 changed files with 69 additions and 63 deletions

@ -29,11 +29,10 @@ distribution.
#include "structmember.h"
#include "DF_Imports.cpp"
#include "DF_Helpers.cpp"
#include "modules/Creatures.h"
using namespace DFHack;
#include "modules/Creatures.h"
struct DF_Creature_Base
{
PyObject_HEAD
@ -117,23 +116,23 @@ static void DF_Creature_Base_dealloc(DF_Creature_Base* self)
{
if(self != NULL)
{
Py_CLEAR(self->position);
Py_CLEAR(self->flags1);
Py_CLEAR(self->flags2);
Py_XDECREF(self->position);
Py_XDECREF(self->flags1);
Py_XDECREF(self->flags2);
Py_CLEAR(self->custom_profession);
Py_CLEAR(self->name);
Py_CLEAR(self->squad_name);
Py_CLEAR(self->artifact_name);
Py_CLEAR(self->current_job);
Py_XDECREF(self->custom_profession);
Py_XDECREF(self->name);
Py_XDECREF(self->squad_name);
Py_XDECREF(self->artifact_name);
Py_XDECREF(self->current_job);
Py_CLEAR(self->flags1);
Py_CLEAR(self->flags2);
Py_XDECREF(self->flags1);
Py_XDECREF(self->flags2);
Py_CLEAR(self->labor_list);
Py_CLEAR(self->trait_list);
Py_CLEAR(self->skill_list);
Py_CLEAR(self->like_list);
Py_XDECREF(self->labor_list);
Py_XDECREF(self->trait_list);
Py_XDECREF(self->skill_list);
Py_XDECREF(self->like_list);
// if(self->labor_list != NULL)
// PyList_Clear(self->labor_list);
@ -222,6 +221,8 @@ static PyObject* BuildCreature(DFHack::t_creature& creature)
obj = (DF_Creature_Base*)PyObject_Call((PyObject*)&DF_Creature_Base_type, NULL, NULL);
if(obj != NULL)
{
obj->position = Py_BuildValue("III", creature.x, creature.y, creature.z);
obj->profession = creature.profession;
obj->c_type = creature.type;
@ -270,7 +271,12 @@ static PyObject* BuildCreature(DFHack::t_creature& creature)
for(int i = 0; i < NUM_CREATURE_TRAITS; i++)
PyList_SetItem(obj->trait_list, i, PyInt_FromLong(creature.traits[i]));
Py_INCREF((PyObject*)obj);
return (PyObject*)obj;
}
Py_RETURN_NONE;
}
#endif