fix: preserve deterministic decisions across saves

This commit is contained in:
Rijad Zuzo
2026-08-12 20:30:21 +02:00
parent ed7236257a
commit 6851e15f77
5 changed files with 38 additions and 10 deletions
+4
View File
@@ -1359,6 +1359,10 @@ func restore_state(record: SimulationStateRecord) -> bool:
village = record.village.restore(debug_logs)
economy.configure(village, debug_logs)
economy.restore_storage(record.storages)
# Priorities and modifiers are deterministic derived state, not save payload.
# Rebuild them before the next decision so save/load cannot change outcomes.
village.update_modifiers()
village.update_priorities()
event_log.restore(record.economic_events, int(record.simulation["next_event_id"]))
latest_decisions.clear()
npcs.clear()