1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00
Go to file
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
2021-07-16 23:51:32 +03:00
2021-02-20 04:57:50 +03:00
2020-10-04 02:20:18 -07:00
2020-05-05 18:44:42 +10:00
2021-04-19 18:33:07 +03:00
2021-07-13 14:56:35 +01:00
2020-01-01 12:54:23 +01:00
2020-09-12 15:34:18 +03:00
2018-10-29 16:30:50 +01:00

Travis Build Status AppVeyor Build status Coverity Scan Build Status

VCMI Project

VCMI is work-in-progress attempt to recreate engine for Heroes III, giving it new and extended possibilities.

Installation guides

To use VCMI you need to own original data files.

Building from source

Platform support is constantly tested by continuous integration and CMake configuration adjusted to generate nice looking projects for all major IDE. Following guides will help you to setup build environment with no effort:

VCMI Project source code is licensed under GPL version 2 or later. VCMI Project assets are licensed under CC-BY-SA 4.0. Assets sources and information about contributors are available under following link: [https://github.com/vcmi/vcmi-assets]

Copyright (C) 2007-2020 VCMI Team (check AUTHORS file for the contributors list)

Description
Open-source engine for Heroes of Might and Magic III
Readme 142 MiB
Languages
C++ 67.1%
JSON-with-Comments 24.5%
Inno Setup 3.4%
Java 1.5%
CMake 1.4%
Other 1.8%