updated to match C++ additions

develop
doomchild 2010-08-18 16:00:49 -05:00
parent f2696dadca
commit fd872922a5
4 changed files with 48 additions and 1 deletions

@ -34,6 +34,9 @@ distribution.
extern "C" {
#endif
DFHACK_EXPORT int Items_Start(DFHackObject* items);
DFHACK_EXPORT int Items_Finish(DFHackObject* items);
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);

@ -62,9 +62,9 @@ DFHACK_EXPORT t_matgloss* Materials_getPlant(DFHackObject* mat);
DFHACK_EXPORT t_matgloss* Materials_getRace(DFHackObject* mat);
DFHACK_EXPORT c_creaturetype* Materials_getRaceEx(DFHackObject* mat);
DFHACK_EXPORT t_descriptor_color* Materials_getColor(DFHackObject* mat);
DFHACK_EXPORT t_matglossOther* Materials_getOther(DFHackObject* mat);
DFHACK_EXPORT t_matgloss* Materials_getAllDesc(DFHackObject* mat);
#ifdef __cplusplus
}

@ -28,6 +28,26 @@ distribution.
extern "C" {
#endif
int Items_Start(DFHackObject* items)
{
if(items != NULL)
{
return ((DFHack::Items*)items)->Start();
}
return -1;
}
int Items_Finish(DFHackObject* items)
{
if(items != NULL)
{
return ((DFHack::Items*)items)->Finish();
}
return -1;
}
//FIXME: beware of bad null-termination! I haven't tested anything here, but it seems that it could be corrupting or truncating strings.
char* Items_getItemDescription(DFHackObject* items, uint32_t itemptr, DFHackObject* mats)

@ -407,6 +407,30 @@ t_matglossOther* Materials_getOther(DFHackObject* mat)
return NULL;
}
t_matgloss* Materials_getAllDesc(DFHackObject* mat)
{
if(mat != NULL)
{
DFHack::Materials* materials = (DFHack::Materials*)mat;
if(materials->alldesc.size() > 0)
{
t_matgloss* buf;
((*alloc_matgloss_buffer_callback)(buf, materials->alldesc.size()));
if(buf != NULL)
{
copy(materials->race.begin(), materials->alldesc.end(), buf);
return buf;
}
}
}
return NULL;
}
#ifdef __cplusplus
}
#endif