|
|
|
@ -114,36 +114,18 @@ static df::building_extents_type *getExtentTile(df::building_extents &extent, df
|
|
|
|
|
return &extent.extents[dx + dy*extent.width];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void add_building_to_all_zones(df::building* bld);
|
|
|
|
|
|
|
|
|
|
static void buildings_fixzones()
|
|
|
|
|
{
|
|
|
|
|
auto& vec = world->buildings.other[buildings_other_id::IN_PLAY];
|
|
|
|
|
|
|
|
|
|
bool changed = false;
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < vec.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
df::building* bld = vec[i];
|
|
|
|
|
|
|
|
|
|
add_building_to_all_zones(bld);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A monitor to work around this bug, in its application to buildings:
|
|
|
|
|
*
|
|
|
|
|
* http://www.bay12games.com/dwarves/mantisbt/view.php?id=1416
|
|
|
|
|
*/
|
|
|
|
|
bool buildings_do_onupdate = false;
|
|
|
|
|
static bool buildings_do_fixzones = false;
|
|
|
|
|
|
|
|
|
|
void buildings_onStateChange(color_ostream &out, state_change_event event)
|
|
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case SC_MAP_LOADED:
|
|
|
|
|
buildings_do_onupdate = true;
|
|
|
|
|
buildings_do_fixzones = true;
|
|
|
|
|
break;
|
|
|
|
|
case SC_MAP_UNLOADED:
|
|
|
|
|
buildings_do_onupdate = false;
|
|
|
|
@ -155,12 +137,6 @@ void buildings_onStateChange(color_ostream &out, state_change_event event)
|
|
|
|
|
|
|
|
|
|
void buildings_onUpdate(color_ostream &out)
|
|
|
|
|
{
|
|
|
|
|
if (buildings_do_fixzones)
|
|
|
|
|
{
|
|
|
|
|
buildings_fixzones();
|
|
|
|
|
buildings_do_fixzones = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildings_do_onupdate = false;
|
|
|
|
|
|
|
|
|
|
df::job_list_link *link = world->jobs.list.next;
|
|
|
|
@ -1450,6 +1426,16 @@ bool Buildings::markedForRemoval(df::building *bld)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Buildings::notifyCivzoneModified(df::building* bld)
|
|
|
|
|
{
|
|
|
|
|
if (bld->getType() != building_type::Civzone)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//remove zone here needs to be the slow method
|
|
|
|
|
remove_zone_from_all_buildings(bld);
|
|
|
|
|
add_zone_to_all_buildings(bld);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Buildings::clearBuildings(color_ostream& out) {
|
|
|
|
|
corner1.clear();
|
|
|
|
|
corner2.clear();
|
|
|
|
|