Implements plugin: channel-safely v1.2.2

minor changes only
The largest change is moving a df::map_block* declaration to an outer loop
develop
Josh Cooper 2022-12-12 10:45:57 -08:00
parent ae8291b952
commit 89eefd006f
3 changed files with 8 additions and 17 deletions

@ -207,6 +207,7 @@ void ChannelGroups::scan(bool full_scan) {
if (!full_scan && !block->flags.bits.designated) {
continue;
}
df::map_block* block_above = Maps::getBlock(bx, by, z+1);
// foreach tile
bool empty_group = true;
for (int16_t lx = 0; lx < 16; ++lx) {
@ -221,14 +222,13 @@ void ChannelGroups::scan(bool full_scan) {
}
block->designation[lx][ly].bits.dig = df::tile_dig_designation::No;
} else if (is_dig_designation(block->designation[lx][ly]) || block->occupancy[lx][ly].bits.dig_marked ) {
if (!is_channel_designation(block->designation[lx][ly])) {
if (df::map_block* block_above = Maps::getBlock(bx, by, z+1)) {
if (!is_channel_designation(block_above->designation[lx][ly])) {
// dig designation without a channel above it, we can skip this.
// We have a dig designated, or marked. Some of these will not need intervention.
if (block_above &&
!is_channel_designation(block->designation[lx][ly]) &&
!is_channel_designation(block_above->designation[lx][ly])) {
// if this tile isn't a channel designation, and doesn't have a channel designation above it.. we can skip it
continue;
}
}
}
for (df::block_square_event* event: block->block_events) {
if (auto evT = virtual_cast<df::block_square_event_designation_priorityst>(event)) {
// we want to let the user keep some designations free of being managed

@ -5,9 +5,6 @@
#include <modules/EventManager.h> //hash function for df::coord
#include <df/block_square_event_designation_priorityst.h>
#include <algorithm>
#include <random>
df::unit* find_dwarf(const df::coord &map_pos) {
df::unit* nearest = nullptr;
uint32_t distance;

@ -416,12 +416,6 @@ namespace CSP {
if (!config.monitoring) continue;
TRACE(monitor).print(" -> compare positions of worker and job\n");
// save position
if (unit->pos != job->pos && isFloorTerrain(*Maps::getTileType(unit->pos))) {
// worker is probably safe right now
continue;
}
// check for fall safety
if (unit->pos == job->pos && !is_safe_fall(job->pos)) {
// unsafe