- edited description
Sultan History Corrupted by Event Shuffling
There are at least three different pieces of code that use Algorithms.RandomShuffleInPlace
on HistoricEntity.events
, which represents a sultan’s temporally-ordered history of significant events and lore. However, the underlying History APIs assume that HistoricEntity.events
List will always be in temporal order (which is how the events are initially added to the list). This is especially important for anything that calls HistoricEntity.GetSnapshotAtYear
, which iterates through the event list, applying it in list order. Because the list has been unexpectedly shuffled, a sultan who, for example, gained a wedding gift and then had that gift stolen at a tavern, will unexpectedly still have the relic in their possession. This is most noticeable in the Tomb reliquaries, where sultans mysteriously end up having relics added to their reliquary (by SultanLoot.generateRelics
) that they supposedly lost or were stolen from them.
Potential solutions:
- Don’t shuffle the event list.
-
Explicitly order the events by year in
HistoricEntity.GetSnapshotAtYear
before applying them to History snapshots (and anywhere else that assumes this logic - that’s the main one I have observed though). This is probably the more robust solution.- i.e.
historicEntity.events.OrderBy(event => event.year).ToList()
- i.e.
I discovered this while digging into how sultan histories work, and I made some wishes that dump info about them. Here’s one example of this issue occurring - pay attention to the relic “Omenycus” and the list of “ItemsCurrentlyHeldBySultan”
Comments (2)
-
reporter -
repo owner - changed status to resolved
fixed in 201.51 nice catch
- Log in to comment