Commit Graph
378 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
Alexander Wilms bc781c28e0 Remove trailing semicolon from NET_EVENT_HANDLER macro 2024-01-14 14:49:25 +00:00
Alexander Wilms f3277b7953 Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
Joakim ThorénandAndrey Filipenkov daf9f9f7f5 Re-add const that was erronously removed with 88ec4fa
Co-authored-by: Andrey Filipenkov <kambaladecapitator@gmail.com>
2023-12-30 11:01:21 +01:00
Joakim Thorén 88ec4fa0e7 Use getTileThreat-helper instead of directly accessing hitMap with tile coordinates 2023-12-29 23:12:06 +01:00
Joakim Thorén 61314a36f6 Fix copy-paste mistake 2023-12-27 22:35:43 +01:00
Joakim Thorén 406d136cdc Fixes warnings about possibly dangling references 2023-12-27 22:24:58 +01:00
Andrii Danylchenko 26b6d1cf74 NKAI: fix capturing shipyards 2023-12-02 14:03:54 +02:00
Ivan Savenko 60ca6f968c Fix hero limit check in AI 2023-11-27 14:08:49 +02:00
Ivan Savenko 20ef3a69e7 Fix most of memleaks discovered by valgrind 2023-11-13 16:27:15 +02:00
Ivan Savenko 4a7fa9bf8c Simplified CTypeList class 2023-11-08 22:05:36 +02:00
Ivan Savenko 6b81012f31 Use variant identifier in netpacks where applicable 2023-11-08 14:00:23 +02:00
Ivan Savenko 10e50548e7 Converted Component class to use VariantIdentifier instead of int 2023-11-02 12:00:04 +02:00
Ivan Savenko 8346d71c98 Remove more subID access 2023-11-01 14:44:05 +02:00
Ivan Savenko 7107b3202f Merge pull request #3069 from SoundSSGood/artifact-location-id
ArtifactLocation now use ID for artHolder identification
2023-11-01 14:41:36 +02:00
SoundSSGood ab2f6abb87 ArtifactLocation now use ID for artHolder identification part2 2023-10-29 17:46:13 +02:00
SoundSSGood 61fc236d79 ArtifactLocation now use ID for artHolder identification part1 2023-10-29 17:46:13 +02:00
Alexander Wilms 5cbc75d3b7 Merge remote-tracking branch 'upstream/develop' into develop 2023-10-29 13:35:37 +00:00
Ivan Savenko 0169c65937 Merge pull request #3100 from IvanSavenko/split_net_packs
Split netpacks.h into multiple files
2023-10-29 13:46:40 +02:00
Alexander Wilms 0a6c82c639 AI/Nullkiller/Behaviors/DefenceBehavior.{h,cpp}: treat -> threat 2023-10-27 23:34:11 +00:00
Ivan Savenko b88a8da4e8 Split off some netpack structures into separate files 2023-10-23 13:59:15 +03:00
Andrii Danylchenko 9eb9404f28 BattleAI: divide only positive part of score onto turns count 2023-10-22 21:37:54 +03:00
Ivan Savenko 4f47555977 Split OBJECT bonus source into OBJECT_TYPE and OBJECT_INSTANCE 2023-10-22 16:55:19 +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
Ivan Savenko 454ba44ac5 Merge pull request #2988 from IvanSavenko/configurable_extensions
Extension of configurable object functionality
2023-10-22 16:24:47 +03:00
Alexandre Detiste 15e45f966c typos found by lintian 2023-10-17 22:06:08 +02:00
Ivan Savenko fd01a25352 Implemented basic version of configurable Witch Hut 2023-10-16 00:12:38 +03:00
nordsoft fadf086e61 Fix review comments 2023-10-12 13:30:01 +02:00
nordsoft 7ccd4cdcb2 Refactor quests progress 2023-10-11 21:10:42 +02:00
nordsoft 5b10b457cf Fix code review suggestions 2023-10-11 00:47:19 +02:00
nordsoft 5eeda3cd25 Quests mostly work 2023-10-10 23:44:29 +02:00
nordsoft bb238f9b72 New quests work 2023-10-10 23:44:29 +02:00
nordsoft 1460541ee5 New limiter based quests 2023-10-10 23:44:29 +02:00
Ivan Savenko 46e4d862a5 Fix AI recruitment 2023-10-04 17:47:12 +03:00
Ivan Savenko 39a92cdde3 Add query for dwellings dialog 2023-10-04 17:47:12 +03:00
Ivan Savenko 898733eed7 Added Query to track visit duration for Taverns and Markets 2023-10-04 17:47:12 +03:00
Andrii Danylchenko ebe155fa95 NKAI: mana recovery 2023-09-30 10:37:36 +03:00
Andrii Danylchenko 2dd0d76412 NKAI: water and air walking 2023-09-30 10:37:32 +03:00
Maxim Korotkov f874d27797 AI: removed redundant checks
The pointers "up" and "down" were checked against nullptr
but it's always non-null
Also added curly braces for if statement. It's good practice
for avoiding shooting yourself to the foot

Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
2023-09-27 09:05:58 +03:00
nordsoft 5f2023c8d5 Fix typo 2023-09-23 04:33:08 +02:00
Ivan Savenko 8c0d78f1d9 Added initiator-player to packs that add/remove/move objects 2023-09-19 19:24:34 +03:00
Ivan Savenko c8e6a7cd27 Fixed most common cases of movement actions 2023-09-16 20:07:26 +03:00
Andrii Danylchenko 988531c6cb Merge pull request #2845 from Alexander-Wilms/fuzzylite
Support include path of more recent fuzzylite versions
2023-09-16 11:05:55 +03:00
Andrii Danylchenko a005829a57 NKAI: cancel checking building which needs itself as prerequisite 2023-09-16 11:04:28 +03:00
Alexander Wilms 6c15e5b426 Add include path of a more recent version of fuzzylite, which is required to build it with gcc 12.2.0
https://github.com/fuzzylite/fuzzylite/commit/a651f3d13e192352d7a02ee9da65ab591a963ab9
2023-09-16 05:13:16 +00:00