Reading of dwarf race index

develop
Petr Mrázek 2010-04-16 13:28:07 +02:00
parent 93c58005c2
commit 52b9ed3afe
2 changed files with 9 additions and 2 deletions

@ -368,7 +368,7 @@ namespace DFHack
bool ReadCreature(const int32_t index, t_creature & furball);
/// write labors of a creature (for Dwarf Therapist)
bool WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LABORS]);
uint32_t GetDwarfRaceIndex ( void );
private:
struct Private;
Private *d;

@ -51,6 +51,7 @@ struct Creatures::Private
bool Started;
Creatures2010::creature_offsets creatures;
uint32_t creature_module;
uint32_t dwarf_race_index_addr;
DfVector *p_cre;
APIPrivate *d;
};
@ -93,7 +94,7 @@ Creatures::Creatures(APIPrivate* _d)
creatures.name_firstname_offset = minfo->getOffset("name_firstname");
creatures.name_nickname_offset = minfo->getOffset("name_nickname");
creatures.name_words_offset = minfo->getOffset("name_words");
d->dwarf_race_index_addr = minfo->getAddress("dwarf_race_index");
// upload offsets to the SHM
if(g_pProcess->getModuleIndex("Creatures2010",1,d->creature_module))
{
@ -306,6 +307,12 @@ bool Creatures::WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LA
return true;
}
uint32_t Creatures::GetDwarfRaceIndex()
{
if(!d->Inited) return 0;
return g_pProcess->readDWord(d->dwarf_race_index_addr);
}
/*
bool API::getCurrentCursorCreature(uint32_t & creature_index)
{