BUGZILLA #535: Fixed CTD that could occur every day on strategy screen at 08:58 when initializing the inventory for the arms dealer

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4512 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-06-21 13:18:58 +00:00
parent 4b55d692c7
commit 1252675d7e
+6 -2
View File
@@ -1226,11 +1226,14 @@ UINT8 HowManyItemsAreSold( INT8 bArmsDealerID, UINT16 usItemIndex, UINT8 ubNumIn
UINT8 HowManyItemsToReorder(UINT8 ubWanted, UINT8 ubStillHave) UINT8 HowManyItemsToReorder(UINT8 ubWanted, UINT8 ubStillHave)
{ {
UINT8 ubNumReordered; UINT8 ubNumReordered = 0;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyItemsToReorder: wanted = %d, still have = %d",ubWanted, ubStillHave)); DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyItemsToReorder: wanted = %d, still have = %d",ubWanted, ubStillHave));
Assert(ubStillHave <= ubWanted); // WANNE: Disabled assertion and fixed possibly problem
//Assert(ubStillHave <= ubWanted);
if (ubWanted > ubStillHave)
{
ubNumReordered = ubWanted - ubStillHave; ubNumReordered = ubWanted - ubStillHave;
//randomize the amount. 33% of the time we add to it, 33% we subtract from it, rest leave it alone //randomize the amount. 33% of the time we add to it, 33% we subtract from it, rest leave it alone
@@ -1243,6 +1246,7 @@ UINT8 HowManyItemsToReorder(UINT8 ubWanted, UINT8 ubStillHave)
ubNumReordered -= ubNumReordered / 2; ubNumReordered -= ubNumReordered / 2;
break; break;
} }
}
DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyBRItemsToOrder: reordered = %d",ubNumReordered)); DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyBRItemsToOrder: reordered = %d",ubNumReordered));
return(ubNumReordered); return(ubNumReordered);