From 74e8ecae8c946dc11fb3dce8b7f9e3ce11c7545e Mon Sep 17 00:00:00 2001 From: Wanne Date: Wed, 29 Feb 2012 00:34:23 +0000 Subject: [PATCH] MERGED bugfixes from revision: 4917 - Bugfix: Bobby Ray: Shipments were not cleared when restarting a game git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4973 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Init.cpp | 4 ---- Laptop/PostalService.cpp | 17 ++++++++++------- Laptop/PostalService.h | 2 +- Strategic/Game Init.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Init.cpp b/Init.cpp index 1f1369ab..49c9cdf4 100644 --- a/Init.cpp +++ b/Init.cpp @@ -91,9 +91,6 @@ extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 gubMaxActionPoints[28];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 extern BOOLEAN GetCDromDriveLetter( STR8 pString ); -#include "PostalService.h" -extern CPostalService gPostalService; - // The InitializeGame function is responsible for setting up all data and Gaming Engine // tasks which will run the game @@ -594,7 +591,6 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) SGP_THROW_IFFALSE(ReadInRoamingInfo(fileName),ROAMINGMILITIAFILENAME); // Dealtar: Read in shipping destinations and delivery methods - gPostalService.Clear(); strcpy(fileName, directoryName); strcat(fileName, SHIPPINGDESTINATIONSFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); diff --git a/Laptop/PostalService.cpp b/Laptop/PostalService.cpp index ff162729..444e227c 100644 --- a/Laptop/PostalService.cpp +++ b/Laptop/PostalService.cpp @@ -97,16 +97,19 @@ CPostalService::CPostalService() { } -void CPostalService::Clear() +void CPostalService::Clear(bool clearDataOnly) { _Shipments.clear(); - _UsedShipmentIDList.clear();; - _DeliveryCallbacks.clear(); - _Destinations.clear(); - _UsedDestinationIDList.clear(); - _DeliveryMethods.clear(); -} + if (!clearDataOnly) + { + _UsedShipmentIDList.clear();; + _DeliveryCallbacks.clear(); + _Destinations.clear(); + _UsedDestinationIDList.clear(); + _DeliveryMethods.clear(); + } +} UINT16 CPostalService::CreateNewShipment(UINT16 usDestinationID, UINT8 ubDeliveryMethodIndex, INT16 sSenderID) { diff --git a/Laptop/PostalService.h b/Laptop/PostalService.h index 7ada5bdd..c3a0aaf1 100644 --- a/Laptop/PostalService.h +++ b/Laptop/PostalService.h @@ -232,7 +232,7 @@ public: UINT16 GetDestinationFee(UINT8 ubDeliveryMethodIndex, UINT16 usDestinationID); RefToDeliveryMethodStruct GetDeliveryMethod(UINT8 ubDeliveryMethodIndex) const; - void Clear(); + void Clear(bool clearOnlyData); CPostalService(); private: ShipmentList _Shipments; diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index 45f7138a..df99a516 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -85,6 +85,9 @@ #include "Luaglobal.h" #include "SaveLoadScreen.h" +#include "PostalService.h" +extern CPostalService gPostalService; + class OBJECTTYPE; class SOLDIERTYPE; @@ -1179,6 +1182,9 @@ void ReStartingGame() //Delete all the strategic events DeleteAllStrategicEvents(); + // Dealtar: Read in shipping destinations and delivery methods + gPostalService.Clear(true); + //This function gets called when ur in a game a click the quit to main menu button, therefore no game is in progress gTacticalStatus.fHasAGameBeenStarted = FALSE;