1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-04-28 20:04:33 +02:00

8885 Commits

Author SHA1 Message Date
Laserlicht a3800ac8ae Merge remote-tracking branch 'origin/develop' into demo 2026-04-19 15:36:41 +02:00
Laserlicht 600d95a984 code review 2026-04-19 15:21:39 +02:00
Aleksander Gosk a93d3d0db7 Fix battleLogMessage translation and add singular/plural support
Fix two issues with the battleLogMessage feature:

1. Translation not working: string registration now happens in
   CSpellHandler::loadFromJson (before translations are loaded)
   instead of in Timed::serializeJsonUnitEffect (which runs in
   afterLoadFinalization, after translations are already loaded).
   The effect now only generates the text ID without registering.

2. Singular/plural support: battleLogMessage is now an object with
   "singular" and "plural" fields for grammatically correct messages
   based on stack size.
   Example: { "singular": "The %s is petrified.",
              "plural": "The %s are petrified." }

Values starting with @ reference an existing text ID instead of
registering a new string. Core spells now use @core.genrltxt.XXX
to reuse the original H3 translations directly.
2026-04-16 01:35:36 +02:00
Aleksander Gosk d6a3541f3a Add configurable battle log message for timed spell effects
Timed spell effects (core:timed) now support an optional
"battleLogMessage" field displayed in the battle log when the effect
is applied. The text should include a %s placeholder for the affected
creature's name.

The field contains the English text directly (same pattern as spell
name/description). A text ID for translation export is auto-generated
at load time as: spell.<scope>.<identifier>.<effectName>.battleLogMessage

String registration happens in the effect itself during deserialization
(Timed::serializeJsonUnitEffect), using spell scope, identifier, and
effect name passed down through the Effects loading chain.

This replaces the previously hardcoded battle log messages for stone
gaze, paralyze, poison, disease, and bind, which are now converted
from the old effects format to the new battleEffects format with
configurable messages. The age ability retains its hardcoded message
because it computes health loss at runtime.

Resolves: https://github.com/vcmi-mods/horn-of-the-abyss/issues/551
2026-04-12 16:20:47 +02:00
Laserlicht 4883ef538d simplify decompression 2026-04-11 20:10:21 +02:00
Laserlicht 4aa7bb2b11 code review part 1 2026-04-11 15:48:05 +02:00
Laserlicht 0fc0b5fd68 compatibility with complete; fix demo detection 2026-04-04 01:03:14 +02:00
Laserlicht 6b2c11f62e launcher demo support 2026-04-03 23:55:14 +02:00
Laserlicht 63a7f164c3 war machines and ui 2026-04-03 22:25:35 +02:00
Laserlicht 24227dab65 fix mapping 2026-04-03 18:25:59 +02:00
Laserlicht 9105bfd697 applied old demo patches to current beta 2026-04-03 17:29:24 +02:00
Ivan Savenko 1a0c8bf8d9 Merge branch 'vcmi/beta' into 'vcmi/develop' 2026-03-31 23:05:13 +03:00
Ivan Savenko b7a027b2f9 Merge pull request #7154 from IvanSavenko/vcmi_campaign_fs
[1.7.4] Fix crash on accessing VCMI campaign inside .zip archive
2026-03-30 14:47:14 +03:00
DjWarmonger cf6934f900 Merge pull request #6677 from vcmi/linear_VCM-40
Improve initial zone placement
2026-03-30 11:33:48 +02:00
Tomasz Zieliński 42b105eae0 Fix SonarQube warnings 2026-03-30 10:44:05 +02:00
Tomasz Zieliński 1754173ee0 Do not allow multiple structure sets and animal sets in a biome 2026-03-30 10:30:51 +02:00
Tomasz Zieliński 9ac4377402 Reduce max number of sets per biome to 7 2026-03-30 08:25:13 +02:00
Tomasz Zieliński 30c9d8551e Do not repeat 10 last obstacle templates 2026-03-29 19:28:13 +02:00
Tomasz Zieliński 6356e66f4e Fix SonarQube warning 2026-03-29 18:42:06 +02:00
Tomasz Zieliński 2881db9962 remove .md from version control 2026-03-29 18:40:14 +02:00
Tomasz Zieliński afea41777e Place zones on multi-level grid 2026-03-29 18:40:14 +02:00
Ivan Savenko 5d6cfc366b Fix crash on accessing VCMI campaign inside .zip archive
Fixes cases where game would try to access file on real filesystem for
VCMI campaigns files that are actually located inside .zip archive.

Made search for other usages of last_write_time access, don't see any
other similar cases left
2026-03-28 20:51:27 +02:00
Ivan Savenko 826c614d77 Merge pull request #6748 from Laserlicht/api_lobby
[1.8?] API for lobby
2026-03-28 01:42:16 +02:00
Ivan Savenko 3fb0cf1f0a Merge pull request #7133 from starius/fix-includes
Fix broken relative local include paths
2026-03-27 19:10:48 +02:00
Boris Nagaev b05c0f8e6d Normalize local relative include directives
Normalize quoted local relative include directives to remove redundant
path segments while preserving relative includes.

This applies the normalizer across the tree and updates 108 includes in
64 files, including cases where paths inside lib/* redundantly used
../../lib/... and now correctly use ../... .

These paths compiled before because include resolution normalized them,
but they were longer and harder to audit.
2026-03-26 20:15:25 -05:00
Boris Nagaev 38bfd1c7e5 Fix broken relative local include paths
Many quoted local includes had an incorrect ../ depth and resolved to
non-existent files from the including file's directory.

This was easy to miss because normal target include directories and PCH
usage masked some failures, and several stale paths lived in files that
are only compiled in optional test configurations. As a result, the
problem mostly surfaced in stricter or broader fresh builds.

Audit all C++ and header local includes, keep them relative, and adjust
paths so each include resolves to an existing in-tree header. For
headers that were renamed or moved, update includes to their current
relative location instead of switching to include-root form.

A few legacy ERM tests also used dynamic_ptr_cast at call sites where we
had to replace stale headers. The helper/header path they relied on is
no longer present after 81af66d35b, so
those downcasts are now explicit dynamic_cast calls with the same intent.
2026-03-26 20:14:59 -05:00
Laserlicht ae0e1c27fd on skill identifier fail -> masteryLevel none 2026-03-27 01:00:11 +01:00
Boris Nagaev f789f469e5 rmg: break quest zone ownership cycle
ASan/LSan fuzz runs were reporting large indirect leaks at exit. The
stack traces touched many RMG modificators (TreasurePlacer, RiverPlacer,
WaterAdopter, ObjectManager), which looked like unrelated leaks at first.

The common root cause is ownership: each Zone owns modificators, while
QuestArtifactPlacer kept neighboring zones in
std::vector<std::shared_ptr<Zone>>. That creates a strong reference cycle
between zones and their modificators, so clearing map zones cannot release
the whole graph and LeakSanitizer reports it as leaked memory.

This was verified by running the same fuzzer command with leak detection
enabled before and after changing only this edge. Before the change, LSAN
consistently reported multi-megabyte indirect leaks; after the change, the
report disappears while fuzzing behavior stays the same.

Use weak_ptr for cross-zone references in QuestArtifactPlacer and lock the
references when iterating. This keeps behavior intact while breaking the
cycle so normal cleanup can reclaim zone state.
2026-03-25 22:00:18 -05:00
Laserlicht 2113f99a74 Merge branch 'beta' into api_lobby 2026-03-25 23:35:59 +01:00
Laserlicht d2e7e05308 method to interface 2026-03-25 23:31:22 +01:00
Laserlicht 7c02976caa code review 2026-03-25 21:51:23 +01:00
Laserlicht d0e8894e1a shared network context & database; get param 2026-03-23 21:21:51 +01:00
Andrey Filipenkov 7d259f91d7 [lobby] fix build 2026-03-23 12:14:47 +03:00
Boris Nagaev 922018ae3e mapeditor: fix random artifact inspect crash
Selecting certain objects in the editor could abort both on a freshly generated
random map and after saving and reloading a map with random artifacts. The
runtime error was std::out_of_range from vector::_M_range_check, with __n shown
as 18446744073709551615, and the stack passed through
Inspector::updateProperties(CGArtifact*), CGArtifact::getArtifactInstance, and
CMap::getArtifactInstance.

The immediate problem was an unset ArtifactInstanceID (-1) on artifact-like
objects. Inspector asked for artifact instance unconditionally, and
CGArtifact::getArtifactInstance forwarded the invalid id into map storage.

The change handles this at both levels involved in the crash path. Inspector now
requests artifact instance only for spell scrolls, and CGArtifact now returns
nullptr when the stored id is unset.

A regression test in vcmitest now constructs EditorCallback + CMap + CGArtifact
with random artifact id and default stored instance, then checks that
getArtifactInstance does not throw and returns nullptr. It fails before the fix
with the same out_of_range path and passes after it.
2026-03-23 03:39:50 -05:00
Yury Zhurikhin ab6c1390c2 add DLL_LINKAGE + out-of-line dtor for all exceptions
(cherry picked from commit 138eb51618)
2026-03-23 10:53:12 +03:00
Yury Zhurikhin 095657be5a add DLL_LINKAGE + out-of-line dtor
(cherry picked from commit ebebca7257)
2026-03-23 10:53:11 +03:00
Yury Zhurikhin 138eb51618 add DLL_LINKAGE + out-of-line dtor for all exceptions 2026-03-22 13:17:51 +03:00
Yury Zhurikhin ebebca7257 add DLL_LINKAGE + out-of-line dtor 2026-03-21 20:00:57 +03:00
Ivan Savenko 1cedbe4cc1 Merge pull request #7119 from Laserlicht/creature_reward
fix creature reward message
2026-03-21 15:48:06 +02:00
Laserlicht a6332bddf5 fix singular 2026-03-21 11:03:32 +01:00
Laserlicht b1d5d6956d fix creature reward message 2026-03-21 00:22:20 +01:00
Ivan Savenko cfbc036564 Merge pull request #7021 from Opuszek/fix_preliminary_spell_target_choice
reworks battleAI preliminary spell target choice
2026-03-19 15:23:13 +02:00
Ivan Savenko df3b14d782 Merge pull request #7062 from Opuszek/fix_targeting_for_spell_like_attacks
fix problems with death cloud targeting
2026-03-19 15:21:03 +02:00
Boris Nagaev 90745728a7 VCMIDirs: fix vcmieditor dev-mode data lookup
On Unix, development mode only activated when the working directory
contained config and Mods plus one of the game binaries. A build that
only produced vcmieditor failed that check, so the editor looked for
installed data paths and aborted on config/filesystem.json.

Treat vcmieditor as a valid development binary so editor-only builds use
the local build tree data layout and start correctly.

Fix the following crash:

$ ./out/build/linux-gcc-release/bin/vcmieditor
Starting map editor of 'VCMI 1.8.0.'
...
Disaster happened.
Reason: Resource with name CONFIG/FILESYSTEM and type JSON wasn't found.
2026-03-16 00:28:56 -05:00
Opuszek e82edf18cf Fix INVINCIBLE bonus 2026-03-14 21:42:10 +01:00
Laserlicht 0efd4723e7 fix crash when multiple processes are in lobby 2026-03-14 13:05:42 +01:00
Ivan Savenko 62bf4931ca Merge pull request #7039 from IvanSavenko/remove_fuzzy_nkai
[1.8] Remove NKAI 1 and fuzzylite from engine
2026-03-13 21:02:20 +02:00
Ivan Savenko 5866d39e40 Merge pull request #7065 from IvanSavenko/lobby_fix
Fix compilation of lobby package
2026-03-12 20:52:19 +02:00
Ivan Savenko e0c13bfb1d Fix compilation of lobby package
Fixes compilation when vcmilobby is enabled alongside with minimal
library. Added cmake preset & CI job to prevent breakage in future
2026-03-11 12:21:32 +02:00
Opuszek 2db8cba51e reworks battleAI preliminary spell target choice - review fix 2026-03-08 23:32:52 +01:00