From 8f3f28aea8fc354b53adcd39d04d0ae4c141c78f Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 7 Jul 2009 08:44:02 +0000 Subject: [PATCH] - TEMPORARY Bugfix: Temporary fix in method "NumEnemiesInSector()" to avoid assertion errors if the "source" sector was along the map's edge (by Headrock) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3088 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Queen Command.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index f1127e3e..38057bd5 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -210,6 +210,16 @@ UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) GROUP *pGroup; UINT8 ubNumTroops; + // HEADROCK: This is a TEMPORARY fix to avoid the assertion error. Not sure this is the best solution, + // probably isn't. But I need this bit to work. + if (sSectorX < MINIMUM_VALID_X_COORDINATE || + sSectorX > MAXIMUM_VALID_X_COORDINATE || + sSectorY < MINIMUM_VALID_Y_COORDINATE || + sSectorY > MAXIMUM_VALID_Y_COORDINATE) + { + return (0); + } + AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE ); AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);