1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00
Commit Graph

489 Commits

Author SHA1 Message Date
Ivan Savenko
41493d6f67 Implemented 'strict' json support 2024-02-26 12:55:49 +02:00
Ivan Savenko
922966dcf8 Renamed JsonNode::meta to more logical modScope. Member is now private 2024-02-26 12:55:49 +02:00
Ivan Savenko
08a27663f9 Reworked JsonNode constructors to more logical form 2024-02-26 12:55:49 +02:00
Ivan Savenko
54796c7c56 Rename toJson to toString/toCompactString for consistency 2024-02-26 12:55:49 +02:00
Ivan Savenko
c0dc1040c2 Fixes crash on attempt to dynamic_cast AbilityCaster to Unit 2024-02-18 20:06:07 +02:00
Ivan Savenko
3740f8b02f Moved bonus parsing to a new file 2024-02-14 15:48:06 +02:00
Ivan Savenko
c3957c2c2a Moved json files to new directory, split on per-class basis 2024-02-14 13:08:24 +02:00
Ivan Savenko
a9866bb5c6 Added RandomGeneratorUtil::nextItemWeighted convenience method 2024-01-31 00:17:40 +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
6e629a6a5f split getBonusLocalFirst into two distinct method:
- const method getFirstBonus that returns single matching bonusToString
- non-const method getLocalBonus that returns bonus from current node
2024-01-19 13:56:06 +02:00
Ivan Savenko
e67e4430ba Removed most of non-const static fields in lib. Reduced header includes. 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
1194419884 Added option to allow self-casting 2024-01-16 15:13:00 +02:00
Ivan Savenko
c839b397e8 Block self-casting, e.g. Archangels can't resurrect themselves 2024-01-15 23:16:53 +02:00
Ivan Savenko
6e5da6c158 Fixed Coronius specialty applying from two locations in code 2024-01-15 23:16:53 +02:00
Ivan Savenko
f6e0f46040
Merge pull request #3467 from dydzio0614/hota-fixes
Fix HotA creature abilities (add bonuses allowing implementing them)
2024-01-12 21:55:18 +02:00
M
9ee526d202 Fixes from code review 2024-01-11 21:10:22 +01:00
Dydzio
250b1b69a8
Update accurate shot translation handling
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-01-10 23:57:29 +01:00
Ivan Savenko
1519de60bf Remove excessive logging on using Recanter's Cloak in siege of Tower 2024-01-05 18:31:07 +02:00
Dydzio
7283a4861e Initial version of ACCURATE_SHOT implementation 2024-01-04 22:27:51 +01:00
Ivan Savenko
65721123a1 Partial fix for Coronius specialty bug 2023-12-10 19:17:58 +02:00
Ivan Savenko
df78c9c6f1 Added workaround for crashes with outdated mods 2023-12-09 18:08:22 +02:00
Ivan Savenko
f2e7791326 Fix crash on Earthquake cast 2023-11-27 14:09:08 +02:00
Ivan Savenko
76956cfe3a
Merge pull request #3188 from IvanSavenko/remove_identifier_implicit_int_conversion2
Remove implicit conversion of identifier to integer
2023-11-16 17:26:32 +02:00
Ivan Savenko
abad4b01ce Remove explicit convesion to int in operators 2023-11-15 15:55:19 +02:00
Ivan Savenko
0842f5afee Removed remaining usages of std::vector<bool> 2023-11-15 15:55:18 +02:00
Ivan Savenko
20ef3a69e7 Fix most of memleaks discovered by valgrind 2023-11-13 16:27:15 +02:00
Ivan Savenko
54103813dd Remove no longer used serialization methods 2023-11-08 21:27:05 +02:00
Ivan Savenko
6b81012f31 Use variant identifier in netpacks where applicable 2023-11-08 14:00:23 +02:00
Ivan Savenko
86a3806bec MetaString refactor to eliminate integer usage for identifiers
- entity names are now stored and serialized as text ID's
- added helper methods for convenience to get entities names to
metastring
2023-11-07 22:47:10 +02:00
Ivan Savenko
5487f07d3b added toEntity overload that accepts generic Services class 2023-11-04 17:04:53 +02:00
Ivan Savenko
04aeea9b68 use toEnum instead of getNum for switch'es 2023-11-03 19:20:25 +02:00
Ivan Savenko
184f5a72cc Use toEntity/toXXX methods in Identifier instead VLC objects access 2023-11-03 16:03:29 +02:00
Ivan Savenko
2b9c362d5b Explicitly convert identifier to underlying enumeration 2023-11-03 16:03:29 +02:00
Ivan Savenko
87f6c7354b
Merge pull request #3139 from IvanSavenko/component_variant_identifier
Refactoring of Component class
2023-11-03 15:52:07 +02:00
Ivan Savenko
eea4cbf242
Merge pull request #3136 from IvanSavenko/fix_teleport
Fix crash on teleport cast
2023-11-03 15:49:55 +02:00
Ivan Savenko
10e50548e7 Converted Component class to use VariantIdentifier instead of int 2023-11-02 12:00:04 +02:00
Ivan Savenko
e57276b7c5 Correctly initialize battleID for teleport action 2023-11-01 17:24:41 +02:00
Ivan Savenko
8346d71c98 Remove more subID access 2023-11-01 14:44:05 +02:00
Ivan Savenko
5cbf5031ea move SetStackEffect to a separate file 2023-10-24 01:27:52 +03:00
Ivan Savenko
b88a8da4e8 Split off some netpack structures into separate files 2023-10-23 13:59:15 +03:00
Ivan Savenko
ac925bb786 Renamed new types for consistency with code style 2023-10-22 16:55:19 +03:00
Ivan Savenko
80e6485965 MetaIdentifier now uses std::variant internally 2023-10-22 16:55:19 +03:00
Ivan Savenko
b394158dc9 Bonus Source ID now uses metaidentifier 2023-10-22 16:55:18 +03:00
Ivan Savenko
77facf9387 Implement missing functions, fixes linking errors 2023-10-22 16:54:56 +03:00
Ivan Savenko
910ad50417 Fix client & server compilation 2023-10-22 16:54:48 +03:00
Ivan Savenko
0a10fc30b8 (lib) Bonus subtype is now stored as metaidentifier that can store any
other identifier inside it
2023-10-22 16:54:43 +03:00