1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
vcmi/mapeditor
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
..
icons Add line and fill brushes 2023-10-14 02:58:13 +02:00
inspector Remove std::vector<boo> from Json Serializer, simplify affected code 2023-11-15 15:55:18 +02:00
mapsettings Fix build 2023-11-15 15:55:19 +02:00
resourceExtractor Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
translation Update Chinese translation for mapeditor 2024-01-13 17:57:36 +08:00
Animation.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
Animation.h Fix animations in editor which use copy-pasted code from client 2023-06-20 19:37:27 +03:00
BitmapHandler.cpp Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
BitmapHandler.h mapeditor: use vcmi_endian.h 2023-02-03 00:39:44 +03:00
CMakeLists.txt add Chinese mapeditor translation into its CMakeFiles.txt 2024-01-13 17:27:28 +08:00
generatorprogress.cpp
generatorprogress.h
generatorprogress.ui
graphics.cpp Merge pull request #2757 from IvanSavenko/filesystem_refactor 2023-09-07 10:51:02 +03:00
graphics.h Add portraits delegate 2023-10-13 20:15:29 +02:00
jsonutils.cpp Reorganization of boost filesystem usage 2023-07-28 19:12:04 +03:00
jsonutils.h Map editor can be built during single-app build 2022-12-05 22:28:01 +02:00
launcherdirs.cpp
launcherdirs.h
main.cpp
mainwindow.cpp Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
mainwindow.h Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
mainwindow.ui Fixes for map editor 2023-10-24 23:58:26 +02:00
mapcontroller.cpp Update editor and tests 2023-12-22 17:56:43 +02:00
mapcontroller.h Mod compatibility check is now in a separate class and not part of 2023-11-08 21:27:05 +02:00
mapeditor.ico
mapeditor.rc
maphandler.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
maphandler.h Redesign map editor rendering 2023-10-20 01:25:06 +02:00
mapview.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
mapview.h Add line and fill brushes 2023-10-14 02:58:13 +02:00
objectbrowser.cpp Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
objectbrowser.h Renamed Terrain.h/cpp -> TerrainHandler.h/cpp 2023-01-10 00:01:35 +02:00
playerparams.cpp Improvements to type safety of Identifier class 2023-10-04 18:05:23 +03:00
playerparams.h Town picker in player settings implemented 2023-09-11 20:37:26 +02:00
playerparams.ui Object picker implemented 2023-09-11 20:37:26 +02:00
playersettings.cpp Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
playersettings.h
playersettings.ui Allow single player on map and fix player params initialization 2023-04-02 14:31:57 +04:00
scenelayer.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
scenelayer.h Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
StdInc.cpp convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
StdInc.h convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
validator.cpp Remove std::vector<boo> from Json Serializer, simplify affected code 2023-11-15 15:55:18 +02:00
validator.h Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
validator.ui
vcmieditor.desktop
windownewmap.cpp Works more or less 2023-10-28 20:30:38 +02:00
windownewmap.h Support teams in map editor 2023-04-30 12:49:45 +04:00
windownewmap.ui Support teams in map editor 2023-04-30 12:49:45 +04:00