1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-10 09:50:17 +02:00
Commit Graph

468 Commits

Author SHA1 Message Date
MichalZr6
7fa965e78b Fix unintentionally broken line endings to LF in Client.cpp 2024-09-19 09:20:36 +02:00
MichalZr6
e13e72d093 Moved code from NetpacksClient.cpp to Client.cpp
Created new function CClient::updatePath that will invalidate paths and update given hero displayed path
2024-09-19 08:43:54 +02:00
Ivan Savenko
01396b62b7 Extracted handling of type ID's from serializer into a separate class 2024-08-26 19:48:46 +00:00
Ivan Savenko
232a759db7 Remove type registration from library pack applying 2024-08-26 19:48:46 +00:00
Ivan Savenko
b84af1a6de Significantly simplify packs applying
Apparently our logic for packs applying with types registration is
overcomplicated and by now completely unnecessary - it became redundant
after introduction of visitor pattern.
2024-08-26 19:48:46 +00:00
Ivan Savenko
2a05fbdd50 Unified handling of battle sides ID's
- Replaced BattleSide namespace-enum with enum class
- Merged two different BattleSide enum's into one
- Merged BattlePerspective enum into BattleSide enum
- Changed all places that use integers to represent battle side to use
BattleSide enum
- Added BattleSideArray convenience wrapper for std::array that is
always 2-elements in size and allows access to its elements using
BattleSide enum
2024-08-11 20:54:44 +00:00
Ivan Savenko
0d66ddbeec GameState now uses random generator from server. Blocked access to rmg
on client
2024-07-16 13:13:38 +00:00
Ivan Savenko
3bea383b59 Merge branch 'vcmi/beta' into 'vcmi/develop' 2024-06-21 12:58:36 +00:00
Ivan Savenko
e08f76ddf0 Add missing lock to Android shutdown logic 2024-06-17 16:17:01 +00:00
Ivan Savenko
6b9d2809b1 Fix crash on Android OS shutdown request 2024-06-17 13:23:44 +00:00
Ivan Savenko
b8beb4fb13 Fixes for various minor issues detected by Sonar Cloud 2024-06-01 11:48:30 +00:00
Ivan Savenko
df83fa33a1 Merge branch 'vcmi/master' into 'vcmi/develop' 2024-05-31 09:34:21 +00:00
Ivan Savenko
d6ff7896fe Fix possible crash on closing game from main menu 2024-05-20 10:57:25 +00:00
Ivan Savenko
d502850054 Add network thread termination logic for adventure map animations 2024-05-18 12:15:48 +00:00
Ivan Savenko
9bfe000724 Added semi-workaround method for network thread shutdown:
Currently closing game while network thread is waiting for something is
very bug-prone, since network thread may resume during shutdown and
access partially destroyed client state.

Now if exit has been requested, the very first step would be semi-
graceful shutdown of network thread (via exception throwing). This may
in theory skip some cleanup in non-RAII code, but since game is shutting
down this does not matters much.

This logic applies to:
- shutting down while network thread is waiting for dialogs
- shuttind down while network thread waiting for animations in combat
2024-05-18 11:04:10 +00:00
Ivan Savenko
8754e0ebb3 Code formatting and cleanup 2024-05-17 17:10:29 +00:00
Ivan Savenko
f3de2cfe1c Removed broken & unused serialization of player interface and AI 2024-05-17 16:35:53 +00:00
Ivan Savenko
93da58beed Do not use locks on single-threaded server.
Especially since this lock is global and is shared between client and
server for no reason
2024-05-13 15:42:33 +00:00
Ivan Savenko
9f47a2e6aa Fix logging of received network packs on client 2024-04-20 12:28:50 +03:00
Evgeny Malygin
25125f96da
Fix: licenses, pragma guards, StdInc 2024-03-29 07:48:52 +02:00
Ivan Savenko
9ebd194ab1
Merge pull request #3609 from IvanSavenko/single_process
Allow running server as part of client process
2024-02-14 12:06:22 +02:00
Ivan Savenko
392c360f88 Replaced some usages of void * with more clear CPack * 2024-02-12 12:53:10 +02:00
Ivan Savenko
c577ea3e8d Fix potentially uninitialized values 2024-02-12 12:31:27 +02:00
Ivan Savenko
0d263c5571 Implemented option to run server as a thread with shared VLC 2024-02-11 17:55:02 +02:00
Ivan Savenko
38ba42ef7a Rename 'c' to 'logicConnection' 2024-02-11 16:26:27 +02:00
Ivan Savenko
1b6ac1052a Properly lock UI mutex on accessing GUI state from network thread 2024-02-03 22:24:32 +02:00
Ivan Savenko
80fc2bb695 Merge remote-tracking branch 'vcmi/develop' into lobby 2024-02-03 21:11:34 +02:00
Laserlicht
1124b43d91
check tactic side 2024-01-29 21:52:11 +01:00
Ivan Savenko
322c5faf63 Merge remote-tracking branch 'vcmi/develop' into lobby 2024-01-26 16:52:23 +02:00
Laserlicht
7f58333ef9
quick combat vs ai 2024-01-25 23:44:41 +01:00
Ivan Savenko
284273379e
Merge pull request #3536 from IvanSavenko/serialization_refactor
Refactoring of serialization versioning handling
2024-01-22 19:49:24 +02:00
Ivan Savenko
fc4ae3bd8c Merge remote-tracking branch 'vcmi/develop' into lobby 2024-01-20 23:01:49 +02:00
Andrii Danylchenko
cc7fc4a2c6 Fix headless mode 2024-01-20 22:55:27 +02:00
Ivan Savenko
0c07384293 Refactoring of serialization versioning handling
- Removed 'version' field from serialize() method
- Handler classes - Binary(De)Serializer now have 'version' field
- Serialization versioning now uses named enum

Save compatibility with 1.4.X saves should be intact
2024-01-20 20:34:51 +02:00
Ivan Savenko
0a1153e1c6 Switch client-server communication to new API 2024-01-19 23:49:59 +02:00
Ivan Savenko
d04241b10a Code cleanup 2024-01-19 23:02:00 +02:00
Ivan Savenko
ea1f05d15a Stabilization 2024-01-19 13:55:22 +02:00
Ivan Savenko
a15366f5a5 Make IObjectInterface::cb non-static 2024-01-19 13:55:21 +02:00
Ivan Savenko
d5c4478816 Remove most of non-const access to VLC entities 2024-01-19 13:54:49 +02:00
Ivan Savenko
bd5682ecc3 Merge remote-tracking branch 'vcmi/master' into develop 2024-01-19 13:49:54 +02:00
Alexander Wilms
73019c204d Replace redundant types with auto for the lvalues of template factory functions for smart pointers
grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > redundant_types.txt

import re

with open("redundant_types.txt") as f:
    for line in f:
        line = line.strip()
        path = line.split(":", 1)[0]
        original_code = ":".join(line.split(":")[1:]).strip()

        print()
        print(path)
        print(original_code)
        prefix = "auto "
        if original_code.startswith("static"):
            static = True
        else:
            static = False

        cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
        print(cpp_type)

        if static:
            new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
        else:
            new_code = "auto "+ " ".join(original_code.split(" ")[1:])
        print(new_code)

        if True:
            with open(path, "r") as f:
                filedata = f.read()

            filedata = filedata.replace(original_code, new_code)

            with open(path, "w") as f:
                f.write(filedata)
2024-01-17 12:50:00 +00:00
Ivan Savenko
6270c81c1a Add logging to trace crash 2024-01-16 15:21:49 +02:00
Alexander Wilms
f3277b7953 Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
Ivan Savenko
07472d3b05
Merge pull request #3147 from IvanSavenko/serialization_refactor
Serialization refactor - remove VLC from saved games
2023-11-11 17:35:01 +02:00
Ivan Savenko
5c810df36f Reorganized types registration code 2023-11-11 00:39:08 +02:00
Ivan Savenko
359af84d59 Fix crash on starting battle in MP 2023-11-09 01:22:09 +02:00
Ivan Savenko
4a7fa9bf8c Simplified CTypeList class 2023-11-08 22:05:36 +02:00
Alexander Wilms
e4db6f2af8 CClient::removeGUI(): This function should be declared 'const' 2023-10-28 23:05:05 +00:00
Johannes Schauer Marin Rodrigues
a1a5bc28c2
convert line endings from CRLF (Windows) to LF (Linux/Unix)
Mixed line endings cause problems when exporting patches with
git-format-patch and then trying to "git am" a patch with mixed and
non-matching line endings. In such a situation git will fail to apply
the patch.

This commit runs the dos2unix tools on the remaining files with CRLF
(\r\n) line endings to convert them to line-feeds (\n) only.

Files that are Windows specific like *.vcxproj and *.props files were
not converted.

Closes: #3073
2023-10-19 16:23:21 +02:00
Ivan Savenko
195320dcf2 Removed remaining references to 'pim' name 2023-09-27 18:50:01 +03:00