mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
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:
@@ -1226,22 +1226,26 @@ 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);
|
||||||
|
|
||||||
ubNumReordered = ubWanted - ubStillHave;
|
if (ubWanted > ubStillHave)
|
||||||
|
|
||||||
//randomize the amount. 33% of the time we add to it, 33% we subtract from it, rest leave it alone
|
|
||||||
switch (Random(3))
|
|
||||||
{
|
{
|
||||||
case 0:
|
ubNumReordered = ubWanted - ubStillHave;
|
||||||
ubNumReordered += ubNumReordered / 2;
|
|
||||||
break;
|
//randomize the amount. 33% of the time we add to it, 33% we subtract from it, rest leave it alone
|
||||||
case 1:
|
switch (Random(3))
|
||||||
ubNumReordered -= ubNumReordered / 2;
|
{
|
||||||
break;
|
case 0:
|
||||||
|
ubNumReordered += ubNumReordered / 2;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ubNumReordered -= ubNumReordered / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyBRItemsToOrder: reordered = %d",ubNumReordered));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("HowManyBRItemsToOrder: reordered = %d",ubNumReordered));
|
||||||
|
|||||||
Reference in New Issue
Block a user