Many build fixes

develop
lethosor 2018-03-10 16:53:45 -05:00
parent f2ff609e1c
commit db95796d4c
14 changed files with 41 additions and 41 deletions

@ -476,7 +476,7 @@ local function matchIds(bid1,wid1,cid1,bid2,wid2,cid2)
end end
local function scanRawsReaction(buildingId,workshopId,customId) local function scanRawsReaction(buildingId,workshopId,customId)
local ret={} 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 for k,v in pairs(reaction.building.type) do
if matchIds(buildingId,workshopId,customId,v,reaction.building.subtype[k],reaction.building.custom[k]) then if matchIds(buildingId,workshopId,customId,v,reaction.building.subtype[k],reaction.building.custom[k]) then
table.insert(ret,reaction) table.insert(ret,reaction)
@ -575,4 +575,4 @@ function getJobs(buildingId,workshopId,customId)
--get jobs, add in from raws --get jobs, add in from raws
return ret return ret
end end
return _ENV return _ENV

@ -733,7 +733,7 @@ bool Materials::ReadOthers(void)
bool Materials::ReadDescriptorColors (void) bool Materials::ReadDescriptorColors (void)
{ {
size_t size = world->raws.language.colors.size(); size_t size = world->raws.descriptors.colors.size();
color.clear(); color.clear();
if(size == 0) if(size == 0)
@ -741,7 +741,7 @@ bool Materials::ReadDescriptorColors (void)
color.reserve(size); color.reserve(size);
for (size_t i = 0; i < size;i++) 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; t_descriptor_color col;
col.id = c->id; col.id = c->id;
col.name = c->name; col.name = c->name;
@ -751,13 +751,13 @@ bool Materials::ReadDescriptorColors (void)
color.push_back(col); color.push_back(col);
} }
size = world->raws.language.patterns.size(); size = world->raws.descriptors.patterns.size();
alldesc.clear(); alldesc.clear();
alldesc.reserve(size); alldesc.reserve(size);
for (size_t i = 0; i < size;i++) for (size_t i = 0; i < size;i++)
{ {
t_matgloss mat; t_matgloss mat;
mat.id = world->raws.language.patterns[i]->id; mat.id = world->raws.descriptors.patterns[i]->id;
alldesc.push_back(mat); alldesc.push_back(mat);
} }
return true; return true;

@ -1 +1 @@
Subproject commit a6297f128686407819fb7fe1e1fddd96606f30a0 Subproject commit 2e97088b1b573ff8f1a6e73b3478838ec8c32b41

@ -356,7 +356,7 @@ static bool find_reactions(color_ostream &out)
reactions.clear(); reactions.clear();
products.clear(); products.clear();
auto &rlist = world->raws.reactions; auto &rlist = df::reaction::get_vector();
for (size_t i = 0; i < rlist.size(); i++) for (size_t i = 0; i < rlist.size(); i++)
{ {

@ -59,10 +59,10 @@ command_result df_dumpmats (color_ostream &out, vector<string> &parameters)
{ {
def_color[matter_state::Liquid] = solid_color; def_color[matter_state::Liquid] = solid_color;
def_color[matter_state::Gas] = 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 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]; string solid_name = mat->state_name[matter_state::Solid];
@ -141,7 +141,7 @@ command_result df_dumpmats (color_ostream &out, vector<string> &parameters)
FOR_ENUM_ITEMS(matter_state, state) FOR_ENUM_ITEMS(matter_state, state)
{ {
if (mat->state_color[state] != -1 && mat->state_color[state] != def_color[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] == 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]) 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<string> &parameters)
if (mat->hardens_with_water.mat_type != -1) 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()); 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) 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) if (mat->soap_level != -0)
out.print("\t[SOAP_LEVEL:%o]\n", mat->soap_level); out.print("\t[SOAP_LEVEL:%o]\n", mat->soap_level);
@ -262,4 +262,4 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
DFhackCExport command_result plugin_shutdown ( Core * c ) DFhackCExport command_result plugin_shutdown ( Core * c )
{ {
return CR_OK; return CR_OK;
} }

@ -1303,7 +1303,7 @@ struct preference_map
} }
case (T_type::LikeShape): 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; break;
case (T_type::LikeTree): case (T_type::LikeTree):
@ -1314,7 +1314,7 @@ struct preference_map
} }
case (T_type::LikeColor): case (T_type::LikeColor):
label += "Color :" + raws.language.colors[pref.color_id]->name; label += "Color :" + raws.descriptors.colors[pref.color_id]->name;
break; break;
case (T_type::LikePoeticForm): case (T_type::LikePoeticForm):

@ -74,7 +74,7 @@ namespace embark_assist {
bool geo_survey(embark_assist::defs::geo_data *geo_summary) { bool geo_survey(embark_assist::defs::geo_data *geo_summary) {
color_ostream_proxy out(Core::getInstance().getConsole()); color_ostream_proxy out(Core::getInstance().getConsole());
df::world_data *world_data = world->world_data; df::world_data *world_data = world->world_data;
auto reactions = world->raws.reactions; auto reactions = df::reaction::get_vector();
bool non_soil_found; bool non_soil_found;
uint16_t size; uint16_t size;

@ -397,7 +397,7 @@ static bool find_reactions(color_ostream &out)
{ {
reactions.clear(); reactions.clear();
auto &rlist = world->raws.reactions; auto &rlist = df::reaction::get_vector();
for (size_t i = 0; i < rlist.size(); i++) for (size_t i = 0; i < rlist.size(); i++)
{ {

@ -583,11 +583,11 @@ class jlfunc_custom : public jlfunc
public: public:
df::unit_labor get_labor(df::job* j) 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); df::unit_labor labor = ENUM_ATTR(job_skill, labor, skill);
return labor; return labor;
} }
@ -894,11 +894,11 @@ df::unit_labor JobLaborMapper::find_job_labor(df::job* j)
{ {
if (j->job_type == df::job_type::CustomReaction) 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); return ENUM_ATTR(job_skill, labor, skill);
} }
} }

@ -416,13 +416,13 @@ function collect_reactions()
end end
for _, reaction_id in ipairs(entity.entity_raw.workshops.permitted_reaction_id) do 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) local name = string.gsub(reaction.name, "^.", string.upper)
reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name)
end end
-- Reactions generated by the game. -- 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 if reaction.source_enid == entity.id then
local name = string.gsub(reaction.name, "^.", string.upper) local name = string.gsub(reaction.name, "^.", string.upper)
reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name)

@ -29,7 +29,7 @@ end
local function get_reaction(name) local function get_reaction(name)
if not reaction_id_cache then if not reaction_id_cache then
reaction_id_cache = {} 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 reaction_id_cache[v.code] = i
end end
end end

@ -221,7 +221,7 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
case df::enums::item_type::STATUE: case df::enums::item_type::STATUE:
{ {
VIRTUAL_CAST_VAR(statue, df::item_statuest, DfItem); VIRTUAL_CAST_VAR(statue, df::item_statuest, DfItem);
df::art_image_chunk * chunk = NULL; df::art_image_chunk * chunk = NULL;
GET_ART_IMAGE_CHUNK GetArtImageChunk = reinterpret_cast<GET_ART_IMAGE_CHUNK>(Core::getInstance().vinfo->getAddress("get_art_image_chunk")); GET_ART_IMAGE_CHUNK GetArtImageChunk = reinterpret_cast<GET_ART_IMAGE_CHUNK>(Core::getInstance().vinfo->getAddress("get_art_image_chunk"));
if (GetArtImageChunk) 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::GEM:
case df::enums::item_type::SMALLGEM: 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) if (shape->gems_use.whole == 0)
continue; continue;
mat_def = out->add_material_list(); mat_def = out->add_material_list();

@ -384,7 +384,7 @@ void ConvertDfColor(int16_t in[3], RemoteFortressReader::ColorDefinition * out)
void ConvertDFColorDescriptor(int16_t index, 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_red(color->red * 255);
out->set_green(color->green * 255); out->set_green(color->green * 255);
out->set_blue(color->blue * 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->mutable_mat_pair()->set_mat_index(i);
mat_def->set_id(mat.getToken()); mat_def->set_id(mat.getToken());
mat_def->set_name(mat.toString()); //find the name at cave temperature; 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()); 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->mutable_mat_pair()->set_mat_index(j);
mat_def->set_id(mat.getToken()); mat_def->set_id(mat.getToken());
mat_def->set_name(mat.toString()); //find the name at cave temperature; 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()); 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->mutable_mat_pair()->set_mat_index(i);
mat_def->set_id(mat.getToken()); mat_def->set_id(mat.getToken());
mat_def->set_name(mat.toString()); //find the name at cave temperature; 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()); 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(); // id << "HF" << i << mat.getToken();
// mat_def->set_id(id.str()); // mat_def->set_id(id.str());
// mat_def->set_name(mat.toString()); //find the name at cave temperature; // 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_red(color->red * 255);
// mat_def->mutable_state_color()->set_green(color->green * 255); // mat_def->mutable_state_color()->set_green(color->green * 255);
// mat_def->mutable_state_color()->set_blue(color->blue * 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->mutable_mat_pair()->set_mat_index(i);
mat_def->set_id(mat.getToken()); mat_def->set_id(mat.getToken());
mat_def->set_name(mat.toString()); //find the name at cave temperature; 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()); 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++) 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(); auto send_pattern = send_mod->add_patterns();
for (int m = 0; m < orig_pattern->colors.size(); m++) for (int m = 0; m < orig_pattern->colors.size(); m++)
{ {
auto send_color = send_pattern->add_colors(); 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_red(orig_color->red * 255.0);
send_color->set_green(orig_color->green * 255.0); send_color->set_green(orig_color->green * 255.0);
send_color->set_blue(orig_color->blue * 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) if (!world)
return CR_FAILURE; 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(); auto netShape = out->add_shapes();
netShape->set_id(shape->id); netShape->set_id(shape->id);
netShape->set_tile(shape->tile); netShape->set_tile(shape->tile);

@ -1 +1 @@
Subproject commit 9d8f2096fc4c247299cbc94c6a8d756f31690a4b Subproject commit 7935e1befd9d3009bf833829c4f5e0e8acb0c65b