From 2254f3dfe581b241df1ed735451433c7d7cb1ad9 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Wed, 16 Jun 2010 00:28:05 +0800 Subject: [PATCH] Flag writing function added --- library/include/dfhack/modules/Creatures.h | 3 ++- library/modules/Creatures.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/library/include/dfhack/modules/Creatures.h b/library/include/dfhack/modules/Creatures.h index 1f08b1aa4..2e27ff3b9 100644 --- a/library/include/dfhack/modules/Creatures.h +++ b/library/include/dfhack/modules/Creatures.h @@ -379,7 +379,8 @@ namespace DFHack /* Write Functions */ // write labors of a creature (for Dwarf Therapist) 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); private: struct Private; diff --git a/library/modules/Creatures.cpp b/library/modules/Creatures.cpp index d882e1d7f..e9193e9dc 100644 --- a/library/modules/Creatures.cpp +++ b/library/modules/Creatures.cpp @@ -371,6 +371,20 @@ bool Creatures::WriteHappiness(const uint32_t index, const uint32_t happinessVal return true; } +bool Creatures::WriteFlags(const uint32_t index, + const uint32_t flags1, + const uint32_t flags2) +{ + if(!d->Started) + return false; + + uint32_t temp = d->p_cre->at (index); + Process * p = d->owner; + p->writeDWord (temp + d->creatures.flags1_offset, flags1); + p->writeDWord (temp + d->creatures.flags2_offset, flags1); + return true; +} + uint32_t Creatures::GetDwarfRaceIndex() { if(!d->Inited) return 0;