Commit Graph
128 Commits
Author SHA1 Message Date
Ivan Savenko 07eee98dd3 Fix build 2026-04-30 18:00:56 +03:00
Ivan Savenko af1db8ff19 Fix sonar, remove no longer used code 2026-04-30 18:00:56 +03:00
Ivan Savenko fa386bf089 Cleanup code, update docs, fix build 2026-04-30 18:00:55 +03:00
Ivan Savenko d556dd1590 All but 4 summon effect test now pass
- Added logging support for Lua
- Added exporting of enums to Lua
- Added few more missing pieces to support summon spell effect
2026-04-30 18:00:38 +03:00
Ivan Savenko 6ad93dd3eb Reworked Lua API type safety
- pushing type that is derived from type registered in Lua will now
correctly push type known to Lua
- Methods of types stored on stack as shared pointers now actually load
this as shared pointer
- It is now possible to return types other than Json from Lua function
2026-04-30 18:00:38 +03:00
Ivan Savenko 32630a95b3 Implement resolving string -> entity for Lua 2026-04-30 18:00:38 +03:00
Ivan Savenko f2076069b7 Moved all Lua-related code into lua module, instead of weird split
between library and lua module
2026-04-30 18:00:37 +03:00
Ivan Savenko 826db7e548 Lua refactoring part 1
- Scripting module and lua dependency are now required.
- Script context pool now only exists in gamestate
- removed unused pools from client and server
- scripts are now registered in pools on start instead of lazy
registering with caching
2026-04-30 18:00:30 +03:00
Ivan Savenko de98e6c39c First attempt at using Lua for actual spell effect 2026-04-30 17:45:10 +03:00
Ivan Savenko 78f34c5a1d Fix SPELLCASTER bonus regressions
Fixed 1.7.2 regression of spellcaster logic when casting non-random
spells.

Slight refactoring of AI code to simplify logic related to SPELLCASTER.
As a side effect - AI should now be better at selecting spells if unit
has multiple spells to cast.
2026-02-20 17:40:27 +02:00
Ivan Savenko 0a843505b7 Added persistent flag to spells for non-removable effects 2026-01-27 18:22:26 +00:00
Ivan Savenko a0b69d79f0 NKAI2 performance improvements
Performance improvements to functions that are called a lot by AI:
- simplify math in BuildAnalyzer
- remove complex randomization in NodeStorage
- Fix excessive copying in Creature::cost
- Generate list of all resources in ResourceTypeHandler once
2025-12-18 19:06:34 +02:00
Laserlicht d808bd6412 introduce toResourceType 2025-09-15 00:08:18 +02:00
Laserlicht b6e8731329 code review 2025-07-08 10:34:11 +02:00
Laserlicht 9bfe3a8195 max range for spellcaster 2025-06-25 15:50:31 +02:00
Ivan Savenko a305ed28bb Support for loading custom bonuses, slightly less hardcoded Skeleton
Transformer
2025-06-15 14:36:29 +03:00
Laserlicht 4e73f7d90f shared_mutex replace boost 2025-02-28 16:01:11 +01:00
Laserlicht 7dfb499edf replace boost locks with std 2025-02-28 15:25:58 +01:00
Ivan Savenko 9d7c4a60e0 Added support for configuring which language channels are visible to
player in lobby
2025-01-27 17:19:14 +00:00
Ivan Savenko 40bff74195 Use small vector for unit list 2025-01-10 18:58:46 +00:00
MichalZr6 8c3a417527 Cleanup 2025-01-06 23:18:20 +01:00
MichalZr6 a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01:00
Ivan Savenko 73d1675ae3 Code cleanup, fixes to discovered regressions 2025-01-05 15:41:42 +00:00
Ivan Savenko 05397e2aaf Caching of bonuses that are requested with different durations 2025-01-04 15:09:50 +00:00
Ivan Savenko 16cfb51f3e Initial version of new bonus caching system 2025-01-04 15:09:50 +00:00
Ivan Savenko 4e5d44bc9c Merge pull request #5149 from vcmi/fix_visitablePos_calls
Fix visitable pos calls
2024-12-25 13:45:51 +02:00
Ivan Savenko 6da58a6871 Fixes excessive logging causing RMG slowdown
- Do not apply formatting on log entries that will be discarded due to
high log level
- Do not log incorrect access to visitablePos due to its numerous use by
RMG
2024-12-23 21:24:00 +00:00
Ivan Savenko 56d5911452 Optimized getMovementRange method - caching, faster route for 0 turns 2024-12-21 14:43:08 +00:00
Ivan Savenko 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
Ivan Savenko c0f5c7c0ea Replace pointer with reference in pack apply functions 2024-10-07 14:59:46 +00:00
Laserlicht e6cb87abac cast only on self 2024-09-28 17:32:53 +02:00
Laserlicht 0aaafc4c8a cast without skip 2024-09-14 15:10:24 +02:00
Ivan Savenko 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
godric3 c34956e912 introduce getModScope method toEntity class and subclasses 2024-08-10 16:08:04 +02:00
Ivan Savenko 34b6eaa25e Integrating changes from PR #4251 - add logging for rng 2024-07-16 15:31:58 +00: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
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 0d427980bc Entities are now non-copyable 2024-05-17 14:47:09 +00:00
Ivan Savenko 07813c9a79 Removed non-functional updateEntity in VLC 2024-05-16 22:05:26 +00:00
Ivan Savenko 10b35ceecb Replaced assertions with exceptions for invalid input in RNG 2024-02-19 00:35:21 +02:00
Ivan Savenko a9866bb5c6 Added RandomGeneratorUtil::nextItemWeighted convenience method 2024-01-31 00:17:40 +02:00
Ivan Savenko bd5682ecc3 Merge remote-tracking branch 'vcmi/master' into develop 2024-01-19 13:49:54 +02:00
Ivan Savenko 1194419884 Added option to allow self-casting 2024-01-16 15:13:00 +02:00
Ivan Savenko 0d0d3d8c80 Renamed speed -> getMovementRange, remove misleading default parameter 2024-01-14 17:14:36 +02:00
Alexander Wilms d2b105f216 CLoggerBase: Use IvanSavenko's single-statement macro so that ct100 is not immediately destroyed 2024-01-14 14:48:48 +00:00
Alexander Wilms f81a0cb4b6 CLoggerBase: Remove semicolon from RAII_TRACE definition
Fixes the following SonarCloud issue:

Modify the macro definition so that it needs to be followed by a semicolon, or remove this empty statement.
Empty statements should be removed cpp:S1116
https://sonarcloud.io/organizations/vcmi/rules?open=cpp%3AS1116&rule_key=cpp%3AS1116
2024-01-13 18:13:56 +00:00
Laserlicht 8d75c30dca remove default value 2023-12-16 19:54:45 +01:00
Laserlicht 56562ad8dc date time format 2023-12-16 18:57:38 +01:00
Ivan Savenko abad4b01ce Remove explicit convesion to int in operators 2023-11-15 15:55:19 +02:00