pmotschmann / Evolve

An incremental game about evolving a civilization
Mozilla Public License 2.0
794 stars 343 forks source link

Fix partial fulfillment for >1 support structs #1127

Open yarukishi opened 2 months ago

yarukishi commented 2 months ago

The code for distributing insufficient support to non-homeworld buildings does not correctly factor in cases where supportSize is different from 1. This causes situations where, for example, more than the total sum of support may be spent on Colonies on Tau Ceti, which results in negative support for the next building in the array, High-Tech Factories.

Keeping the same code structure where (used_support + operating) is fixed to (used_support + operating * supportSize) could still result in fractional building support, so I added a call to Math.floor() instead.

Tested with the following save file. negative support.txt