Merge pull request #3929 from myk002/myk_beeeees

adjust price of vermin swarms
develop
Myk 2023-10-28 18:46:57 -07:00 committed by GitHub
commit 82491a6570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

@ -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

@ -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