1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00
vcmi/client
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
..
battle Fixes for code review issues 2021-02-20 04:57:50 +03:00
gui Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
icons
lobby client/lobby/CBonusSelection.cpp: fix difficulty overflow in bonus UI 2021-07-25 21:01:17 +03:00
mainmenu Fix: 'Load' and 'Main menu' in-game buttons should work properly 2021-01-17 19:18:26 +03:00
widgets Merge branch 'develop' into handlersAbstraction 2021-07-16 00:32:13 +03:00
windows Fixes for code review issues 2021-02-20 04:57:50 +03:00
CBitmapHandler.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CBitmapHandler.h Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
CGameInfo.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CGameInfo.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Client.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Client.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMakeLists.txt CMake more transitive 2019-03-28 16:56:51 +03:00
CMessage.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CMessage.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CMT.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMT.h Full rework of pre-game interface and networking 2018-04-04 14:24:26 +07:00
CMusicHandler.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMusicHandler.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CPlayerInterface.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CPlayerInterface.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CreatureCostBox.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CreatureCostBox.h Gui cleanup3 - UI refactoring to use smart pointers (#440) 2018-04-07 18:34:11 +07:00
CServerHandler.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CServerHandler.h Add proper thread synchronization for campaigns 2019-03-30 00:28:33 +01:00
CVideoHandler.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CVideoHandler.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
DPIaware.manifest
Graphics.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Graphics.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
mapHandler.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
mapHandler.h Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
NetPacksClient.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
NetPacksLobbyClient.cpp Remove empty branch from LobbyClientConnected::applyOnLobbyScreen (#507) 2018-10-30 04:59:02 +03:00
resource.h
SDLMain.h
SDLMain.m
SDLRWwrapper.cpp copyright stuff 2016-01-31 11:13:56 +01:00
SDLRWwrapper.h Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
StdInc.cpp
StdInc.h Implemented SDL2 unicode input. Hotkeys are sill broken. 2014-06-13 07:55:42 +04:00
VCMI_client.cbp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
VCMI_client.rc don't use separate .rc files for MSVC and MinGW 2014-10-12 16:32:02 +03:00
VCMI_client.vcxproj Update VS files to 2019, partially fix test project 2019-06-09 17:28:55 +02:00
VCMI_client.vcxproj.filters Update project files to match vcmi code changes 2018-07-06 18:52:51 +02:00
vcmi.ico