diff --git a/CorsixTH/Src/th_gfx.cpp b/CorsixTH/Src/th_gfx.cpp
index 2f54f49..1fb0e79 100644
--- a/CorsixTH/Src/th_gfx.cpp
+++ b/CorsixTH/Src/th_gfx.cpp
@@ -28,7 +28,7 @@ SOFTWARE.
#include <new>
#include <algorithm>
#include <memory.h>
-#include <limits.h>
+#include <limits>
#include <cassert>
#include <cstdint>
@@ -375,7 +375,7 @@ size_t THAnimationManager::loadElements(Input &input, THSpriteSheet *pSpriteShee
while (iNumElements > 0)
{
if (iLoadedElements >= iElementCount || !input.Available(12))
- return SIZE_MAX;
+ return std::numeric_limits<std::size_t>::max();
size_t iSprite = input.Uint32();
int iX = input.Int16();