From a543b33c4bf1fa7edb621be239a9fa9e170ae632 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 8 Aug 2013 20:49:41 +0000 Subject: [PATCH] Fix: adding new mercs to the MERC webpage in an ongoing campaign destroyed sort order and made mercs unavailable (by silversurfer) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6278 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/mercs.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++++-- Laptop/mercs.h | 1 + 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index ea1550d7..443db7f7 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -363,9 +363,81 @@ BOOLEAN LoadNewMercsFromLoadGameFile( HWFILE hFile ) return( FALSE ); } + // make sure that gubMercArray (the list of mercs for M.E.R.C website) is populated with + // the same mercs as gConditionsForMercAvailability that we just read from the savegame + RevaluateMercArray(); + return( TRUE ); } +// silversurfer: this function checks if gubMercArray contains the same list of mercs as gConditionsForMercAvailability +// if not there will be problems with display of mercs on M.E.R.C website so we will force an update +void RevaluateMercArray() +{ + UINT8 i; + + NUMBER_OF_MERCS = 0; + LAST_MERC_ID = -1; + NUMBER_OF_BAD_MERCS = -1; + + // first clear gubMercArray + for ( i=0; i