@@ -54,6 +54,7 @@ using namespace std;
5454#include " df/world_region_details.h"
5555#include " df/builtin_mats.h"
5656#include " df/block_square_event_grassst.h"
57+ #include " df/z_level_flags.h"
5758
5859using namespace DFHack ;
5960using namespace df ::enums;
@@ -176,6 +177,30 @@ df::world_data::T_region_map *Maps::getRegionBiome(df::coord2d rgn_pos)
176177 return &data->region_map [rgn_pos.x ][rgn_pos.y ];
177178}
178179
180+ void Maps::enableBlockUpdates (df::map_block *blk, bool flow, bool temperature)
181+ {
182+ if (!blk || !(flow || temperature)) return ;
183+
184+ if (temperature)
185+ blk->flags .bits .update_temperature = true ;
186+
187+ if (flow)
188+ {
189+ blk->flags .bits .update_liquid = true ;
190+ blk->flags .bits .update_liquid_twice = true ;
191+ }
192+
193+ auto z_flags = world->map .z_level_flags ;
194+ int z_level = blk->map_pos .z ;
195+
196+ if (z_flags && z_level >= 0 && z_level < world->map .z_count_block )
197+ {
198+ z_flags += z_level;
199+ z_flags->bits .update = true ;
200+ z_flags->bits .update_twice = true ;
201+ }
202+ }
203+
179204df::feature_init *Maps::getGlobalInitFeature (int32_t index)
180205{
181206 auto data = world->world_data ;
@@ -426,7 +451,6 @@ MapExtras::Block::Block(MapCache *parent, DFCoord _bcoord) : parent(parent)
426451 dirty_designations = false ;
427452 dirty_tiles = false ;
428453 dirty_temperatures = false ;
429- dirty_blockflags = false ;
430454 dirty_occupancies = false ;
431455 valid = false ;
432456 bcoord = _bcoord;
@@ -440,7 +464,6 @@ MapExtras::Block::Block(MapCache *parent, DFCoord _bcoord) : parent(parent)
440464 {
441465 COPY (designation, block->designation );
442466 COPY (occupancy, block->occupancy );
443- blockflags = block->flags ;
444467
445468 COPY (temp1, block->temperature_1 );
446469 COPY (temp2, block->temperature_2 );
@@ -449,7 +472,6 @@ MapExtras::Block::Block(MapCache *parent, DFCoord _bcoord) : parent(parent)
449472 }
450473 else
451474 {
452- blockflags.whole = 0 ;
453475 memset (designation,0 ,sizeof (designation));
454476 memset (occupancy,0 ,sizeof (occupancy));
455477 memset (temp1,0 ,sizeof (temp1));
@@ -634,11 +656,6 @@ bool MapExtras::Block::Write ()
634656{
635657 if (!valid) return false ;
636658
637- if (dirty_blockflags)
638- {
639- block->flags = blockflags;
640- dirty_blockflags = false ;
641- }
642659 if (dirty_designations)
643660 {
644661 COPY (block->designation , designation);
0 commit comments