|
|
@ -855,6 +855,22 @@ static command_result CheckHashes(color_ostream &stream, const EmptyMessage *in)
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CopyMat(RemoteFortressReader::MatPair * mat, int type, int index)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (type >= MaterialInfo::FIGURE_BASE && type < MaterialInfo::PLANT_BASE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
df::historical_figure * figure = df::historical_figure::find(index);
|
|
|
|
|
|
|
|
if (figure)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
type -= MaterialInfo::GROUP_SIZE;
|
|
|
|
|
|
|
|
index = figure->race;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mat->set_mat_type(type);
|
|
|
|
|
|
|
|
mat->set_mat_index(index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
map<DFCoord, uint16_t> hashes;
|
|
|
|
map<DFCoord, uint16_t> hashes;
|
|
|
|
|
|
|
|
|
|
|
|
//check if the tiletypes have changed
|
|
|
|
//check if the tiletypes have changed
|
|
|
@ -1033,31 +1049,31 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < history->figures.size(); i++)
|
|
|
|
//for (int i = 0; i < history->figures.size(); i++)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
df::historical_figure * figure = history->figures[i];
|
|
|
|
// df::historical_figure * figure = history->figures[i];
|
|
|
|
if (figure->race < 0)
|
|
|
|
// if (figure->race < 0)
|
|
|
|
continue;
|
|
|
|
// continue;
|
|
|
|
df::creature_raw * creature = raws->creatures.all[figure->race];
|
|
|
|
// df::creature_raw * creature = raws->creatures.all[figure->race];
|
|
|
|
for (int j = 0; j < creature->material.size(); j++)
|
|
|
|
// for (int j = 0; j < creature->material.size(); j++)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
mat.decode(j + MaterialInfo::FIGURE_BASE, i);
|
|
|
|
// mat.decode(j + MaterialInfo::FIGURE_BASE, i);
|
|
|
|
MaterialDefinition *mat_def = out->add_material_list();
|
|
|
|
// MaterialDefinition *mat_def = out->add_material_list();
|
|
|
|
mat_def->mutable_mat_pair()->set_mat_type(j + MaterialInfo::FIGURE_BASE);
|
|
|
|
// mat_def->mutable_mat_pair()->set_mat_type(j + MaterialInfo::FIGURE_BASE);
|
|
|
|
mat_def->mutable_mat_pair()->set_mat_index(i);
|
|
|
|
// mat_def->mutable_mat_pair()->set_mat_index(i);
|
|
|
|
stringstream id;
|
|
|
|
// stringstream id;
|
|
|
|
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->language.colors.size())
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
df::descriptor_color *color = raws->language.colors[creature->material[j]->state_color[GetState(creature->material[j])]];
|
|
|
|
// df::descriptor_color *color = raws->language.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);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
for (int i = 0; i < raws->plants.all.size(); i++)
|
|
|
|
for (int i = 0; i < raws->plants.all.size(); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::plant_raw * plant = raws->plants.all[i];
|
|
|
|
df::plant_raw * plant = raws->plants.all[i];
|
|
|
@ -1241,28 +1257,18 @@ void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBloc
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RemoteFortressReader::MatPair * material = NetBlock->add_materials();
|
|
|
|
CopyMat(NetBlock->add_materials(), staticMat.mat_type, staticMat.mat_index);
|
|
|
|
material->set_mat_type(staticMat.mat_type);
|
|
|
|
CopyMat(NetBlock->add_layer_materials(), 0, block->layerMaterialAt(p));
|
|
|
|
material->set_mat_index(staticMat.mat_index);
|
|
|
|
CopyMat(NetBlock->add_vein_materials(), 0, block->veinMaterialAt(p));
|
|
|
|
RemoteFortressReader::MatPair * layerMaterial = NetBlock->add_layer_materials();
|
|
|
|
CopyMat(NetBlock->add_base_materials(), baseMat.mat_type, baseMat.mat_index);
|
|
|
|
layerMaterial->set_mat_type(0);
|
|
|
|
|
|
|
|
layerMaterial->set_mat_index(block->layerMaterialAt(p));
|
|
|
|
|
|
|
|
RemoteFortressReader::MatPair * veinMaterial = NetBlock->add_vein_materials();
|
|
|
|
|
|
|
|
veinMaterial->set_mat_type(0);
|
|
|
|
|
|
|
|
veinMaterial->set_mat_index(block->veinMaterialAt(p));
|
|
|
|
|
|
|
|
RemoteFortressReader::MatPair * baseMaterial = NetBlock->add_base_materials();
|
|
|
|
|
|
|
|
baseMaterial->set_mat_type(baseMat.mat_type);
|
|
|
|
|
|
|
|
baseMaterial->set_mat_index(baseMat.mat_index);
|
|
|
|
|
|
|
|
RemoteFortressReader::MatPair * constructionItem = NetBlock->add_construction_items();
|
|
|
|
RemoteFortressReader::MatPair * constructionItem = NetBlock->add_construction_items();
|
|
|
|
constructionItem->set_mat_type(-1);
|
|
|
|
CopyMat(constructionItem, -1, -1);
|
|
|
|
constructionItem->set_mat_index(-1);
|
|
|
|
|
|
|
|
if (tileMaterial(tile) == tiletype_material::CONSTRUCTION)
|
|
|
|
if (tileMaterial(tile) == tiletype_material::CONSTRUCTION)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::construction *con = df::construction::find(DfBlock->map_pos + df::coord(xx, yy, 0));
|
|
|
|
df::construction *con = df::construction::find(DfBlock->map_pos + df::coord(xx, yy, 0));
|
|
|
|
if (con)
|
|
|
|
if (con)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
constructionItem->set_mat_type(con->item_type);
|
|
|
|
CopyMat(constructionItem, con->item_type, con->item_subtype);
|
|
|
|
constructionItem->set_mat_index(con->item_subtype);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NetBlock->add_tree_percent(trunk_percent[xx][yy]);
|
|
|
|
NetBlock->add_tree_percent(trunk_percent[xx][yy]);
|
|
|
@ -1388,9 +1394,7 @@ void Copyspatters(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetB
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
auto send_spat = send_pile->add_spatters();
|
|
|
|
auto send_spat = send_pile->add_spatters();
|
|
|
|
send_spat->set_state((MatterState)mat->mat_state);
|
|
|
|
send_spat->set_state((MatterState)mat->mat_state);
|
|
|
|
auto send_mat = send_spat->mutable_material();
|
|
|
|
CopyMat(send_spat->mutable_material(), mat->mat_type, mat->mat_index);
|
|
|
|
send_mat->set_mat_index(mat->mat_index);
|
|
|
|
|
|
|
|
send_mat->set_mat_type(mat->mat_type);
|
|
|
|
|
|
|
|
send_spat->set_amount(mat->amount[xx][yy]);
|
|
|
|
send_spat->set_amount(mat->amount[xx][yy]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for each (auto item in items)
|
|
|
|
for each (auto item in items)
|
|
|
@ -1398,9 +1402,7 @@ void Copyspatters(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetB
|
|
|
|
if (item->amount[xx][yy] == 0)
|
|
|
|
if (item->amount[xx][yy] == 0)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
auto send_spat = send_pile->add_spatters();
|
|
|
|
auto send_spat = send_pile->add_spatters();
|
|
|
|
auto send_mat = send_spat->mutable_material();
|
|
|
|
CopyMat(send_spat->mutable_material(), item->mattype, item->matindex);
|
|
|
|
send_mat->set_mat_index(item->matindex);
|
|
|
|
|
|
|
|
send_mat->set_mat_type(item->mattype);
|
|
|
|
|
|
|
|
send_spat->set_amount(item->amount[xx][yy]);
|
|
|
|
send_spat->set_amount(item->amount[xx][yy]);
|
|
|
|
auto send_item = send_spat->mutable_item();
|
|
|
|
auto send_item = send_spat->mutable_item();
|
|
|
|
send_item->set_mat_type(item->item_type);
|
|
|
|
send_item->set_mat_type(item->item_type);
|
|
|
@ -2469,15 +2471,12 @@ static void CopyLocalMap(df::world_data * worldData, df::world_region_details* w
|
|
|
|
out_building->set_max_x(in_building->max_x - (site_x * 48));
|
|
|
|
out_building->set_max_x(in_building->max_x - (site_x * 48));
|
|
|
|
out_building->set_max_y(in_building->max_y - (site_y * 48));
|
|
|
|
out_building->set_max_y(in_building->max_y - (site_y * 48));
|
|
|
|
|
|
|
|
|
|
|
|
auto mat = out_building->mutable_material();
|
|
|
|
CopyMat(out_building->mutable_material(), in_building->item.mat_type, in_building->item.mat_index);
|
|
|
|
mat->set_mat_type(in_building->item.mat_type);
|
|
|
|
|
|
|
|
mat->set_mat_index(in_building->item.mat_index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STRICT_VIRTUAL_CAST_VAR(tower_info, df::site_realization_building_info_castle_towerst, in_building->building_info);
|
|
|
|
STRICT_VIRTUAL_CAST_VAR(tower_info, df::site_realization_building_info_castle_towerst, in_building->building_info);
|
|
|
|
if (tower_info)
|
|
|
|
if (tower_info)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mat->set_mat_index(tower_info->wall_item.mat_index);
|
|
|
|
CopyMat(out_building->mutable_material(), tower_info->wall_item.mat_type, tower_info->wall_item.mat_index);
|
|
|
|
mat->set_mat_type(tower_info->wall_item.mat_type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto out_tower = out_building->mutable_tower_info();
|
|
|
|
auto out_tower = out_building->mutable_tower_info();
|
|
|
|
out_tower->set_roof_z(tower_info->roof_z);
|
|
|
|
out_tower->set_roof_z(tower_info->roof_z);
|
|
|
@ -2487,8 +2486,7 @@ static void CopyLocalMap(df::world_data * worldData, df::world_region_details* w
|
|
|
|
STRICT_VIRTUAL_CAST_VAR(wall_info, df::site_realization_building_info_castle_wallst, in_building->building_info);
|
|
|
|
STRICT_VIRTUAL_CAST_VAR(wall_info, df::site_realization_building_info_castle_wallst, in_building->building_info);
|
|
|
|
if (wall_info)
|
|
|
|
if (wall_info)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mat->set_mat_index(wall_info->wall_item.mat_index);
|
|
|
|
CopyMat(out_building->mutable_material(), wall_info->wall_item.mat_type, wall_info->wall_item.mat_index);
|
|
|
|
mat->set_mat_type(wall_info->wall_item.mat_type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto out_wall = out_building->mutable_wall_info();
|
|
|
|
auto out_wall = out_building->mutable_wall_info();
|
|
|
|
|
|
|
|
|
|
|
@ -2720,10 +2718,7 @@ static command_result GetCreatureRaws(color_ostream &stream, const EmptyMessage
|
|
|
|
send_tissue->set_name(orig_tissue->tissue_name_singular);
|
|
|
|
send_tissue->set_name(orig_tissue->tissue_name_singular);
|
|
|
|
send_tissue->set_subordinate_to_tissue(orig_tissue->subordinate_to_tissue);
|
|
|
|
send_tissue->set_subordinate_to_tissue(orig_tissue->subordinate_to_tissue);
|
|
|
|
|
|
|
|
|
|
|
|
auto send_mat = send_tissue->mutable_material();
|
|
|
|
CopyMat(send_tissue->mutable_material(), orig_tissue->mat_type, orig_tissue->mat_index);
|
|
|
|
|
|
|
|
|
|
|
|
send_mat->set_mat_index(orig_tissue->mat_index);
|
|
|
|
|
|
|
|
send_mat->set_mat_type(orig_tissue->mat_type);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2779,9 +2774,7 @@ static command_result GetPlantRaws(color_ostream &stream, const EmptyMessage *in
|
|
|
|
growth_remote->set_timing_end(growth_local->timing_2);
|
|
|
|
growth_remote->set_timing_end(growth_local->timing_2);
|
|
|
|
growth_remote->set_trunk_height_start(growth_local->trunk_height_perc_1);
|
|
|
|
growth_remote->set_trunk_height_start(growth_local->trunk_height_perc_1);
|
|
|
|
growth_remote->set_trunk_height_end(growth_local->trunk_height_perc_2);
|
|
|
|
growth_remote->set_trunk_height_end(growth_local->trunk_height_perc_2);
|
|
|
|
auto growthMat = growth_remote->mutable_mat();
|
|
|
|
CopyMat(growth_remote->mutable_mat(), growth_local->mat_type, growth_local->mat_index);
|
|
|
|
growthMat->set_mat_index(growth_local->mat_index);
|
|
|
|
|
|
|
|
growthMat->set_mat_type(growth_local->mat_type);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|