Skip to content

Commit

Permalink
Merge branch 'develop' into adv-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Aug 8, 2024
2 parents 462a3e9 + a356348 commit 4a1ccdc
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
args: ['--fix=lf']
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.6
rev: 0.29.1
hooks:
- id: check-github-workflows
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Template for new versions:
## New Features

## Fixes
- `buildingplan`: improved performance in forts with large numbers of items

## Misc Improvements

Expand Down
1 change: 0 additions & 1 deletion library/modules/Buildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ static void add_zone_to_all_buildings(df::building* zone_as_building)
static void remove_building_from_zone(df::building* bld, df::building_civzonest* zone) {
erase_from_vector(zone->contained_buildings, &df::building::id, bld->id);
vector_erase_at(bld->relations, binsearch_index(bld->relations, &df::building::id, zone->id));

}

static void remove_zone_from_all_buildings(df::building* zone_as_building)
Expand Down
2 changes: 1 addition & 1 deletion library/xml
Submodule xml updated 1 files
+1 −1 .pre-commit-config.yaml
2 changes: 1 addition & 1 deletion plugins/autobutcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
autobutcher_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/autochop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
int32_t designated = do_cycle(out);
if (0 < designated)
out.print("autochop: designated %d tree(s) for chopping\n", designated);
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoclothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
// Whatever you put here will be done in each game step. Don't abuse it.
// It's optional, so you can just comment it out like this if you don't need it.
DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_autoclothing();
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/autofarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ DFhackCExport command_result plugin_shutdown(color_ostream& out)

DFhackCExport command_result plugin_onupdate(color_ostream& out)
{
if (enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
autofarmInstance->process(out);

return CR_OK;
Expand Down
2 changes: 1 addition & 1 deletion plugins/autonestbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
autonestbox_cycle(out);
return CR_OK;
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/autoslab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ static const int32_t CYCLE_TICKS = 1289;

DFhackCExport command_result plugin_onupdate(color_ostream &out)
{
CoreSuspender suspend;
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
28 changes: 14 additions & 14 deletions plugins/buildingplan/buildingplan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode())
return CR_OK;

if (is_enabled &&
(cycle_requested || world->frame_counter - cycle_timestamp >= CYCLE_TICKS))
if (cycle_requested || world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down Expand Up @@ -667,22 +666,23 @@ static int scanAvailableItems(color_ostream &out, df::building_type type, int16_
auto &jitem = job_items[index];
auto vector_ids = getVectorIds(out, jitem, ignore_filters);

ItemFilter filter = filters[index];
set<string> special = specials;
if (ignore_filters || counts) {
// don't filter by material; we want counts for all materials
filter.setMaterialMask(0);
filter.setMaterials(set<MaterialInfo>());
special.clear();
}
if (ignore_quality) {
filter.setMinQuality(df::item_quality::Ordinary);
filter.setMaxQuality(df::item_quality::Artifact);
}

int count = 0;
for (auto vector_id : vector_ids) {
auto other_id = ENUM_ATTR(job_item_vector_id, other, vector_id);
for (auto &item : df::global::world->items.other[other_id]) {
ItemFilter filter = filters[index];
set<string> special = specials;
if (ignore_filters || counts) {
// don't filter by material; we want counts for all materials
filter.setMaterialMask(0);
filter.setMaterials(set<MaterialInfo>());
special.clear();
}
if (ignore_quality) {
filter.setMinQuality(df::item_quality::Ordinary);
filter.setMaxQuality(df::item_quality::Artifact);
}
if (itemPassesScreen(out, item) && matchesFilters(item, jitem, heat, filter, special)) {
if (item_ids)
item_ids->emplace_back(item->id);
Expand Down
2 changes: 1 addition & 1 deletion plugins/dig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void do_cycle(color_ostream &out) {
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/dwarfvet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
dwarfvet_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/examples/persistent_per_save_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 0 additions & 2 deletions plugins/infiniteSky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ void doInfiniteSky(color_ostream& out, int32_t howMany);

DFhackCExport command_result plugin_onupdate ( color_ostream &out )
{
if ( !enabled )
return CR_OK;
if ( !Core::getInstance().isMapLoaded() )
return CR_OK;
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/logistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ DFhackCExport command_result plugin_load_site_data(color_ostream &out) {
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (!is_enabled || !Core::getInstance().isMapLoaded() || !World::isFortressMode())
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode())
return CR_OK;
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
logistics_cycle(out, true);
Expand Down
2 changes: 1 addition & 1 deletion plugins/misery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/nestboxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/preserve-tombs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= cycle_freq)
if (world->frame_counter - cycle_timestamp >= cycle_freq)
update_tomb_assignments(out);
return CR_OK;
}
Expand Down
2 changes: 0 additions & 2 deletions plugins/remotefortressreader/remotefortressreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ DFhackCExport command_result plugin_shutdown(color_ostream &out)

DFhackCExport command_result plugin_onupdate(color_ostream &out)
{
if (!enableUpdates)
return CR_OK;
KeyUpdate();
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/seedwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
int32_t num_enabled_seeds, num_disabled_seeds;
do_cycle(out, &num_enabled_seeds, &num_disabled_seeds);
if (0 < num_enabled_seeds)
Expand Down
3 changes: 0 additions & 3 deletions plugins/stockflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ static LuaHelper helper;
#define DELTA_TICKS 600

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (!enabled)
return CR_OK;

if (!Maps::IsValid())
return CR_OK;

Expand Down
3 changes: 1 addition & 2 deletions plugins/suspendmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled &&
(cycle_needed || world->frame_counter - cycle_timestamp >= CYCLE_TICKS))
if (cycle_needed || world->frame_counter - cycle_timestamp >= CYCLE_TICKS)
do_cycle(out);
return CR_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/tailor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (is_enabled && world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
int ordered = do_cycle(out);
if (0 < ordered)
out.print("tailor: ordered %d items of clothing\n", ordered);
Expand Down
3 changes: 0 additions & 3 deletions plugins/workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,6 @@ static void process_constraints(color_ostream &out);

DFhackCExport command_result plugin_onupdate(color_ostream &out)
{
if (!enabled)
return CR_OK;

// Every 5 frames check the jobs for disappearance
static unsigned cnt = 0;
if ((++cnt % 5) != 0)
Expand Down
2 changes: 1 addition & 1 deletion scripts

0 comments on commit 4a1ccdc

Please sign in to comment.