From f00bc1aa14ce94e69d8643587bb34ceeb0327fdb Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 24 Feb 2014 21:06:37 +0000 Subject: [PATCH] Merged revision(s) 6971 from branches/ja2_source_official_2014: Fix: MERC members accounts not displayed if they were at the end of the list git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6972 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/mercs Account.cpp | 45 ++++++++++++---------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/Laptop/mercs Account.cpp b/Laptop/mercs Account.cpp index dcdc64a9..ba736115 100644 --- a/Laptop/mercs Account.cpp +++ b/Laptop/mercs Account.cpp @@ -505,55 +505,36 @@ void DisplayHiredMercs() UINT8 i, usMercID; UINT8 ubFontColor; UINT8 usMercIDStart; - UINT8 usMercIDEnd; - INT16 usCurrentRow = -1; + INT16 usCurrentRow = -1; + INT16 merccounter = -1; usPosY = MERC_AC_FIRST_ROW_Y + 3; // Start usMercIDStart = iCurrentAccountPage * MAX_NUMBER_MERCS_ON_PAGE; - - // End - if ((usMercIDStart + MAX_NUMBER_MERCS_ON_PAGE) > (NUMBER_OF_MERCS - 1)) - { - usMercIDEnd = (NUMBER_OF_MERCS - 1); - } - else - { - usMercIDEnd = usMercIDStart + MAX_NUMBER_MERCS_ON_PAGE; - } - - // Flugente: neither do I, so screw this - // WANNE.LARRY: I don't understand why this is needed??? I did not change anything on this yet. - // At least second page - // This approach is needed, because auf LARRY_ROACHBURN - /*if (usMercIDStart > 0) - { - usMercIDStart++; - }*/ - + // Loop through all the mercs - for(i=usMercIDStart; i < usMercIDEnd/*(NUMBER_OF_MERCS - 1)*/ ; ++i) + for(i=0; i < NUMBER_OF_MERCS ; ++i) { - // We have no more free rows on the current page - if (usCurrentRow == usMercIDEnd - 1) + // Exit if this page is full + if (usCurrentRow >= MAX_NUMBER_MERCS_ON_PAGE - 1 ) break; // WANNE: If we have drunken merc, then skip otherwise is will exist 2 times! if (gConditionsForMercAvailability[ i ].Drunk) continue; - - // WANNE.LARRY - //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) - /*if( i == MERC_LARRY_ROACHBURN ) - continue;*/ - + usMercID = GetMercIDFromMERCArray( i ); //is the merc on the team, or is owed money if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) { - usCurrentRow++; + // count the number of mercs we really hired, but only display those that should be on this page + ++merccounter; + if ( merccounter < usMercIDStart ) + continue; + + ++usCurrentRow; //if the merc is dead, make the color red, else white if( IsMercDead( usMercID ) )