mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Changed variables to UINT16, in case a dropdown has a lot of entries
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8179 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+17
-16
@@ -95,8 +95,8 @@ DropDownBase::Init(UINT16 sX, UINT16 sY)
|
||||
mFirstShownEntry = max(0, min(mFirstShownEntry, mEntryVector.size() - 1 - mNumDisplayedEntries));
|
||||
|
||||
musWidth = 0;
|
||||
UINT8 size = mEntryVector.size();
|
||||
for( UINT8 i = 0; i < size; ++i)
|
||||
UINT16 size = mEntryVector.size();
|
||||
for ( UINT16 i = 0; i < size; ++i )
|
||||
{
|
||||
musWidth = max(musWidth, StringPixLength ( mEntryVector[i].second, DEF_DROPDOWN_FONT ));
|
||||
}
|
||||
@@ -253,7 +253,7 @@ DropDownBase::Destroy_Drop()
|
||||
if( !mfMouseRegionsCreated_Drop )
|
||||
return;
|
||||
|
||||
UINT8 i;
|
||||
UINT16 i;
|
||||
for ( i = 0; i< mNumDisplayedEntries; ++i )
|
||||
MSYS_RemoveRegion( &mDropDownRegion[i]);
|
||||
|
||||
@@ -307,6 +307,7 @@ DropDownBase::Display()
|
||||
|
||||
//get and display the up and down arrows
|
||||
GetVideoObject( &hArrowHandle, guGoldArrowImages );
|
||||
|
||||
//top arrow
|
||||
BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
|
||||
@@ -392,10 +393,10 @@ DropDownBase::DrawSelectedCity()
|
||||
UINT16 usMaxY = 0;
|
||||
|
||||
// make sure we dont go out of our array
|
||||
if( mFirstShownEntry+mNumDisplayedEntries > (UINT8)(mEntryVector.size() ) )
|
||||
if ( mFirstShownEntry + mNumDisplayedEntries > (UINT16)(mEntryVector.size( )) )
|
||||
mFirstShownEntry = mEntryVector.size() - mNumDisplayedEntries;
|
||||
|
||||
for( UINT8 i = mFirstShownEntry; i < mFirstShownEntry+mNumDisplayedEntries; ++i)
|
||||
for ( UINT16 i = mFirstShownEntry; i < mFirstShownEntry + mNumDisplayedEntries; ++i )
|
||||
{
|
||||
usMaxY = min(usPosY+musFontHeight+2, musStartY_Drop + musAreaHeight - 4);
|
||||
|
||||
@@ -490,7 +491,7 @@ DropDownBase::SelectDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reaso
|
||||
{
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON ;
|
||||
|
||||
mSelectedEntry = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ) + mFirstShownEntry;
|
||||
mSelectedEntry = (UINT16)MSYS_GetRegionUserData( pRegion, 0 ) + mFirstShownEntry;
|
||||
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
|
||||
@@ -508,8 +509,8 @@ DropDownBase::SelectDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
{
|
||||
UINT8 ubSelected = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
mSelectedEntry = min(ubSelected + mFirstShownEntry, (UINT8)(max(0, mEntryVector.size() -1)) );
|
||||
UINT16 ubSelected = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
mSelectedEntry = min( ubSelected + mFirstShownEntry, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
|
||||
Destroy_Drop();
|
||||
}
|
||||
@@ -523,7 +524,7 @@ DropDownBase::SelectUpDownArrowOnScrollAreaRegionCallBack(MOUSE_REGION * pRegion
|
||||
}
|
||||
else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP || iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
|
||||
{
|
||||
UINT8 ubDownArrow = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
UINT16 ubDownArrow = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
if( ubDownArrow )
|
||||
{
|
||||
@@ -566,7 +567,7 @@ DropDownBase::SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, I
|
||||
{
|
||||
if( gfLeftButtonState )
|
||||
{
|
||||
UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
@@ -579,10 +580,10 @@ DropDownBase::SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, I
|
||||
}
|
||||
else if( mFirstShownEntry + ubCityNum > mSelectedEntry )
|
||||
{
|
||||
mSelectedEntry = min( mFirstShownEntry + ubCityNum, (UINT8)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
mSelectedEntry = min( mFirstShownEntry + ubCityNum, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
|
||||
if ( ubCityNum == mNumDisplayedEntries - 1 )
|
||||
mFirstShownEntry = min( mFirstShownEntry + 1, (UINT8)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
mFirstShownEntry = min( mFirstShownEntry + 1, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
}
|
||||
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
@@ -602,7 +603,7 @@ DropDownBase::SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
{
|
||||
UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
if( ubCityNum < mSelectedEntry )
|
||||
{
|
||||
@@ -623,7 +624,7 @@ DropDownBase::SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT)
|
||||
{
|
||||
UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON ;
|
||||
|
||||
@@ -654,7 +655,7 @@ DropDownBase::SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT
|
||||
void
|
||||
DropDownBase::SetSelectedEntryKey( INT16 aKey )
|
||||
{
|
||||
UINT8 cnt = 0;
|
||||
UINT16 cnt = 0;
|
||||
std::vector<std::pair<INT16, STR16> >::iterator itend = mEntryVector.end();
|
||||
for ( std::vector<std::pair<INT16, STR16> >::iterator it = mEntryVector.begin(); it != itend; ++it )
|
||||
{
|
||||
@@ -672,7 +673,7 @@ DropDownBase::SetSelectedEntryKey( INT16 aKey )
|
||||
* set the nth entry as the selected one
|
||||
*/
|
||||
void
|
||||
DropDownBase::SetNthEntry( UINT8 aNr )
|
||||
DropDownBase::SetNthEntry( UINT16 aNr )
|
||||
{
|
||||
mSelectedEntry = min( aNr, max(0, mEntryVector.size() - 1) );
|
||||
}
|
||||
|
||||
+4
-4
@@ -232,7 +232,7 @@ public:
|
||||
/*
|
||||
* set the nth entry as the selected one
|
||||
*/
|
||||
void SetNthEntry( UINT8 aNr );
|
||||
void SetNthEntry( UINT16 aNr );
|
||||
|
||||
/*
|
||||
* Get width of entire DropDownBase
|
||||
@@ -334,9 +334,9 @@ private:
|
||||
|
||||
CHAR16 mHelpText[200];
|
||||
|
||||
UINT8 mSelectedEntry; // keeps track of the currently selected city
|
||||
UINT8 mFirstShownEntry; // top entry of the dropped region
|
||||
UINT8 mNumDisplayedEntries; // number of entries displayed. Calculated internally, no need to change by user
|
||||
UINT16 mSelectedEntry; // keeps track of the currently selected city
|
||||
UINT16 mFirstShownEntry; // top entry of the dropped region
|
||||
UINT16 mNumDisplayedEntries; // number of entries displayed. Calculated internally, no need to change by user
|
||||
|
||||
BOOLEAN mfDropScrollBar; // do we need a scrollbar and a down arrow?
|
||||
};
|
||||
|
||||
@@ -425,8 +425,9 @@ IMPDialogueChooseBox::Init( UINT16 sX, UINT16 sY )
|
||||
mSelectedEntry = 0;
|
||||
|
||||
musWidth = 0;
|
||||
UINT8 size = mEntryVector.size( );
|
||||
for ( UINT8 i = 0; i < size; ++i )
|
||||
|
||||
UINT16 size = mEntryVector.size( );
|
||||
for ( UINT16 i = 0; i < size; ++i )
|
||||
{
|
||||
musWidth = max( musWidth, StringPixLength( mEntryVector[i].second, MYBOX_FONT_DEF ) );
|
||||
}
|
||||
@@ -449,8 +450,8 @@ IMPDialogueChooseBox::Create( UINT16 sX, UINT16 sY )
|
||||
|
||||
sY += IMPDIALOGUECHOOSEBOX_BAR_Y_OFFSET;
|
||||
|
||||
UINT8 size = mEntryVector.size( );
|
||||
for ( UINT8 i = 0; i < size; ++i )
|
||||
UINT16 size = mEntryVector.size( );
|
||||
for ( UINT16 i = 0; i < size; ++i )
|
||||
{
|
||||
if ( !mChoiceRegionDefined[i] )
|
||||
{
|
||||
@@ -559,7 +560,7 @@ IMPDialogueChooseBox::DrawTopEntry( )
|
||||
|
||||
UINT16 sY = GetY( ) + IMPDIALOGUECHOOSEBOX_BAR_Y_OFFSET;
|
||||
|
||||
UINT8 cnt = 0;
|
||||
UINT16 cnt = 0;
|
||||
std::vector<std::pair<INT16, STR16> >::iterator itend = mEntryVector.end( );
|
||||
for ( std::vector<std::pair<INT16, STR16> >::iterator it = mEntryVector.begin( ); it != itend; ++it )
|
||||
{
|
||||
@@ -586,7 +587,7 @@ IMPDialogueChooseBox::SelectDropDownRegionCallBack( MOUSE_REGION * pRegion, INT3
|
||||
}
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
mSelectedEntry = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
mSelectedEntry = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ private:
|
||||
|
||||
CHAR16 mHelpText[200];
|
||||
|
||||
UINT8 mSelectedEntry; // keeps track of the currently selected city
|
||||
UINT16 mSelectedEntry; // keeps track of the currently selected city
|
||||
|
||||
CHAR16 mText[500];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user