All the modules *should* now use the new offset storage properly. Maybe, needs testing :)

develop
Petr Mrázek 2010-08-30 00:08:17 +02:00
parent 028dca0bef
commit 95abf6e605
13 changed files with 182 additions and 129 deletions

@ -918,6 +918,7 @@
<Offset name="current_job_skill" description="the skill that will be increased at the end of the mood (or not)" /> <Offset name="current_job_skill" description="the skill that will be increased at the end of the mood (or not)" />
<Offset name="physical" value="0x464" description="An array of physical attributes." /> <Offset name="physical" value="0x464" description="An array of physical attributes." />
<Offset name="appearance_vector" description="seems to be indexes in the list of possible colors defined in the raws for each group" /> <Offset name="appearance_vector" description="seems to be indexes in the list of possible colors defined in the raws for each group" />
<Offset name="inventory_vector" />
<Offset name="artifact_name" description="Name of the artifact created by this creature." /> <Offset name="artifact_name" description="Name of the artifact created by this creature." />
<Offset name="soul_vector" description="A vector of souls attached to the creature." /> <Offset name="soul_vector" description="A vector of souls attached to the creature." />
<Offset name="current_soul" description="Currently active soul?" /> <Offset name="current_soul" description="Currently active soul?" />
@ -952,6 +953,7 @@
<Address name="organics_plants" description="plant matter" /> <Address name="organics_plants" description="plant matter" />
<Address name="organics_trees" description="just wood" /> <Address name="organics_trees" description="just wood" />
<Address name="creature_type_vector" description="A vector of creature races" /> <Address name="creature_type_vector" description="A vector of creature races" />
<Address name="other" description="Base material types? Code suggests it's a null-terminated string of string pointers?" />
<Group name="creature" description="Creature race objects"> <Group name="creature" description="Creature race objects">
<Offset name="caste_vector" description="A race is divided into castes. Normally male and female."/> <Offset name="caste_vector" description="A race is divided into castes. Normally male and female."/>
<Offset name="extract_vector"/> <Offset name="extract_vector"/>
@ -1013,6 +1015,7 @@
<HexValue name="sizeof"/> <HexValue name="sizeof"/>
</Group> </Group>
<Group name="Items"> <Group name="Items">
<!-- most of those seem completely unused! -->
<Address name="items_vector" /> <Address name="items_vector" />
List of offsets in the VTable : List of offsets in the VTable :
<Offset name="item_type_accessor" /> <Offset name="item_type_accessor" />
@ -1554,6 +1557,7 @@
<Address name="current_race" value="0x014b9f1c" /> <Address name="current_race" value="0x014b9f1c" />
<Group name="creature"> <Group name="creature">
<Group name="advanced"> <Group name="advanced">
<Offset name="inventory_vector" value="0x2FC" />
<Offset name="physical" value="0x4AC" /> <Offset name="physical" value="0x4AC" />
<Offset name="appearance_vector" value="0x64c" /> <!-- Maybe slightly wrong --> <Offset name="appearance_vector" value="0x64c" /> <!-- Maybe slightly wrong -->
<Offset name="artifact_name" value="0x71c" /> <Offset name="artifact_name" value="0x71c" />

@ -1,5 +1,10 @@
#ifndef CL_MOD_ITEMS #ifndef CL_MOD_ITEMS
#define CL_MOD_ITEMS #define CL_MOD_ITEMS
/*
* DEPRECATED, DO NOT USE UNTIL FURTHER NOTICE!
**/
/* /*
* Creatures * Creatures
*/ */

@ -72,11 +72,12 @@ Buildings::Buildings(DFContextShared * d_)
d->owner = d_->p; d->owner = d_->p;
d->Inited = d->Started = false; d->Inited = d->Started = false;
VersionInfo * mem = d->d->offset_descriptor; VersionInfo * mem = d->d->offset_descriptor;
d->custom_workshop_vector = mem->getAddress("custom_workshop_vector"); OffsetGroup * OG_build = mem->getGroup("Buildings");
d->building_custom_workshop_type = mem->getOffset("building_custom_workshop_type"); d->custom_workshop_vector = OG_build->getAddress("custom_workshop_vector");
d->custom_workshop_type = mem->getOffset("custom_workshop_type"); d->building_custom_workshop_type = OG_build->getOffset("building_custom_workshop_type");
d->custom_workshop_name = mem->getOffset("custom_workshop_name"); d->custom_workshop_type = OG_build->getOffset("custom_workshop_type");
d->buildings_vector = mem->getAddress ("buildings_vector"); d->custom_workshop_name = OG_build->getOffset("custom_workshop_name");
d->buildings_vector = OG_build->getAddress ("buildings_vector");
mem->resolveClassnameToClassID("building_custom_workshop", d->custom_workshop_id); mem->resolveClassnameToClassID("building_custom_workshop", d->custom_workshop_id);
d->Inited = true; d->Inited = true;
} }

@ -53,7 +53,7 @@ Constructions::Constructions(DFContextShared * d_)
d->p_cons = 0; d->p_cons = 0;
d->Inited = d->Started = false; d->Inited = d->Started = false;
VersionInfo * mem = d->d->offset_descriptor; VersionInfo * mem = d->d->offset_descriptor;
d->construction_vector = mem->getAddress ("construction_vector"); d->construction_vector = mem->getGroup("Constructions")->getAddress ("vector");
d->Inited = true; d->Inited = true;
} }

@ -71,49 +71,59 @@ Creatures::Creatures(DFContextShared* _d)
{ {
VersionInfo * minfo = d->d->offset_descriptor; VersionInfo * minfo = d->d->offset_descriptor;
Creatures2010::creature_offsets &creatures = d->creatures; Creatures2010::creature_offsets &creatures = d->creatures;
creatures.vector = minfo->getAddress ("creature_vector"); OffsetGroup *OG_Creatures = minfo->getGroup("Creatures");
creatures.pos_offset = minfo->getOffset ("creature_position"); {
creatures.profession_offset = minfo->getOffset ("creature_profession"); creatures.vector = OG_Creatures->getAddress ("vector");
creatures.custom_profession_offset = minfo->getOffset ("creature_custom_profession"); d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race");
creatures.race_offset = minfo->getOffset ("creature_race"); d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ");
creatures.civ_offset = minfo->getOffset ("creature_civ"); OffsetGroup *OG_creature = OG_Creatures->getGroup("creature");
creatures.flags1_offset = minfo->getOffset ("creature_flags1"); {
creatures.flags2_offset = minfo->getOffset ("creature_flags2"); creatures.name_offset = OG_creature->getOffset ("name");
creatures.name_offset = minfo->getOffset ("creature_name"); creatures.custom_profession_offset = OG_creature->getOffset ("custom_profession");
creatures.sex_offset = minfo->getOffset ("creature_sex"); creatures.profession_offset = OG_creature->getOffset ("profession");
creatures.caste_offset = minfo->getOffset ("creature_caste"); creatures.race_offset = OG_creature->getOffset ("race");
creatures.id_offset = minfo->getOffset ("creature_id"); creatures.pos_offset = OG_creature->getOffset ("position");
creatures.labors_offset = minfo->getOffset ("creature_labors"); creatures.flags1_offset = OG_creature->getOffset ("creature_flags1");
creatures.happiness_offset = minfo->getOffset ("creature_happiness"); creatures.flags2_offset = OG_creature->getOffset ("creature_flags2");
creatures.artifact_name_offset = minfo->getOffset("creature_artifact_name"); creatures.sex_offset = OG_creature->getOffset ("sex");
creatures.soul_vector_offset = minfo->getOffset("creature_soul_vector"); creatures.caste_offset = OG_creature->getOffset ("caste");
creatures.default_soul_offset = minfo->getOffset("creature_default_soul"); creatures.id_offset = OG_creature->getOffset ("id");
creatures.physical_offset = minfo->getOffset("creature_physical"); creatures.civ_offset = OG_creature->getOffset ("civ");
creatures.mood_offset = minfo->getOffset("creature_mood"); OffsetGroup *OG_creature_ex = OG_creature->getGroup("advanced");
creatures.mood_skill_offset = minfo->getOffset("creature_mood_skill"); {
creatures.pickup_equipment_bit = minfo->getOffset("creature_pickup_equipment_bit"); creatures.inventory_offset = OG_creature_ex->getOffset("inventory_vector");
creatures.current_job_offset = minfo->getOffset("creature_current_job"); creatures.pickup_equipment_bit = OG_creature_ex->getOffset("pickup_equipment_bit");
// soul offsets creatures.mood_offset = OG_creature_ex->getOffset("mood");
creatures.soul_skills_vector_offset = minfo->getOffset("soul_skills_vector"); // pregnancy
creatures.soul_mental_offset = minfo->getOffset("soul_mental"); // pregnancy_ptr
creatures.soul_traits_offset = minfo->getOffset("soul_traits"); creatures.birth_year_offset = OG_creature_ex->getOffset("birth_year");
creatures.birth_time_offset = OG_creature_ex->getOffset("birth_time");
// appearance creatures.current_job_offset = OG_creature_ex->getOffset("current_job");
creatures.appearance_vector_offset = minfo->getOffset("creature_appearance_vector"); creatures.mood_skill_offset = OG_creature_ex->getOffset("current_job_skill");
creatures.physical_offset = OG_creature_ex->getOffset("physical");
//birth creatures.appearance_vector_offset = OG_creature_ex->getOffset("appearance_vector");
creatures.birth_year_offset = minfo->getOffset("creature_birth_year"); creatures.artifact_name_offset = OG_creature_ex->getOffset("artifact_name");
creatures.birth_time_offset = minfo->getOffset("creature_birth_time"); creatures.soul_vector_offset = OG_creature_ex->getOffset("soul_vector");
creatures.default_soul_offset = OG_creature_ex->getOffset("current_soul");
creatures.labors_offset = OG_creature_ex->getOffset ("labors");
creatures.happiness_offset = OG_creature_ex->getOffset ("happiness");
}
}
OffsetGroup *OG_soul = OG_Creatures->getGroup("soul");
{
creatures.soul_mental_offset = OG_soul->getOffset("mental");
creatures.soul_skills_vector_offset = OG_soul->getOffset("skills_vector");
creatures.soul_traits_offset = OG_soul->getOffset("traits");
}
}
// name offsets for the creature module // name offsets for the creature module
creatures.name_firstname_offset = minfo->getOffset("name_firstname"); OffsetGroup * OG_name = minfo->getGroup("name");
creatures.name_nickname_offset = minfo->getOffset("name_nickname"); {
creatures.name_words_offset = minfo->getOffset("name_words"); creatures.name_firstname_offset = OG_name->getOffset("first");
creatures.name_nickname_offset = OG_name->getOffset("nick");
creatures.inventory_offset = minfo->getOffset("creature_inventory_vector"); creatures.name_words_offset = OG_name->getOffset("second_words");
}
d->dwarf_race_index_addr = minfo->getAddress("dwarf_race_index");
d->dwarf_civ_id_addr = minfo->getAddress("dwarf_civ_id");
/* /*
// upload offsets to the SHM // upload offsets to the SHM
if(p->getModuleIndex("Creatures2010",1,d->creature_module)) if(p->getModuleIndex("Creatures2010",1,d->creature_module))

@ -51,10 +51,10 @@ Gui::Gui(DFContextShared * _d)
d->owner = _d->p; d->owner = _d->p;
d->Inited = d->Started = true; d->Inited = d->Started = true;
VersionInfo * mem = d->d->offset_descriptor; OffsetGroup * OG_Gui = d->d->offset_descriptor->getGroup("Gui");
d->current_menu_state_offset = mem->getAddress("current_menu_state"); d->current_menu_state_offset = OG_Gui->getAddress("current_menu_state");
d->pause_state_offset = mem->getAddress ("pause_state"); d->pause_state_offset = OG_Gui->getAddress ("pause_state");
d->view_screen_offset = mem->getAddress ("view_screen"); d->view_screen_offset = OG_Gui->getAddress ("view_screen");
d->Inited = d->Started = true; d->Inited = d->Started = true;
} }

@ -189,11 +189,12 @@ int32_t Accessor::getValue(uint32_t objectPtr)
ItemDesc::ItemDesc(uint32_t VTable, Process *p) ItemDesc::ItemDesc(uint32_t VTable, Process *p)
{ {
uint32_t funcOffsetA = p->getDescriptor()->getOffset("item_type_accessor"); OffsetGroup * Items = p->getDescriptor()->getGroup("Items");
uint32_t funcOffsetB = p->getDescriptor()->getOffset("item_subtype_accessor"); uint32_t funcOffsetA = Items->getOffset("item_type_accessor");
uint32_t funcOffsetC = p->getDescriptor()->getOffset("item_subindex_accessor"); uint32_t funcOffsetB = Items->getOffset("item_subtype_accessor");
uint32_t funcOffsetD = p->getDescriptor()->getOffset("item_index_accessor"); uint32_t funcOffsetC = Items->getOffset("item_subindex_accessor");
uint32_t funcOffsetQuality = p->getDescriptor()->getOffset("item_quality_accessor"); uint32_t funcOffsetD = Items->getOffset("item_index_accessor");
uint32_t funcOffsetQuality = Items->getOffset("item_quality_accessor");
this->vtable = VTable; this->vtable = VTable;
this->p = p; this->p = p;
this->className = p->readClassName(VTable).substr(5); this->className = p->readClassName(VTable).substr(5);

@ -76,37 +76,42 @@ Maps::Maps(DFContextShared* _d)
// get the offsets once here // get the offsets once here
OffsetGroup *OG_Maps = mem->getGroup("Maps"); OffsetGroup *OG_Maps = mem->getGroup("Maps");
off.map_offset = OG_Maps->getAddress ("map_data"); {
off.x_count_offset = OG_Maps->getAddress ("x_count_block"); off.map_offset = OG_Maps->getAddress ("map_data");
off.y_count_offset = OG_Maps->getAddress ("y_count_block"); off.x_count_offset = OG_Maps->getAddress ("x_count_block");
off.z_count_offset = OG_Maps->getAddress ("z_count_block"); off.y_count_offset = OG_Maps->getAddress ("y_count_block");
off.region_x_offset = OG_Maps->getAddress ("region_x"); off.z_count_offset = OG_Maps->getAddress ("z_count_block");
off.region_y_offset = OG_Maps->getAddress ("region_y"); off.region_x_offset = OG_Maps->getAddress ("region_x");
off.region_z_offset = OG_Maps->getAddress ("region_z"); off.region_y_offset = OG_Maps->getAddress ("region_y");
off.world_size_x = OG_Maps->getAddress ("world_size_x"); off.region_z_offset = OG_Maps->getAddress ("region_z");
off.world_size_y = OG_Maps->getAddress ("world_size_y"); off.world_size_x = OG_Maps->getAddress ("world_size_x");
off.world_size_y = OG_Maps->getAddress ("world_size_y");
OffsetGroup *OG_MapBlock = OG_Maps->getGroup("block");
off.tile_type_offset = OG_MapBlock->getOffset ("type"); OffsetGroup *OG_MapBlock = OG_Maps->getGroup("block");
off.designation_offset = OG_MapBlock->getOffset ("designation"); {
off.occupancy_offset = OG_MapBlock->getOffset("occupancy"); off.tile_type_offset = OG_MapBlock->getOffset ("type");
off.biome_stuffs = OG_MapBlock->getOffset ("biome_stuffs"); off.designation_offset = OG_MapBlock->getOffset ("designation");
off.veinvector = OG_MapBlock->getOffset ("vein_vector"); off.occupancy_offset = OG_MapBlock->getOffset("occupancy");
off.local_feature_offset = OG_MapBlock->getOffset ("feature_local"); off.biome_stuffs = OG_MapBlock->getOffset ("biome_stuffs");
off.global_feature_offset = OG_MapBlock->getOffset ("feature_global"); off.veinvector = OG_MapBlock->getOffset ("vein_vector");
off.temperature1_offset = OG_MapBlock->getOffset ("temperature1"); off.local_feature_offset = OG_MapBlock->getOffset ("feature_local");
off.temperature2_offset = OG_MapBlock->getOffset ("temperature2"); off.global_feature_offset = OG_MapBlock->getOffset ("feature_global");
off.temperature1_offset = OG_MapBlock->getOffset ("temperature1");
OffsetGroup *OG_Geology = OG_Maps->getGroup("geology"); off.temperature2_offset = OG_MapBlock->getOffset ("temperature2");
off.world_regions = OG_Geology->getAddress ("ptr2_region_array"); }
off.region_size = OG_Geology->getHexValue ("region_size");
off.region_geo_index_offset = OG_Geology->getOffset ("region_geo_index_off"); OffsetGroup *OG_Geology = OG_Maps->getGroup("geology");
off.geolayer_geoblock_offset = OG_Geology->getOffset ("geolayer_geoblock_offset"); {
off.world_geoblocks_vector = OG_Geology->getAddress ("geoblock_vector"); off.world_regions = OG_Geology->getAddress ("ptr2_region_array");
off.type_inside_geolayer = OG_Geology->getOffset ("type_inside_geolayer"); off.region_size = OG_Geology->getHexValue ("region_size");
off.region_geo_index_offset = OG_Geology->getOffset ("region_geo_index_off");
d->OG_global_features = OG_Maps->getGroup("features")->getGroup("global"); off.geolayer_geoblock_offset = OG_Geology->getOffset ("geolayer_geoblock_offset");
d->OG_local_features = OG_Maps->getGroup("features")->getGroup("local"); off.world_geoblocks_vector = OG_Geology->getAddress ("geoblock_vector");
off.type_inside_geolayer = OG_Geology->getOffset ("type_inside_geolayer");
}
d->OG_global_features = OG_Maps->getGroup("features")->getGroup("global");
d->OG_local_features = OG_Maps->getGroup("features")->getGroup("local");
}
d->OG_vector = mem->getGroup("vector"); d->OG_vector = mem->getGroup("vector");
// these can (will) fail and will be found when looking at the actual veins later // these can (will) fail and will be found when looking at the actual veins later

@ -38,6 +38,12 @@ class Materials::Private
DFContextShared *d; DFContextShared *d;
Process * owner; Process * owner;
OffsetGroup * OG_Materials; OffsetGroup * OG_Materials;
uint32_t vector_inorganic;
uint32_t vector_organic_all;
uint32_t vector_organic_plants;
uint32_t vector_organic_trees;
uint32_t vector_races;
uint32_t vector_other;
/* /*
bool Inited; bool Inited;
bool Started; bool Started;
@ -49,7 +55,14 @@ Materials::Materials(DFContextShared * d_)
d = new Private; d = new Private;
d->d = d_; d->d = d_;
d->owner = d_->p; d->owner = d_->p;
d->OG_Materials = d->owner->getDescriptor()->getGroup("Materials"); OffsetGroup *OG_Materials = d->OG_Materials = d->owner->getDescriptor()->getGroup("Materials");
{
d->vector_inorganic = OG_Materials->getAddress("inorganics");
d->vector_organic_all = OG_Materials->getAddress ("organics_all");
d->vector_organic_plants = OG_Materials->getAddress ("organics_plants");
d->vector_organic_trees = OG_Materials->getAddress ("organics_trees");
d->vector_races = OG_Materials->getAddress("creature_type_vector");
}
} }
Materials::~Materials() Materials::~Materials()
{ {
@ -218,7 +231,7 @@ inline bool ReadNamesOnly(Process* p, uint32_t address, vector<t_matgloss> & nam
bool Materials::ReadInorganicMaterials (void) bool Materials::ReadInorganicMaterials (void)
{ {
Process * p = d->owner; Process * p = d->owner;
DfVector <uint32_t> p_matgloss (p, d->OG_Materials->getAddress("inorganics")); DfVector <uint32_t> p_matgloss (p, d->vector_inorganic);
uint32_t size = p_matgloss.size(); uint32_t size = p_matgloss.size();
inorganic.clear(); inorganic.clear();
inorganic.reserve (size); inorganic.reserve (size);
@ -239,22 +252,22 @@ bool Materials::ReadInorganicMaterials (void)
bool Materials::ReadOrganicMaterials (void) bool Materials::ReadOrganicMaterials (void)
{ {
return ReadNamesOnly(d->owner, d->OG_Materials->getAddress ("organics_all"), organic ); return ReadNamesOnly(d->owner, d->vector_organic_all, organic );
} }
bool Materials::ReadWoodMaterials (void) bool Materials::ReadWoodMaterials (void)
{ {
return ReadNamesOnly(d->owner, d->OG_Materials->getAddress ("organics_trees"), tree ); return ReadNamesOnly(d->owner, d->vector_organic_trees, tree );
} }
bool Materials::ReadPlantMaterials (void) bool Materials::ReadPlantMaterials (void)
{ {
return ReadNamesOnly(d->owner, d->OG_Materials->getAddress ("organics_plants"), plant ); return ReadNamesOnly(d->owner, d->vector_organic_plants, plant );
} }
bool Materials::ReadCreatureTypes (void) bool Materials::ReadCreatureTypes (void)
{ {
return ReadNamesOnly(d->owner, d->OG_Materials->getAddress ("creature_type_vector"), race ); return ReadNamesOnly(d->owner, d->vector_races, race );
return true; return true;
} }
@ -283,7 +296,8 @@ bool Materials::ReadOthers(void)
bool Materials::ReadDescriptorColors (void) bool Materials::ReadDescriptorColors (void)
{ {
Process * p = d->owner; Process * p = d->owner;
DfVector <uint32_t> p_colors (p, p->getDescriptor()->getAddress ("descriptor_colors_vector")); OffsetGroup * OG_Descriptors = p->getDescriptor()->getGroup("Materials")->getGroup("descriptors");
DfVector <uint32_t> p_colors (p, OG_Descriptors->getAddress ("colors_vector"));
uint32_t size = p_colors.size(); uint32_t size = p_colors.size();
color.clear(); color.clear();
@ -293,43 +307,52 @@ bool Materials::ReadDescriptorColors (void)
for (uint32_t i = 0; i < size;i++) for (uint32_t i = 0; i < size;i++)
{ {
t_descriptor_color col; t_descriptor_color col;
p->readSTLString (p_colors[i] + p->getDescriptor()->getOffset ("descriptor_rawname"), col.id, 128); p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("rawname"), col.id, 128);
p->readSTLString (p_colors[i] + p->getDescriptor()->getOffset ("descriptor_name"), col.name, 128); p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("name"), col.name, 128);
col.r = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_r") ); col.r = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_r") );
col.v = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_v") ); col.v = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_v") );
col.b = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_b") ); col.b = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_b") );
color.push_back(col); color.push_back(col);
} }
return ReadNamesOnly(d->owner, d->owner->getDescriptor()->getAddress ("descriptor_all_colors"), alldesc ); return ReadNamesOnly(d->owner, OG_Descriptors->getAddress ("all_colors_vector"), alldesc );
return true; return true;
} }
bool Materials::ReadCreatureTypesEx (void) bool Materials::ReadCreatureTypesEx (void)
{ {
Process *p = d->owner; Process *p = d->owner;
VersionInfo *mem = d->owner->getDescriptor(); VersionInfo *mem = p->getDescriptor();
DfVector <uint32_t> p_races (p, mem->getAddress ("creature_type_vector")); OffsetGroup * OG_string = mem->getGroup("string");
uint32_t castes_vector_offset = mem->getOffset ("creature_type_caste_vector"); uint32_t sizeof_string = OG_string->getHexValue ("sizeof");
uint32_t extract_vector_offset = mem->getOffset ("creature_type_extract_vector");
uint32_t sizeof_string = mem->getHexValue ("sizeof_string"); OffsetGroup * OG_Mats = mem->getGroup("Materials");
uint32_t caste_colormod_offset = mem->getOffset ("caste_color_modifiers"); DfVector <uint32_t> p_races (p, OG_Mats->getAddress ("creature_type_vector"));
uint32_t caste_bodypart_offset = mem->getOffset ("caste_bodypart_vector");
uint32_t caste_attributes_offset = mem->getOffset ("caste_attributes"); OffsetGroup * OG_Creature = OG_Mats->getGroup("creature");
uint32_t bodypart_id_offset = mem->getOffset ("bodypart_id"); uint32_t castes_vector_offset = OG_Creature->getOffset ("caste_vector");
uint32_t bodypart_category_offset = mem->getOffset ("bodypart_category"); uint32_t extract_vector_offset = OG_Creature->getOffset ("extract_vector");
uint32_t bodypart_layers_offset = mem->getOffset ("bodypart_layers_vector"); uint32_t tile_offset = OG_Creature->getOffset ("creature_tile");
uint32_t bodypart_singular_offset = mem->getOffset ("bodypart_singular_vector"); // unused uint32_t tile_color_offset = OG_Creature->getOffset ("creature_tile_color");
uint32_t bodypart_plural_offset = mem->getOffset ("bodypart_plural_vector"); // unused OffsetGroup * OG_Caste = OG_Creature->getGroup("caste");
uint32_t color_modifier_part_offset = mem->getOffset ("color_modifier_part"); uint32_t caste_colormod_offset = OG_Caste->getOffset ("color_modifiers");
uint32_t color_modifier_startdate_offset = mem->getOffset ("color_modifier_startdate"); uint32_t caste_attributes_offset = OG_Caste->getOffset ("attributes");
uint32_t color_modifier_enddate_offset = mem->getOffset ("color_modifier_enddate"); uint32_t caste_bodypart_offset = OG_Caste->getOffset ("bodypart_vector");
OffsetGroup * OG_CasteBodyparts = OG_Creature->getGroup("caste_bodyparts");
uint32_t bodypart_id_offset = OG_CasteBodyparts->getOffset ("id");
uint32_t bodypart_category_offset = OG_CasteBodyparts->getOffset ("category");
uint32_t bodypart_layers_offset = OG_CasteBodyparts->getOffset ("layers_vector"); // unused
uint32_t bodypart_singular_offset = OG_CasteBodyparts->getOffset ("singular_vector"); // unused
uint32_t bodypart_plural_offset = OG_CasteBodyparts->getOffset ("plural_vector"); // unused
OffsetGroup * OG_CasteColorMods = OG_Creature->getGroup("caste_color_mods");
uint32_t color_modifier_part_offset = OG_CasteColorMods->getOffset ("part");
uint32_t color_modifier_startdate_offset = OG_CasteColorMods->getOffset ("startdate");
uint32_t color_modifier_enddate_offset = OG_CasteColorMods->getOffset ("enddate");
uint32_t size = p_races.size(); uint32_t size = p_races.size();
uint32_t sizecas = 0; uint32_t sizecas = 0;
uint32_t sizecolormod; uint32_t sizecolormod;
uint32_t sizecolorlist; uint32_t sizecolorlist;
uint32_t sizebp; uint32_t sizebp;
uint32_t tile_offset = mem->getOffset ("creature_tile");
uint32_t tile_color_offset = mem->getOffset ("creature_tile_color");
raceEx.clear(); raceEx.clear();
raceEx.reserve (size); raceEx.reserve (size);
for (uint32_t i = 0; i < size;i++) for (uint32_t i = 0; i < size;i++)

@ -61,6 +61,7 @@ Position::Position(DFContextShared * d_)
d->StartedHotkeys = d->Started = d->StartedScreen = false; d->StartedHotkeys = d->Started = d->StartedScreen = false;
OffsetGroup * OG_Position; OffsetGroup * OG_Position;
VersionInfo * mem = d->d->offset_descriptor; VersionInfo * mem = d->d->offset_descriptor;
// this is how to do feature detection properly
try try
{ {
OG_Position = mem->getGroup("Position"); OG_Position = mem->getGroup("Position");

@ -52,11 +52,12 @@ Translation::Translation(DFContextShared * d_)
d = new Private; d = new Private;
d->d = d_; d->d = d_;
d->Inited = d->Started = false; d->Inited = d->Started = false;
VersionInfo * mem = d->d->offset_descriptor; OffsetGroup * OG_Translation = d->d->offset_descriptor->getGroup("Translations");
d->genericAddress = mem->getAddress ("language_vector"); OffsetGroup * OG_String = d->d->offset_descriptor->getGroup("string");
d->transAddress = mem->getAddress ("translation_vector"); d->genericAddress = OG_Translation->getAddress ("language_vector");
d->word_table_offset = mem->getOffset ("word_table"); d->transAddress = OG_Translation->getAddress ("translation_vector");
d->sizeof_string = mem->getHexValue ("sizeof_string"); d->word_table_offset = OG_Translation->getOffset ("word_table");
d->sizeof_string = OG_String->getHexValue ("sizeof");
d->Inited = true; d->Inited = true;
} }

@ -53,9 +53,9 @@ Vegetation::Vegetation(DFContextShared * d_)
d->owner = d_->p; d->owner = d_->p;
d->d = d_; d->d = d_;
d->Inited = d->Started = false; d->Inited = d->Started = false;
VersionInfo * mem = d->d->offset_descriptor; OffsetGroup * OG_Veg = d->d->offset_descriptor->getGroup("Vegetation");
d->vegetation_vector = mem->getAddress ("vegetation_vector"); d->vegetation_vector = OG_Veg->getAddress ("vector");
d->tree_desc_offset = mem->getOffset ("tree_desc_offset"); d->tree_desc_offset = OG_Veg->getOffset ("tree_desc_offset");
d->Inited = true; d->Inited = true;
} }
@ -68,6 +68,8 @@ Vegetation::~Vegetation()
bool Vegetation::Start(uint32_t & numplants) bool Vegetation::Start(uint32_t & numplants)
{ {
if(!d->Inited)
return false;
d->p_veg = new DfVector <uint32_t> (d->owner, d->vegetation_vector); d->p_veg = new DfVector <uint32_t> (d->owner, d->vegetation_vector);
numplants = d->p_veg->size(); numplants = d->p_veg->size();
d->Started = true; d->Started = true;

@ -60,9 +60,9 @@ World::World(DFContextShared * _d)
d->d = _d; d->d = _d;
d->owner = _d->p; d->owner = _d->p;
VersionInfo * mem = d->d->offset_descriptor; OffsetGroup * OG_World = d->d->offset_descriptor->getGroup("World");
d->year_offset = mem->getAddress( "current_year" ); d->year_offset = OG_World->getAddress( "current_year" );
d->tick_offset = mem->getAddress( "current_tick" ); d->tick_offset = OG_World->getAddress( "current_tick" );
d->Inited = d->Started = true; d->Inited = d->Started = true;
} }