Index: ps/trunk/source/gui/CSlider.cpp =================================================================== --- ps/trunk/source/gui/CSlider.cpp +++ ps/trunk/source/gui/CSlider.cpp @@ -20,6 +20,7 @@ #include "CSlider.h" #include "gui/CGUI.h" +#include "maths/MathUtil.h" CSlider::CSlider(CGUI& pGUI) : IGUIObject(pGUI), m_IsPressed(false), m_ButtonSide(0) Index: ps/trunk/source/lib/lib.h =================================================================== --- ps/trunk/source/lib/lib.h +++ ps/trunk/source/lib/lib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -63,14 +63,6 @@ #include // fabsf #include // numeric_limits #include // out_of_range -#include // min, max - -template -T Clamp(T val, T min, T max) -{ - ASSERT(min <= max); - return std::max(min, std::min(val, max)); -} template T DivideRoundUp(T dividend, T divisor) Index: ps/trunk/source/maths/MathUtil.h =================================================================== --- ps/trunk/source/maths/MathUtil.h +++ ps/trunk/source/maths/MathUtil.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,24 +23,28 @@ #define SQR(x) ((x) * (x)) template -inline T Interpolate(const T& a, const T& b, float l) +inline T Interpolate(const T& a, const T& b, float t) { - return a + (b - a) * l; + return a + (b - a) * t; } template -inline T clamp(T value, T min, T max) +inline T Clamp(T value, T min, T max) { - if (value <= min) return min; - else if (value >= max) return max; - else return value; + if (value <= min) + return min; + else if (value >= max) + return max; + return value; } inline float sgn(float a) { - if (a > 0.0f) return 1.0f; - if (a < 0.0f) return -1.0f; + if (a > 0.0f) + return 1.0f; + if (a < 0.0f) + return -1.0f; return 0.0f; } -#endif +#endif // INCLUDED_MATHUTIL Index: ps/trunk/source/soundmanager/data/ogg.cpp =================================================================== --- ps/trunk/source/soundmanager/data/ogg.cpp +++ ps/trunk/source/soundmanager/data/ogg.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,14 +20,13 @@ #if CONFIG2_AUDIO +#include "lib/byte_order.h" #include "lib/external_libraries/openal.h" #include "lib/external_libraries/vorbis.h" - -#include "lib/byte_order.h" -#include "lib/file/io/io.h" #include "lib/file/file_system.h" - +#include "lib/file/io/io.h" #include "lib/file/vfs/vfs_util.h" +#include "maths/MathUtil.h" #include "ps/CLogger.h" #include "ps/Filesystem.h"