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.
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.
For weapons, negative bonus is now shown as "- 2" instead of as "+ -2".
For armour, the bonus is now accounted for and the numbers should match
what is actually calculated in damage_pc().
Thanks to @fosnola for noticing the armour discrepancy.
This should avoid any format inconsistencies, like missing newlines and the like.
Although a basic save and load works, there may still be some issues with the format.
This probably renders older saved games incompatible.
The format is mostly the same, but there are a few small changes
in the name of making the format more uniform.
This covers only the places where they were used to indicate
a preset selection in constructors.
The usage in qdpict where they're actually passed to the Resource Manager,
as well as the 4-character constants representing file types and creator
codes, are still present.
- Context type (town/out/scen) is now an enum
- Don't expose internals in the header
- Use a state struct to pass things around through the system
- Fix special AFFECT_DEADNESS case for default party selection
- Maybe other bits and pieces?
Previous code would raise this error with GCC 5.5.0:
build/obj/scenario/monster.cpp:804:19: error: use of 'abil' before deduction of 'auto'
for(auto& abil : abil) {
^
I'd advise to do some further refactoring to prevent confusion between the public 'abil'
which is a map of two types of abilities, and the various local 'abil's that shadow it
in monster.cpp.