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

338 Commits

Author SHA1 Message Date
Ivan Savenko
9e49587749 Replace bonus string description with metastring that can properly
handle translations
2024-04-09 16:13:30 +03:00
Ivan Savenko
907438c6f5 Fix crash on attempt to compute movement range for siege tower 2024-04-06 15:59:08 +03:00
Evgeny Malygin
ee42527ee1
Fixes 2024-03-29 12:28:14 +02:00
Evgeny Malygin
25125f96da
Fix: licenses, pragma guards, StdInc 2024-03-29 07:48:52 +02:00
Ivan Savenko
6e399eb21a Make some non-const static variables const or constexpr 2024-02-12 13:22:54 +02:00
Ivan Savenko
a9866bb5c6 Added RandomGeneratorUtil::nextItemWeighted convenience method 2024-01-31 00:17:40 +02:00
Ivan Savenko
2a193effcc Merge branch 'master' into 'develop' 2024-01-25 16:23:13 +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
24d25730ad Changed checks for null with checks for hasValue 2024-01-20 16:41:10 +02:00
Ivan Savenko
ffd604c114 Removed unnecessary access to IHandler::objects 2024-01-19 13:56:06 +02:00
Ivan Savenko
9af7c63a26 Fix build 2024-01-19 13:56:05 +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
bd5682ecc3 Merge remote-tracking branch 'vcmi/master' into develop 2024-01-19 13:49:54 +02:00
Ivan Savenko
b698b6e79d
Merge pull request #3512 from Alexander-Wilms/use-auto-with-template-factory-functions-for-smart-pointers
Use auto with template factory functions for smart pointers
2024-01-18 16:05:05 +02:00
Alexander Wilms
271eeca11b Fix BattleEvaluator.cpp:286:32: error: function 'battleGetAllObstacles' with deduced return type cannot be used before it is defined 2024-01-17 14:41:47 +00:00
Alexander Wilms
f08c6d1ce9 Fix issues created by type replacement script 2024-01-17 14:33:02 +00: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
Alexander Wilms
558ead41fe Add missing semicolon after macro usage 2024-01-16 20:18:18 +00:00
Alexander Wilms
ccac73fb69 Remove trailing semicolons from more macros 2024-01-16 19:46:21 +00:00
Ivan Savenko
0d0d3d8c80 Renamed speed -> getMovementRange, remove misleading default parameter 2024-01-14 17:14:36 +02:00
M
9ee526d202 Fixes from code review 2024-01-11 21:10:22 +01:00
M
7bf273e01c Extract revenge calculation to separate method 2024-01-10 22:56:26 +01:00
M
815fa26fb3 Change nix rounding, revert assert comment 2024-01-10 22:18:53 +01:00
Alexander Wilms
f3277b7953 Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
M
67f18729fa REVENGE bonus that matches HotA haspid ability 2024-01-09 19:10:43 +01:00
Dydzio
dbba1164ef Fix floating point rounding for 5 attack points and unupgraded nix 2024-01-08 20:50:37 +01:00
Dydzio
675f9b11fa Add ENEMY_ATTACK_REDUCTION bonus - fixes HotA Nix 2024-01-08 19:37:04 +01:00
Ivan Savenko
85de3143ff Fixed Genie spellcasting logic to account for spell immunities 2023-12-24 01:13:19 +02:00
Ivan Savenko
3b6d3dee69 Slayer spell should only affect creatures with KING bonus 2023-12-10 19:17:09 +02:00
Ivan Savenko
07e7d6cc14 Do not allow fleeing from cities without fort 2023-11-21 20:32:07 +02:00
Ivan Savenko
b58301849b Pass functor via reference to avoid costly copies 2023-11-18 19:43:11 +02:00
Ivan Savenko
f5a64a0ac5 Call cheap to compute conditions before costly conditions 2023-11-18 19:42:45 +02:00
Ivan Savenko
3ac80e1f09 Avoid costly std vector construction 2023-11-18 19:42:02 +02:00
Ivan Savenko
abad4b01ce Remove explicit convesion to int in operators 2023-11-15 15:55:19 +02:00
Ivan Savenko
09e42cd9df Remove magic number 2023-11-07 22:47:11 +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
885dce0c27 Replace static_cast's of Identifiers with getNum call 2023-11-03 16:03:29 +02:00
Ivan Savenko
8f25f1fd4b Serialize identifiers without implicit conversion to int 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
b88a8da4e8 Split off some netpack structures into separate files 2023-10-23 13:59:15 +03:00
Ivan Savenko
3880ea58b9 Merge branch 'josch/dos2unix' into develop 2023-10-22 18:39:03 +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
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
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
Alexandre Detiste
15e45f966c typos found by lintian 2023-10-17 22:06:08 +02:00
nordsoft
16b147d588 Fix negative spell cost 2023-09-22 01:12:10 +02:00
Ivan Savenko
c4e2417326 Fix crash on obstacle creation (e.g. moat) 2023-09-08 16:35:43 +03:00