1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/client/lobby
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
..
CBonusSelection.cpp client/lobby/CBonusSelection.cpp: fix difficulty overflow in bonus UI 2021-07-25 21:01:17 +03:00
CBonusSelection.h Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CLobbyScreen.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CLobbyScreen.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CSavingScreen.cpp Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CSavingScreen.h Fix double free and use of dead reference when saving (#445) 2018-04-07 22:21:28 +07:00
CScenarioInfoScreen.cpp Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CScenarioInfoScreen.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CSelectionBase.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CSelectionBase.h Optimize button responsiveness during pregame options 2019-04-20 18:26:54 +02:00
OptionsTab.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
OptionsTab.h Full rework of pre-game interface and networking 2018-04-04 14:24:26 +07:00
RandomMapTab.cpp Random Map Generator Option: Allow having more computer only players than human/computer players 2020-07-07 19:45:53 +08:00
RandomMapTab.h Random Map Generator Option: Allow having more computer only players than human/computer players 2020-07-07 19:45:53 +08:00
SelectionTab.cpp client/lobby/SelectionTab.cpp: initialize generalSortingBy before use 2021-07-25 21:00:31 +03:00
SelectionTab.h Full rework of pre-game interface and networking 2018-04-04 14:24:26 +07:00