From df2ffc590b18109caad12a5feafdccb8e8e37718 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 19 Oct 2013 16:52:53 +0000 Subject: [PATCH] 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 --- Laptop/DropDown.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Laptop/DropDown.cpp b/Laptop/DropDown.cpp index eee8d688..1673b6fa 100644 --- a/Laptop/DropDown.cpp +++ b/Laptop/DropDown.cpp @@ -358,6 +358,7 @@ void DropDown::DrawSelectedCity() { UINT16 usPosY = musStartY_Drop; + UINT16 usMaxY = 0; // make sure we dont go out of our array if( mFirstShownEntry+mNumDisplayedEntries > (UINT8)(mEntryVector.size() ) ) @@ -365,16 +366,18 @@ DropDown::DrawSelectedCity() for( UINT8 i = mFirstShownEntry; i < mFirstShownEntry+mNumDisplayedEntries; ++i) { + usMaxY = min(usPosY+musFontHeight+2, musStartY_Drop + musAreaHeight - 4); + 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); 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); } 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 ); }