diff --git a/library/python/pydfhack/buildings.py b/library/python/pydfhack/buildings.py index 32c330201..d58b92840 100644 --- a/library/python/pydfhack/buildings.py +++ b/library/python/pydfhack/buildings.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import * +from dftypes import * import util libdfhack.Buildings_GetCustomWorkshopType.argtypes = [ c_void_p, POINTER(CustomWorkshop) ] @@ -28,20 +28,7 @@ class Buildings(object): return None def read_custom_workshop_types(self): - def read_callback(count): - allocated = util._allocate_array(CustomWorkshop, count) - - workshop_types = allocated[0] - - return allocated[1] - - workshop_types = None - callback = _arr_create_func(read_callback) - - if libdfhack.Buildings_ReadCustomWorkshopTypes(self._b_ptr, callback) > 0: - return workshop_types - else: - return None + return libdfhack.Buildings_ReadCustomWorkshopTypes(self._b_ptr) def get_custom_workshop_type(self, custom_workshop): return libdfhack.Buildings_GetCustomWorkshopType(self._b_ptr, byref(custom_workshop)) diff --git a/library/python/pydfhack/constructions.py b/library/python/pydfhack/constructions.py index e525d564e..fea93ee0b 100644 --- a/library/python/pydfhack/constructions.py +++ b/library/python/pydfhack/constructions.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import * +from dftypes import * class Constructions(object): def __init__(self, ptr): diff --git a/library/python/pydfhack/context.py b/library/python/pydfhack/context.py index 0afc2cf25..1f9f06c16 100644 --- a/library/python/pydfhack/context.py +++ b/library/python/pydfhack/context.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import * +from dftypes import * libdfhack.ContextManager_Alloc.restype = c_void_p libdfhack.ContextManager_Free.argtypes = [ c_void_p ] diff --git a/library/python/pydfhack/creatures.py b/library/python/pydfhack/creatures.py index d07cf2bdf..06bc52c36 100644 --- a/library/python/pydfhack/creatures.py +++ b/library/python/pydfhack/creatures.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import libdfhack, Creature, Material +from dftypes import libdfhack, Creature, Material import util libdfhack.Creatures_WriteLabors.argtypes = [ c_void_p, c_uint, POINTER(c_ubyte) ] @@ -45,31 +45,18 @@ class Creatures(object): return libdfhack.Creatures_WriteLabors(self._c_ptr, c_uint(index), labors) > 0 def read_job(self, creature): - def read_callback(count): - allocated = util._allocate_array(Material, count) - - jobs = allocated[0] - - return allocated[1] - - jobs = None - callback = _arr_create_func(read_callback) - - if libdfhack.Creatures_ReadJob(self._c_ptr, byref(creature), callback) > 0: - return jobs - else: - return None + return libdfhack.Creatures_ReadJob(self._c_ptr, byref(creature)) @property def dwarf_race_index(self): if self._d_race_index is None: - self._d_race_index = int(libdfhack.Creatures_GetDwarfRaceIndex(self._c_ptr).value) + self._d_race_index =libdfhack.Creatures_GetDwarfRaceIndex(self._c_ptr) return self._d_race_index @property def dwarf_civ_id(self): if self._d_civ_id is None: - self._d_civ_id = int(libdfhack.Creatures_GetDwarfCivId(self._c_ptr).value) + self._d_civ_id = libdfhack.Creatures_GetDwarfCivId(self._c_ptr) return self._d_civ_id diff --git a/library/python/pydfhack/items.py b/library/python/pydfhack/items.py index 47ad42907..8c5d6625e 100644 --- a/library/python/pydfhack/items.py +++ b/library/python/pydfhack/items.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import * +from dftypes import * libdfhack.Items_getItemDescription.argtypes = [ c_void_p, c_uint, c_void_ptr, _arr_create_func ] libdfhack.Items_getItemDescription.restype = c_char_p diff --git a/library/python/pydfhack/materials.py b/library/python/pydfhack/materials.py index 04d82fddb..354f4e59a 100644 --- a/library/python/pydfhack/materials.py +++ b/library/python/pydfhack/materials.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import libdfhack +from dftypes import libdfhack from util import * _get_arg_types = [ c_void_p, _arr_create_func ] diff --git a/library/python/pydfhack/position.py b/library/python/pydfhack/position.py index ffa758150..d302d4a6a 100644 --- a/library/python/pydfhack/position.py +++ b/library/python/pydfhack/position.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import libdfhack +from dftypes import libdfhack class Position(object): def __init__(self, ptr): diff --git a/library/python/pydfhack/vegetation.py b/library/python/pydfhack/vegetation.py index 0c22d26b5..ca1f12bd6 100644 --- a/library/python/pydfhack/vegetation.py +++ b/library/python/pydfhack/vegetation.py @@ -1,5 +1,5 @@ from ctypes import * -from pydftypes import libdfhack, Tree +from dftypes import libdfhack, Tree class Vegetation(object): def __init__(self, ptr):