From fa56d63ce45c92c400d6b87f189543897b246b38 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Tue, 8 Oct 2013 17:55:45 +0000 Subject: [PATCH] Bugfix for JaggZilla Bug #623 The crash was caused by Mike or Iggy because they are created from an Elite but don't have ubSoldierClass set to SOLDIER_CLASS_ELITE. Therefore ubNumElites and num remained at 1 when the for loop was done. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6475 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Queen Command.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index e0fee489..36bb16dd 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -846,6 +846,21 @@ BOOLEAN PrepareEnemyForSectorBattle() pSoldier->ubGroupID = pGroup->ubGroupID; } break; + // silversurfer: bugfix for Jaggzilla bug #623 + // Mike or Iggy can be part of the enemy team and they are created from an Elite but they don't have SOLDIER_CLASS_ELITE. + // Therefore once this for loop was done ubNumElites was still 1 which caused an assertion error. + case SOLDIER_CLASS_NONE: + if( ubNumElites ) + { + if ( pSoldier->ubProfile == MIKE || pSoldier->ubProfile == IGGY ) + { + num--; + sNumSlots--; + ubNumElites--; + pSoldier->ubGroupID = pGroup->ubGroupID; + } + } + break; } }