diff --git a/data/Memory-ng.xml b/data/Memory-ng.xml
index d22192b81..d02701380 100644
--- a/data/Memory-ng.xml
+++ b/data/Memory-ng.xml
@@ -939,11 +939,11 @@
-
-
-
-
-
+
+
+
+
+
@@ -1214,11 +1214,11 @@
seems to be just like the old occupations
- like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
- subsubtype ?
- subtype ?
- index of material (for example, 2 is for silver)
- set only for shell / bone mood requirements ?
+ like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
+ subsubtype ?
+ subtype ?
+ index of material (for example, 2 is for silver)
+ set only for shell / bone mood requirements ?
@@ -1746,11 +1746,11 @@
seems to be just like the old occupations
- like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
- subsubtype ?
- subtype ?
- index of material (for example, 2 is for silver)
- set only for shell / bone mood requirements ?
+ like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
+ subsubtype ?
+ subtype ?
+ index of material (for example, 2 is for silver)
+ set only for shell / bone mood requirements ?
-->
@@ -1865,6 +1865,10 @@
+
+
+
+
diff --git a/library/modules/Creatures.cpp b/library/modules/Creatures.cpp
index 0ab171440..ee78df9d8 100644
--- a/library/modules/Creatures.cpp
+++ b/library/modules/Creatures.cpp
@@ -54,6 +54,8 @@ struct Creatures::Private
uint32_t creature_module;
uint32_t dwarf_race_index_addr;
uint32_t dwarf_civ_id_addr;
+ OffsetGroup * OG_jobs;
+ OffsetGroup * OG_job_mats;
DfVector *p_cre;
DFContextShared *d;
Process *owner;
@@ -123,6 +125,8 @@ Creatures::Creatures(DFContextShared* _d)
creatures.name_nickname_offset = OG_name->getOffset("nick");
creatures.name_words_offset = OG_name->getOffset("second_words");
}
+ d->OG_jobs = OG_Creatures->getGroup("job");
+ d->OG_job_mats = d->OG_jobs->getGroup("material");
/*
// upload offsets to the SHM
@@ -231,8 +235,8 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
if(furball.current_job.occupationPtr)
{
furball.current_job.active = true;
- furball.current_job.jobType = p->readByte (furball.current_job.occupationPtr + minfo->getOffset("job_type") );
- furball.current_job.jobId = p->readDWord (furball.current_job.occupationPtr + minfo->getOffset("job_id") );
+ furball.current_job.jobType = p->readByte (furball.current_job.occupationPtr + d->OG_jobs->getOffset("type") );
+ furball.current_job.jobId = p->readDWord (furball.current_job.occupationPtr + d->OG_jobs->getOffset("id") );
}
else
{
@@ -534,21 +538,19 @@ bool Creatures::WriteMoodSkill(const uint32_t index, const uint16_t moodSkill)
bool Creatures::WriteJob(const t_creature * furball, std::vector const& mat)
{
- unsigned int i;
+ unsigned int i;
if(!d->Inited) return false;
if(!furball->current_job.active) return false;
Process * p = d->owner;
- VersionInfo * minfo = d->d->offset_descriptor;
-
- DfVector cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
+ DfVector cmats(p, furball->current_job.occupationPtr + d->OG_jobs->getOffset("materials_vector"));
for(i=0;iwriteWord(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);
+ p->writeWord(cmats[i] + d->OG_job_mats->getOffset("maintype"), mat[i].itemType);
+ p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"), mat[i].subType);
+ p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"), mat[i].subIndex);
+ p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"), mat[i].index);
+ p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("flags"), mat[i].flags);
}
return true;
}
@@ -610,15 +612,15 @@ bool Creatures::ReadJob(const t_creature * furball, vector & mat)
Process * p = d->owner;
VersionInfo * minfo = d->d->offset_descriptor;
- DfVector cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
+ DfVector cmats(p, furball->current_job.occupationPtr + d->OG_jobs->getOffset("materials_vector"));
mat.resize(cmats.size());
for(i=0;ireadWord(cmats[i] + minfo->getOffset("job_material_maintype"));
- mat[i].subType = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype1"));
- mat[i].subIndex = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype2"));
- mat[i].index = p->readDWord(cmats[i] + minfo->getOffset("job_material_sectype3"));
- mat[i].flags = p->readDWord(cmats[i] + minfo->getOffset("job_material_flags"));
+ mat[i].itemType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("maintype"));
+ mat[i].subType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"));
+ mat[i].subIndex = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"));
+ mat[i].index = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"));
+ mat[i].flags = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("flags"));
}
return true;
}