diff --git a/library/include/dfhack-c/modules/Maps_C.h b/library/include/dfhack-c/modules/Maps_C.h index d1bad823e..fdbfdf1be 100644 --- a/library/include/dfhack-c/modules/Maps_C.h +++ b/library/include/dfhack-c/modules/Maps_C.h @@ -36,6 +36,8 @@ extern "C" { DFHACK_EXPORT int Maps_Start(DFHackObject* maps); DFHACK_EXPORT int Maps_Finish(DFHackObject* maps); +DFHACK_EXPORT t_feature* Maps_ReadGlobalFeatures(DFHackObject* maps); + DFHACK_EXPORT void Maps_getSize(DFHackObject* maps, uint32_t* x, uint32_t* y, uint32_t* z); DFHACK_EXPORT int Maps_isValidBlock(DFHackObject* maps, uint32_t x, uint32_t y, uint32_t z); diff --git a/library/modules/Maps_C.cpp b/library/modules/Maps_C.cpp index 09a7dc065..911f4e0f9 100644 --- a/library/modules/Maps_C.cpp +++ b/library/modules/Maps_C.cpp @@ -54,6 +54,37 @@ int Maps_Finish(DFHackObject* maps) return -1; } +t_feature* Maps_ReadGlobalFeatures(DFHackObject* maps) +{ + if(maps != NULL) + { + std::vector featureVec; + + if(((DFHack::Maps*)maps)->ReadGlobalFeatures(featureVec)) + { + if(featureVec.size() <= 0) + return NULL; + + t_feature* buf; + + (*alloc_t_feature_buffer_callback)(buf, featureVec.size()); + + if(buf != NULL) + { + copy(featureVec.begin(), featureVec.end(), buf); + + return buf; + } + else + return NULL; + } + else + return NULL; + } + + return NULL; +} + void Maps_getSize(DFHackObject* maps, uint32_t* x, uint32_t* y, uint32_t* z) { if(maps != NULL)