Creature birth date and time is now read

develop
simon 2010-05-12 14:41:43 +02:00
parent 76dddb8419
commit db1decea0a
5 changed files with 18 additions and 1 deletions

@ -348,6 +348,9 @@ namespace DFHack
t_soul defaultSoul;
uint32_t nbcolors;
uint32_t color[MAX_COLORS];
uint32_t birth_year;
uint32_t birth_time;
};
class APIPrivate;

@ -100,6 +100,10 @@ Creatures::Creatures(APIPrivate* _d)
// appearance
creatures.appearance_vector_offset = minfo->getOffset("creature_appearance_vector");
//birth
creatures.birth_year_offset = minfo->getOffset("creature_birth_year");
creatures.birth_time_offset = minfo->getOffset("creature_birth_time");
// name offsets for the creature module
creatures.name_firstname_offset = minfo->getOffset("name_firstname");
@ -217,6 +221,8 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
furball.current_job.active = false;;
}
furball.birth_year = p->readDWord (temp + offs.birth_year_offset );
furball.birth_time = p->readDWord (temp + offs.birth_time_offset );
// current job HACK: the job object isn't cleanly represented here
/*

@ -65,6 +65,8 @@ typedef struct
uint32_t soul_mental_offset;
uint32_t soul_traits_offset;
uint32_t appearance_vector_offset;
uint32_t birth_year_offset;
uint32_t birth_time_offset;
} creature_offsets;
typedef struct

@ -204,6 +204,7 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
}
*/
cout << endl;
cout << "Born on the year " << creature.birth_year << ", month " << (creature.birth_time/1200/28) << ", day " << ((creature.birth_time/1200) % 28 + 1) << endl;
cout << "Appearance : ";
for(unsigned int i = 0; i<creature.nbcolors ; i++)
{

@ -1132,7 +1132,10 @@ map_data_1b60_offset 0x1B9c
<Offset name="name_nickname">0x1C</Offset>
<Offset name="name_words">0x38</Offset>
Time
====
<Address name="current_month">0x0e47e08</Address>
<Address name="current_year">0x0e79f00</Address>
Creatures
=========
@ -1156,6 +1159,8 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_pregnancy">0x28C</Offset>
<Offset name="creature_pregnancy_ptr">0x290</Offset>
<Offset name="creature_birth_year">0x298</Offset>
<Offset name="creature_birth_time">0x29C</Offset>
<Offset name="creature_physical">0x464</Offset>
<!--