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

7752 Commits

Author SHA1 Message Date
Andrii Danylchenko
8961f1c803 AI: fix hero exchange logic, allow splitting weakest-fastest creature, refactoring 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
e838e70165 ai fix town portal to occupied town 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
774f531c4e hero chain stabilisation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
87f1079c60 nullkiller&herochain stabilisation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
62e5366a08 AI: rough hero chain stabilisation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
ff57a52001 Nullkiller: hero chain stabilisation 2021-07-26 21:02:50 +03:00
AlexVinS
dd046e60be Quick fix for https://bugs.vcmi.eu/view.php?id=3041 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
fa39279c82 Nullkiller - rough stabilisation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
cd0f479d7e Nullkiller: rough implementation of prioritization 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
eee145c486 Nullkiller: rough implementation of capture objects and recruit hero behaviors 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
9c85e26d3c Nullkiller: add engine and activate it for blue AI only. Engine does nothing 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
a88181acd7 AI: separate hero chain recalculation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
c1e521a544 Nullkiller - rough stabilisation 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
9d70b28c9b AI: hero chain basic logic 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
1e4a086bb1 AI pathfinding loss evaluation 2021-07-26 21:02:50 +03:00
AlexVinS
594d1684e9 Switch to MinGW 7.3 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
0bff5f9eb6 AI pathfinding shared storage 2021-07-26 21:02:50 +03:00
Andrii Danylchenko
be4f803d4a Nullkiller: copy VCAI 2021-07-26 21:02:50 +03:00
Sergei Trofimovich
e407d4e547 client/lobby/CBonusSelection.cpp: fix difficulty overflow in bonus UI
Before the change campaign bonus selection screen had inconsistent
overflow behaviour for difficulty selection:

```
    0 1 2 3 4 | available buttons: '-' to decrease
      ^       |                    '+' to increase
```

Before the change:

1. If we click '+' 5 times we will end up on difficulty=4 (ok, saturated).
2. If we click '-' 5 times we will end up on difficulty=1 (unexpected, wrap around).

After the change:

1. If we click '+' 5 times we will end up on difficulty=4 (saturated).
2. If we click '-' 5 times we will end up on difficulty=0 (saturated).

The inconsistency happens because `difficulty` variable has `ui8` type
and server uses `difficulty = vstd::abetween(difficulty, 0, 4)` to
implement the saturation.

For large positive values saturation works as expected:
    vstd::abetween(difficulty=5, 0, 4) -> 4
For small values it does not:
    vstd::abetween(difficulty=-1, 0, 4) -> 4

The change makes client to avoid using negative values.
2021-07-25 21:01:17 +03:00
Sergei Trofimovich
e4dd2f6dd8 client/lobby/SelectionTab.cpp: initialize generalSortingBy before use
Noticed use of uninitialized value when built vcmi with -fsanitize=undefined:

```
  Established connection with
    VCMI 0.99 b310f2e61e (server).
    UUID: bab9a90d-7416-4566-8817-e367ffcac7c1
  ../vcmi-9999/client/lobby/SelectionTab.cpp:138:16:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
  /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/g++-v12/tuple:190:4:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
  /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/g++-v12/tuple:190:4:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
```

Here (before the change) `SelectionTab()` used `generalSortingBy` before
first use:

```
    SelectionTab::SelectionTab(ESelectionScreen Type) {
        ...
        if(tabType != ESelectionScreen::campaignList)
        {
            ...
                ESortBy criteria = (ESortBy)i;
                if(criteria == _name)
                    criteria = generalSortingBy;

                buttonsSortBy.push_back(... std::bind(&SelectionTab::sortBy, this, criteria)));
            ...
        }
        ...
        switch(tabType)
        {
        case ESelectionScreen::newGame:
                generalSortingBy = ESortBy::_name;
        ....
```

The change moves `generalSortingBy` initialization before first use.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2021-07-25 21:00:31 +03:00
kdmcser
10cfefdf9d
fix bug: valid json will failed when object template contains zIndex (#698) 2021-07-18 10:44:44 +03:00
Andrii Danylchenko
a6d98bcc6b
Merge pull request #456 from vcmi/handlersAbstraction
Handlers refactoring and initial scripting support
2021-07-17 22:00:31 +03:00
Andrii Danylchenko
840a2d854d Fix build for luajit 2021-07-16 23:51:32 +03:00
Andrii Danylchenko
9c8d776398 Merge branch 'develop' into handlersAbstraction
# Conflicts:
#	CI/linux/before_install.sh
#	CI/mac/before_install.sh
#	CI/mxe/before_install.sh
#	lib/CModHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.h
#	lib/mapObjects/CommonConstructors.cpp
#	server/CGameHandler.cpp
#	test/CMakeLists.txt
#	test/spells/effects/TeleportTest.cpp
2021-07-16 00:32:13 +03:00
Andrii Danylchenko
3cef42fd1a Fix github actions build 2021-07-13 22:50:18 +03:00
Andrii Danylchenko
92a9106e89 Disable publishing builds to download.vcmi.eu except develop. Added artifacts 2021-07-13 14:56:35 +01:00
Andrii Danylchenko
6d8373a473 Configure github actions 2021-07-13 14:56:35 +01:00
Alexander Shishkin
2669aa446e
Merge pull request #697 from vcmi/fix-campaign-transition
3095 - fix campaign transition
2021-06-20 21:10:24 +03:00
Andrii Danylchenko
4a1e676399 3095 - fix campaign transition 2021-06-18 20:57:07 +03:00
Alexander Shishkin
9e422a1664
Merge pull request #690 from nullkiller/erm-fix-vr
ERM: fix string concatenations and bit operations
2021-04-29 16:05:20 +03:00
Alexander Shishkin
b310f2e61e
Merge pull request #687 from kambala-decapitator/fix-server-crash-client-disconnect
fix server crash on unexpected client disconnect
2021-04-29 16:03:07 +03:00
Alexander Shishkin
2b4a99994a
Merge pull request #691 from ShubusCorporation/do/fix/many_mods_gaisen_bug
Fix: ID-collisions on large mods collections loading
2021-04-29 15:54:33 +03:00
Alexander Shishkin
ef363ba4ed
Merge pull request #692 from ShubusCorporation/do/fix/attempt_equip_spellbook
Fix: VCAI should not attempt to move Spell Book
2021-04-29 15:52:06 +03:00
Dmitry Orlov
0e5d427dc9 Fix: VCAI should not attempt to move Spellbook 2021-04-29 00:04:22 +03:00
Dmitry Orlov
8b08973283 Fix: ID-collisions when processing large mods collections 2021-04-25 15:07:06 +03:00
Andrii Danylchenko
fc9bbfb895 ERM: revert unwanted changes 2021-04-19 18:33:07 +03:00
Andrii Danylchenko
061941b3ac ERM VR:M,VR:U 2021-04-19 18:28:55 +03:00
Alexander Shishkin
4063ab5894
Merge pull request #689 from kdmcser/develop
fix bug: may load mod before dependencies
2021-04-11 01:07:12 +03:00
kdmcser
10dc6922de refactor code: change code style and add some comments 2021-04-10 23:23:58 +08:00
AlexVinS
f0a7a6ffbf Fixed build
Some stubs for !!UN

C::B project update
2021-04-10 02:04:07 +03:00
Andrii Danylchenko
35566d7748 ERM: fix string concatenations and bit operations 2021-04-09 23:41:50 +03:00
kdmcser
3049c4b70e fix bug: may load mod before dependeny 2021-04-04 21:54:00 +08:00
Andrii Danylchenko
bd31a87133
a few erm interpretter unit tests and fixes (#688) 2021-03-27 15:47:44 +03:00
Andrey Filipenkov
7f3b06eb86 fix server crash on unexpected client disconnect 2021-03-20 17:12:56 +03:00
Andrey Filipenkov
bc1d99431d fix boost.locale crash on macOS-arm64 2021-03-05 21:00:33 +00:00
AlexVinS
483a4689ce Fixes for code review issues 2021-02-20 04:57:50 +03:00
Alexander Shishkin
784f6b973b
Apply suggestions from code review
Co-authored-by: Andrii Danylchenko <danilchenko.andrij@gmail.com>
2021-02-20 02:31:00 +03:00
Alexander Shishkin
d74127cb84
Update lib/ScriptHandler.cpp
Co-authored-by: Andrii Danylchenko <danilchenko.andrij@gmail.com>
2021-02-20 02:04:10 +03:00
AlexVinS
6d245a7821 Less ugly API declarations 2021-02-17 01:14:53 +03:00
AlexVinS
ec6f7b88fe !?OB WIP 2021-02-16 13:32:18 +03:00