|
|
@ -222,28 +222,27 @@ static void update_tomb_assignments(color_ostream &out) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// now check our civzones for unassignment / deleted zone /
|
|
|
|
// now check our civzones for unassignment / deleted zone
|
|
|
|
for (auto it = tomb_assignments.begin(); it != tomb_assignments.end(); ++it){
|
|
|
|
std::erase_if(tomb_assignments,[&](const auto& p){
|
|
|
|
auto &[unit_id, building_id] = *it;
|
|
|
|
auto &[unit_id, building_id] = p;
|
|
|
|
|
|
|
|
|
|
|
|
const int tomb_idx = binsearch_index(world->buildings.other.ZONE_TOMB, building_id);
|
|
|
|
const int tomb_idx = binsearch_index(world->buildings.other.ZONE_TOMB, building_id);
|
|
|
|
if (tomb_idx == -1) {
|
|
|
|
if (tomb_idx == -1) {
|
|
|
|
out.print("%s tomb missing: %d - removing\n", plugin_name, building_id);
|
|
|
|
out.print("%s tomb missing: %d - removing\n", plugin_name, building_id);
|
|
|
|
it = tomb_assignments.erase(it);
|
|
|
|
return true;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const auto tomb = virtual_cast<df::building_civzonest>(world->buildings.other.ZONE_TOMB[tomb_idx]);
|
|
|
|
const auto tomb = virtual_cast<df::building_civzonest>(world->buildings.other.ZONE_TOMB[tomb_idx]);
|
|
|
|
if (!tomb || !tomb->flags.bits.exists) {
|
|
|
|
if (!tomb || !tomb->flags.bits.exists) {
|
|
|
|
out.print("%s tomb missing: %d - removing\n", plugin_name, building_id);
|
|
|
|
out.print("%s tomb missing: %d - removing\n", plugin_name, building_id);
|
|
|
|
it = tomb_assignments.erase(it);
|
|
|
|
return true;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tomb->assigned_unit_id != unit_id) {
|
|
|
|
if (tomb->assigned_unit_id != unit_id) {
|
|
|
|
out.print("%s unassigned unit %d from tomb %d - removing\n", plugin_name, unit_id, building_id);
|
|
|
|
out.print("%s unassigned unit %d from tomb %d - removing\n", plugin_name, unit_id, building_id);
|
|
|
|
it = tomb_assignments.erase(it);
|
|
|
|
return true;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|