Commit Graph

52 Commits

Author SHA1 Message Date
a52ce5189b Fix a bunch of undefined behaviour detected by the static analyzer in the saved game format. 2024-08-10 00:16:52 -04:00
cf28d61035 Scenario editor initialize new town bounds/entrances 2023-02-02 23:30:40 -05:00
35050aedc7 Some minor special node fixes 2023-01-30 00:10:56 -05:00
31d83c00f1 rename INFINITE to INFINITE_AMOUNT 2023-01-28 22:05:14 -05:00
ed9a8b035a #include <bitset> so visual studio finds it 2023-01-28 22:05:14 -05:00
d5ea213edd Update swap functions to recommended ADL-friendly format 2023-01-25 23:09:13 -05:00
64c7e4a5a0 Replace C-style 2D arrays with nested std::array 2023-01-25 23:09:13 -05:00
b03c34396d Split quest flags into two separate boolean values 2023-01-22 18:56:50 -05:00
9931ef8ffe const-correctness in scenario classes 2023-01-22 17:25:16 -05:00
cd8f73344f Tiny cleanup, add a bounds check 2023-01-22 17:21:26 -05:00
345b47bbcf Fix import of Make Town Hostile special nodes
Thanks to @fosnola for spotting, and the suggested fix.
2023-01-22 12:51:24 -05:00
ALONSO Laurent
b45f3f66e3 check that picture id are correct... 2023-01-22 12:16:52 -05:00
5bce71d59f Make implicit switch fallthrough an error in the Xcode project and fix all places that do it
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.
2023-01-21 22:39:33 -05:00
ALONSO Laurent
7685a2e571 special.cpp: retrieve correctly allow/deny enter in legacy scenario, 2023-01-21 20:55:43 -05:00
dc716fa5e6 Don't store inactive timers in the saved game
Thanks to @fosnola for spotting this.
2023-01-21 10:28:16 -05:00
c7c8f3fa77 Sanity pass of saved game format
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.
2023-01-20 23:51:35 -05:00
68ef066dca Some adjustments to item interesting strings
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.
2023-01-19 09:52:01 -05:00
2d1bbe0058 Move get_item_interesting_string() into the cItem class 2023-01-19 09:32:07 -05:00
04d079fbaf Clean up cTown::set_up_lights
Thanks to @fosnola for spotting the potential buffer overreach
2023-01-18 21:14:19 -05:00
303b0b8114 Missed an initializer
Thanks to @fosnola for spotting this.
2023-01-18 20:58:13 -05:00
a6196832de Fix item flags not being loaded correctly from saved games 2023-01-18 20:53:07 -05:00
2492610ec7 Reading and writing saved games now uses the new tagfile system.
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.
2023-01-18 00:54:39 -05:00
ALONSO Laurent
26db220f15 special and legacy: check type of monster values in nuke_monsters (to avoid
accidentally all monsters, ...)
2023-01-07 12:37:45 -05:00
cb73719af3 Make item abil_data a bit more readable
A two-element array is an ugly thing to behold
2023-01-06 02:13:46 -05:00
baf8bfd5c7 Make flight ability usable outdoors 2023-01-06 00:55:11 -05:00
5b2561d034 Disable header maps in Xcode 12 2022-07-12 20:35:41 -04:00
7b93726383 Replace 4-character constants with enums
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.
2020-02-21 00:16:58 -05:00
02d98db391 Prevent shops from selling unidentified options.
Patch identified by @x-qq

Fixes #65
2020-02-03 20:43:43 -05:00
511b1858a3 Fix Windows build and tests 2020-02-02 22:32:33 -05:00
86d2574aed Some refactor of special node system
- 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?
2020-02-02 19:12:45 -05:00
68502c8f37 Fix spellcasting item being usable by magically inept characters 2020-02-01 22:17:47 -05:00
488e5a2570 Fix import of legacy Wandering Will Fight special nodes
After checking legacy documentation, I determined that
the meaning of ex1a is reversed in the latest code.
2020-01-19 16:26:15 -05:00
56523f1623 Fix import issue with Can't Enter special nodes 2020-01-19 15:39:42 -05:00
c5dedeb2a7 Fix missile graphic not being written to the saved game
Should fix #202
2020-01-12 12:31:14 -05:00
479cfb75f6 Fix improper loading order with saved games 2020-01-02 00:28:52 -05:00
6f96222c37 Remove the 30-item limit in shops 2019-12-02 01:16:34 -05:00
fd8bd913cc Fix monsters killed in town not being initialized,
resulting in garbage values after loading a saved game
2019-12-01 14:36:14 -05:00
dc25cf6ffb Move abil_chart to be private to cItem and fix missing entries for summoning and quickfire abilities 2019-11-24 20:28:52 -05:00
4ad85936d3 Fix use of a static bitset to record whether items (in a dynamic vector) have been taken 2019-11-23 12:31:30 -05:00
Rémi Verschelde
141cfab23c Fix GCC build issue with ambiguous for loop iterator
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.
2018-04-05 11:13:58 +02:00
03c19fa7ec Use the new erase_completed_specials() function for towns too 2018-02-17 18:46:53 -05:00
1d5e0c2e1e Formatting 2018-02-17 18:14:38 -05:00
Mark Clark
a2dc641f31 Refactored erase_out_specials(); 2018-02-17 17:10:34 -05:00
9127e4a03f Enable building tests in MSVC 2013 2017-09-16 12:46:31 -04:00
9d86053817 Fix up MSVC project file for the major reorganization 2017-08-30 00:09:01 -04:00
1f9615d185 Add an info structure for eItemType enum 2017-04-15 02:03:42 -04:00
c2ce2a2cd1 Split up the graphtool files 2017-04-14 15:43:07 -04:00
e57441f6a0 Consolidate active quest data into a single map 2017-04-14 11:38:06 -04:00
936a848166 Move terrain blockage check into cTerrain class 2017-04-14 01:12:56 -04:00
4baac518e9 Move stream operator declarations into the same file as their types 2017-04-14 01:07:21 -04:00