Commit Graph

68 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
3c3a105ae4 make pop_next_action() return a reference 2024-07-28 17:07:33 -04:00
902fdb7a61 put extern forward-declarations first 2024-07-28 17:07:33 -04:00
756cf658d6 when replaying, don't open file browsers 2024-07-28 17:07:33 -04:00
31dcb26d9d WIP encode and decode save files in action logs 2024-07-28 17:07:33 -04:00
8af5a9e1ca Update and fix Mac CI builds
- GitHub discontinued Actions runners for macos-10 and macos-11, so we
  build cboe on macos-12 now
- The path to Xcode.app has changed
- mac scons build wanted a new include statement for vector
- hint scons to look for boost 1.85, not 1.58.
2024-05-29 19:39:03 -04:00
1bb0927ecb Update and fix Windows CI builds
- boost-spirit dependency needed to be installed
- Visual Studio wanted boost/filesystem.hpp included in more places
- a deprecated enum was removed from new versions of boost, so we use
  its replacement enum now
- vcpkg repository is now pinned to a commit where boost 1.84 libraries
  work smoothly, there should be no more surprises
- vcpkg dependencies now cache, so successive CI runs are dramatically
  faster
- for win-scons, we need to use 'call' in our batch script to source
  vcvarsall.bat
- I updated the includepath and libpath we pass to win-scons to match
  reality, but it still can't find any vcpkg libraries. This will need
  further sleuthing
2024-05-29 19:39:03 -04:00
ca816995ba Make the XML printer output formatted XML again
This is mainly just to keep consistency with the old printer so that the output can be cleanly diffed without any difficulty
2023-01-30 20:05:11 -05:00
748f960b38 Disable [[fallthrough]] declarations 2023-01-28 22:05:14 -05:00
31d83c00f1 rename INFINITE to INFINITE_AMOUNT 2023-01-28 22:05:14 -05:00
32f24b40d6 Update TinyXML 2023-01-26 01:41:39 -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
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
fb8b0d7459 Fix white space condensing not functioning when reading a scenario
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.
2023-01-21 16:42:33 -05:00
76ee270c6e Add some new features to our quoted string parser, and a unit test
- Now supports \n \t \f escape sequences
- Now supports strings with literal tabs
2023-01-21 15:55:58 -05:00
641bef9f80 gzstream: memmove is safer here
Thanks to @fosnola for spotting this.
2023-01-21 11:01:47 -05:00
a430abbd50 Fix fields array not matching the size of the town
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.
2023-01-21 00:47:35 -05:00
ffa09bb10c Fix inconsistent function signatures 2023-01-19 08:48:08 -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
99bd1678e4 tagfile: Support mapped containers, similar to a sparse array
Note: This now treats vector<pair> as a mapped container as well – an ordered multimap, so to speak
2023-01-18 00:54:39 -05:00
50d611e319 tagfile: Support vector2d, both sparse and dense 2023-01-18 00:54:39 -05:00
50bd1e9c6e tagfile: A few more tests; support sparse arrays 2023-01-18 00:54:39 -05:00
d3ed054bbb tagfile: Support hexadecimal integer tags 2023-01-18 00:54:39 -05:00
e5b347c70f tagfile: A few more tests; fix tuple handling 2023-01-18 00:54:39 -05:00
40db245011 maybe_quote_string now quotes the empty string 2023-01-18 00:54:39 -05:00
657df9ea8d Rework the tagfile library
After further experimentation, the previous template-heavy design
turned out to cause issues with compilation.

Thus, it has now been replaced with a simpler, dumber implementation
that pushes more of the logic into the caller.
2023-01-18 00:54:39 -05:00
8872f1aa25 Stop storing players as bare pointers - use unique_ptr instead
Should fix some potential memory leaks that were caught by static analysis
2023-01-12 21:26:08 -05:00
1a82f8ff8b Fix a memory leak found by static analysis 2023-01-12 20:24:39 -05:00
ac5cbe3a60 Test case for dialog XMLs in-engine 2023-01-08 17:25:33 -05:00
6319d46d67 Fix compilation on Xcode 4
- Add new files to project
- Xcode 4 doesn't support inheriting constructors
2023-01-07 14:27:02 -05:00
71f9dd0043 TagFile refinements
- Use a custom prefix system for tagfiles - f for a file, p for a page, t for a tag
- Add a hex tag that reads and writes a number as hex
- Ensure booleans are always read and written as alpha
2023-01-07 13:55:04 -05:00
e3d6a4748e Dialog XML definitions are now loaded thru the resource manager 2023-01-07 11:59:42 -05:00
ALONSO Laurent
4973659808 scenario: try to retrieve the hidden town's flag... 2023-01-06 20:04:01 -05:00
ALONSO Laurent
271f198ff8 save/restore: do not save useless data when we are not in a scenario... 2023-01-06 13:59:41 -05:00
ALONSO Laurent
8d698dda88 fileio_party.cpp: check if save/townmaps.dat before reading it 2023-01-06 13:53:21 -05:00
fed6e19ddb Fix missing cast in writeArray 2023-01-06 13:50:33 -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
0da809d76f Fix the tagfile build error 2023-01-05 02:10:20 -05:00
b469b3aeea Add a new class to encapsulate the file format used by save files
The class is not yet used in the wild, but does have a unit test
2023-01-04 19:57:12 -05:00
df631f6c3c fix unit tests 2022-07-12 20:35:45 -04:00
5b2561d034 Disable header maps in Xcode 12 2022-07-12 20:35:41 -04:00
864aa95fea Fix various compiler warnings 2022-07-05 09:29:15 -04:00
8d31c27d11 Fix unused element and unhandled switch case warnings 2022-07-05 09:19:32 -04:00
x-qq
55a105a0f6 make the game buildable on linux (#283)
- Scons -> python3
- include issues
2022-03-13 15:38:22 -04:00
12bde373b1 Refactor dialog parsing to reduce code duplication
- Refactor dialog format parameter management to use a single protected control function
- Format parameters "frame" and "frame style" merged
- Colour is now a first-class format parameter (though it still has a separate setter)
2020-02-20 23:41:40 -05:00
335fb87e51 Store custom graphics classifications as symbols instead of integers 2020-02-09 12:10:52 -05:00
a8ed8b3bb4 Add config_dir/data to the list of resolution paths in the resource manager
This allows anyone to drop substitute graphics into the data folder, and
the game will load them instead of the default graphics.
2020-02-04 20:56:56 -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
be1bf2fe65 Change Linux userdata directory according to FreeDesktop standards:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Patch from @x-qq
2020-02-01 21:44:22 -05:00