Commit graph

175 commits

Author SHA1 Message Date
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 135f5e03c7,
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
Anders Jenbo
20186e0370 🎨 Replace TRUE/FALSE with true/false
fix


Fix


fix
2021-04-09 15:13:02 +02:00
Anders Jenbo
93d42b62b8 ♻️ Change BOOL to bool 2021-04-09 15:13:02 +02:00
Gleb Mazovetskiy
642472cce8 pfile: extract pfile_get_password() 2021-04-08 21:51:55 +02:00
Anders Jenbo
ebc27082e7 🔥 remove unused parts of init_test_access 2021-04-08 19:20:55 +02:00
Anders Jenbo
bfb3c11c2b 🎨 Change namespace to devilution 2021-04-06 15:21:25 +02:00
Anders Jenbo
630e507f63 🚚 Apply namespace 2021-04-06 15:21:25 +02:00
Anders Jenbo
6f1498d315 🚚 Move structures to there respective headers 2021-04-06 12:41:00 +02:00
Anders Jenbo
bc3dc545da 🔥 Remove unused parts of game creation logic 2021-04-06 12:41:00 +02:00
Anders Jenbo
bba73ea20f Handle mixed item origins in multiplayer 2021-04-01 14:52:44 +02:00
Anders Jenbo
a2656637e4 🎨 Format source 2021-03-31 00:52:47 +02:00
Anders Jenbo
8196bdbd31 Set the initial ready spell when creating a new hero 2021-03-29 02:19:01 +02:00
Anders Jenbo
1284333765 ♻️ Use explicit types and remove globals from save file logic 2021-03-09 22:27:11 +01:00
Xadhoom
12c7b715cd Add test for vanilla pfile_write_hero() 2021-03-08 18:32:25 +01:00
qndel
12dddc4e8f Preserve active spell and hotkeys across games 2021-03-07 17:30:03 +01:00
Anders Jenbo
c71efb5960 Better assertions on item generation tests
[Diablo/Hellfire] Also clear PkItemStruct when calling PackItem() to
avoid garbage data ending up in the saves.
2021-03-03 09:30:09 +01:00
Anders Jenbo
8cebb84475 Remove unused function 2021-02-27 15:01:07 +01:00
Anders Jenbo
3593266ef7 Converte all Levels when cross loading saves 2021-02-27 14:51:37 +01:00
Anders Jenbo
4d47d513ce Implement Hellfire multiplayer saves 2021-02-25 05:50:24 +01:00
pionere
97d53ced7e get rid of a few warnings (strncpy) 2021-02-19 22:04:11 +01:00
qndel
ab9911064f unify checks for single and multiplayer 2021-02-18 22:32:01 +01:00
Anders Jenbo
4ffbb32952 [hellfire] Allow continuing Diablo saves in Hellfire and vice versa 2021-01-13 16:10:21 +01:00
Anders Jenbo
0c96e32f19 Unify all defines, enums and structs 2021-01-08 20:53:06 +01:00
Anders Jenbo
6f8f4c3293 Unify another chunk of simple Hellfire code paths 2021-01-07 07:19:07 +01:00
Anders Jenbo
e609e170d0 Merge a large chunk of Hellfire the code paths 2021-01-06 08:07:20 +01:00
Anders Jenbo
a2a3729491 Enable loading hellfire games form main menu 2021-01-02 07:40:05 +01:00
Anders Jenbo
8f0b8b3b51 Clean up pfile.cpp 2021-01-02 03:37:23 +01:00
Anders Jenbo
e33914c0c8 Merge branch 'master' of github.com:diasurgical/devilution 2021-01-01 22:57:37 +01:00
Anders Jenbo
da908b83f2 [hellfire] pfile_read 2021-01-01 20:43:27 +01:00
Anders Jenbo
87c325ef31 [hellfire] pfile_write_save_file 2021-01-01 19:40:33 +01:00
Anders Jenbo
5169c054b6 [hellfire] pfile_archive_contains_game 2021-01-01 19:14:01 +01:00
Anders Jenbo
5bd15f28db [hellfire] pfile_read_hero 2021-01-01 15:52:54 +01:00
Anders Jenbo
363c37a447 [hellfire] pfile_get_file_name 2021-01-01 04:41:36 +01:00
Anders Jenbo
e46a0bff55 [hellfire] pfile_ui_set_hero_infos 2021-01-01 04:26:38 +01:00
Anders Jenbo
6cfc2862d6 [hellfire] pfile_get_save_path and frinds 2021-01-01 04:12:01 +01:00
Anders Jenbo
2de8282345 [hellfire] pfile_encode_hero 2021-01-01 02:54:45 +01:00
Anders Jenbo
043d15db66 [hellfire] PackPlayer and frinds 2021-01-01 01:34:54 +01:00
Anders Jenbo
61b2d0de95 Merge branch 'master' of github.com:diasurgical/devilution 2020-12-16 02:24:39 +01:00
qndel
23c2108dff GetTempSaveNames/GetPermSaveNames 2020-11-12 15:14:47 +01:00
Anders Jenbo
4ae75753c8 Merge branch 'master' of github.com:diasurgical/devilution 2020-11-09 01:24:02 +01:00
Anders Jenbo
3b8b5f9007 Reorder pfile.cpp 2020-11-05 02:29:00 +01:00
Gleb Mazovetskiy
a091a56e8e
Remove MAX_PATH restriction (#898)
Do not limit filesystem paths to 259 chars for MPQs, save files, and diablo.ini.

The MAX_PATH constant remains but now only limits path lengths within the MPQs.
2020-10-26 13:39:27 +01:00
Anders Jenbo
46e3216aac Remove unused code 2020-10-24 14:03:15 +02:00
Anders Jenbo
e073422ce7 Unify executable for Spawn and Retail
The game will now autodetect if it should run in shareware mode or full
retail based on the found mpq file. Additionally it can beforced in the
shareware mode with --spawn even if the retail data is found.

This simplifies a lot of the spagetty code and lets us better refactor,
also worth noteing is that we won't have to setup a secound set of build
tests.
2020-10-20 19:42:01 +02:00
Anders Jenbo
57f0f5f4c7 Handle hellfire save game differences 2020-10-13 05:12:20 +02:00