added ReadVegetation implementation

develop
doomchild 2011-03-11 16:58:42 -06:00
parent 870be3a1e7
commit c5e9f67389
1 changed files with 29 additions and 1 deletions

@ -110,7 +110,7 @@ t_feature* Maps_ReadGlobalFeatures(DFHackObject* maps)
t_feature** buf = NULL; t_feature** buf = NULL;
(*alloc_t_feature_buffer_callback)(buf, featureVec.size()); (*alloc_feature_buffer_callback)(buf, featureVec.size());
if(buf != NULL) if(buf != NULL)
{ {
@ -615,6 +615,34 @@ int Maps_ReadAllVeins(DFHackObject* maps, uint32_t x, uint32_t y, uint32_t z, c_
return -1; return -1;
} }
t_tree* Maps_ReadVegetation(DFHackObject* maps, uint32_t x, uint32_t y, uint32_t z)
{
if(maps == NULL)
return NULL;
else
{
std::vector<t_tree> plants;
bool result = ((DFHack::Maps*)maps)->ReadVegetation(x, y, z, &plants);
t_tree* buf = NULL;
if(!result || plants.size() <= 0)
return NULL;
else
{
((*alloc_tree_buffer_callback)(&buf, plants.size()));
if(buf == NULL)
return NULL;
copy(plants.begin(), plants.end(), buf);
return buf;
}
}
return NULL;
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif