Since we can't directly use C++11 attributes, I've chosen BOOST_FALLTHROUGH to annotate intentional fallthroughs.
Thanks to @fosnola for spotting a missing break, which triggered this.
The original source had remnants of a PC-specific experience gain adjustment, which
appeared to be intended as a debugging aid.
I've restored and implemented it, and used it on the debug party.
It doesn't necessary need to be relegated to only a debug feature, but for now, that's
good enough.
It seemed like it was intended as a mirror of cTown::difficulty, yet there didn't seem to
be anything that ever wrote to it.
So I just made everything use cTown::difficulty directly instead.
This should help avoid issues from integer overflow (which is technically undefined behaviour)
while also allowing such issues to be addressed centrally if they still exist.
This also adds an Allow Resist flag to determine whether the target's
Mage Spells or Priest Spells skill can reduce the amount drained.
Thanks to @fosnola for spotting this issue.
Since dialogs turn off whitespace condensing, and it's a global flag,
that caused scenarios to be read with the flag disabled.
The solution is for scenarios to directly turn the flag on before reading.
The fields array was fixed at 64x64, which is fine for all towns
supported in legacy BoE.
However, we intend to support even larger towns in the future,
and also it seems silly to hold so much extra space for a smaller town.
So now, the fields array is a 2D vector that matches the size of the terrain vector.
The setup array is similarly a list of 2D vectors.
This radically changes the format used to store the setup array in a saved game.
Older saves won't crash the game, but fields will be messed up or missing.
Resetting towns is recommended.
This adds several fields to the saved game format that were simply missing.
- Monster boolean flags (for summons)
- Some missing monster ability details (for summons)
- Special on talk (for creatures)
- Max SP and morale (for creatures)
- Source scenario (for encounter notes)
It also changes the default resist to 0 instead of 100, meaning that
resistances will be saved almost always, but should be loaded correctly.
The target location is no longer saved for creatures.
There was already code that nulled it out after loading,
so now that just happens during loading instead.
The town active flags (belt_present and quickfire_present)
are now set during loading instead of after loading.
This changes the save format, so there will be minor incompatibilities.
In particular, monster health won't be loaded correctly from older saves.