diff --git a/library/include/modules/Materials.h b/library/include/modules/Materials.h index da0504f19..4ee315fbc 100644 --- a/library/include/modules/Materials.h +++ b/library/include/modules/Materials.h @@ -253,25 +253,25 @@ namespace DFHack std::vector ColorModifier; std::vector bodypart; - t_attrib strength; - t_attrib agility; - t_attrib toughness; - t_attrib endurance; - t_attrib recuperation; - t_attrib disease_resistance; - t_attrib analytical_ability; - t_attrib focus; - t_attrib willpower; - t_attrib creativity; - t_attrib intuition; - t_attrib patience; - t_attrib memory; - t_attrib linguistic_ability; - t_attrib spatial_sense; - t_attrib musicality; - t_attrib kinesthetic_sense; - t_attrib empathy; - t_attrib social_awareness; + int32_t strength[7]; + int32_t agility[7]; + int32_t toughness[7]; + int32_t endurance[7]; + int32_t recuperation[7]; + int32_t disease_resistance[7]; + int32_t analytical_ability[7]; + int32_t focus[7]; + int32_t willpower[7]; + int32_t creativity[7]; + int32_t intuition[7]; + int32_t patience[7]; + int32_t memory[7]; + int32_t linguistic_ability[7]; + int32_t spatial_sense[7]; + int32_t musicality[7]; + int32_t kinesthetic_sense[7]; + int32_t empathy[7]; + int32_t social_awareness[7]; }; /** diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index ef91838cd..4432956c3 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -60,6 +60,9 @@ using namespace std; #include "df/descriptor_pattern.h" #include "df/descriptor_shape.h" +#include "df/physical_attribute_type.h" +#include "df/mental_attribute_type.h" + using namespace DFHack; using namespace df::enums; using df::global::world; @@ -747,48 +750,28 @@ bool Materials::ReadCreatureTypesEx (void) caste.bodypart.push_back(part); } - t_attrib *phys[] = { - &caste.strength, - &caste.agility, - &caste.toughness, - &caste.endurance, - &caste.recuperation, - &caste.disease_resistance - }; - for (uint32_t k = 0; k < 6; k++) - { - phys[k]->level = ca->attributes.phys_att_range[k][0]; - phys[k]->field_4 = ca->attributes.phys_att_range[k][1]; - phys[k]->field_8 = ca->attributes.phys_att_range[k][2]; - phys[k]->field_C = ca->attributes.phys_att_range[k][3]; - phys[k]->leveldiff = ca->attributes.phys_att_range[k][4]; - phys[k]->field_14 = ca->attributes.phys_att_range[k][5]; - phys[k]->field_18 = ca->attributes.phys_att_range[k][6]; - } - t_attrib *ment[] = { - &caste.analytical_ability, - &caste.focus, - &caste.willpower, - &caste.creativity, - &caste.intuition, - &caste.patience, - &caste.memory, - &caste.linguistic_ability, - &caste.spatial_sense, - &caste.musicality, - &caste.kinesthetic_sense, - &caste.empathy, - &caste.social_awareness - }; - for (uint32_t k = 0; k < 13; k++) + for (int32_t k = 0; k < 7; k++) { - ment[k]->level = ca->attributes.ment_att_range[k][0]; - ment[k]->field_4 = ca->attributes.ment_att_range[k][1]; - ment[k]->field_8 = ca->attributes.ment_att_range[k][2]; - ment[k]->field_C = ca->attributes.ment_att_range[k][3]; - ment[k]->leveldiff = ca->attributes.ment_att_range[k][4]; - ment[k]->field_14 = ca->attributes.ment_att_range[k][5]; - ment[k]->field_18 = ca->attributes.ment_att_range[k][6]; + caste.strength[k] = ca->attributes.phys_att_range[df::physical_attribute_type::STRENGTH][k]; + caste.agility[k] = ca->attributes.phys_att_range[df::physical_attribute_type::AGILITY][k]; + caste.toughness[k] = ca->attributes.phys_att_range[df::physical_attribute_type::TOUGHNESS][k]; + caste.endurance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::ENDURANCE][k]; + caste.recuperation[k] = ca->attributes.phys_att_range[df::physical_attribute_type::RECUPERATION][k]; + caste.disease_resistance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::DISEASE_RESISTANCE][k]; + + caste.analytical_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::ANALYTICAL_ABILITY][k]; + caste.focus[k] = ca->attributes.phys_att_range[df::mental_attribute_type::FOCUS][k]; + caste.willpower[k] = ca->attributes.phys_att_range[df::mental_attribute_type::WILLPOWER][k]; + caste.creativity[k] = ca->attributes.phys_att_range[df::mental_attribute_type::CREATIVITY][k]; + caste.intuition[k] = ca->attributes.phys_att_range[df::mental_attribute_type::INTUITION][k]; + caste.patience[k] = ca->attributes.phys_att_range[df::mental_attribute_type::PATIENCE][k]; + caste.memory[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MEMORY][k]; + caste.linguistic_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::LINGUISTIC_ABILITY][k]; + caste.spatial_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SPATIAL_SENSE][k]; + caste.musicality[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MUSICALITY][k]; + caste.kinesthetic_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::KINESTHETIC_SENSE][k]; + caste.empathy[k] = ca->attributes.phys_att_range[df::mental_attribute_type::EMPATHY][k]; + caste.social_awareness[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SOCIAL_AWARENESS][k]; } mat.castes.push_back(caste); }