1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00
Commit Graph

562 Commits

Author SHA1 Message Date
a8f9ac41e1 Fix no damage chance for catapult with no ballistics 2025-03-13 17:50:18 +01:00
a061ed04de Remove usage of ConstTransitivePtr from CTown 2025-03-08 14:04:51 +00:00
9f713a0914 Rename int3::valid to isValid for consistency 2025-03-03 10:46:00 +00:00
a8a6be7ac1 Fix potential compatibility with C++20 / C++23 mode
This fixes several issues with compatibility with C++20. C++23 was also
tested, but apparently it does not have any additional breaking changes
compared to C++20 (or we don't have those).

VCMI still uses C++17 as before - goal is only to make potential
transition easier.

There were 2 cases that are deprecated in C++20 that we use:
- Floating point operations on enums are deprecated
- `this` can no longer be captured when using default capture by value
`[=]`

Both of those should now be replaced with code that works fine in both C+
+17 and in C++20 mode
2025-03-02 14:11:48 +00:00
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
ec970c7b22 Support for configuring minimal cost for moving between tiles
- Added `movementCostBase` parameter to game config that defines minimal
amount of movement points that will be spent when moving from one tile
on another while offroad (and cost of Fly / Town Portal spells)
- Added `BASE_TILE_MOVEMENT_COST` bonus type that allows modifying
`movementCostBase` on per-hero basis

Example usage for hota-like pathfinding skill
```json
"tileCostReduction" : {
	"type" : "BASE_TILE_MOVEMENT_COST",
	"val" : -15
}
```
2025-02-03 22:52:33 +00:00
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
30bd975f95 Use unit->getHexes()
instead of battle::Unit::getHexes(stack->getPosition(), stack->doubleWide(), stack->unitSide())
2025-01-21 13:23:18 +01:00
ecdd394bb1 Use BattleHex as const ref wherever possible
Minor Fixes
Drop unused function from BattleHexArray
2025-01-21 13:23:17 +01:00
5bfc837a8f Fix regressions from battlehex PR (mostly related to towers) 2025-01-12 11:07:50 +00:00
48473b18f6 move checks for invincible bonus to UnitState & cache 2025-01-10 21:15:37 +00:00
40bff74195 Use small vector for unit list 2025-01-10 18:58:46 +00:00
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
4031006317 Drop battle elapsed time measurement, restore avHexes.
Github validation report fixes.
2025-01-06 23:28:47 +01:00
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
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
8c3a417527 Cleanup 2025-01-06 23:18:20 +01:00
5f799d41b3 Use cached neighbouring tiles where possible 2025-01-06 23:18:19 +01:00
a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01:00
95a07ee5cb Use bonus system cache whenever possible 2024-12-21 18:47:11 +00:00
1960d66971 fix INVINCIBLE 2024-12-01 12:25:27 +01:00
aef6b0cc00 Fix several new issues detected by SonarCloud 2024-11-20 16:06:38 +00:00
dfe6e04464 Implemented semi-transparent spell effects 2024-11-17 19:48:16 +00:00
08fbcd5239 TerrainTile now uses identifiers instead of pointers to VLC 2024-10-30 16:22:11 +00:00
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
3dd4fa2528 Reduce usage of pointers to VLC entities
Final goal (of multiple PR's) is to remove all remaining pointers from
serializeable game state, and replace them with either identifiers or
with shared/unique pointers.

CGTownInstance::town and CGHeroInstance::type members have been removed.
Now this data is computed dynamically using subID member.

VLC entity of a town can now be accessed via following methods:
- getFactionID() returns ID of a faction
- getFaction() returns pointer to a faction
- getTown() returns pointer to a town

VLC entity of a hero can now be accessed via following methods:
- getHeroTypeID() returns ID of a hero
- getHeroClassID() returns ID of a hero class
- getHeroType() returns pointer to a hero
- getHeroClass() returns pointer to a hero class
2024-10-10 12:28:08 +00:00
a8f8c3f4b1 Replaced most of accesses to CGObjectInstance::pos with anchorPoint() 2024-10-09 15:43:46 +00:00
c0f5c7c0ea Replace pointer with reference in pack apply functions 2024-10-07 14:59:46 +00:00
b85ccccb37 Minor refactoring of translations:
- removed unsuccessful and broken validation of translations
- pass JsonNode when registering strings to provide information on mod
source
2024-10-06 19:42:15 +00:00
f816c3306b Merge pull request #4694 from Laserlicht/spell_cast_only_self
cast only on self
2024-10-01 17:20:20 +03:00
e6cb87abac cast only on self 2024-09-28 17:32:53 +02:00
63b711758f Fix chain lightning wasting effect on creatures immune to magic 2024-09-28 17:22:26 +02:00
19db016473 Merge pull request #4654 from dydzio0614/any-hex-shooting
Allow targeting empty hex by shooters with multi-tile SPELL_LIKE_ABILITY
2024-09-27 19:23:33 +03:00
bb69ab1a1a Fix assert and condition for counting spell hexes 2024-09-22 18:25:18 +02:00
1a2d349267 Initial unconditionally working version 2024-09-22 15:07:44 +02:00
899d3a14a0 only blocking non positive spells; counterstrike 2024-09-21 23:50:35 +02:00
cb96b9959e Merge pull request #4623 from Laserlicht/invincible_bonus
INVINCIBLE bonus
2024-09-20 11:50:29 +03:00
b36c05df1d INVINCIBLE bonus 2024-09-19 03:14:45 +02:00
0aaafc4c8a cast without skip 2024-09-14 15:10:24 +02:00
8225eb454e Added GameSettings to gamestate, potentially allowing to define game
settings per map (or in random map template)
2024-09-05 15:16:27 +00:00
36c1ed670f Support for configurable town fortifications
Removed most of hardcoded checks for fort level or for presence of fort/
citadel/castle buildings.

It is now possible to define which parts of town fortifications are
provided by town buildings

Configuration for H3-like fortifications is provided in
buildingsLibrary.json and will be used automatically by mods as long as
mods have buidings named "fort", "citadel" and "castle".

Alternatively, mods can separately define:
- hitpoints of walls (shared value for all sections)
- hitpoints of central, upper and lower towers (separate values)
- presence of moat
- shooters for each tower (separate values)
2024-08-28 19:42:14 +00:00
a481f07daf PlayerState now stores all objects owned by player 2024-08-28 12:51:27 +00:00
0d5a9b8e3b Refactor for previous fix in CSpellHandler 2024-08-23 09:43:41 +02:00
e7b94014e1 allow lowercase 'X' in spellRangeInHexes 2024-08-18 18:46:54 +02:00
49c5f650f7 Merge pull request #4437 from IvanSavenko/battle_sides
Unified handling of battle sides ID's
2024-08-14 18:37:05 +03:00
6ab97bad7e Merge pull request #4433 from IvanSavenko/spell_cleanup
Minor cleanup of SpellHandler
2024-08-14 17:05:22 +03:00
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
c34956e912 introduce getModScope method toEntity class and subclasses 2024-08-10 16:08:04 +02:00
a4fa409d1f Parse spell range on load instead of on every cast attempt 2024-08-10 12:22:21 +00:00
a3b2c49c79 Remove leftovers from old VLC serialization code 2024-08-09 22:26:46 +00:00