diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 8768f066..389e20bd 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -2306,8 +2306,8 @@ void editorinput(void) break; } - ed.levx = clamp(help.Int(coord_x) - 1, 0, cl.mapwidth - 1); - ed.levy = clamp(help.Int(coord_y) - 1, 0, cl.mapheight - 1); + ed.levx = SDL_clamp(help.Int(coord_x) - 1, 0, cl.mapwidth - 1); + ed.levy = SDL_clamp(help.Int(coord_y) - 1, 0, cl.mapheight - 1); graphics.backgrounddrawn = false; break; } diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 81c6064c..d488d1df 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -521,10 +521,10 @@ void Graphics::do_print( int position = 0; std::string::const_iterator iter = text.begin(); - r = clamp(r, 0, 255); - g = clamp(g, 0, 255); - b = clamp(b, 0, 255); - a = clamp(a, 0, 255); + r = SDL_clamp(r, 0, 255); + g = SDL_clamp(g, 0, 255); + b = SDL_clamp(b, 0, 255); + a = SDL_clamp(a, 0, 255); ct.colour = getRGBA(r, g, b, a); diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 43cb122d..11487bb3 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -356,7 +356,7 @@ static void slidermodeinput(void) { *user_changing_volume += USER_VOLUME_STEP; } - *user_changing_volume = clamp(*user_changing_volume, 0, USER_VOLUME_MAX); + *user_changing_volume = SDL_clamp(*user_changing_volume, 0, USER_VOLUME_MAX); } static void menuactionpress(void) diff --git a/desktop_version/src/Maths.h b/desktop_version/src/Maths.h index 1290c31c..97c24186 100644 --- a/desktop_version/src/Maths.h +++ b/desktop_version/src/Maths.h @@ -13,11 +13,6 @@ float inline fRandom(void) return ( float(rand()) / float(RAND_MAX)) ; } -inline int clamp(int x, int a, int b) -{ - return x < a ? a : (x > b ? b : x); -} - struct point { int x; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index c3f568fd..36558b5b 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -78,7 +78,7 @@ static void volumesliderrender(void) num_positions = slider_length - symbol_length + 1; offset = num_positions * (*volume_ptr) / USER_VOLUME_MAX; - offset = clamp(offset, 0, slider_length - symbol_length); + offset = SDL_clamp(offset, 0, slider_length - symbol_length); /* SDL_strlcpy null-terminates, which would end the string in the middle of * it, which we don't want!