Fix: colouring selected entry wrote over lower boundary

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6511 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-10-19 16:52:53 +00:00
parent b9ac50aaac
commit df2ffc590b
+5 -2
View File
@@ -358,6 +358,7 @@ void
DropDown::DrawSelectedCity() DropDown::DrawSelectedCity()
{ {
UINT16 usPosY = musStartY_Drop; UINT16 usPosY = musStartY_Drop;
UINT16 usMaxY = 0;
// make sure we dont go out of our array // make sure we dont go out of our array
if( mFirstShownEntry+mNumDisplayedEntries > (UINT8)(mEntryVector.size() ) ) if( mFirstShownEntry+mNumDisplayedEntries > (UINT8)(mEntryVector.size() ) )
@@ -365,16 +366,18 @@ DropDown::DrawSelectedCity()
for( UINT8 i = mFirstShownEntry; i < mFirstShownEntry+mNumDisplayedEntries; ++i) for( UINT8 i = mFirstShownEntry; i < mFirstShownEntry+mNumDisplayedEntries; ++i)
{ {
usMaxY = min(usPosY+musFontHeight+2, musStartY_Drop + musAreaHeight - 4);
if ( i == mSelectedEntry ) if ( i == mSelectedEntry )
{ {
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usPosY+musFontHeight+2, mColorMarked ); ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usMaxY, mColorMarked );
SetFontShadow(NO_SHADOW); SetFontShadow(NO_SHADOW);
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
SetFontShadow(DEFAULT_SHADOW); SetFontShadow(DEFAULT_SHADOW);
} }
else else
{ {
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usPosY+musFontHeight+2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usMaxY, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
} }