Change Difficulty_level_type from unsigned to signed
Difficulty_level_type is used in arithmetic expressions. If
Difficulty_level_type is unsigned, then those expressions use unsigned
terms, but some of the expressions were designed to use signed terms and
produce incorrect results when used with unsigned terms. There is no
strong reason to make Difficulty_level_type unsigned, so switch it to
signed instead of trying to fix every site that uses it.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/471>
Fixes: 1eaaff3016
("Move Difficulty_level to GameUniqueState")
This commit is contained in:
parent
ba283fb036
commit
075b14373a
|
@ -127,7 +127,11 @@ void calc_d_tick();
|
|||
|
||||
extern int Game_suspended; // if non-zero, nothing moves but player
|
||||
|
||||
enum Difficulty_level_type : unsigned
|
||||
/* This must be a signed type. Some sites, such as `bump_this_object`,
|
||||
* use Difficulty_level_type in arithmetic expressions, and those
|
||||
* expressions must be signed to produce the correct result.
|
||||
*/
|
||||
enum Difficulty_level_type : signed int
|
||||
{
|
||||
Difficulty_0,
|
||||
Difficulty_1,
|
||||
|
|
Loading…
Reference in a new issue