|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/*
|
|
|
|
|
www.sourceforge.net/projects/dfhack
|
|
|
|
|
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
|
|
|
|
|
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
|
|
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
|
warranty. In no event will the authors be held liable for any
|
|
|
|
@ -49,7 +49,8 @@ distribution.
|
|
|
|
|
using namespace std;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef enum DFHackAPIVectorTypeC {
|
|
|
|
|
typedef enum DFHackAPIVectorTypeC
|
|
|
|
|
{
|
|
|
|
|
DFHackAPIVectorTypeC_Normal, // array of struct's
|
|
|
|
|
DFHackAPIVectorTypeC_Matgloss, // array of t_matgloss's
|
|
|
|
|
DFHackAPIVectorTypeC_Uint16, // array of uint16_t's
|
|
|
|
@ -59,7 +60,8 @@ typedef enum DFHackAPIVectorTypeC {
|
|
|
|
|
DFHackAPIVectorTypeC_DWord = 0xffffffff // Unused
|
|
|
|
|
} DFHackAPIVectorTypeC;
|
|
|
|
|
|
|
|
|
|
typedef struct DFHackAPIVectorC {
|
|
|
|
|
typedef struct DFHackAPIVectorC
|
|
|
|
|
{
|
|
|
|
|
void *data;
|
|
|
|
|
uint32_t length;
|
|
|
|
|
DFHackAPIVectorTypeC type;
|
|
|
|
@ -73,7 +75,8 @@ typedef char bool;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
|
|
// The C interface for vector management
|
|
|
|
@ -91,6 +94,7 @@ DFHACKAPI bool DFHackAPI_ReadStoneMatgloss(DFHackAPIHandle self, DFHackAPIVector
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadWoodMatgloss (DFHackAPIHandle self, DFHackAPIVectorC *output);
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadMetalMatgloss (DFHackAPIHandle self, DFHackAPIVectorC *output);
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadPlantMatgloss (DFHackAPIHandle self, DFHackAPIVectorC *output);
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadCreatureMatgloss (DFHackAPIHandle self, DFHackAPIVectorC *output);
|
|
|
|
|
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadGeology (DFHackAPIHandle self, DFHackAPIVectorC *assign);
|
|
|
|
|
|
|
|
|
@ -126,6 +130,10 @@ DFHACKAPI uint32_t DFHackAPI_InitReadVegetation(DFHackAPIHandle self);
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadVegetation (DFHackAPIHandle self, const uint32_t *index, t_tree_desc * shrubbery);
|
|
|
|
|
DFHACKAPI void DFHackAPI_FinishReadVegetation (DFHackAPIHandle self);
|
|
|
|
|
|
|
|
|
|
DFHACKAPI uint32_t DFHackAPI_InitReadCreatures (DFHackAPIHandle self);
|
|
|
|
|
DFHACKAPI bool DFHackAPI_ReadCreature (DFHackAPIHandle self, const uint32_t *index, t_creature * furball);
|
|
|
|
|
DFHACKAPI void DFHackAPI_FinishReadCreatures (DFHackAPIHandle self);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
@ -176,6 +184,17 @@ inline bool DFHackAPI_ReadPlantMatgloss(DFHackAPIHandle self, vector<t_matgloss>
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool DFHackAPI_ReadCreatureMatgloss (DFHackAPIHandle self, vector<t_matgloss> & output)
|
|
|
|
|
{
|
|
|
|
|
DFHackAPIVectorC vector;
|
|
|
|
|
bool result = DFHackAPI_ReadCreatureMatgloss (self, &vector);
|
|
|
|
|
uint32_t i;
|
|
|
|
|
for (i = 0; i < vector.length; i++)
|
|
|
|
|
output.push_back ( ( (t_matgloss *) vector.data) [i]);
|
|
|
|
|
DFHackAPIVector_free (&vector);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool DFHackAPI_ReadGeology (DFHackAPIHandle self, vector< vector<uint16_t> > &assign)
|
|
|
|
|
{
|
|
|
|
|
DFHackAPIVectorC vec;
|
|
|
|
@ -278,7 +297,10 @@ public:
|
|
|
|
|
return DFHackAPI_ReadPlantMatgloss (handle, output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME: add creatures for all the creature products
|
|
|
|
|
inline bool ReadCreatureMatgloss (vector<t_matgloss> & output)
|
|
|
|
|
{
|
|
|
|
|
return DFHackAPI_ReadCreatureMatgloss (handle, output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// read region surroundings, get their vectors of geolayers so we can do translation (or just hand the translation table to the client)
|
|
|
|
|
// returns an array of 9 vectors of indices into stone matgloss
|
|
|
|
@ -434,6 +456,23 @@ public:
|
|
|
|
|
{
|
|
|
|
|
DFHackAPI_FinishReadVegetation (handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline uint32_t InitReadCreatures()
|
|
|
|
|
{
|
|
|
|
|
return DFHackAPI_InitReadCreatures (handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool ReadCreature (const uint32_t &index, t_creature & furball)
|
|
|
|
|
{
|
|
|
|
|
return DFHackAPI_ReadCreature (handle, &index, &furball);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void FinishReadCreatures()
|
|
|
|
|
{
|
|
|
|
|
DFHackAPI_FinishReadCreatures (handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
|
|