Fix: crash when clicking on empty inventory slot

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8459 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-08-26 19:49:05 +00:00
parent 04ce05bdf3
commit 5f5b1f27c4
2 changed files with 11 additions and 2 deletions
+4 -2
View File
@@ -1546,8 +1546,10 @@ void ResizeBoxToText(INT32 hBoxHandle)
break;
}
}
PopUpBoxList[hBoxHandle]->Dimensions.iBottom=iHeight;
PopUpBoxList[hBoxHandle]->Dimensions.iRight=iWidth;
// Flugente we shouldn't have added more popup options than we can display anyway, but I have no idea where to stop that, so at least we can fix this
PopUpBoxList[hBoxHandle]->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - PopUpBoxList[hBoxHandle]->Position.iY);
PopUpBoxList[hBoxHandle]->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - PopUpBoxList[hBoxHandle]->Position.iX );
}
+7
View File
@@ -1646,6 +1646,13 @@ void POPUP::DetermineBoxPositions( void )
return;
}
// Flugente: fix obvious errors
pPoint.iX = max( pPoint.iX, 0 );
pPoint.iX = min( pPoint.iX, SCREEN_WIDTH );
pPoint.iY = max( pPoint.iY, 0 );
pPoint.iY = min( pPoint.iY, SCREEN_HEIGHT );
// set all the other positions to match this one
this->Position = pPoint;
this->BoxesX = pPoint.iX;