diff --git a/library/lua/dfhack/workshops.lua b/library/lua/dfhack/workshops.lua index 09268ff38..a09849a57 100644 --- a/library/lua/dfhack/workshops.lua +++ b/library/lua/dfhack/workshops.lua @@ -476,7 +476,7 @@ local function matchIds(bid1,wid1,cid1,bid2,wid2,cid2) end local function scanRawsReaction(buildingId,workshopId,customId) local ret={} - for idx,reaction in ipairs(df.global.world.raws.reactions) do + for idx,reaction in ipairs(df.global.world.raws.reactions.reactions) do for k,v in pairs(reaction.building.type) do if matchIds(buildingId,workshopId,customId,v,reaction.building.subtype[k],reaction.building.custom[k]) then table.insert(ret,reaction) @@ -575,4 +575,4 @@ function getJobs(buildingId,workshopId,customId) --get jobs, add in from raws return ret end -return _ENV \ No newline at end of file +return _ENV diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 219932657..a8f10d7d2 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -733,7 +733,7 @@ bool Materials::ReadOthers(void) bool Materials::ReadDescriptorColors (void) { - size_t size = world->raws.language.colors.size(); + size_t size = world->raws.descriptors.colors.size(); color.clear(); if(size == 0) @@ -741,7 +741,7 @@ bool Materials::ReadDescriptorColors (void) color.reserve(size); for (size_t i = 0; i < size;i++) { - df::descriptor_color *c = world->raws.language.colors[i]; + df::descriptor_color *c = world->raws.descriptors.colors[i]; t_descriptor_color col; col.id = c->id; col.name = c->name; @@ -751,13 +751,13 @@ bool Materials::ReadDescriptorColors (void) color.push_back(col); } - size = world->raws.language.patterns.size(); + size = world->raws.descriptors.patterns.size(); alldesc.clear(); alldesc.reserve(size); for (size_t i = 0; i < size;i++) { t_matgloss mat; - mat.id = world->raws.language.patterns[i]->id; + mat.id = world->raws.descriptors.patterns[i]->id; alldesc.push_back(mat); } return true; diff --git a/library/xml b/library/xml index a6297f128..2e97088b1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit a6297f128686407819fb7fe1e1fddd96606f30a0 +Subproject commit 2e97088b1b573ff8f1a6e73b3478838ec8c32b41 diff --git a/plugins/add-spatter.cpp b/plugins/add-spatter.cpp index 1e835b8b6..3d2d89dd1 100644 --- a/plugins/add-spatter.cpp +++ b/plugins/add-spatter.cpp @@ -356,7 +356,7 @@ static bool find_reactions(color_ostream &out) reactions.clear(); products.clear(); - auto &rlist = world->raws.reactions; + auto &rlist = df::reaction::get_vector(); for (size_t i = 0; i < rlist.size(); i++) { diff --git a/plugins/devel/dumpmats.cpp b/plugins/devel/dumpmats.cpp index e50771a9f..23c7be4e1 100644 --- a/plugins/devel/dumpmats.cpp +++ b/plugins/devel/dumpmats.cpp @@ -59,10 +59,10 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) { def_color[matter_state::Liquid] = solid_color; def_color[matter_state::Gas] = solid_color; - out.print("\t[STATE_COLOR:ALL:%s]\n", world->raws.language.colors[solid_color]->id.c_str()); + out.print("\t[STATE_COLOR:ALL:%s]\n", world->raws.descriptors.colors[solid_color]->id.c_str()); } else - out.print("\t[STATE_COLOR:ALL_SOLID:%s]\n", world->raws.language.colors[solid_color]->id.c_str()); + out.print("\t[STATE_COLOR:ALL_SOLID:%s]\n", world->raws.descriptors.colors[solid_color]->id.c_str()); } string solid_name = mat->state_name[matter_state::Solid]; @@ -141,7 +141,7 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) FOR_ENUM_ITEMS(matter_state, state) { if (mat->state_color[state] != -1 && mat->state_color[state] != def_color[state]) - out.print("\t[STATE_COLOR:%s:%s]\n", state_names[state], world->raws.language.colors[mat->state_color[state]]->id.c_str()); + out.print("\t[STATE_COLOR:%s:%s]\n", state_names[state], world->raws.descriptors.colors[mat->state_color[state]]->id.c_str()); if (mat->state_name[state] == mat->state_adj[state]) { if (mat->state_name[state].size() && mat->state_name[state] != def_name[state] || mat->state_adj[state].size() && mat->state_adj[state] != def_adj[state]) @@ -241,7 +241,7 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) if (mat->hardens_with_water.mat_type != -1) out.print("\t[HARDENS_WITH_WATER:%s:%s%s%s]\n", mat->hardens_with_water.str[0].c_str(), mat->hardens_with_water.str[1].c_str(), mat->hardens_with_water.str[2].size() ? ":" : "", mat->hardens_with_water.str[2].c_str()); if (mat->powder_dye != -1) - out.print("\t[POWDER_DYE:%s]\n", world->raws.language.colors[mat->powder_dye]->id.c_str()); + out.print("\t[POWDER_DYE:%s]\n", world->raws.descriptors.colors[mat->powder_dye]->id.c_str()); if (mat->soap_level != -0) out.print("\t[SOAP_LEVEL:%o]\n", mat->soap_level); @@ -262,4 +262,4 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector DFhackCExport command_result plugin_shutdown ( Core * c ) { return CR_OK; -} \ No newline at end of file +} diff --git a/plugins/dwarfmonitor.cpp b/plugins/dwarfmonitor.cpp index bf7c02efc..56ca53091 100644 --- a/plugins/dwarfmonitor.cpp +++ b/plugins/dwarfmonitor.cpp @@ -1303,7 +1303,7 @@ struct preference_map } case (T_type::LikeShape): - label += "Shape :" + raws.language.shapes[pref.shape_id]->name_plural; + label += "Shape :" + raws.descriptors.shapes[pref.shape_id]->name_plural; break; case (T_type::LikeTree): @@ -1314,7 +1314,7 @@ struct preference_map } case (T_type::LikeColor): - label += "Color :" + raws.language.colors[pref.color_id]->name; + label += "Color :" + raws.descriptors.colors[pref.color_id]->name; break; case (T_type::LikePoeticForm): diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index 6583d2479..5df070303 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -74,7 +74,7 @@ namespace embark_assist { bool geo_survey(embark_assist::defs::geo_data *geo_summary) { color_ostream_proxy out(Core::getInstance().getConsole()); df::world_data *world_data = world->world_data; - auto reactions = world->raws.reactions; + auto reactions = df::reaction::get_vector(); bool non_soil_found; uint16_t size; diff --git a/plugins/eventful.cpp b/plugins/eventful.cpp index 365542314..f4056a3d5 100644 --- a/plugins/eventful.cpp +++ b/plugins/eventful.cpp @@ -397,7 +397,7 @@ static bool find_reactions(color_ostream &out) { reactions.clear(); - auto &rlist = world->raws.reactions; + auto &rlist = df::reaction::get_vector(); for (size_t i = 0; i < rlist.size(); i++) { diff --git a/plugins/labormanager/joblabormapper.cpp b/plugins/labormanager/joblabormapper.cpp index 779839e99..f47077134 100644 --- a/plugins/labormanager/joblabormapper.cpp +++ b/plugins/labormanager/joblabormapper.cpp @@ -583,11 +583,11 @@ class jlfunc_custom : public jlfunc public: df::unit_labor get_labor(df::job* j) { - for (auto r = world->raws.reactions.begin(); r != world->raws.reactions.end(); r++) + for (auto r : df::reaction::get_vector()) { - if ((*r)->code == j->reaction_name) + if (r->code == j->reaction_name) { - df::job_skill skill = (*r)->skill; + df::job_skill skill = r->skill; df::unit_labor labor = ENUM_ATTR(job_skill, labor, skill); return labor; } @@ -894,11 +894,11 @@ df::unit_labor JobLaborMapper::find_job_labor(df::job* j) { if (j->job_type == df::job_type::CustomReaction) { - for (auto r = world->raws.reactions.begin(); r != world->raws.reactions.end(); r++) + for (auto r : df::reaction::get_vector()) { - if ((*r)->code == j->reaction_name) + if (r->code == j->reaction_name) { - df::job_skill skill = (*r)->skill; + df::job_skill skill = r->skill; return ENUM_ATTR(job_skill, labor, skill); } } diff --git a/plugins/lua/stockflow.lua b/plugins/lua/stockflow.lua index fcaca0ecd..ca484d831 100644 --- a/plugins/lua/stockflow.lua +++ b/plugins/lua/stockflow.lua @@ -416,13 +416,13 @@ function collect_reactions() end for _, reaction_id in ipairs(entity.entity_raw.workshops.permitted_reaction_id) do - local reaction = df.global.world.raws.reactions[reaction_id] + local reaction = df.global.world.raws.reactions.reactions[reaction_id] local name = string.gsub(reaction.name, "^.", string.upper) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) end -- Reactions generated by the game. - for _, reaction in ipairs(df.global.world.raws.reactions) do + for _, reaction in ipairs(df.global.world.raws.reactions.reactions) do if reaction.source_enid == entity.id then local name = string.gsub(reaction.name, "^.", string.upper) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) diff --git a/plugins/lua/workflow.lua b/plugins/lua/workflow.lua index dcec1248d..6c4230a51 100644 --- a/plugins/lua/workflow.lua +++ b/plugins/lua/workflow.lua @@ -29,7 +29,7 @@ end local function get_reaction(name) if not reaction_id_cache then reaction_id_cache = {} - for i,v in ipairs(df.global.world.raws.reactions) do + for i,v in ipairs(df.global.world.raws.reactions.reactions) do reaction_id_cache[v.code] = i end end diff --git a/plugins/remotefortressreader/item_reader.cpp b/plugins/remotefortressreader/item_reader.cpp index 59b1f36e7..5bfccbfad 100644 --- a/plugins/remotefortressreader/item_reader.cpp +++ b/plugins/remotefortressreader/item_reader.cpp @@ -221,7 +221,7 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem) case df::enums::item_type::STATUE: { VIRTUAL_CAST_VAR(statue, df::item_statuest, DfItem); - + df::art_image_chunk * chunk = NULL; GET_ART_IMAGE_CHUNK GetArtImageChunk = reinterpret_cast(Core::getInstance().vinfo->getAddress("get_art_image_chunk")); if (GetArtImageChunk) @@ -518,9 +518,9 @@ DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack:: case df::enums::item_type::GEM: case df::enums::item_type::SMALLGEM: { - for (int i = 0; i < world->raws.language.shapes.size(); i++) + for (int i = 0; i < world->raws.descriptors.shapes.size(); i++) { - auto shape = world->raws.language.shapes[i]; + auto shape = world->raws.descriptors.shapes[i]; if (shape->gems_use.whole == 0) continue; mat_def = out->add_material_list(); diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index e321bf8d5..197c4bd6a 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -384,7 +384,7 @@ void ConvertDfColor(int16_t in[3], RemoteFortressReader::ColorDefinition * out) void ConvertDFColorDescriptor(int16_t index, RemoteFortressReader::ColorDefinition * out) { - df::descriptor_color *color = world->raws.language.colors[index]; + df::descriptor_color *color = world->raws.descriptors.colors[index]; out->set_red(color->red * 255); out->set_green(color->green * 255); out->set_blue(color->blue * 255); @@ -859,7 +859,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)] < raws->language.colors.size()) + if (raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)], mat_def->mutable_state_color()); } @@ -877,7 +877,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(j); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])] < raws->language.colors.size()) + if (raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])], mat_def->mutable_state_color()); } @@ -894,7 +894,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->language.colors.size()) + if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(creature->material[j]->state_color[GetState(creature->material[j])], mat_def->mutable_state_color()); } @@ -916,9 +916,9 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage // id << "HF" << i << mat.getToken(); // mat_def->set_id(id.str()); // mat_def->set_name(mat.toString()); //find the name at cave temperature; - // if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->language.colors.size()) + // if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->descriptors.colors.size()) // { - // df::descriptor_color *color = raws->language.colors[creature->material[j]->state_color[GetState(creature->material[j])]]; + // df::descriptor_color *color = raws->descriptors.colors[creature->material[j]->state_color[GetState(creature->material[j])]]; // mat_def->mutable_state_color()->set_red(color->red * 255); // mat_def->mutable_state_color()->set_green(color->green * 255); // mat_def->mutable_state_color()->set_blue(color->blue * 255); @@ -936,7 +936,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (plant->material[j]->state_color[GetState(plant->material[j])] < raws->language.colors.size()) + if (plant->material[j]->state_color[GetState(plant->material[j])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(plant->material[j]->state_color[GetState(plant->material[j])], mat_def->mutable_state_color()); } @@ -2683,13 +2683,13 @@ static command_result GetPartialCreatureRaws(color_ostream &stream, const ListRe for (int l = 0; l < orig_mod->pattern_index.size(); l++) { - auto orig_pattern = world->raws.language.patterns[orig_mod->pattern_index[l]]; + auto orig_pattern = world->raws.descriptors.patterns[orig_mod->pattern_index[l]]; auto send_pattern = send_mod->add_patterns(); for (int m = 0; m < orig_pattern->colors.size(); m++) { auto send_color = send_pattern->add_colors(); - auto orig_color = world->raws.language.colors[orig_pattern->colors[m]]; + auto orig_color = world->raws.descriptors.colors[orig_pattern->colors[m]]; send_color->set_red(orig_color->red * 255.0); send_color->set_green(orig_color->green * 255.0); send_color->set_blue(orig_color->blue * 255.0); @@ -2980,9 +2980,9 @@ static command_result GetLanguage(color_ostream & stream, const EmptyMessage * i if (!world) return CR_FAILURE; - for (int i = 0; i < world->raws.language.shapes.size(); i++) + for (int i = 0; i < world->raws.descriptors.shapes.size(); i++) { - auto shape = world->raws.language.shapes[i]; + auto shape = world->raws.descriptors.shapes[i]; auto netShape = out->add_shapes(); netShape->set_id(shape->id); netShape->set_tile(shape->tile); diff --git a/scripts b/scripts index 9d8f2096f..7935e1bef 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 9d8f2096fc4c247299cbc94c6a8d756f31690a4b +Subproject commit 7935e1befd9d3009bf833829c4f5e0e8acb0c65b