Job writing for mood material editing

develop
sizeak 2010-08-09 19:28:35 +01:00
parent c7dc55a85a
commit 7d684d12b4
2 changed files with 22 additions and 1 deletions

@ -380,7 +380,6 @@ namespace DFHack
int32_t GetDwarfCivId ( void ); int32_t GetDwarfCivId ( void );
/* Write Functions */ /* Write Functions */
// write labors of a creature (for Dwarf Therapist)
bool WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LABORS]); bool WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LABORS]);
bool WriteHappiness(const uint32_t index, const uint32_t happinessValue); bool WriteHappiness(const uint32_t index, const uint32_t happinessValue);
bool WriteFlags(const uint32_t index, const uint32_t flags1, const uint32_t flags2); bool WriteFlags(const uint32_t index, const uint32_t flags1, const uint32_t flags2);
@ -390,6 +389,7 @@ namespace DFHack
bool WriteTraits(const uint32_t index, const t_soul &soul); bool WriteTraits(const uint32_t index, const t_soul &soul);
bool WriteMood(const uint32_t index, const uint16_t mood); bool WriteMood(const uint32_t index, const uint16_t mood);
bool WriteMoodSkill(const uint32_t index, const uint16_t moodSkill); bool WriteMoodSkill(const uint32_t index, const uint16_t moodSkill);
bool WriteJob(const t_creature * furball, std::vector<t_material> const& mat);
bool WritePos(const uint32_t index, const t_creature &creature); bool WritePos(const uint32_t index, const t_creature &creature);
bool WriteCiv(const uint32_t index, const int32_t civ); bool WriteCiv(const uint32_t index, const int32_t civ);

@ -519,6 +519,27 @@ bool Creatures::WriteMoodSkill(const uint32_t index, const uint16_t moodSkill)
return true; return true;
} }
bool Creatures::WriteJob(const t_creature * furball, std::vector<t_material> const& mat)
{
unsigned int i;
if(!d->Inited) return false;
if(!furball->current_job.active) return false;
Process * p = d->owner;
memory_info * minfo = d->d->offset_descriptor;
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
for(i=0;i<cmats.size();i++)
{
p->writeWord(cmats[i] + minfo->getOffset("job_material_maintype"), mat[i].itemType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype1"), mat[i].subType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype2"), mat[i].subIndex);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_sectype3"), mat[i].index);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_flags"), mat[i].flags);
}
return true;
}
bool Creatures::WritePos(const uint32_t index, const t_creature &creature) bool Creatures::WritePos(const uint32_t index, const t_creature &creature)
{ {
if(!d->Started) if(!d->Started)