Got archery target direction back, and cleaned up a few things.

develop
Rose 2023-01-07 14:37:44 -08:00
parent 1808cfc51b
commit 95223d8197
3 changed files with 24 additions and 52 deletions

@ -1 +1 @@
Subproject commit d026f34ed1f7ab79aebb1c5bc8a36ee9b30bd13d Subproject commit d7de31978634d6bd165069e5fcaffc64a0d4a91c

@ -316,8 +316,6 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
material->set_mat_index(local_build->mat_index); material->set_mat_index(local_build->mat_index);
remote_build->set_building_flags(local_build->flags.whole); remote_build->set_building_flags(local_build->flags.whole);
//FIXME: Figure out what to replace this with.
//remote_build->set_is_room(local_build->is_room);
if (local_build->room.width > 0 && local_build->room.height > 0 && local_build->room.extents != nullptr) if (local_build->room.width > 0 && local_build->room.height > 0 && local_build->room.extents != nullptr)
{ {
auto room = remote_build->mutable_room(); auto room = remote_build->mutable_room();
@ -609,28 +607,29 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
case df::enums::building_type::ArcheryTarget: case df::enums::building_type::ArcheryTarget:
{ {
//FIXME: Need to decode archery targets again. //FIXME: Need to decode archery targets again.
//auto actual = strict_virtual_cast<df::building_archerytargetst>(local_build); auto actual = strict_virtual_cast<df::building_archerytargetst>(local_build);
//if (actual) if (actual)
//{ {
// auto facing = actual->archery_direction; for (size_t i = 0; i < actual->relations.size(); i++)
// switch (facing) {
// { if (actual->relations[i]->getType() != df::enums::building_type::Civzone)
// case df::building_archerytargetst::TopToBottom: continue;
// remote_build->set_direction(NORTH); auto zone = strict_virtual_cast<df::building_civzonest>(actual->relations[i]);
// break; if (!zone)
// case df::building_archerytargetst::BottomToTop: continue;
// remote_build->set_direction(SOUTH); if (zone->type != df::civzone_type::ArcheryRange)
// break; continue;
// case df::building_archerytargetst::LeftToRight: if(zone->dir_x < 0)
// remote_build->set_direction(WEST); remote_build->set_direction(EAST);
// break; else if(zone->dir_x > 0)
// case df::building_archerytargetst::RightToLeft: remote_build->set_direction(WEST);
// remote_build->set_direction(EAST); else if (zone->dir_y < 0)
// break; remote_build->set_direction(SOUTH);
// default: else if (zone->dir_y > 0)
// break; remote_build->set_direction(NORTH);
// } break;
//} }
}
break; break;
} }
case df::enums::building_type::Chain: case df::enums::building_type::Chain:
@ -851,7 +850,6 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
auto actual = strict_virtual_cast<df::building_windmillst>(local_build); auto actual = strict_virtual_cast<df::building_windmillst>(local_build);
if (actual) if (actual)
{ {
#if DF_VERSION_INT > 34011
if (actual->orient_x < 0) if (actual->orient_x < 0)
remote_build->set_direction(WEST); remote_build->set_direction(WEST);
else if (actual->orient_x > 0) else if (actual->orient_x > 0)
@ -861,7 +859,6 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
else if (actual->orient_y > 0) else if (actual->orient_y > 0)
remote_build->set_direction(SOUTH); remote_build->set_direction(SOUTH);
else else
#endif
remote_build->set_direction(WEST); remote_build->set_direction(WEST);
if (actual->machine.machine_id >= 0) if (actual->machine.machine_id >= 0)
{ {

@ -859,31 +859,6 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage
} }
} }
} }
//for (size_t i = 0; i < history->figures.size(); i++)
//{
// df::historical_figure * figure = history->figures[i];
// if (figure->race < 0)
// continue;
// df::creature_raw * creature = raws->creatures.all[figure->race];
// for (int j = 0; j < creature->material.size(); j++)
// {
// mat.decode(j + MaterialInfo::FIGURE_BASE, i);
// 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_index(i);
// stringstream id;
// 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->descriptors.colors.size())
// {
// 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);
// }
// }
//}
for (size_t i = 0; i < raws->plants.all.size(); i++) for (size_t i = 0; i < raws->plants.all.size(); i++)
{ {
df::plant_raw * plant = raws->plants.all[i]; df::plant_raw * plant = raws->plants.all[i];