From 3ce0e04a79e6dfc96e0426d32ac93ccab1dc4094 Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 11 Jan 2016 18:06:21 +0000 Subject: [PATCH] Fix: possible overflow when creating building (by asm-debacle) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8020 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TileEngine/Buildings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TileEngine/Buildings.cpp b/TileEngine/Buildings.cpp index ec5da9c7..fb91c515 100644 --- a/TileEngine/Buildings.cpp +++ b/TileEngine/Buildings.cpp @@ -552,11 +552,11 @@ BUILDING * GenerateBuilding( INT32 sDesiredSpot ) // something that has gone pear shaped if(uiLoop2 >= WORLD_MAX) { - UINT8 x = 0; - UINT8 y = 0; + INT32 x = 0; + INT32 y = 0; while((sDesiredSpot - ((y + 1) * WORLD_COLS)) >= 0) { - y++; + ++y; } x = sDesiredSpot - (y * WORLD_COLS); DebugMsg (TOPIC_JA2,DBG_LEVEL_2,String( "113/UC Warning! Building Walk Algorithm has covered the entire map! Building %d located at [%d,%d] must be bogus.", ubBuildingID, x, y ));