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 |
|
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én
|
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 |
|
Ivan Savenko
|
85de3143ff
|
Fixed Genie spellcasting logic to account for spell immunities
|
2023-12-24 01:13:19 +02:00 |
|
Dydzio
|
fe39faf36c
|
Add UNTIL_OWN_ATTACK bonus duration and use for berserk
|
2023-12-19 19:52:40 +01:00 |
|
Andrii Danylchenko
|
26b6d1cf74
|
NKAI: fix capturing shipyards
|
2023-12-02 14:03:54 +02:00 |
|
Ivan Savenko
|
d326c53b9a
|
AI will now respect current value of "Use spells in autocombat" setting
|
2023-11-28 15:48:35 +02:00 |
|
Ivan Savenko
|
60ca6f968c
|
Fix hero limit check in AI
|
2023-11-27 14:08:49 +02:00 |
|
Ivan Savenko
|
ff6260e5c5
|
Merge pull request #3195 from IvanSavenko/identifier_string_serialization
Serialize Identifiers that can be added by mods as strings
|
2023-11-20 14:07:24 +02:00 |
|
Ivan Savenko
|
b58301849b
|
Pass functor via reference to avoid costly copies
|
2023-11-18 19:43:11 +02:00 |
|
Ivan Savenko
|
9b8145f522
|
Compute creature speed only once during evaluation
|
2023-11-18 19:41:29 +02:00 |
|
Ivan Savenko
|
9f906ff1d2
|
Remove pointer to CGObjectInstance from map header
|
2023-11-17 16:39:15 +02:00 |
|
Ivan Savenko
|
76956cfe3a
|
Merge pull request #3188 from IvanSavenko/remove_identifier_implicit_int_conversion2
Remove implicit conversion of identifier to integer
|
2023-11-16 17:26:32 +02:00 |
|
Ivan Savenko
|
52050d0ef1
|
Fix build
|
2023-11-15 15:55:19 +02:00 |
|
Ivan Savenko
|
96c81be68e
|
Win/loss conditions now use VariantIdentifier. Removed non-implemented
options
|
2023-11-15 15:55:19 +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 |
|
Alexander Wilms
|
ed86a917eb
|
AI/BattleAI/BattleAI.cpp: Use Class template argument deduction for wallParts array
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
|
2023-10-29 13:34:19 +00:00 |
|
Alexander Wilms
|
0232ae5327
|
AI/BattleAI/BattleEvaluator.cpp: Convert this integer literal to a bool literal.
Integer literals should not be cast to bool
|
2023-10-29 13:34:19 +00:00 |
|
Alexander Wilms
|
bfddc90ff4
|
AI/BattleAI.cpp: Use "std::array" or "std::vector" instead of a C-style array.
Variables of array type should not be declared cpp:M23_356
|
2023-10-29 13:34:19 +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 |
|
Alexander Wilms
|
457e73ed12
|
AI/BattleAI/BattleExchangeVariant.cpp: Do not assign data members in a constructor. Initialize members in an initialization list.
Member data should be initialized in-class or in a constructor initialization list
|
2023-10-27 23:34:11 +00:00 |
|
Alexander Wilms
|
b10b1a5444
|
AI/BattleAI/BattleExchangeVariant.cpp: This function should be declared "const".
Member functions that don't mutate their objects should be declared "const"
|
2023-10-27 23:34:11 +00:00 |
|
Alexander Wilms
|
af330ff038
|
AI/BattleAI/BattleEvaluator.cpp: Remove this redundant cast.
Redundant casts should not be used
|
2023-10-27 18:19:17 +00:00 |
|
Alexander Wilms
|
f01ec55d21
|
Use the "nullptr" literal.
"nullptr" should be used to denote the null pointer
|
2023-10-27 18:18:59 +00:00 |
|
Alexander Wilms
|
bcaa2e5966
|
AI/VCAI/VCAI.cpp: Remove "e" from "throw" statement to rethrow the original exception.
The original exception object should be rethrown
|
2023-10-27 14:29:44 +00:00 |
|
Ivan Savenko
|
5cbf5031ea
|
move SetStackEffect to a separate file
|
2023-10-24 01:27:52 +03:00 |
|
Ivan Savenko
|
b88a8da4e8
|
Split off some netpack structures into separate files
|
2023-10-23 13:59:15 +03:00 |
|
Andrii Danylchenko
|
f74daa2e1f
|
BattleAI: fix health bounty calculation
|
2023-10-22 22:06:42 +03:00 |
|
Andrii Danylchenko
|
870fbd50e3
|
BattleAI: bigger reachability map
|
2023-10-22 21:37:55 +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
|
3880ea58b9
|
Merge branch 'josch/dos2unix' into develop
|
2023-10-22 18:39:03 +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 |
|