From a9f219baf9dda6d8cc300251fc040420e84bbc49 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Mon, 29 Jun 2020 16:16:44 -0500 Subject: [PATCH] update for DFHack/df-structures#7dfea1f1d4e453b97d5529785701db46360596ce --- library/modules/Kitchen.cpp | 4 ++-- library/modules/MapCache.cpp | 8 ++++---- library/modules/Materials.cpp | 2 +- library/xml | 2 +- plugins/autochop.cpp | 2 +- plugins/getplants.cpp | 10 +++++----- plugins/stonesense | 2 +- scripts | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/library/modules/Kitchen.cpp b/library/modules/Kitchen.cpp index 63372d564..fa4d1dea7 100644 --- a/library/modules/Kitchen.cpp +++ b/library/modules/Kitchen.cpp @@ -95,7 +95,7 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex) { ui->kitchen.item_types.push_back(item_type::SEEDS); ui->kitchen.item_subtypes.push_back(organicSubtype); - ui->kitchen.mat_types.push_back(type->material_defs.type_seed); + ui->kitchen.mat_types.push_back(type->material_defs.type[plant_material_def::seed]); ui->kitchen.mat_indices.push_back(materialIndex); ui->kitchen.exc_types.push_back(df::kitchen_exc_type::Cook); } @@ -103,7 +103,7 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex) { ui->kitchen.item_types.push_back(item_type::PLANT); ui->kitchen.item_subtypes.push_back(organicSubtype); - ui->kitchen.mat_types.push_back(type->material_defs.type_basic_mat); + ui->kitchen.mat_types.push_back(type->material_defs.type[plant_material_def::basic_mat]); ui->kitchen.mat_indices.push_back(materialIndex); ui->kitchen.exc_types.push_back(df::kitchen_exc_type::Cook); } diff --git a/library/modules/MapCache.cpp b/library/modules/MapCache.cpp index b61ba375e..ce3039ecf 100644 --- a/library/modules/MapCache.cpp +++ b/library/modules/MapCache.cpp @@ -899,8 +899,8 @@ t_matpair MapExtras::BlockInfo::getBaseMaterial(df::tiletype tt, df::coord2d pos { if (auto raw = df::plant_raw::find(plant->material)) { - rv.mat_type = raw->material_defs.type_basic_mat; - rv.mat_index = raw->material_defs.idx_basic_mat; + rv.mat_type = raw->material_defs.type[plant_material_def::basic_mat]; + rv.mat_index = raw->material_defs.idx[plant_material_def::basic_mat]; } } break; @@ -912,8 +912,8 @@ t_matpair MapExtras::BlockInfo::getBaseMaterial(df::tiletype tt, df::coord2d pos rv.mat_type = MaterialInfo::PLANT_BASE; if (auto raw = df::plant_raw::find(grass[x][y])) { - rv.mat_type = raw->material_defs.type_basic_mat; - rv.mat_index = raw->material_defs.idx_basic_mat; + rv.mat_type = raw->material_defs.type[plant_material_def::basic_mat]; + rv.mat_index = raw->material_defs.idx[plant_material_def::basic_mat]; } break; diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 51d717d05..c341ea99e 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -261,7 +261,7 @@ bool MaterialInfo::findPlant(const std::string &token, const std::string &subtok // As a special exception, return the structural material with empty subtoken if (subtoken.empty()) - return decode(p->material_defs.type_basic_mat, p->material_defs.idx_basic_mat); + return decode(p->material_defs.type[plant_material_def::basic_mat], p->material_defs.idx[plant_material_def::basic_mat]); for (size_t j = 0; j < p->material.size(); j++) if (p->material[j]->id == subtoken) diff --git a/library/xml b/library/xml index 97084e556..7dfea1f1d 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 97084e556119ce4445c3745151180467338a746a +Subproject commit 7dfea1f1d4e453b97d5529785701db46360596ce diff --git a/plugins/autochop.cpp b/plugins/autochop.cpp index e7f3874d3..8f2225f72 100644 --- a/plugins/autochop.cpp +++ b/plugins/autochop.cpp @@ -258,7 +258,7 @@ static bool skip_plant(const df::plant * plant, bool *restricted) const df::plant_raw *plant_raw = df::plant_raw::find(plant->material); // Skip fruit trees if set. - if (skip.fruit_trees && plant_raw->material_defs.type_drink != -1) + if (skip.fruit_trees && plant_raw->material_defs.type[plant_material_def::drink] != -1) { if (restricted) *restricted = true; diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index d1ee79a04..b4b7a493b 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -70,7 +70,7 @@ enum class selectability { //selectability selectablePlant(color_ostream &out, const df::plant_raw *plant, bool farming) selectability selectablePlant(const df::plant_raw *plant, bool farming) { - const DFHack::MaterialInfo basic_mat = DFHack::MaterialInfo(plant->material_defs.type_basic_mat, plant->material_defs.idx_basic_mat); + const DFHack::MaterialInfo basic_mat = DFHack::MaterialInfo(plant->material_defs.type[plant_material_def::basic_mat], plant->material_defs.idx[plant_material_def::basic_mat]); bool outOfSeason = false; selectability result = selectability::Nonselectable; @@ -92,7 +92,7 @@ selectability selectablePlant(const df::plant_raw *plant, bool farming) return selectability::Grass; } - if (farming && plant->material_defs.type_seed == -1) + if (farming && plant->material_defs.type[plant_material_def::seed] == -1) { return selectability::Nonselectable; } @@ -163,8 +163,8 @@ selectability selectablePlant(const df::plant_raw *plant, bool farming) { for (size_t k = 0; growth_mat.material->reaction_product.material.mat_type.size(); k++) { - if (growth_mat.material->reaction_product.material.mat_type[k] == plant->material_defs.type_seed && - growth_mat.material->reaction_product.material.mat_index[k] == plant->material_defs.idx_seed) + if (growth_mat.material->reaction_product.material.mat_type[k] == plant->material_defs.type[plant_material_def::seed] && + growth_mat.material->reaction_product.material.mat_index[k] == plant->material_defs.idx[plant_material_def::seed]) { seedSource = true; break; @@ -193,7 +193,7 @@ selectability selectablePlant(const df::plant_raw *plant, bool farming) } /* else if (plant->growths[i]->behavior.bits.has_seed) // This code designates beans, etc. when DF doesn't, but plant gatherers still fail to collect anything, so it's useless: bug #0006940. { - const DFHack::MaterialInfo seed_mat = DFHack::MaterialInfo(plant->material_defs.type_seed, plant->material_defs.idx_seed); + const DFHack::MaterialInfo seed_mat = DFHack::MaterialInfo(plant->material_defs.type[plant_material_def::seed], plant->material_defs.idx[plant_material_def::seed]); if (seed_mat.material->flags.is_set(material_flags::EDIBLE_RAW) || seed_mat.material->flags.is_set(material_flags::EDIBLE_COOKED)) diff --git a/plugins/stonesense b/plugins/stonesense index 5b7e7743a..bdab71c99 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 5b7e7743a1372b929acb2ccb75080e139ac11691 +Subproject commit bdab71c99a0a7cc268ca517a0cd3f0a5fb41042a diff --git a/scripts b/scripts index 47d9b3c93..792ae44ab 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 47d9b3c9390d21ecc49ddaba477b16071884ee87 +Subproject commit 792ae44ab14afd3a2b3e850a6fcb463d714b0a44