1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +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
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
CMessage.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CMessage.h
CMT.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMT.h
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
CServerHandler.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CServerHandler.h
CVideoHandler.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CVideoHandler.h
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
resource.h
SDLMain.h
SDLMain.m
SDLRWwrapper.cpp
SDLRWwrapper.h
StdInc.cpp
StdInc.h
VCMI_client.cbp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
VCMI_client.rc
VCMI_client.vcxproj Update VS files to 2019, partially fix test project 2019-06-09 17:28:55 +02:00
VCMI_client.vcxproj.filters
vcmi.ico