adding creature extract support

develop
simon 2010-04-30 17:03:21 +02:00
parent c0f1178888
commit 6531829268
2 changed files with 15 additions and 0 deletions

@ -45,11 +45,17 @@ namespace DFHack
char plural[128]; char plural[128];
char adjective[128]; char adjective[128];
}; };
struct t_creatureextract
{
char rawname[128];
};
// this doesn't transfer well across the shm gap... // this doesn't transfer well across the shm gap...
struct t_creaturetype struct t_creaturetype
{ {
char rawname[128]; char rawname[128];
std::vector <t_creaturecaste> castes; std::vector <t_creaturecaste> castes;
std::vector <t_creatureextract> extract;
uint8_t tile_character; uint8_t tile_character;
struct struct
{ {

@ -269,6 +269,7 @@ bool Materials::ReadCreatureTypesEx (void)
memory_info *mem = d->owner->getDescriptor(); memory_info *mem = d->owner->getDescriptor();
DfVector <uint32_t> p_races (p, mem->getAddress ("creature_type_vector")); DfVector <uint32_t> p_races (p, mem->getAddress ("creature_type_vector"));
uint32_t castes_vector_offset = mem->getOffset ("creature_type_caste_vector"); uint32_t castes_vector_offset = mem->getOffset ("creature_type_caste_vector");
uint32_t extract_vector_offset = mem->getOffset ("creature_type_extract_vector");
uint32_t sizeof_string = mem->getHexValue ("sizeof_string"); uint32_t sizeof_string = mem->getHexValue ("sizeof_string");
uint32_t size = p_races.size(); uint32_t size = p_races.size();
uint32_t sizecas = 0; uint32_t sizecas = 0;
@ -296,6 +297,14 @@ bool Materials::ReadCreatureTypesEx (void)
mat.tilecolor.fore = p->readWord( p_races[i] + tile_color_offset ); mat.tilecolor.fore = p->readWord( p_races[i] + tile_color_offset );
mat.tilecolor.back = p->readWord( p_races[i] + tile_color_offset + 2 ); mat.tilecolor.back = p->readWord( p_races[i] + tile_color_offset + 2 );
mat.tilecolor.bright = p->readWord( p_races[i] + tile_color_offset + 4 ); mat.tilecolor.bright = p->readWord( p_races[i] + tile_color_offset + 4 );
DfVector <uint32_t> p_extract(p, p_races[i] + extract_vector_offset);
for(uint32_t j = 0; j < p_extract.size(); j++)
{
t_creatureextract extract;
p->readSTLString( p_extract[j], extract.rawname, sizeof(extract.rawname));
mat.extract.push_back(extract);
}
raceEx.push_back(mat); raceEx.push_back(mat);
} }
return true; return true;