mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Fix comparison between signed and unsigned integer
This commit is contained in:
@@ -262,7 +262,7 @@ static bool is_changable_pixel(sint32 palette_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sint32 get_closest_palette_index(sint16 *colour){
|
static sint32 get_closest_palette_index(sint16 *colour){
|
||||||
uint32 smallest_error = -1;
|
uint32 smallest_error = (uint32)-1;
|
||||||
sint32 best_match = -1;
|
sint32 best_match = -1;
|
||||||
|
|
||||||
for (sint32 x = 0; x < 256; x++){
|
for (sint32 x = 0; x < 256; x++){
|
||||||
@@ -272,7 +272,7 @@ static sint32 get_closest_palette_index(sint16 *colour){
|
|||||||
((sint16)(spriteFilePalette[x].g) - colour[1]) * ((sint16)(spriteFilePalette[x].g) - colour[1]) +
|
((sint16)(spriteFilePalette[x].g) - colour[1]) * ((sint16)(spriteFilePalette[x].g) - colour[1]) +
|
||||||
((sint16)(spriteFilePalette[x].b) - colour[2]) * ((sint16)(spriteFilePalette[x].b) - colour[2]);
|
((sint16)(spriteFilePalette[x].b) - colour[2]) * ((sint16)(spriteFilePalette[x].b) - colour[2]);
|
||||||
|
|
||||||
if (smallest_error == -1 || smallest_error > error){
|
if (smallest_error == (uint32)-1 || smallest_error > error){
|
||||||
best_match = x;
|
best_match = x;
|
||||||
smallest_error = error;
|
smallest_error = error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void game_handle_input()
|
|||||||
|
|
||||||
if (_inputFlags & INPUT_FLAG_5) {
|
if (_inputFlags & INPUT_FLAG_5) {
|
||||||
game_handle_input_mouse(x, y, state);
|
game_handle_input_mouse(x, y, state);
|
||||||
} else if (x != 0x80000000) {
|
} else if (x != (sint32)0x80000000) {
|
||||||
sint32 screenWidth = context_get_width();
|
sint32 screenWidth = context_get_width();
|
||||||
sint32 screenHeight = context_get_height();
|
sint32 screenHeight = context_get_height();
|
||||||
x = Math::Clamp(0, x, screenWidth - 1);
|
x = Math::Clamp(0, x, screenWidth - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user