1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
Commit Graph

197 Commits

Author SHA1 Message Date
Ivan Savenko
d04241b10a Code cleanup 2024-01-19 23:02:00 +02:00
Ivan Savenko
a15366f5a5 Make IObjectInterface::cb non-static 2024-01-19 13:55:21 +02:00
Ivan Savenko
d5c4478816 Remove most of non-const access to VLC entities 2024-01-19 13:54:49 +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
Andrii Danylchenko
26b6d1cf74 NKAI: fix capturing shipyards 2023-12-02 14:03:54 +02:00
Ivan Savenko
20ef3a69e7 Fix most of memleaks discovered by valgrind 2023-11-13 16:27:15 +02: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
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
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
Evgeniy Meshcheryakov
ecf9b1aa2f Fix NKAI compilation with NKAI_PATHFINDER_TRACE_LEVEL>=2 2023-09-04 10:08:56 +03:00
Ivan Savenko
87957e74c1 Replaced boost::thread_specific_ptr with thread_local 2023-08-23 16:32:29 +03:00
Andrii Danylchenko
f1a9ae99ee NKAI: various behavior fixes, undo max_gold_preasure 2023-07-31 22:01:12 +03:00
Andrii Danylchenko
fb7477047a NKAI: loosen gold presure on build system. 2023-07-31 22:01:12 +03:00
Andrii Danylchenko
202e13ce2e NKAI: log paths scan depth 2023-07-31 22:01:11 +03:00
Andrii Danylchenko
5083100d3b NKA: fix accessing removed hero and heroExchangeCount 2023-07-31 22:01:11 +03:00
Andrii Danylchenko
b19ac01bf9 Fuzzy rework, added more defence and gather army routines 2023-07-31 22:01:10 +03:00
Andrii Danylchenko
b1ca663eb6 Fuzzy rework 2023-07-31 22:01:10 +03:00
Andrii Danylchenko
38a98387e4 Temp fix for blocked in garrison ai. 2023-07-31 22:01:10 +03:00
Ivan Savenko
85262cf4f5 Moved CGameState files into a separate directory 2023-06-26 17:15:59 +03:00
Ivan Savenko
08cfbe79cf Added encapsulation for movement points access 2023-06-25 17:42:36 +03:00
Ivan Savenko
ebc7a82c2e Converted pathfinder enum's to enum class 2023-06-21 15:38:57 +03:00
Ivan Savenko
f78470a301 Fix build 2023-06-21 14:55:25 +03:00
Ivan Savenko
bd4d2788ed Split pathfinder into multiple smaller files 2023-06-21 13:46:09 +03:00
Ivan Savenko
87fcfa4add Removed excessive pathfinder includes 2023-06-21 12:00:44 +03:00
Ivan Savenko
6aedb99117 Cleaned up IShipyard interface 2023-06-16 17:59:10 +03:00
Ivan Savenko
acac42291e Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
Andrii Danylchenko
0829593356 NKAI: composite pathfinder actions and fix for guarded bordergate 2023-05-07 09:15:37 +03:00
Konstantin
86f5d6de69 vcmi: modernize headers 2023-04-30 13:35:54 +03:00
Andrii Danylchenko
fbc9a32ad8 #2018 - fix shipyard usage for NKAI, allied shipyard should work now 2023-04-22 18:42:36 +03:00
Andrii Danylchenko
d347db4c16 Fix hero count calculation for resourceful ai mod 2023-04-22 14:47:31 +03:00
nordsoft
0a28262c15 Merge remote-tracking branch 'upstream/develop' into boats
# Conflicts:
#	AI/VCAI/Pathfinding/AINodeStorage.cpp
2023-04-19 02:22:19 +04:00
nordsoft
37027ad17f Fix AI boat logic 2023-04-18 18:33:44 +04:00
Konstantin
7a5775a9f9 vcmi: use std::optional 2023-04-17 00:43:13 +03:00
Konstantin
11b237a23c vcmi: massive refactoring v1 2023-04-05 22:33:12 +03:00
Andrii Danylchenko
34abc9f82d NKAI: disallow using allied shipyard 2023-04-02 10:04:10 +03:00
Andrey Filipenkov
3602645a30 improve iterating over EPathfindingLayer 2023-03-20 11:35:19 +03:00
Andrii Danylchenko
fa9e1d2d83 NKAI: fix crash 2023-03-12 16:31:15 +02:00
Andrii Danylchenko
4bf570763a NKAI: improve neutral town priority handling, reduce priority of objects like star axis 2023-03-12 16:31:15 +02:00
Ivan Savenko
05a1d7c6e3 All text for factions/towns/building are passed through translator 2023-01-20 15:18:36 +02:00
Ivan Savenko
fa6f7513e8 All heroes-related strings are passed through translator 2023-01-20 15:18:36 +02:00
Ivan Savenko
eb20a4b208 Merge remote-tracking branch 'vcmi/develop' into warnings_fix 2022-12-23 14:40:45 +02:00
Andrii Danylchenko
56bf8ec2c4 #1228 - prevent second AI activation on AI defeat due to wrong EndTurn packet 2022-12-14 22:13:26 +02:00
Andrii Danylchenko
01980f4310 Small optimization of NKAI pathfinder 2022-12-10 22:08:16 +02:00
Ivan Savenko
8dcecdc235 Fix deprecation warning 2022-12-09 14:16:23 +02:00
Andrii Danylchenko
233b850daf NKAI: a few crash/hang fixes 2022-11-07 13:58:20 +02:00
Andrii Danylchenko
ebf4854801 Battle AI: add some comments + refactoring 2022-10-23 11:41:03 +03:00
Andrii Danylchenko
eeea01d778 NKAI: namespace 2022-10-04 08:40:14 +03:00
Andrii Danylchenko
2434fe3f6f NK: fix AI speed 2022-10-01 13:49:27 +03:00
DjWarmonger
58a3abb643
Merge pull request #963 from vcmi/terrain-rewrite
Terrain rewrite
2022-09-29 18:24:05 +02:00
Andrii Danylchenko
878aabd4d6
Merge pull request #981 from kambala-decapitator/fix-analyzer-warnings
Fix Clang Analyzer warnings
2022-09-29 19:23:24 +03:00
Tomasz Zieliński
f386f42166 Merge remote-tracking branch 'origin/develop' into terrain-rewrite
# Conflicts:
#	lib/Terrain.cpp
#	lib/Terrain.h
#	lib/battle/CBattleInfoEssentials.cpp
#	lib/rmg/ObstaclePlacer.cpp
#	lib/rmg/RiverPlacer.cpp
2022-09-27 07:50:17 +02:00
Tomasz Zieliński
fd63cb6109 and here 2022-09-25 08:07:22 +02:00
Andrey Filipenkov
659be89a01 remove setting values that are never read 2022-09-24 16:52:38 +03:00
Andrey Filipenkov
ff635edc0b wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined
preparation for having client and server in a single process
2022-09-24 15:55:21 +03:00
Tomasz Zieliński
a5077245a8 Merge remote-tracking branch 'origin/develop' into terrain-rewrite
# Conflicts:
#	lib/Terrain.cpp
#	lib/Terrain.h
2022-09-23 20:01:13 +02:00
Andrey Filipenkov
c9c79887a7 remove unused variables 2022-09-22 11:54:10 +03:00
Andrey Filipenkov
1d57c40740 wrap && conditions in parentheses when near || 2022-09-22 11:54:09 +03:00
Andrey Filipenkov
a1cf120ea6 add missing virtual destructors 2022-09-22 11:54:09 +03:00
Tomasz Zieliński
494b0f0226 First version that compiles 2022-09-21 11:34:23 +02:00
DjWarmonger
7ba271edf1
Rotation rebase2 (#912)
* Instead of [x][y][z] coordinates, map will be stored as [z][x][y].
* Nullkiller AI can get it too.
* Use boost::multi_array instead of nested vectors
* In MapHandler too
* Rotate foreach algorithms, too
* VCAI gets rotated, too
2022-09-18 17:39:10 +03:00
Nordsoft91
aaa07e4d2e New terrain support - part 1 (#755)
Initial support of new terrains
2022-09-11 11:31:26 +03:00
Andrii Danylchenko
31c9d6e28d Fix performance issue related to TurnInfo construction 2022-06-06 09:47:37 +03:00
Andrii Danylchenko
fa9a420f99 Fix a few crashes 2022-04-17 09:10:53 +03:00
Andrey Filipenkov
fc064b1c45 replace boost::chrono with std::chrono 2021-11-23 10:23:55 +03:00
Andrii Danylchenko
d47564955e Nullkiller: fix/refactor temporary bonus nodes, fix gather army quest completion 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
70ed3f55a5 Nullkiller: replace a hack with temporary bonus node concept 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
3fa7e0976f Nullkiller: update / fix build, core changes required for Nullkiller AI 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
b4241670ba Nullkiller: rename VCAI to AIGateway 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
87a8c776c9 Nullkiller: reduce memory usage for x86 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
7184364bcb Nullkiller: disable logging and fix tbb build 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
bc95e4b935 Fix tbb build 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
1aa81530cb Nullkiller: cancel heavy decomposition on shipyards 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
9a203b8af9 Nullkiller: parallel object clusterization, stabilization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
66843b22d3 Nullkiller: async hero chain calculation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
0265de77fa Nullkiller: fix crash, refactor 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
fb3cda666f Nullkiller: tbb and hero chain calculation optimization and parallel cpathfinder initialization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
0ffc7c3b94 Nullkiller: turn limit for main heroes 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
4c01a8eec4 Nullkiller: fix a few crashes 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
3d91f2e988 Fix defence crashes and hangs 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
3dc76cfe35 Nullkiller: fix crash when buy army through pathfinder 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
45942cfbbe Nullkiller: stabilization, fix memory leaks 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
7e88819105 Nullkiller: fix crash and freeze 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
80df879489 Nullkiller: stabilization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
f2c26d7553 Nullkiller: thread interuption point 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
3822d788e8 Nullkiller: allow buy army through pathfinder 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
f0ceaf5852 Nullkiller: improve perofrmance of AI pathfinding 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
cf4484e071 Nullkiller: stabilization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
e385c83a88 Nullkiller - rewrite decomposition, decomposition cache, morale management 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
35a1167f3d Nullkiller: refactoring and stabilization of gather army & clusterization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
1fdf0de75d Nullkiller: clusterization fixes, heroes clusterization for additional mains in case of locked heroes 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
645c393e25 Nullkiller: fix freeze on accessing guarded object 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
5bfe71c8f3 Nullkiller: small optimization of AIPathfinder for big maps 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
3e9bf9b662 Nullkiller: try to fix build 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
32fb465823 Nullkiller: stabilization+clasterization improvements+fuzzy fear 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
75b8ee74fa Nullkiller: stabilisation after refactoring 2021-07-26 21:02:50 +03:00