Skip to content

Commit

Permalink
Merge pull request #3929 from myk002/myk_beeeees
Browse files Browse the repository at this point in the history
adjust price of vermin swarms
  • Loading branch information
myk002 authored Oct 29, 2023
2 parents 7103cd5 + 31b568b commit 82491a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Template for new versions:

## Fixes
- `stockpiles`: hide configure and help buttons when the overlay panel is minimized
- `caravan`: price of vermin swarms correctly adjusted down. a stack of 10000 bees is worth 10, not 10000

## Misc Improvements
- `buildingplan`: display how many items are available on the planner panel
Expand Down
12 changes: 9 additions & 3 deletions library/modules/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2042,10 +2042,16 @@ int Items::getValue(df::item *item, df::caravan_state *caravan)
{
int divisor = 1;
auto creature = vector_get(world->raws.creatures.all, mat_type);
if (creature && size_t(mat_subtype) < creature->caste.size())
divisor = creature->caste[mat_subtype]->misc.petvalue_divisor;
if (divisor > 1)
if (creature) {
size_t caste = std::max(0, mat_subtype);
if (caste < creature->caste.size())
divisor = creature->caste[caste]->misc.petvalue_divisor;
}
if (divisor > 1) {
value /= divisor;
if (!value)
value = 1;
}
}

// Add in value from units contained in cages
Expand Down

0 comments on commit 82491a6

Please sign in to comment.