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

284 Commits

Author SHA1 Message Date
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
e849e4170a
Merge pull request #3486 from Alexander-Wilms/replace-redundant-types-with-auto
Replace redundant types with `auto`
2024-01-17 13:31:05 +02:00
Alexander Wilms
1b85abb508 Use auto instead of redundant type in initializations using new
grep -r --include \*.h --include \*.cpp "=" * | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return\|{\|}\|= \"\|= tr(\|virtual\|void" | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "float\|nullptr" | grep "new" | grep -v "AI/FuzzyLite" | grep \( | grep "= new" > 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 = line.split(":")[1].strip()
        if "new " in original_code:

            cpp_type = original_code.split(" ")[0]
            if original_code.count(cpp_type) == 2:
                print()
                print(path)
                print(original_code)
                new_code = "auto "+" ".join(original_code.split(" ")[1:])
                print(new_code)

                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-16 21:40:53 +00:00
Alexander Wilms
cca08e29da Remove duplicate semicolons 2024-01-16 19:02:39 +00:00
Andrii Danylchenko
e46f442a20
Merge pull request #2838 from Alexander-Wilms/ci-using-encrypted-data
Enable unit tests for Linux CI builds
2024-01-13 12:26:28 +02:00
Alexander Wilms
f3277b7953 Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
Alexander Wilms
8800b361fd Disable broken tests so the working ones don't rot 2024-01-08 19:13:44 +00:00
Ivan Savenko
9b40271ab1 Update editor and tests 2023-12-22 17:56:43 +02:00
Ivan Savenko
118dafb71b Fix tests 2023-11-18 21:17:40 +02:00
Ivan Savenko
52050d0ef1 Fix build 2023-11-15 15:55:19 +02:00
Ivan Savenko
13763cad8e Remove few more implicit conversions 2023-11-15 15:55:19 +02:00
SoundSSGood
e1a9763ae4 fix test, throwing exception fix 2023-11-09 12:38:50 +02:00
Ivan Savenko
32a2e540d3 Fix build 2023-11-08 14:00:23 +02:00
Tomasz Zieliński
c909bd766e Merge remote-tracking branch 'origin/develop' into fix_rmg_teams
# Conflicts:
#	lib/rmg/CMapGenOptions.cpp
#	lib/rmg/CMapGenOptions.h
2023-11-07 20:54:04 +01:00
Tomasz Zieliński
e105b23a37 Merge remote-tracking branch 'origin/develop' into fix_rmg_teams
# Conflicts:
#	Mods/vcmi/config/vcmi/rmg/heroes3/newcomers.JSON
#	Mods/vcmi/config/vcmi/rmg/heroes3/southOfHell.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/2sm0k.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/2sm2i(2).JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/3sb0b.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/3sb0c.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/5sb0a.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/5sb0b.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/7sb0b.JSON
#	Mods/vcmi/config/vcmi/rmg/symmetric/7sb0c.JSON
#	client/lobby/RandomMapTab.cpp
2023-10-30 20:08:13 +01:00
Tomasz Zieliński
4f2cde018c Fixed most of reported issues, removed unused code. 2023-10-29 21:25:39 +01:00
SoundSSGood
7e6ab5e87b fix test & fix build & suggested changes 2023-10-29 17:46:14 +02:00
Tomasz Zieliński
07dac8b6d4 Works more or less 2023-10-28 20:30:38 +02:00
Ivan Savenko
5cbf5031ea move SetStackEffect to a separate file 2023-10-24 01:27:52 +03:00
Ivan Savenko
ae92bdfb51 Fix Lua and test building 2023-10-23 16:05:38 +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
910ad50417 Fix client & server compilation 2023-10-22 16:54:48 +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
Ivan Savenko
bb05c2dea5 Implemented configurable shrine 2023-10-16 00:12:39 +03:00
Ivan Savenko
b75a67ef7c
Merge pull request #2973 from IvanSavenko/identifier_explicit_constructor
Improvements to type safety of Identifier class
2023-10-05 00:33:07 +03:00
Ivan Savenko
037efdf5fc Improvements to type safety of Identifier class
- Constructor of Identifier from integer is now explicit
- Lobby hero/town selection now uses Identifiers instead of int's
- Removed serialization workaround for hero portraits
- Added dummy objects for custom heroes portraits for ID resolver to use
- HeroInstance now stores portrait ID only in case of custom portrait
- Fixed loading of campaign heroes portraits on RoE maps
2023-10-04 18:05:23 +03:00
Ivan Savenko
3cb489e9bd Fix University and Altar 2023-10-04 17:47:12 +03:00
nordsoft
9631176e58 Fix tests 2023-09-29 00:28:09 +02:00
nordsoft
5b97c323d3 Rename hero strings to text id 2023-09-28 00:04:05 +02:00
Ivan Savenko
d257fb37f0 Use optional instead of Json for queries 2023-09-26 13:42:20 +03:00
Ivan Savenko
371d798302 Fix tests 2023-09-19 20:09:18 +03:00
Alexander Wilms
ee935e9fa7 Fix JSON files 2023-09-17 12:36:57 +00:00
Ivan Savenko
f39fbe5151
Merge pull request #2757 from IvanSavenko/filesystem_refactor
Filesystem refactor - part 1
2023-09-07 10:51:02 +03:00
Ivan Savenko
8bdddd1324 Fix tests compilation 2023-09-06 16:03:47 +03:00
Ivan Savenko
fc4dfda00f Added support for concurrent battles to gamestate and server 2023-09-06 16:03:02 +03:00
Ivan Savenko
8dfdfffd87 Use ResourcePath for audio files 2023-09-04 18:22:34 +03:00
Ivan Savenko
6f0108e462 Use ResourcePath for referencing texts and json's 2023-09-04 18:22:34 +03:00
Ivan Savenko
823ffa7a07 Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
Ivan Savenko
e54287ea5d Converted remaining identifier to new system 2023-08-25 13:38:02 +03:00
Ivan Savenko
0240ee886d Converted (almost) all namespace enum's to enum classes 2023-08-25 13:38:02 +03:00
Ivan Savenko
62cd8b12d4 Converted several namespace enums to enum class 2023-08-25 13:38:02 +03:00
Ivan Savenko
ec8d31bbfc First step at unifying game identifiers code 2023-08-25 13:38:01 +03:00
Konstantin
d746a96d55 vcmi: use SpellSchool identifier instead of enum
Use identifier instead of enum inside callbacks. It is better and more
expandable solution.
2023-08-23 17:53:09 +03:00
Konstantin
8724181a0f vcmi: spell resistance rework
Now instead of XXX_IMMUNITY bonuses we have 2 bonuses with spellSchool
subtype: SPELL_SCHOOL_IMMUNITY and NEGATIVE_EFFECT_IMMUNITY.
All previous bonuses of subtype 0 is covered by SPELL_SCHOOL_IMMUNITY,
and all previous bonuses of subtype 1 is covered by
NEGATIVE_EFFECT_IMMUNITY. Unit tests are updated accordingly.
2023-08-23 17:52:16 +03:00
Ivan Savenko
44d16b32fe Use API identical to std classes where possible 2023-08-23 16:32:29 +03:00
Ivan Savenko
87957e74c1 Replaced boost::thread_specific_ptr with thread_local 2023-08-23 16:32:29 +03:00