Commit Graph
169 Commits
Author SHA1 Message Date
Anders Jenbo eb3012cc0d Reset player object before unpacking hero data 2021-10-12 04:56:30 +02:00
Anders Jenbo a56452eec3 Validate player sync 2021-10-12 04:56:30 +02:00
Juliano Leal Goncalves 28134d099c 🚚 Rename 'PkPlayerStruct' to 'PlayerPack' 2021-08-30 08:01:53 +02:00
Juliano Leal Goncalves bbf529c65a 🚚 Rename 'PlayerStruct' to 'Player' 2021-08-30 06:44:18 +02:00
Anders Jenbo 4044fadeb5 Clean up some players references 2021-08-30 03:26:17 +02:00
qndel 30de22f026 fix displayed save number 2021-08-18 16:07:51 +02:00
Anders Jenbo 9c4e34f988 Player by reference 2021-07-20 01:35:56 +02:00
Jonathan Bergeron 33ad9fa187 renamed Source/mainmenu.cpp and .h to menu.cpp/.h 2021-07-18 01:31:15 +02:00
obligaron f5b437dd9c Use save number to load/save games (instead of hero name) 2021-07-16 02:22:54 +02:00
Anders Jenbo 96bf75b502 Rename player globals 2021-07-08 02:01:14 -07:00
Anders Jenbo a7c7fa0030 Fully apply clang-tidy/format to all files 2021-07-03 16:41:43 -07:00
Anders Jenbo ecea12fc15 Clang-tidy: ParameterCase 2021-07-03 15:46:39 -07:00
Anders Jenbo fc353fc799 Clang-tidy: FunctionCase 2021-07-03 15:46:39 -07:00
Anders Jenbo bf221f4322 Clang-tidy: readability-simplify-boolean-expr 2021-06-26 23:12:22 +02:00
Anders Jenbo d8fa29c972 Clean up more implicit bool conversion 2021-06-26 10:07:02 -07:00
Anders Jenbo 22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Anders Jenbo ee7b32d8f6 Player by reference part 3 2021-06-24 00:53:09 +02:00
Gleb Mazovetskiy 4ea7ba0f5f 🚚 engine.h: Extract LoadLE32 and LoadBE32 2021-06-21 02:34:28 -07:00
Anders Jenbo 27591cc29f Fix spawn save game compatability 2021-06-06 04:51:43 +02:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
Anders Jenbo 34744c068f ♻️Consitantly use %i and not %d 2021-05-15 14:17:52 +02:00
Anders Jenbo a095bc0bf7 ♻️Migrate more code away from miniwin 2021-05-13 02:30:18 +02:00
Anders Jenbo 0c2042fa52 ♻️ Player by reference
Update Source/items.cpp
Update Source/lighting.cpp
Update Source/pack.cpp
asd


ads


as
2021-05-13 01:47:46 +02:00
Gleb Mazovetskiy a3423cbc92 🧹 Move Storm code out of file_util 2021-05-10 12:35:37 +02:00
obligaron 60bfd5db34 Move SFileOpenArchive calls to new helper SFileOpenArchiveDiablo 2021-05-10 08:34:12 +02:00
staphen 3e5e5b2696 Synchronize SFileCloseFile() access 2021-05-08 04:01:07 +02:00
Gleb Mazovetskiy 987ab2533b 🐞 Synchronize SFileReadFile access
StormLib read function is not thread-safe: https://github.com/ladislav-zezula/StormLib/issues/175
2021-05-03 02:35:22 +02:00
Gleb Mazovetskiy f33f7ae7eb 💨 Do not zero-initalize arrays we write to
`std::make_unique<T[]>(size)` always zero-initalizes the array.

C++20 has `std::make_unique_for_overwrite` to avoid that, while
older C++ versions can use the approach applied here.
2021-05-02 05:52:11 +02:00
Gleb Mazovetskiy 47c93c2f9c 🧹 Fix more -Wformat warnings 2021-05-01 22:19:27 +02:00
Vladimir Olteanu a2cb1e5c59 Cleanup pfile_encode_hero 2021-04-30 13:31:48 +02:00
Vladimir Olteanu c319344c50 Load/save cleanup (#1766) 2021-04-30 08:44:11 +02:00
Vladimir Olteanu bea21a5e20 Replace LOAD_LE32 & LOAD_BE32 with signedness- and endian-agnostic equivalents 2021-04-28 20:11:51 +02:00
Gleb Mazovetskiy 83292c8e67 ♻️ Fix -Wunused-variable in pfile.cpp 2021-04-26 05:16:59 +02:00
JmgrandGleb Mazovetskiy d4f62870b8 Remove globals from paths.h
Fix for Vita

Update to use free functions

Use std::optional to allow setting empty paths

Change header inclusion order

Co-authored-by: Gleb Mazovetskiy <[email protected]>

Use std::optional to allow setting empty paths

Apply clang-format

Temporary commit
2021-04-25 22:26:37 +02:00
Anders Jenbo b69d18f12d 🌐 Enable translation of all remaning strings 2021-04-25 21:32:41 +02:00
Anders Jenbo 7912e510f0 🎨 Clean up overuse of SDL types 2021-04-24 17:07:07 +02:00
Anders Jenbo 8fa0612433 🐛 Fix loading chosen hero 2021-04-23 04:53:46 +02:00
Anders Jenbo a32ac83090 🎨 cleanup trivial trype comparisons 2021-04-23 02:48:25 +02:00
Anders Jenbo cc164985a3 🎨 Correct type checks in src sub-folder 2021-04-22 20:33:24 +02:00
Anders Jenbo f004c78824 🧹 performance-unnecessary-value-param 2021-04-22 00:08:19 +02:00
qndel 7563234ca9 fix saves (#1621) 2021-04-19 23:31:04 +02:00
Anders Jenbo bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo c89bd9c001 🚨 Fix remaning warnings for clang and gcc 2021-04-19 02:44:39 +02:00
Gleb Mazovetskiy 95946e3a7c 🧹 Cleanup unused variables (#1584)
Fixes `unused-variable` and `unused-but-set-variable` compiler warnings.
2021-04-18 18:15:47 +02:00
Gleb Mazovetskiy 2c924e1ab1 🐞 pfile: Fix stale tables after leaving a game
In multiplayer, the hash and block tables are kept around between the
saves (presumably to improve performance).

When leaving the game, they should be cleared.

Clearing of the tables is handled by `Archive::Close` in `mpqapi.cpp`.

After https://github.com/diasurgical/devilutionX/commit/135f5e03c796f7184b52abf1abfba5ac0d525379,
which moved the archive closing inside `pfile_write_hero`, the tables
were no longer cleared on `pfile_flush_W` (because the archive was
already closed when it was called).

To fix the issue, this commit adds a `clear_tables` argument
to `pfile_write_hero` and removes the `pfile_flush_W` method.

Bug reported and root cause found by @Eider-McDuck:

> Example to reproduce: Have 2 vanilla savegames, join a game with the first,
> then leave, then join a game with the second, then drop an item on the floor.
2021-04-16 15:50:13 +02:00
Anders Jenbo 8c821e98d3 🚚 Restructure files 2021-04-16 03:57:22 +02:00
Anders Jenbo 997c1dba55 🚚 Split up all.h in to proper header relations 2021-04-16 01:04:54 +02:00
Anders Jenbo 6e1a106a38 🚚 Move header we implement into the project 2021-04-16 01:04:54 +02:00
Gleb Mazovetskiy 135f5e03c7 Only write to the file once when saving 2021-04-12 10:44:36 +02:00
Anders Jenbo a1dabf3aba 🐛 Fix Hellfire save games corrupting game state in Windows 2021-04-11 15:42:45 +02:00