Skip to content

Commit

Permalink
Merge pull request #3888 from myk002/myk_ashcoalsoap
Browse files Browse the repository at this point in the history
[buildingplan] we can no longer build with ash, coal, or soap
  • Loading branch information
myk002 authored Oct 16, 2023
2 parents 9812897 + f50c137 commit dffe3bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Template for new versions:
- `sort`: new search widgets for slab engraving menu; can filter for only units that need a slab to prevent rising as a ghost

## Fixes
- `buildingplan`: remove bars of ash, coal, and soap as valid building materials to match v50 rules
- `zone`: races without specific child or baby names will now get generic child/baby names instead of an empty string
- `zone`: don't show animal assignment link for cages and restraints linked to dungeon zones (which aren't normally assignable)
- `sort`: don't count mercenaries as appointed officials in the squad assignment screen
Expand Down
19 changes: 18 additions & 1 deletion plugins/buildingplan/buildingplan_cycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,28 @@ static bool isAccessible(color_ostream& out, df::item* item) {
return is_walkable;
}

// as of v50, soap, coal, and ash are no longer valid building materials
static bool isUnusableBar(color_ostream& out, df::item* item) {
if (item->getType() != df::item_type::BAR)
return false;

MaterialInfo minfo(item);
string token = minfo.getToken();
if (token.starts_with("COAL:") || token == "ASH")
return true;

df::job_item_flags2 ok;
df::job_item_flags2 mask;
minfo.getMatchBits(ok, mask);
return ok.bits.soap;
}

bool itemPassesScreen(color_ostream& out, df::item* item) {
static const BadFlags bad_flags;
return !(item->flags.whole & bad_flags.whole)
&& !item->isAssignedToStockpile()
&& isAccessible(out, item);
&& isAccessible(out, item)
&& !isUnusableBar(out, item);
}

bool matchesHeatSafety(int16_t mat_type, int32_t mat_index, HeatSafety heat) {
Expand Down

0 comments on commit dffe3bd

Please sign in to comment.