argument types were wrong for vein readers

added world position getter
develop
doomchild 2011-03-29 10:37:31 -05:00
parent cf59b7802d
commit f1bb4a4661
1 changed files with 17 additions and 15 deletions

@ -5,9 +5,9 @@ from util import _uintify, uint_ptr, check_pointer_cache
_MAX_DIM = 0x300 _MAX_DIM = 0x300
_MAX_DIM_SQR = _MAX_DIM * _MAX_DIM _MAX_DIM_SQR = _MAX_DIM * _MAX_DIM
_default_argtypes = [ c_void_p, uint_ptr, uint_ptr, uint_ptr ] libdfhack.Maps_getSize.argtypes = [ c_void_p, uint_ptr, uint_ptr, uint_ptr ]
libdfhack.Maps_getPosition.argtypes = [ c_void_p, uint_ptr, uint_ptr, uint_ptr ]
libdfhack.Maps_getSize.argtypes = _default_argtypes
libdfhack.Maps_ReadTileTypes.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(TileTypes40d) ] libdfhack.Maps_ReadTileTypes.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(TileTypes40d) ]
libdfhack.Maps_WriteTileTypes.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(TileTypes40d) ] libdfhack.Maps_WriteTileTypes.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(TileTypes40d) ]
libdfhack.Maps_ReadDesignations.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(Designations40d) ] libdfhack.Maps_ReadDesignations.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(Designations40d) ]
@ -18,14 +18,13 @@ libdfhack.Maps_ReadOccupancy.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POIN
libdfhack.Maps_WriteOccupancy.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(Occupancies40d) ] libdfhack.Maps_WriteOccupancy.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(Occupancies40d) ]
libdfhack.Maps_ReadRegionOffsets.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(BiomeIndices40d) ] libdfhack.Maps_ReadRegionOffsets.argtypes = [ c_void_p, c_uint, c_uint, c_uint, POINTER(BiomeIndices40d) ]
#libdfhack.Maps_ReadVegetation.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadVegetation.restype = c_void_p libdfhack.Maps_ReadVegetation.restype = c_void_p
libdfhack.Maps_ReadStandardVeins.argtypes = _default_argtypes libdfhack.Maps_ReadStandardVeins.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadFrozenVeins.argtypes = _default_argtypes libdfhack.Maps_ReadFrozenVeins.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadSpatterVeins.argtypes = _default_argtypes libdfhack.Maps_ReadSpatterVeins.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadGrassVeins.argtypes = _default_argtypes libdfhack.Maps_ReadGrassVeins.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadWorldConstructions.argtypes = _default_argtypes libdfhack.Maps_ReadWorldConstructions.argtypes = [ c_void_p, c_uint, c_uint, c_uint ]
libdfhack.Maps_ReadStandardVeins.restype = c_void_p libdfhack.Maps_ReadStandardVeins.restype = c_void_p
libdfhack.Maps_ReadFrozenVeins.restype = c_void_p libdfhack.Maps_ReadFrozenVeins.restype = c_void_p
@ -217,16 +216,19 @@ class Maps(object):
@property @property
def size(self): def size(self):
x = c_uint() x, y, z = (0, 0, 0)
y = c_uint()
z = c_uint()
retval = libdfhack.Maps_getSize(self._map_ptr, byref(x), byref(y), byref(z)) retval = libdfhack.Maps_getSize(self._map_ptr, byref(x), byref(y), byref(z))
if retval > 0: return (x, y, z)
return (int(x.value), int(y.value), int(z.value))
else: @property
return (-1, -1, -1) def position(self):
x, y, z = (0, 0, 0)
libdfhack.Maps_getPosition(self._map_ptr, byref(x), byref(y), byref(z))
return (x, y, z)
class MapPoint(object): class MapPoint(object):
__slots__ = ["_x", "_y", "_z", "_cmp_val"] __slots__ = ["_x", "_y", "_z", "_cmp_val"]