1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
Commit Graph

7742 Commits

Author SHA1 Message Date
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
Alexander Shishkin
094486eec1
Merge pull request #682 from vlad-yakovlev/macos-cpack-fix
[3148] [MacOS] Game always crash after end of the day button is pressed
2021-02-16 08:02:17 +03:00
Alexander Shishkin
5e707eee0f
Merge pull request #683 from vlad-yakovlev/fix-map-select-crahs
[3167] Crash when click single scenario in new game
2021-02-16 07:59:47 +03:00
Vladislav Yakovlev
8e57d36b8c [3167] Fix SDL_StopTextInput extra calls 2021-02-15 21:11:18 +03:00
Vladislav Yakovlev
6fa7b6e467 [3148] Fix macOS build 2021-02-15 20:45:12 +03:00
AlexVinS
a59e12ca5f tweaks 2021-02-15 15:03:32 +03:00
AlexVinS
ecaa9f5d0b Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2021-02-14 19:05:43 +03:00
Alexander Shishkin
11bb46780a
Merge pull request #678 from MikeLodz/develop
Fixes mantis tickets 2899 and 2984 (bugged hero spell specialties)
2021-02-14 11:22:23 +03:00
MikeLodz
fe9412f845 hero specialty fixes continuation: changes requested during code review 2021-02-13 16:02:42 +01:00
Alexander Shishkin
6055747dc1
Merge pull request #681 from ShubusCorporation/do/fix/hero_classes_initial_values
Fix: Some map objects sometimes do not increment some primary skills of some heroes
2021-02-13 03:51:31 +03:00
Dmitry Orlov
55b3f0b24c Fix: Map objects sometimes do not increment primary skills for some heroes 2021-02-13 00:24:14 +03:00