diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index a04766405..de8e1dae4 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -26,7 +26,6 @@ include/dfhack/DFContext.h include/dfhack/DFContextManager.h include/dfhack/DFError.h include/dfhack/DFExport.h -include/dfhack/DFGlobal.h include/dfhack/DFIntegers.h include/dfhack/DFMiscUtils.h include/dfhack/DFModule.h @@ -57,6 +56,7 @@ SET(PROJECT_C_HDRS include/DFHack_C.h include/dfhack-c/DFProcess_C.h include/dfhack-c/DFTypes_C.h +include/dfhack-c/DFTileTypes_C.h include/dfhack-c/DFContext_C.h include/dfhack-c/modules/Buildings_C.h include/dfhack-c/modules/Constructions_C.h @@ -107,6 +107,7 @@ SET(PROJECT_C_SRCS DFContext_C.cpp DFProcess_C.cpp DFTypes_C.cpp +DFTileTypes_C.cpp modules/Buildings_C.cpp modules/Constructions_C.cpp diff --git a/library/DFContext_C.cpp b/library/DFContext_C.cpp index cb8d965ff..cfe24ad00 100644 --- a/library/DFContext_C.cpp +++ b/library/DFContext_C.cpp @@ -27,14 +27,13 @@ distribution. #include #include #include +using namespace std; + #include "dfhack/DFIntegers.h" -#include "dfhack/DFTileTypes.h" -#include "dfhack/DFTypes.h" -//#include "dfhack/modules/WindowIO.h" #include "dfhack/DFContextManager.h" #include "dfhack/DFContext.h" -using namespace std; + using namespace DFHack; #include "dfhack-c/DFContext_C.h" diff --git a/library/DFProcess_C.cpp b/library/DFProcess_C.cpp index 870344e28..3a07329f8 100644 --- a/library/DFProcess_C.cpp +++ b/library/DFProcess_C.cpp @@ -133,7 +133,7 @@ void Process_write(DFHackObject* p_Ptr, uint32_t address, uint32_t length, uint8 ((DFHack::Process*)p_Ptr)->write(address, length, buffer); } -char* Process_readString(DFHackObject* p_Ptr, uint32_t offset) +const char* Process_readString(DFHackObject* p_Ptr, uint32_t offset) { if(p_Ptr == NULL || alloc_char_buffer_callback == NULL) return NULL; @@ -162,7 +162,7 @@ char* Process_readString(DFHackObject* p_Ptr, uint32_t offset) return ""; } -char* Process_getPath(DFHackObject* p_Ptr) +const char* Process_getPath(DFHackObject* p_Ptr) { if(p_Ptr == NULL || alloc_char_buffer_callback == NULL) return NULL; @@ -191,7 +191,7 @@ char* Process_getPath(DFHackObject* p_Ptr) return ""; } -char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr) +const char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr) { if(p_Ptr == NULL || alloc_char_buffer_callback == NULL) return NULL; diff --git a/library/DFTypes_C.cpp b/library/DFTypes_C.cpp index 410baba2a..d87352c8a 100644 --- a/library/DFTypes_C.cpp +++ b/library/DFTypes_C.cpp @@ -22,21 +22,18 @@ must not be misrepresented as being the original software. distribution. */ -#include "dfhack/DFIntegers.h" -#include "dfhack/DFTileTypes.h" -#include -#include "string.h" +#include "Internal.h" + +#include +#include +#include #include #include - using namespace std; -#include "Internal.h" #include "dfhack/DFTypes.h" -#include "dfhack/DFTileTypes.h" #include "dfhack-c/DFTypes_C.h" #include "dfhack/modules/Materials.h" - using namespace DFHack; /* @@ -170,46 +167,6 @@ void RegisterFeatureMapBufferCallback(int (*funcptr)(c_featuremap_node**, uint32 UNREG_MACRO(FeatureMap, alloc_featuremap_buffer_callback) -int DFHack_isWallTerrain(int in) -{ - return DFHack::isWallTerrain(in); -} - -int DFHack_isFloorTerrain(int in) -{ - return DFHack::isFloorTerrain(in); -} - -int DFHack_isRampTerrain(int in) -{ - return DFHack::isRampTerrain(in); -} - -int DFHack_isStairTerrain(int in) -{ - return DFHack::isStairTerrain(in); -} - -int DFHack_isOpenTerrain(int in) -{ - return DFHack::isOpenTerrain(in); -} - -int DFHack_getVegetationType(int in) -{ - return DFHack::getVegetationType(in); -} - -int DFHack_getTileType(int index, TileRow* tPtr) -{ - if(index >= TILE_TYPE_ARRAY_LENGTH) - return 0; - - *tPtr = tileTypeTable[index]; - - return 1; -} - #ifdef __cplusplus } #endif diff --git a/library/include/DFHack.h b/library/include/DFHack.h index 2cebc31a5..d0c3d7aaa 100644 --- a/library/include/DFHack.h +++ b/library/include/DFHack.h @@ -19,7 +19,6 @@ // DFHack core classes and types #include "dfhack/DFIntegers.h" -#include "dfhack/DFGlobal.h" #include "dfhack/DFError.h" #include "dfhack/DFContextManager.h" #include "dfhack/DFContext.h" diff --git a/library/include/dfhack-c/DFProcess_C.h b/library/include/dfhack-c/DFProcess_C.h index aeb58d21e..e63b748fb 100644 --- a/library/include/dfhack-c/DFProcess_C.h +++ b/library/include/dfhack-c/DFProcess_C.h @@ -72,9 +72,9 @@ DFHACK_EXPORT void Process_write(DFHackObject* p_Ptr, uint32_t address, uint32_t DFHACK_EXPORT int Process_readSTLVector(DFHackObject* p_Ptr, uint32_t address, t_vecTriplet* vector); -DFHACK_EXPORT char* Process_readString(DFHackObject* p_Ptr, uint32_t offset); -DFHACK_EXPORT char* Process_getPath(DFHackObject* p_Ptr); -DFHACK_EXPORT char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr); +DFHACK_EXPORT const char* Process_readString(DFHackObject* p_Ptr, uint32_t offset); +DFHACK_EXPORT const char* Process_getPath(DFHackObject* p_Ptr); +DFHACK_EXPORT const char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr); DFHACK_EXPORT int Process_isSuspended(DFHackObject* p_Ptr); DFHACK_EXPORT int Process_isAttached(DFHackObject* p_Ptr); diff --git a/library/include/dfhack-c/DFTypes_C.h b/library/include/dfhack-c/DFTypes_C.h index 4bd2fa0cc..b65134717 100644 --- a/library/include/dfhack-c/DFTypes_C.h +++ b/library/include/dfhack-c/DFTypes_C.h @@ -31,7 +31,7 @@ distribution. #include "dfhack/modules/Maps.h" #include "dfhack/modules/Materials.h" #include "dfhack/modules/Gui.h" -#include "dfhack/DFTileTypes.h" +//#include "dfhack/DFTileTypes.h" #define HBUILD(a) a ## BufferCallback #define HREG_MACRO(type_name, type) DFHACK_EXPORT void HBUILD(Register ## type_name) (int (*funcptr)(type, uint32_t)); @@ -256,15 +256,6 @@ DFHACK_EXPORT extern int (*alloc_featuremap_buffer_callback)(c_featuremap_node** DFHACK_EXPORT void RegisterFeatureMapBufferCallback(int (*funcptr)(c_featuremap_node**, uint32_t*, uint32_t)); -DFHACK_EXPORT int DFHack_isWallTerrain(int in); -DFHACK_EXPORT int DFHack_isFloorTerrain(int in); -DFHACK_EXPORT int DFHack_isRampTerrain(int in); -DFHACK_EXPORT int DFHack_isStairTerrain(int in); -DFHACK_EXPORT int DFHack_isOpenTerrain(int in); -DFHACK_EXPORT int DFHack_getVegetationType(int in); - -DFHACK_EXPORT int DFHack_getTileType(int index, TileRow* tPtr); - #ifdef __cplusplus } #endif diff --git a/library/modules/Translation_C.cpp b/library/modules/Translation_C.cpp index 64420ae33..b11acd586 100644 --- a/library/modules/Translation_C.cpp +++ b/library/modules/Translation_C.cpp @@ -22,12 +22,13 @@ must not be misrepresented as being the original software. distribution. */ -#include "dfhack/DFIntegers.h" -#include +#include "Internal.h" +#include +#include using namespace std; -#include "Internal.h" + #include "dfhack/DFTypes.h" #include "dfhack/modules/Translation.h" #include "dfhack-c/modules/Translation_C.h" diff --git a/library/modules/Vegetation_C.cpp b/library/modules/Vegetation_C.cpp index 0a919c070..848a24a95 100644 --- a/library/modules/Vegetation_C.cpp +++ b/library/modules/Vegetation_C.cpp @@ -22,8 +22,11 @@ must not be misrepresented as being the original software. distribution. */ -#include "dfhack/DFIntegers.h" #include "Internal.h" +#include +#include +using namespace std; + #include "dfhack/DFTypes.h" #include "dfhack/modules/Vegetation.h" #include "dfhack-c/modules/Vegetation_C.h"