don't special case vermin; fallback on caste instead

develop
Myk Taylor 2023-10-28 10:25:26 -07:00
parent 4e864ae2dc
commit 5f6cfcdbe7
No known key found for this signature in database
1 changed files with 7 additions and 5 deletions

@ -2043,13 +2043,15 @@ int Items::getValue(df::item *item, df::caravan_state *caravan)
int divisor = 1; int divisor = 1;
auto creature = vector_get(world->raws.creatures.all, mat_type); auto creature = vector_get(world->raws.creatures.all, mat_type);
if (creature) { if (creature) {
if (creature->flags.is_set(df::creature_raw_flags::VERMIN_SOIL_COLONY)) size_t caste = std::max(0, mat_subtype);
divisor = 10000; if (caste < creature->caste.size())
else if (size_t(mat_subtype) < creature->caste.size()) divisor = creature->caste[caste]->misc.petvalue_divisor;
divisor = creature->caste[mat_subtype]->misc.petvalue_divisor;
} }
if (divisor > 1) if (divisor > 1) {
value /= divisor; value /= divisor;
if (!value)
value = 1;
}
} }
// Add in value from units contained in cages // Add in value from units contained in cages