From 44cbc3fd5ce1e665ea1494f70b60015c644bb231 Mon Sep 17 00:00:00 2001 From: doomchild Date: Wed, 9 Mar 2011 12:22:48 -0600 Subject: [PATCH] fixed allocator callbacks to take pointers to pointers so they'll actually, you know, WORK --- library/DFTypes_C.cpp | 144 +++++++++++++-------------- library/include/dfhack-c/DFTypes_C.h | 124 +++++++++++------------ 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/library/DFTypes_C.cpp b/library/DFTypes_C.cpp index 4bd1a676b..ce2a00448 100644 --- a/library/DFTypes_C.cpp +++ b/library/DFTypes_C.cpp @@ -68,60 +68,60 @@ void UnregisterByteBufferCallback() extern "C" { #endif -int (*alloc_byte_buffer_callback)(int8_t*, uint32_t) = NULL; -int (*alloc_short_buffer_callback)(int16_t*, uint32_t) = NULL; -int (*alloc_int_buffer_callback)(int32_t*, uint32_t) = NULL; - -int (*alloc_ubyte_buffer_callback)(uint8_t*, uint32_t) = NULL; -int (*alloc_ushort_buffer_callback)(uint16_t*, uint32_t) = NULL; -int (*alloc_uint_buffer_callback)(uint32_t*, uint32_t) = NULL; - -int (*alloc_char_buffer_callback)(char*, uint32_t) = NULL; - -int (*alloc_matgloss_buffer_callback)(t_matgloss*, uint32_t) = NULL; -int (*alloc_descriptor_buffer_callback)(t_descriptor_color*, uint32_t) = NULL; -int (*alloc_matgloss_other_buffer_callback)(t_matglossOther*, uint32_t) = NULL; - -int (*alloc_t_feature_buffer_callback)(t_feature*, uint32_t) = NULL; -int (*alloc_t_hotkey_buffer_callback)(t_hotkey*, uint32_t) = NULL; -int (*alloc_t_screen_buffer_callback)(t_screen*, uint32_t) = NULL; - -int (*alloc_t_customWorkshop_buffer_callback)(t_customWorkshop*, uint32_t) = NULL; -int (*alloc_t_material_buffer_callback)(t_material*, uint32_t) = NULL; - -int (*alloc_empty_colormodifier_callback)(c_colormodifier*) = NULL; -int (*alloc_colormodifier_callback)(c_colormodifier*, const char*, uint32_t) = NULL; -int (*alloc_colormodifier_buffer_callback)(c_colormodifier*, uint32_t) = NULL; - -int (*alloc_empty_creaturecaste_callback)(c_creaturecaste*)= NULL; -int (*alloc_creaturecaste_callback)(c_creaturecaste*, const char*, const char*, const char*, const char*, uint32_t, uint32_t) = NULL; -int (*alloc_creaturecaste_buffer_callback)(c_creaturecaste*, uint32_t) = NULL; - -int (*alloc_empty_creaturetype_callback)(c_creaturetype*) = NULL; -int (*alloc_creaturetype_callback)(c_creaturetype*, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t) = NULL; -int (*alloc_creaturetype_buffer_callback)(c_creaturetype*, uint32_t) = NULL; - -int (*alloc_vein_buffer_callback)(t_vein*, uint32_t) = NULL; -int (*alloc_frozenliquidvein_buffer_callback)(t_frozenliquidvein*, uint32_t) = NULL; -int (*alloc_spattervein_buffer_callback)(t_spattervein*, uint32_t) = NULL; -int (*alloc_grassvein_buffer_callback)(t_grassvein*, uint32_t) = NULL; -int (*alloc_worldconstruction_buffer_callback)(t_worldconstruction*, uint32_t) = NULL; - -REG_MACRO(Byte, int8_t*, alloc_byte_buffer_callback) -REG_MACRO(Short, int16_t*, alloc_short_buffer_callback) -REG_MACRO(Int, int32_t*, alloc_int_buffer_callback) -REG_MACRO(UByte, uint8_t*, alloc_ubyte_buffer_callback) -REG_MACRO(UShort, uint16_t*, alloc_ushort_buffer_callback) -REG_MACRO(UInt, uint32_t*, alloc_uint_buffer_callback) -REG_MACRO(Char, char*, alloc_char_buffer_callback) -REG_MACRO(Matgloss, t_matgloss*, alloc_matgloss_buffer_callback) -REG_MACRO(DescriptorColor, t_descriptor_color*, alloc_descriptor_buffer_callback) -REG_MACRO(MatglossOther, t_matglossOther*, alloc_matgloss_other_buffer_callback) -REG_MACRO(Feature, t_feature*, alloc_t_feature_buffer_callback) -REG_MACRO(Hotkey, t_hotkey*, alloc_t_hotkey_buffer_callback) -REG_MACRO(Screen, t_screen*, alloc_t_screen_buffer_callback) -REG_MACRO(CustomWorkshop, t_customWorkshop*, alloc_t_customWorkshop_buffer_callback) -REG_MACRO(Material, t_material*, alloc_t_material_buffer_callback) +int (*alloc_byte_buffer_callback)(int8_t**, uint32_t) = NULL; +int (*alloc_short_buffer_callback)(int16_t**, uint32_t) = NULL; +int (*alloc_int_buffer_callback)(int32_t**, uint32_t) = NULL; + +int (*alloc_ubyte_buffer_callback)(uint8_t**, uint32_t) = NULL; +int (*alloc_ushort_buffer_callback)(uint16_t**, uint32_t) = NULL; +int (*alloc_uint_buffer_callback)(uint32_t**, uint32_t) = NULL; + +int (*alloc_char_buffer_callback)(char**, uint32_t) = NULL; + +int (*alloc_matgloss_buffer_callback)(t_matgloss**, uint32_t) = NULL; +int (*alloc_descriptor_buffer_callback)(t_descriptor_color**, uint32_t) = NULL; +int (*alloc_matgloss_other_buffer_callback)(t_matglossOther**, uint32_t) = NULL; + +int (*alloc_t_feature_buffer_callback)(t_feature**, uint32_t) = NULL; +int (*alloc_t_hotkey_buffer_callback)(t_hotkey**, uint32_t) = NULL; +int (*alloc_t_screen_buffer_callback)(t_screen**, uint32_t) = NULL; + +int (*alloc_t_customWorkshop_buffer_callback)(t_customWorkshop**, uint32_t) = NULL; +int (*alloc_t_material_buffer_callback)(t_material**, uint32_t) = NULL; + +int (*alloc_empty_colormodifier_callback)(c_colormodifier**) = NULL; +int (*alloc_colormodifier_callback)(c_colormodifier**, const char*, uint32_t) = NULL; +int (*alloc_colormodifier_buffer_callback)(c_colormodifier**, uint32_t) = NULL; + +int (*alloc_empty_creaturecaste_callback)(c_creaturecaste**)= NULL; +int (*alloc_creaturecaste_callback)(c_creaturecaste**, const char*, const char*, const char*, const char*, uint32_t, uint32_t) = NULL; +int (*alloc_creaturecaste_buffer_callback)(c_creaturecaste**, uint32_t) = NULL; + +int (*alloc_empty_creaturetype_callback)(c_creaturetype**) = NULL; +int (*alloc_creaturetype_callback)(c_creaturetype**, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t) = NULL; +int (*alloc_creaturetype_buffer_callback)(c_creaturetype**, uint32_t) = NULL; + +int (*alloc_vein_buffer_callback)(t_vein**, uint32_t) = NULL; +int (*alloc_frozenliquidvein_buffer_callback)(t_frozenliquidvein**, uint32_t) = NULL; +int (*alloc_spattervein_buffer_callback)(t_spattervein**, uint32_t) = NULL; +int (*alloc_grassvein_buffer_callback)(t_grassvein**, uint32_t) = NULL; +int (*alloc_worldconstruction_buffer_callback)(t_worldconstruction**, uint32_t) = NULL; + +REG_MACRO(Byte, int8_t**, alloc_byte_buffer_callback) +REG_MACRO(Short, int16_t**, alloc_short_buffer_callback) +REG_MACRO(Int, int32_t**, alloc_int_buffer_callback) +REG_MACRO(UByte, uint8_t**, alloc_ubyte_buffer_callback) +REG_MACRO(UShort, uint16_t**, alloc_ushort_buffer_callback) +REG_MACRO(UInt, uint32_t**, alloc_uint_buffer_callback) +REG_MACRO(Char, char**, alloc_char_buffer_callback) +REG_MACRO(Matgloss, t_matgloss**, alloc_matgloss_buffer_callback) +REG_MACRO(DescriptorColor, t_descriptor_color**, alloc_descriptor_buffer_callback) +REG_MACRO(MatglossOther, t_matglossOther**, alloc_matgloss_other_buffer_callback) +REG_MACRO(Feature, t_feature**, alloc_t_feature_buffer_callback) +REG_MACRO(Hotkey, t_hotkey**, alloc_t_hotkey_buffer_callback) +REG_MACRO(Screen, t_screen**, alloc_t_screen_buffer_callback) +REG_MACRO(CustomWorkshop, t_customWorkshop**, alloc_t_customWorkshop_buffer_callback) +REG_MACRO(Material, t_material**, alloc_t_material_buffer_callback) UNREG_MACRO(Byte, alloc_byte_buffer_callback) UNREG_MACRO(Short, alloc_short_buffer_callback) @@ -139,19 +139,19 @@ UNREG_MACRO(Screen, alloc_t_screen_buffer_callback) UNREG_MACRO(CustomWorkshop, alloc_t_customWorkshop_buffer_callback) UNREG_MACRO(Material, alloc_t_material_buffer_callback) -void RegisterEmptyColorModifierCallback(int (*funcptr)(c_colormodifier*)) +void RegisterEmptyColorModifierCallback(int (*funcptr)(c_colormodifier**)) { alloc_empty_colormodifier_callback = funcptr; } -void RegisterNewColorModifierCallback(int (*funcptr)(c_colormodifier*, const char*, uint32_t)) +void RegisterNewColorModifierCallback(int (*funcptr)(c_colormodifier**, const char*, uint32_t)) { alloc_colormodifier_callback = funcptr; } -REG_MACRO(ColorModifier, c_colormodifier*, alloc_colormodifier_buffer_callback) +REG_MACRO(ColorModifier, c_colormodifier**, alloc_colormodifier_buffer_callback) -void RegisterEmptyCreatureCasteCallback(int (*funcptr)(c_creaturecaste*)) +void RegisterEmptyCreatureCasteCallback(int (*funcptr)(c_creaturecaste**)) { alloc_empty_creaturecaste_callback = funcptr; } @@ -166,12 +166,12 @@ void UnregisterNewColorModifierCallback() alloc_colormodifier_callback = NULL; } -void RegisterNewCreatureCasteCallback(int (*funcptr)(c_creaturecaste*, const char*, const char*, const char*, const char*, uint32_t, uint32_t)) +void RegisterNewCreatureCasteCallback(int (*funcptr)(c_creaturecaste**, const char*, const char*, const char*, const char*, uint32_t, uint32_t)) { alloc_creaturecaste_callback = funcptr; } -REG_MACRO(CreatureCaste, c_creaturecaste*, alloc_creaturecaste_buffer_callback) +REG_MACRO(CreatureCaste, c_creaturecaste**, alloc_creaturecaste_buffer_callback) UNREG_MACRO(CreatureCaste, alloc_creaturecaste_buffer_callback) void UnregisterEmptyCreatureCasteCallback() @@ -184,17 +184,17 @@ void UnregisterNewCreatureCasteCallback() alloc_creaturecaste_callback = NULL; } -void RegisterEmptyCreatureTypeCallback(int (*funcptr)(c_creaturetype*)) +void RegisterEmptyCreatureTypeCallback(int (*funcptr)(c_creaturetype**)) { alloc_empty_creaturetype_callback = funcptr; } -void RegisterNewCreatureTypeCallback(int (*funcptr)(c_creaturetype*, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t)) +void RegisterNewCreatureTypeCallback(int (*funcptr)(c_creaturetype**, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t)) { alloc_creaturetype_callback = funcptr; } -REG_MACRO(CreatureType, c_creaturetype*, alloc_creaturetype_buffer_callback) +REG_MACRO(CreatureType, c_creaturetype**, alloc_creaturetype_buffer_callback) UNREG_MACRO(CreatureType, alloc_creaturetype_buffer_callback) void UnregisterEmptyCreatureTypeCallback() @@ -207,11 +207,11 @@ void UnregisterNewCreatureTypeCallback() alloc_creaturetype_callback = NULL; } -REG_MACRO(Vein, t_vein*, alloc_vein_buffer_callback) -REG_MACRO(FrozenLiquidVein, t_frozenliquidvein*, alloc_frozenliquidvein_buffer_callback) -REG_MACRO(SpatterVein, t_spattervein*, alloc_spattervein_buffer_callback) -REG_MACRO(GrassVein, t_grassvein*, alloc_grassvein_buffer_callback) -REG_MACRO(WorldConstruction, t_worldconstruction*, alloc_worldconstruction_buffer_callback) +REG_MACRO(Vein, t_vein**, alloc_vein_buffer_callback) +REG_MACRO(FrozenLiquidVein, t_frozenliquidvein**, alloc_frozenliquidvein_buffer_callback) +REG_MACRO(SpatterVein, t_spattervein**, alloc_spattervein_buffer_callback) +REG_MACRO(GrassVein, t_grassvein**, alloc_grassvein_buffer_callback) +REG_MACRO(WorldConstruction, t_worldconstruction**, alloc_worldconstruction_buffer_callback) UNREG_MACRO(Vein, alloc_vein_buffer_callback) UNREG_MACRO(FrozenLiquidVein, alloc_frozenliquidvein_buffer_callback) @@ -268,7 +268,7 @@ int ColorListConvert(t_colormodifier* src, c_colormodifier* dest) if(src == NULL) return -1; - ((*alloc_colormodifier_callback)(dest, src->part, src->colorlist.size())); + ((*alloc_colormodifier_callback)(&dest, src->part, src->colorlist.size())); copy(src->colorlist.begin(), src->colorlist.end(), dest->colorlist); @@ -280,10 +280,10 @@ int CreatureCasteConvert(t_creaturecaste* src, c_creaturecaste* dest) if(src == NULL) return -1; - ((*alloc_creaturecaste_callback)(dest, src->rawname, src->singular, src->plural, src->adjective, src->ColorModifier.size(), src->bodypart.size())); + ((*alloc_creaturecaste_callback)(&dest, src->rawname, src->singular, src->plural, src->adjective, src->colorModifier.size(), src->bodypart.size())); for(unsigned int i = 0; i < dest->colorModifierLength; i++) - ColorListConvert(&src->ColorModifier[i], &dest->ColorModifier[i]); + ColorListConvert(&src->colorModifier[i], &(dest->colorModifier[i])); copy(src->bodypart.begin(), src->bodypart.end(), dest->bodypart); @@ -295,7 +295,7 @@ int CreatureTypeConvert(t_creaturetype* src, c_creaturetype* dest) if(src == NULL) return -1; - ((*alloc_creaturetype_callback)(dest, src->rawname, src->castes.size(), src->extract.size(), src->tile_character, src->tilecolor.fore, src->tilecolor.back, src->tilecolor.bright)); + ((*alloc_creaturetype_callback)(&dest, src->rawname, src->castes.size(), src->extract.size(), src->tile_character, src->tilecolor.fore, src->tilecolor.back, src->tilecolor.bright)); for(unsigned int i = 0; i < dest->castesCount; i++) CreatureCasteConvert(&src->castes[i], &dest->castes[i]); diff --git a/library/include/dfhack-c/DFTypes_C.h b/library/include/dfhack-c/DFTypes_C.h index f0c3dcb4c..8832ea3d8 100644 --- a/library/include/dfhack-c/DFTypes_C.h +++ b/library/include/dfhack-c/DFTypes_C.h @@ -41,41 +41,41 @@ distribution. extern "C" { #endif -DFHACK_EXPORT extern int (*alloc_byte_buffer_callback)(int8_t*, uint32_t); -DFHACK_EXPORT extern int (*alloc_short_buffer_callback)(int16_t*, uint32_t); -DFHACK_EXPORT extern int (*alloc_int_buffer_callback)(int32_t*, uint32_t); +DFHACK_EXPORT extern int (*alloc_byte_buffer_callback)(int8_t**, uint32_t); +DFHACK_EXPORT extern int (*alloc_short_buffer_callback)(int16_t**, uint32_t); +DFHACK_EXPORT extern int (*alloc_int_buffer_callback)(int32_t**, uint32_t); -DFHACK_EXPORT extern int (*alloc_ubyte_buffer_callback)(uint8_t*, uint32_t); -DFHACK_EXPORT extern int (*alloc_ushort_buffer_callback)(uint16_t*, uint32_t); -DFHACK_EXPORT extern int (*alloc_uint_buffer_callback)(uint32_t*, uint32_t); +DFHACK_EXPORT extern int (*alloc_ubyte_buffer_callback)(uint8_t**, uint32_t); +DFHACK_EXPORT extern int (*alloc_ushort_buffer_callback)(uint16_t**, uint32_t); +DFHACK_EXPORT extern int (*alloc_uint_buffer_callback)(uint32_t**, uint32_t); -DFHACK_EXPORT extern int (*alloc_char_buffer_callback)(char*, uint32_t); +DFHACK_EXPORT extern int (*alloc_char_buffer_callback)(char**, uint32_t); -DFHACK_EXPORT extern int (*alloc_matgloss_buffer_callback)(t_matgloss*, uint32_t); -DFHACK_EXPORT extern int (*alloc_descriptor_buffer_callback)(t_descriptor_color*, uint32_t); -DFHACK_EXPORT extern int (*alloc_matgloss_other_buffer_callback)(t_matglossOther*, uint32_t); +DFHACK_EXPORT extern int (*alloc_matgloss_buffer_callback)(t_matgloss**, uint32_t); +DFHACK_EXPORT extern int (*alloc_descriptor_buffer_callback)(t_descriptor_color**, uint32_t); +DFHACK_EXPORT extern int (*alloc_matgloss_other_buffer_callback)(t_matglossOther**, uint32_t); -DFHACK_EXPORT extern int (*alloc_t_feature_buffer_callback)(t_feature*, uint32_t); -DFHACK_EXPORT extern int (*alloc_t_hotkey_buffer_callback)(t_hotkey*, uint32_t); -DFHACK_EXPORT extern int (*alloc_t_screen_buffer_callback)(t_screen*, uint32_t); +DFHACK_EXPORT extern int (*alloc_t_feature_buffer_callback)(t_feature**, uint32_t); +DFHACK_EXPORT extern int (*alloc_t_hotkey_buffer_callback)(t_hotkey**, uint32_t); +DFHACK_EXPORT extern int (*alloc_t_screen_buffer_callback)(t_screen**, uint32_t); -DFHACK_EXPORT void RegisterByteBufferCallback(int (*funcptr)(int8_t*, uint32_t)); -DFHACK_EXPORT void RegisterShortBufferCallback(int (*funcptr)(int16_t*, uint32_t)); -DFHACK_EXPORT void RegisterIntBufferCallback(int (*funcptr)(int32_t*, uint32_t)); +DFHACK_EXPORT void RegisterByteBufferCallback(int (*funcptr)(int8_t**, uint32_t)); +DFHACK_EXPORT void RegisterShortBufferCallback(int (*funcptr)(int16_t**, uint32_t)); +DFHACK_EXPORT void RegisterIntBufferCallback(int (*funcptr)(int32_t**, uint32_t)); -DFHACK_EXPORT void RegisterUByteBufferCallback(int (*funcptr)(uint8_t*, uint32_t)); -DFHACK_EXPORT void RegisterUShortBufferCallback(int (*funcptr)(uint16_t*, uint32_t)); -DFHACK_EXPORT void RegisterUIntBufferCallback(int (*funcptr)(uint32_t*, uint32_t)); +DFHACK_EXPORT void RegisterUByteBufferCallback(int (*funcptr)(uint8_t**, uint32_t)); +DFHACK_EXPORT void RegisterUShortBufferCallback(int (*funcptr)(uint16_t**, uint32_t)); +DFHACK_EXPORT void RegisterUIntBufferCallback(int (*funcptr)(uint32_t**, uint32_t)); -DFHACK_EXPORT void RegisterCharBufferCallback(int (*funcptr)(char*, uint32_t)); +DFHACK_EXPORT void RegisterCharBufferCallback(int (*funcptr)(char**, uint32_t)); -DFHACK_EXPORT void RegisterMatglossBufferCallback(int (*funcptr)(t_matgloss*, uint32_t)); -DFHACK_EXPORT void RegisterDescriptorColorBufferCallback(int (*funcptr)(t_descriptor_color*, uint32_t)); -DFHACK_EXPORT void RegisterMatglossOtherBufferCallback(int (*funcptr)(t_matglossOther*, uint32_t)); +DFHACK_EXPORT void RegisterMatglossBufferCallback(int (*funcptr)(t_matgloss**, uint32_t)); +DFHACK_EXPORT void RegisterDescriptorColorBufferCallback(int (*funcptr)(t_descriptor_color**, uint32_t)); +DFHACK_EXPORT void RegisterMatglossOtherBufferCallback(int (*funcptr)(t_matglossOther**, uint32_t)); -DFHACK_EXPORT void RegisterFeatureBufferCallback(int (*funcptr)(t_feature*, uint32_t)); -DFHACK_EXPORT void RegisterHotkeyBufferCallback(int (*funcptr)(t_hotkey*, uint32_t)); -DFHACK_EXPORT void RegisterScreenBufferCallback(int (*funcptr)(t_screen*, uint32_t)); +DFHACK_EXPORT void RegisterFeatureBufferCallback(int (*funcptr)(t_feature**, uint32_t)); +DFHACK_EXPORT void RegisterHotkeyBufferCallback(int (*funcptr)(t_hotkey**, uint32_t)); +DFHACK_EXPORT void RegisterScreenBufferCallback(int (*funcptr)(t_screen**, uint32_t)); HUNREG_MACRO(Byte) HUNREG_MACRO(Short) @@ -100,11 +100,11 @@ struct t_customWorkshop char name[256]; }; -DFHACK_EXPORT extern int (*alloc_t_customWorkshop_buffer_callback)(t_customWorkshop*, uint32_t); -DFHACK_EXPORT extern int (*alloc_t_material_buffer_callback)(t_material*, uint32_t); +DFHACK_EXPORT extern int (*alloc_t_customWorkshop_buffer_callback)(t_customWorkshop**, uint32_t); +DFHACK_EXPORT extern int (*alloc_t_material_buffer_callback)(t_material**, uint32_t); -DFHACK_EXPORT void RegisterCustomWorkshopBufferCallback(int (*funcptr)(t_customWorkshop*, uint32_t)); -DFHACK_EXPORT void RegisterMaterialBufferCallback(int (*funcptr)(t_material*, uint32_t)); +DFHACK_EXPORT void RegisterCustomWorkshopBufferCallback(int (*funcptr)(t_customWorkshop**, uint32_t)); +DFHACK_EXPORT void RegisterMaterialBufferCallback(int (*funcptr)(t_material**, uint32_t)); HUNREG_MACRO(CustomWorkshop) HUNREG_MACRO(Material) @@ -116,13 +116,13 @@ struct c_colormodifier uint32_t colorlistLength; }; -DFHACK_EXPORT extern int (*alloc_empty_colormodifier_callback)(c_colormodifier*); -DFHACK_EXPORT extern int (*alloc_colormodifier_callback)(c_colormodifier*, const char*, uint32_t); -DFHACK_EXPORT extern int (*alloc_colormodifier_buffer_callback)(c_colormodifier*, uint32_t); +DFHACK_EXPORT extern int (*alloc_empty_colormodifier_callback)(c_colormodifier**); +DFHACK_EXPORT extern int (*alloc_colormodifier_callback)(c_colormodifier**, const char*, uint32_t); +DFHACK_EXPORT extern int (*alloc_colormodifier_buffer_callback)(c_colormodifier**, uint32_t); -DFHACK_EXPORT void RegisterEmptyColorModifierCallback(int (*funcptr)(c_colormodifier*)); -DFHACK_EXPORT void RegisterNewColorModifierCallback(int (*funcptr)(c_colormodifier*, const char*, uint32_t)); -DFHACK_EXPORT void RegisterColorModifierBufferCallback(int (*funcptr)(c_colormodifier*, uint32_t)); +DFHACK_EXPORT void RegisterEmptyColorModifierCallback(int (*funcptr)(c_colormodifier**)); +DFHACK_EXPORT void RegisterNewColorModifierCallback(int (*funcptr)(c_colormodifier**, const char*, uint32_t)); +DFHACK_EXPORT void RegisterColorModifierBufferCallback(int (*funcptr)(c_colormodifier**, uint32_t)); DFHACK_EXPORT void UnregisterEmptyColorModifierCallback(); DFHACK_EXPORT void UnregisterNewColorModifierCallback(); @@ -135,20 +135,20 @@ struct c_creaturecaste char plural[128]; char adjective[128]; - c_colormodifier* ColorModifier; + c_colormodifier* colorModifier; uint32_t colorModifierLength; t_bodypart* bodypart; uint32_t bodypartLength; }; -DFHACK_EXPORT extern int (*alloc_empty_creaturecaste_callback)(c_creaturecaste*); -DFHACK_EXPORT extern int (*alloc_creaturecaste_callback)(c_creaturecaste*, const char*, const char*, const char*, const char*, uint32_t, uint32_t); -DFHACK_EXPORT extern int (*alloc_creaturecaste_buffer_callback)(c_creaturecaste*, uint32_t); +DFHACK_EXPORT extern int (*alloc_empty_creaturecaste_callback)(c_creaturecaste**); +DFHACK_EXPORT extern int (*alloc_creaturecaste_callback)(c_creaturecaste**, const char*, const char*, const char*, const char*, uint32_t, uint32_t); +DFHACK_EXPORT extern int (*alloc_creaturecaste_buffer_callback)(c_creaturecaste**, uint32_t); -DFHACK_EXPORT void RegisterEmptyCreatureCasteCallback(int (*funcptr)(c_creaturecaste*)); -DFHACK_EXPORT void RegisterNewCreatureCasteCallback(int (*funcptr)(c_creaturecaste*, const char*, const char*, const char*, const char*, uint32_t, uint32_t)); -DFHACK_EXPORT void RegisterCreatureCasteBufferCallback(int (*funcptr)(c_creaturecaste*, uint32_t)); +DFHACK_EXPORT void RegisterEmptyCreatureCasteCallback(int (*funcptr)(c_creaturecaste**)); +DFHACK_EXPORT void RegisterNewCreatureCasteCallback(int (*funcptr)(c_creaturecaste**, const char*, const char*, const char*, const char*, uint32_t, uint32_t)); +DFHACK_EXPORT void RegisterCreatureCasteBufferCallback(int (*funcptr)(c_creaturecaste**, uint32_t)); DFHACK_EXPORT void UnregisterEmptyCreatureCasteCallback(); DFHACK_EXPORT void UnregisterNewCreatureCasteCallback(); @@ -174,25 +174,25 @@ struct c_creaturetype } tilecolor; }; -DFHACK_EXPORT extern int (*alloc_empty_creaturetype_callback)(c_creaturetype*); -DFHACK_EXPORT extern int (*alloc_creaturetype_callback)(c_creaturetype*, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t); -DFHACK_EXPORT extern int (*alloc_creaturetype_buffer_callback)(c_creaturetype*, uint32_t); - -DFHACK_EXPORT extern int (*alloc_vein_buffer_callback)(t_vein*, uint32_t); -DFHACK_EXPORT extern int (*alloc_frozenliquidvein_buffer_callback)(t_frozenliquidvein*, uint32_t); -DFHACK_EXPORT extern int (*alloc_spattervein_buffer_callback)(t_spattervein*, uint32_t); -DFHACK_EXPORT extern int (*alloc_grassvein_buffer_callback)(t_grassvein*, uint32_t); -DFHACK_EXPORT extern int (*alloc_worldconstruction_buffer_callback)(t_worldconstruction*, uint32_t); - -DFHACK_EXPORT void RegisterEmptyCreatureTypeCallback(int (*funcptr)(c_creaturetype*)); -DFHACK_EXPORT void RegisterNewCreatureTypeCallback(int (*funcptr)(c_creaturetype*, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t)); -DFHACK_EXPORT void RegisterCreatureTypeBufferCallback(int (*funcptr)(c_creaturetype*, uint32_t)); - -DFHACK_EXPORT void RegisterVeinBufferCallback(int (*funcptr)(t_vein*, uint32_t)); -DFHACK_EXPORT void RegisterFrozenLiquidVeinBufferCallback(int (*funcptr)(t_frozenliquidvein*, uint32_t)); -DFHACK_EXPORT void RegisterSpatterVeinBufferCallback(int (*funcptr)(t_spattervein*, uint32_t)); -DFHACK_EXPORT void RegisterGrassVeinBufferCallback(int (*funcptr)(t_grassvein*, uint32_t)); -DFHACK_EXPORT void RegisterWorldConstructionBufferCallback(int (*funcptr)(t_worldconstruction*, uint32_t)); +DFHACK_EXPORT extern int (*alloc_empty_creaturetype_callback)(c_creaturetype**); +DFHACK_EXPORT extern int (*alloc_creaturetype_callback)(c_creaturetype**, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t); +DFHACK_EXPORT extern int (*alloc_creaturetype_buffer_callback)(c_creaturetype**, uint32_t); + +DFHACK_EXPORT extern int (*alloc_vein_buffer_callback)(t_vein**, uint32_t); +DFHACK_EXPORT extern int (*alloc_frozenliquidvein_buffer_callback)(t_frozenliquidvein**, uint32_t); +DFHACK_EXPORT extern int (*alloc_spattervein_buffer_callback)(t_spattervein**, uint32_t); +DFHACK_EXPORT extern int (*alloc_grassvein_buffer_callback)(t_grassvein**, uint32_t); +DFHACK_EXPORT extern int (*alloc_worldconstruction_buffer_callback)(t_worldconstruction**, uint32_t); + +DFHACK_EXPORT void RegisterEmptyCreatureTypeCallback(int (*funcptr)(c_creaturetype**)); +DFHACK_EXPORT void RegisterNewCreatureTypeCallback(int (*funcptr)(c_creaturetype**, const char*, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t)); +DFHACK_EXPORT void RegisterCreatureTypeBufferCallback(int (*funcptr)(c_creaturetype**, uint32_t)); + +DFHACK_EXPORT void RegisterVeinBufferCallback(int (*funcptr)(t_vein**, uint32_t)); +DFHACK_EXPORT void RegisterFrozenLiquidVeinBufferCallback(int (*funcptr)(t_frozenliquidvein**, uint32_t)); +DFHACK_EXPORT void RegisterSpatterVeinBufferCallback(int (*funcptr)(t_spattervein**, uint32_t)); +DFHACK_EXPORT void RegisterGrassVeinBufferCallback(int (*funcptr)(t_grassvein**, uint32_t)); +DFHACK_EXPORT void RegisterWorldConstructionBufferCallback(int (*funcptr)(t_worldconstruction**, uint32_t)); DFHACK_EXPORT void UnregisterEmptyCreatureTypeCallback(); DFHACK_EXPORT void UnregisterNewCreatureTypeCallback();