1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
Commit Graph

18 Commits

Author SHA1 Message Date
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
nordsoft
4ab203eaae Add more object search flexibility 2023-10-14 03:16:17 +02:00
Ivan Savenko
d6a357fd17 Split some map object files into smaller files. Reduced includes usage. 2023-06-02 21:47:37 +03:00
Ivan Savenko
e48bd39b9c Moved road & river handlers into a separate file 2023-01-11 15:17:24 +02:00
Ivan Savenko
4f3ea0d1d9 Renamed Terrain.h/cpp -> TerrainHandler.h/cpp 2023-01-10 00:01:35 +02:00
Ivan Savenko
e1799379dd Terrain/Road/River handler are now in compileable state 2023-01-10 00:01:35 +02:00
Ivan Savenko
1468f6aded Converted terrainTypeHandler into proper handler class 2023-01-10 00:01:35 +02:00
Ivan Savenko
eb20a4b208 Merge remote-tracking branch 'vcmi/develop' into warnings_fix 2022-12-23 14:40:45 +02:00
nordsoft
4674e240d8 Fix mxe map editor drag'n'drop 2022-12-21 23:02:53 +04:00
nordsoft
2489a21ced Fix linux build 2022-12-04 20:48:21 +04:00
nordsoft
20d1d346bb Rubber band for selection 2022-12-04 15:38:38 +04:00
nordsoft
8dc0682d81 Drag drop works for objects 2022-12-04 15:38:31 +04:00
lainon
7fdad4e0f6 Code refactor following C++ standard and condition fixes 2022-11-15 03:20:55 +03:00
nordsoft
5bac36ba38 Attempt to fix compilation 2022-10-16 14:22:34 +04:00
nordsoft
b4a806d7fa Code polishing 2022-10-13 01:51:55 +04:00
nordsoft
d7de9accee Fix code review problems 2022-10-13 01:40:52 +04:00
nordsoft
6d92a66fea Fix compilation with latest develop 2022-10-08 23:54:45 +04:00
nordsoft
0b9f601d2c Squashing editor 2022-09-18 03:23:17 +04:00