diff --git a/dfhack/include/modules/Items_C.h b/dfhack/include/modules/Items_C.h index 201e7142a..da84b19a5 100644 --- a/dfhack/include/modules/Items_C.h +++ b/dfhack/include/modules/Items_C.h @@ -27,18 +27,20 @@ distribution. #include "Export.h" #include "integers.h" +#include "DFCommonInternal.h" + +using namespace DFHack; + #include "DFTypes.h" #include "modules/Items.h" #include "DFHackAPI_C.h" -using namespace DFHack; - #ifdef __cplusplus extern "C" { #endif -DFHACK_EXPORT char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObject* mats, char* (*char_buffer_create)(int)); -DFHACK_EXPORT char* Items_getItemClass(DFHackObject* items, int32_t index, char* (*char_buffer_create)(int)); +DFHACK_EXPORT char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObject* mats); +DFHACK_EXPORT char* Items_getItemClass(DFHackObject* items, int32_t index); DFHACK_EXPORT int Items_getItemData(DFHackObject* items, uint32_t itemptr, t_item* item); #ifdef __cplusplus diff --git a/dfhack/modules/Items_C.cpp b/dfhack/modules/Items_C.cpp index a28b3f86a..ee652af13 100644 --- a/dfhack/modules/Items_C.cpp +++ b/dfhack/modules/Items_C.cpp @@ -22,25 +22,27 @@ must not be misrepresented as being the original software. distribution. */ +#include "Export.h" #include "integers.h" -#include +#include +#include +#include "DFTypes.h" using namespace std; +using namespace DFHack; -#include "DFCommonInternal.h" -#include "DFTypes.h" -#include "DFHackAPI.h" +#include "DFProcess.h" #include "modules/Materials.h" #include "modules/Items.h" +#include "DFTypes_C.h" #include "modules/Items_C.h" -using namespace DFHack; #ifdef __cplusplus extern "C" { #endif -char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObject* mats, char* (*char_buffer_create)(int)) +char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObject* mats) { if(items != NULL && mats != NULL) { @@ -48,7 +50,7 @@ char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObje if(desc.size() > 0) { - char* buf = (*char_buffer_create)(desc.size()); + char* buf = (*alloc_char_buffer_callback)(desc.size()); if(buf != NULL) { @@ -67,7 +69,7 @@ char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObje return NULL; } -char* Items_getItemClass(DFHackObject* items, int32_t index, char* (*char_buffer_create)(int)) +char* Items_getItemClass(DFHackObject* items, int32_t index) { if(items != NULL) { @@ -75,7 +77,7 @@ char* Items_getItemClass(DFHackObject* items, int32_t index, char* (*char_buffer if(iclass.size() > 0) { - char* buf = (*char_buffer_create)(iclass.size()); + char* buf = (*alloc_char_buffer_callback)(iclass.size()); if(buf != NULL) {