1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

383 Commits

Author SHA1 Message Date
Ivan Savenko
313fa1e80e Remove commented-out code 2025-01-30 11:31:54 +00:00
Ivan Savenko
d8ec69bfaa Remove non-const iterators to BattleHexArray container
Replaced with several non-const methods to prevent modification of
internal storage without corresponding modification of internal flags
2025-01-29 23:02:51 +00:00
Ivan Savenko
f858a6e04b
Merge pull request #5266 from MichalZr6/battlefield
Minor fixes to BattleHexArray. BattleHex'es as const reference where possible.
2025-01-25 17:44:14 +02:00
Ivan Savenko
2ee5f2df02
Merge pull request #5295 from IvanSavenko/bugfixing
[1.6.4] Bugfixing for recently reported issues
2025-01-21 15:50:02 +02:00
MichalZr6
a1593948b7 Restore LF, use JsonKeys for logging, fix BattleHex description 2025-01-21 13:23:17 +01:00
MichalZr6
ecdd394bb1 Use BattleHex as const ref wherever possible
Minor Fixes
Drop unused function from BattleHexArray
2025-01-21 13:23:17 +01:00
MichalZr6
8f63a82d60 Minor changes with BattleHex and BattleHexArray 2025-01-21 13:23:17 +01:00
Ivan Savenko
2d6ae7859b Fixes BattleAI not selecting best hex when approaching nearest enemy 2025-01-19 16:38:50 +00:00
Ivan Savenko
e829d723b2 Replace global bonus tree change counter with per-node counter 2025-01-12 12:23:07 +00:00
Ivan Savenko
3d1bf03a25 Fix potential concurrent access 2025-01-12 11:06:00 +00:00
Ivan Savenko
5cff9af236 Reduce BattleAI logging 2025-01-10 19:45:35 +00:00
Ivan Savenko
40bff74195 Use small vector for unit list 2025-01-10 18:58:46 +00:00
Ivan Savenko
797b62fd46 Try to implement lazy evaluation for reachability map 2025-01-10 17:43:45 +00:00
Ivan Savenko
2d5b5d94e7 Optimize computation of reachability map 2025-01-10 15:38:28 +00:00
MichalZr6
dbe82b94f6 Changes following review:
- shared_ptr for destructibleEnemyTurns instead of raw pointer
- drop implicit int conversion for BattleHex class
  and implement toInt() instead
- implement necessary operators in BattleHex
- adjust code to work properly with JSON serializer
2025-01-08 07:24:43 +01:00
MichalZr6
dad6437661 Refactor BattleHex, remake the use of precomputed neighbouring tiles containers.
- Moved short, frequently used functions to the BattleHex header for inlining
- Made BattleHex a class with a private hex value
- Moved getClosestTile implementation back to BattleHex
- Enabled access to static precomputed data in BattleHexArray via BattleHex
(note: circular dependency prevented static precomputed containers being directly placed in BattleHex)
2025-01-06 23:28:46 +01:00
MichalZr6
ac8104d56d SonarCloud recomendations.
Code review follow-up:
- Replace std::vector with boost::small_vector
- Rename function merge to insert
2025-01-06 23:28:45 +01:00
MichalZr6
44a645b5e0 use bitset for presenceFlags and steady_clock for measurments 2025-01-06 23:28:45 +01:00
MichalZr6
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
MichalZr6
8c3a417527 Cleanup 2025-01-06 23:18:20 +01:00
MichalZr6
5f799d41b3 Use cached neighbouring tiles where possible 2025-01-06 23:18:19 +01:00
MichalZr6
a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01:00
Ivan Savenko
78fc6d0e41 Remove unused code 2025-01-04 15:09:50 +00:00
Ivan Savenko
9f4e92b5f6 Fix computation of spell value when attacker can't reach enemies behind
walls in siege combat
2025-01-04 14:01:40 +00:00
Ivan Savenko
c4623aad0f Backported fix for BattleAI not casting spells that would kill entire
unit
2025-01-04 12:23:36 +00:00
Ivan Savenko
bb7cf3ffbf Use existing callback method instead of custom one in AI 2024-12-14 14:53:34 +00:00
Xilmi
f56681d521 Removed weird logic that prevented AI from casting spells.
What was the rationale? AI loses fights with full Mana that it could easily have won otherwise. I just removed that weird logic and now it uses it's mana and wins.
2024-12-08 21:43:17 +01:00
Xilmi
df21a77857 Battle-AI-improvements
When defending the AI is now much smarter to use their defensive-structures like walls, towers and the moat to their advantage instead of allowing them to be lured out and killed in the open.

A penalty-multiplier is now applied when deciding which units to walk towards. If an ally is closer than us to the enemy unit in question, we reduce our score for walking towards that unit too. This shall help against baiting a whole flock of AI-stacks to overcommit on chasing an inferior stack of the enemy.
2024-12-05 21:09:24 +01:00
Ivan Savenko
5332ad59a4 Remove copy-pasted code 2024-11-26 19:13:10 +00:00
Xilmi
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02:00
Xilmi
c838f5d0c2 Update BattleEvaluator.cpp
Restored spell-damage-calculations for units that would die from spells.
2024-10-11 20:27:18 +02:00
Ivan Savenko
a8e84c55f6 Fix some of the new warnings from sonarcloud 2024-10-11 10:45:29 +00:00
Xilmi
9a40577994 Merge remote-tracking branch 'upstream/develop' into develop 2024-10-08 16:15:22 +02:00
Ivan Savenko
c0f5c7c0ea Replace pointer with reference in pack apply functions 2024-10-07 14:59:46 +00:00
MichalZr6
259fcedc85 Fix flying units move into damaging obstacles 2024-10-03 23:03:36 +02:00
Xilmi
1d831022e8 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-25 14:08:34 +02:00
Ivan Savenko
76e3ca4afe Fix potential access to destroyed variable on stack 2024-09-22 20:32:20 +00:00
Xilmi
d679ee72b9 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 12:21:20 +02:00
Ivan Savenko
6832a5c4be
Merge pull request #4599 from MichalZr6/fix_hero_access_check
Fix error "hero access check" flooding console during quick-battle
2024-09-20 13:01:49 +03:00
Laserlicht
a1384bf47f defending, when not possible to attack invincible 2024-09-19 20:54:50 +02:00
MichalZr6
cb9070fb5b Fix unnecesarry error log in console from CBattleInfoEssentials::battleGetFightingHero 2024-09-15 08:51:05 +02:00
Xilmi
a1a03d4b74 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-12 14:54:39 +02:00
Ivan Savenko
39a2c29c97 Removed creatureBank flag from battle, battles now receive BattleLayout
struct that defines how units are placed in combat
2024-09-12 12:11:18 +00:00
Ivan Savenko
48b0a222a0
Merge pull request #4570 from kdmcser/crash_fix
fix Ballista Bank Mod auto combat crash
2024-09-12 14:16:41 +03:00
Xilmi
d4fd4ed670 Update BattleEvaluator.cpp
Make sure trace-message doesn't crash from accessing invalid element.
2024-09-11 16:05:53 +02:00
kdmcser
312403962b
Update BattleExchangeVariant.cpp
fix.compile error
2024-09-11 11:39:03 +08:00
kdmcser
bb759dc2b8 fix compile error 2024-09-11 01:43:30 +08:00
kdmcser
58cdbccf21
Update AI/BattleAI/BattleExchangeVariant.cpp
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-09-10 15:29:11 +08:00
Xilmi
5999c6d891 Update BattleEvaluator.cpp
Removed now unnecessary additional check for dead units.
2024-09-09 19:54:20 +02:00
kdmcser
c5b598b277 fix Ballista Bank Mod auto combat crash 2024-09-08 01:05:03 +08:00