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

300 Commits

Author SHA1 Message Date
Xilmi
e6d907af55 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-18 09:52:59 +02:00
Ivan Savenko
49c5f650f7
Merge pull request #4437 from IvanSavenko/battle_sides
Unified handling of battle sides ID's
2024-08-14 18:37:05 +03:00
Ivan Savenko
5c7c4a7810
Merge pull request #4443 from IvanSavenko/fix_sonar
Fix miscellaneous issues discovered by Sonar
2024-08-14 17:12:27 +03:00
Ivan Savenko
cd6d55fe75 Do not try to shoot at 2nd hex of wide creatures 2024-08-14 10:38:59 +00:00
Xilmi
6bd442e6f1 BattleAI: Fix endless loop
Fixed an issue where the part of a 2-tile-unit that is outside of the map was considered a target and caused an endless-loop in the pathfinding being unable to get there.
2024-08-13 23:43:56 +02:00
Ivan Savenko
97f1a310df Fix miscellaneous issues discovered by Sonar 2024-08-12 18:26:30 +00:00
Xilmi
068e3bdc59 Fix endless loop
Fixed an endless-loop caused by someone removing this ", turn++".
2024-08-12 19:47:15 +02:00
Ivan Savenko
2a05fbdd50 Unified handling of battle sides ID's
- Replaced BattleSide namespace-enum with enum class
- Merged two different BattleSide enum's into one
- Merged BattlePerspective enum into BattleSide enum
- Changed all places that use integers to represent battle side to use
BattleSide enum
- Added BattleSideArray convenience wrapper for std::array that is
always 2-elements in size and allows access to its elements using
BattleSide enum
2024-08-11 20:54:44 +00:00
Xilmi
99e4052dc0 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-11 11:37:10 +02:00
Xilmi
a454ecfe38 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-10 11:05:28 +02:00
Andrii Danylchenko
9ffd6368d4 Add visual logger for battle interface 2024-08-10 10:54:20 +03:00
Andrii Danylchenko
51b8bc9fc3 BattleAI: fix shhoters waiting and reduce strength of our loss affecting decissions 2024-08-04 17:50:19 +03:00
Andrii Danylchenko
801e919e7e BattleAI: fix ap calculation in exchange variant 2024-08-03 20:35:20 +03:00
Andrii Danylchenko
9edb0afff8 BattleAI: fix dragonbreath retaliation 2024-07-28 14:41:32 +03:00
Andrii Danylchenko
da46d5d01b BattleAI: take into account defender dragon breath and other mutitarget attacks 2024-07-22 20:39:33 +03:00
Andrii Danylchenko
4e83deca92 BattleAI: fix waited attack calculation 2024-07-22 20:39:33 +03:00
Andrii Danylchenko
33e0eeaa8a BattleAI: fix dragon breath 2024-07-22 20:39:32 +03:00
Xilmi
6f9309696d Merge remote-tracking branch 'upstream/develop' into develop 2024-07-21 19:06:14 +02:00
Ivan Savenko
1c522c49b6 Fix possible crash on trying to move to invalid battlefield hexes 2024-07-20 18:28:13 +00:00
Xilmi
fa2f883361 Merge remote-tracking branch 'upstream/develop' into develop 2024-07-19 15:26:31 +02:00
Ivan Savenko
63bcf7d83c Replaced most of usages of CRandomGenerator with vstd::RNG in library 2024-07-16 13:13:07 +00:00
Ivan Savenko
60a51e98de Remove usage of std::function from CRandomGenerator 2024-07-16 13:13:07 +00:00
Xilmi
a821978d4e Merge remote-tracking branch 'upstream/develop' into develop 2024-07-12 17:43:04 +02:00
Ivan Savenko
6b8f94e6e7 Merge remote-tracking branch 'vcmi/master' into develop 2024-07-11 17:43:44 +00:00
Xilmi
98415e98da Spellcasting-bug-fix
Fixed a bug that prevented the AI from using spells when attacking an enemy settlement that has towers.
The bug was caused by noticing how greatly effective spells would be against towers but not being able to actually target them.
By skipping invalid targets, this no longer is an issue.
2024-07-10 14:36:35 +00:00
Xilmi
073c5bee45 Spellcasting fixes
Allowed the AI to cast spells that are aimed at a location instead of a unit. For example meteor shower.
Fixed an issue that caused the AI to not kill unit-stacks with spells due to only considering stacks where at least one unit survives in it's score-calculations.
2024-07-10 02:40:42 +02:00
Xilmi
13bbb573bd Spellcasting-bug-fix
Fixed a bug that prevented the AI from using spells when attacking an enemy settlement that has towers.
The bug was caused by noticing how greatly effective spells would be against towers but not being able to actually target them.
By skipping invalid targets, this no longer is an issue.
2024-07-09 22:55:39 +02:00
Alexander Wilms
02e429e973 Fix typos using https://github.com/crate-ci/typos
Changes were reviewed manually
2024-06-24 03:47:19 +02:00
Ivan Savenko
3bea383b59 Merge branch 'vcmi/beta' into 'vcmi/develop' 2024-06-21 12:58:36 +00:00
Ivan Savenko
0e4be8c776 Fix crash on sieging Citadel or Castle 2024-06-19 19:59:06 +00:00
Ivan Savenko
a9cf322f61
Merge pull request #4161 from vcmi/fix-4142
#4142 - sometimes Battle AI wants to attack unit which is behind a lo…
2024-06-19 21:28:58 +03:00
Andrii Danylchenko
fc32078a3a #4142 - sometimes Battle AI wants to attack unit which is behind a lot of obstackles and other units 2024-06-18 20:03:07 +03:00
Ivan Savenko
b7efa6c8cc Fixed potential thread races in Battle AI 2024-06-17 16:15:19 +00:00
Ivan Savenko
eb67e04ccb Remove old and unmaintained codeblocks project 2024-05-17 10:44:57 +00:00
Ivan Savenko
3f6eb13ee0 Delete old and unmaintained msvc project files 2024-05-17 10:44:11 +00:00
Andrii Danylchenko
0935f931fa BattleAI: fix bypassing 2-hex moat 2024-04-20 15:28:57 +03:00
Ivan Savenko
ced0bbe526 Remove "catch everything and silently ignore" block 2024-04-16 18:54:51 +03:00
Ivan Savenko
9e49587749 Replace bonus string description with metastring that can properly
handle translations
2024-04-09 16:13:30 +03:00
Ivan Savenko
7359b66f99 Do not use floating point equality checks 2024-02-14 12:07:07 +02:00
Ivan Savenko
9ebd194ab1
Merge pull request #3609 from IvanSavenko/single_process
Allow running server as part of client process
2024-02-14 12:06:22 +02:00
Ivan Savenko
4c70abbeb5 Reduced usage of global variables - removed or made const / constexpr 2024-02-12 13:49:45 +02:00
Ivan Savenko
a909d7ddde Removed cmake_modules/VCMI_lib macro, use it directly in place 2024-02-11 20:38:24 +02:00
Ivan Savenko
f08c9f4d59 Renamed ENABLE_STATIC_AI_LIBS option to match its actual effect 2024-02-11 17:55:02 +02:00
Andrii Danylchenko
ec5c44bb92
Merge pull request #3594 from vcmi/fix-3550
#3550 - fix case when unit is in reachability map but only next turn
2024-02-04 10:07:44 +02:00
Andrii Danylchenko
c66de29550 #3550 - fix case when unit is in reachability map but only next turn 2024-02-03 17:48:52 +02:00
Ivan Savenko
a9866bb5c6 Added RandomGeneratorUtil::nextItemWeighted convenience method 2024-01-31 00:17:40 +02:00
Ivan Savenko
d5c4478816 Remove most of non-const access to VLC entities 2024-01-19 13:54:49 +02:00
Ivan Savenko
bd5682ecc3 Merge remote-tracking branch 'vcmi/master' into develop 2024-01-19 13:49:54 +02:00
Alexander Wilms
73019c204d Replace redundant types with auto for the lvalues of template factory functions for smart pointers
grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > 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 = ":".join(line.split(":")[1:]).strip()

        print()
        print(path)
        print(original_code)
        prefix = "auto "
        if original_code.startswith("static"):
            static = True
        else:
            static = False

        cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
        print(cpp_type)

        if static:
            new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
        else:
            new_code = "auto "+ " ".join(original_code.split(" ")[1:])
        print(new_code)

        if True:
            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-17 12:50:00 +00:00
Ivan Savenko
a582cb554e
Merge pull request #3500 from IvanSavenko/fix_dendroid_bind
[1.4.3] Fix handling of Dendroid's Bind ability
2024-01-15 12:02:06 +02:00