From f839dcbe736ef1e44516b46bd8984615f0d0aacc Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 5 Nov 2006 21:21:51 +0000 Subject: [PATCH] - bugfix: CTDs after you have placed your mercs before the attacking occurs - added notification when you try to create a new IMP and you already have the maxium number of mercs (18) in your team. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@619 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- JA2.suo | Bin 197632 -> 197632 bytes Laptop/AimMembers.cpp | 12 ++++++------ Laptop/IMP HomePage.cpp | 33 +++++++++++++++++++++++++++++---- Laptop/mercs Files.cpp | 2 +- Strategic/Town Militia.cpp | 2 +- Tactical/Handle UI.cpp | 4 ++-- Tactical/Merc Hiring.cpp | 2 +- Tactical/Merc Hiring.h | 2 +- Tactical/Soldier Init List.cpp | 9 +++++++-- Utils/Text.h | 2 +- 10 files changed, 49 insertions(+), 19 deletions(-) diff --git a/JA2.suo b/JA2.suo index 59dd9d8a281052e2e5291a2f4ada9aeff55636e7..4d3380e1408462e86968b80d3660f9c520f7bcd9 100644 GIT binary patch delta 4912 zcmb7H4Qx}_6~5=$ah&k%II%zr| zuc|iGF^Td@j@C_6mbROwmJ-z(-n40DbU+79m3CRWNn0DxgqS)N+R>uY7Vn&E$Fcp4 z2hX~G_I>Am_uTV+=iK|eM^x_-b+led$rnQ02?PQTZG$o=DV6>e`1UGag4KDm^`kj( z0SwgT_4)>l=fTK^zIu~aSz)B!Y-)YtG0`Qq3y+PiEc5#-5K=NOqT59F8Xe#2h_~~kBCm{3c5~RzRol^ zIaWYV7-iZq?Pi8cb%Z*?ogTYOt9MkI*vVv}-L^NXmKYn8jXI1%8*~hUUHix%MAGt9JRvS-5->zK<2}Ly`Zi5mv&( zE5$z1AvV(Y9=dmtls1u&>WH2F#9}RR)I`1esWEvwsYMCT|F8*a;qbKl7Kr=7`<8IZ z+3V=LpFUkAVvpENLg^8^=~)}i#!?UVbducmh!U|#RMMxE`okBV{8+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XVbRjpop_B_5qN<`fs-V4MY58Zd4}lP^YXg_MBS{Eel~r)4M-d(1*w6pjUaXAiL>z z`>02GHRhShhfL78{eCFoE<%f2)PS$&D`cWs86MA;6=Bt)5+?Rq(8WJ5l2iQ|ks(7< V3^tuI= 18 ) - return; - char charPlayerActivationString[32]; wcstombs(charPlayerActivationString,pPlayerActivationString,32); + BOOLEAN freeMercSlot = TRUE; + + // WANNE: Check total number of hired mercs + if( NumberOfMercsOnPlayerTeam() >= 18 ) + { + freeMercSlot = FALSE; + } + //Madd multiple imps if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) )&&( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) { + // WANNE: Check total number of hired mercs + if( freeMercSlot == FALSE ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return; + } + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) { // Kaiden: Need to reset skills, attributes and personalities with the new UB Method. @@ -408,6 +419,13 @@ void ProcessPlayerInputActivationString( void ) //Madd multiple imps else if( ( wcscmp(pPlayerActivationString, L"90210") == 0 ) && ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) ) else if( wcscmp(pPlayerActivationString, L"90210") == 0 ) { + // WANNE: Check total number of hired mercs + if( freeMercSlot == FALSE ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return; + } + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) { if (LoadImpCharacter( IMP_MERC_FILENAME ) == TRUE) @@ -424,6 +442,13 @@ void ProcessPlayerInputActivationString( void ) // Madd: load characters by name else if ( ImpExists( charPlayerActivationString ) ) { + // WANNE: Check total number of hired mercs + if( freeMercSlot == FALSE ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return; + } + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) { if (LoadImpCharacter( charPlayerActivationString ) == TRUE) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 23ba59a9..89cd1d20 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -650,7 +650,7 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) bReturnCode = HireMerc( &HireMercStruct ); //already have 20 mercs on the team - if( bReturnCode == MERC_HIRE_OVER_20_MERCS_HIRED ) + if( bReturnCode == MERC_HIRE_OVER_18_MERCS_HIRED ) { DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, MercInfo[ MERC_FILES_HIRE_TO_MANY_PEOPLE_WARNING ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return(FALSE); diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index a9070cdc..5ce3c646 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -336,7 +336,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); // damn well better have that many around to promote! - Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany); + //Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany); //KM : July 21, 1999 patch fix if( pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] < ubHowMany ) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 47eeb24a..69769326 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -1063,9 +1063,9 @@ UINT32 UIHandleNewMerc( UI_EVENT *pUIEvent ) { ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Merc hire failed: Either already hired or dislikes you." ); } - else if( bReturnCode == MERC_HIRE_OVER_20_MERCS_HIRED ) + else if( bReturnCode == MERC_HIRE_OVER_18_MERCS_HIRED ) { - ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Can't hire more than 20 mercs." ); + ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Can't hire more than 18 mercs." ); } else { diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index bf196113..5c8b0882 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -92,7 +92,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) return( MERC_HIRE_FAILED ); if( NumberOfMercsOnPlayerTeam() >= 18 ) - return( MERC_HIRE_OVER_20_MERCS_HIRED ); + return( MERC_HIRE_OVER_18_MERCS_HIRED ); // ATE: if we are to use landing zone, update to latest value // they will be updated again just before arrival... diff --git a/Tactical/Merc Hiring.h b/Tactical/Merc Hiring.h index e1b72c0e..032eaa11 100644 --- a/Tactical/Merc Hiring.h +++ b/Tactical/Merc Hiring.h @@ -7,7 +7,7 @@ // // Used with the HireMerc function // -#define MERC_HIRE_OVER_20_MERCS_HIRED -1 +#define MERC_HIRE_OVER_18_MERCS_HIRED -1 #define MERC_HIRE_FAILED 0 #define MERC_HIRE_OK 1 diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 5cc06b7d..97244989 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -2343,6 +2343,13 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu UINT8 ubCurrSlot; UINT8 ubTotalSoldiers; UINT8 bDesiredDirection=0; + + ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites; + + // WANNE: If we have no militia soldiers -> exit! + if (ubTotalSoldiers == 0) + return; + switch( ubStrategicInsertionCode ) { case INSERTION_CODE_NORTH: bDesiredDirection = SOUTHEAST; break; @@ -2355,8 +2362,6 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites ); #endif - ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites; - ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumGreen + ubNumReg + ubNumElites) ); ubCurrSlot = 0; while( ubTotalSoldiers ) diff --git a/Utils/Text.h b/Utils/Text.h index 4108245f..6b7ab2db 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -987,7 +987,7 @@ enum AIM_MEMBER_LEAVE_MSG, AIM_MEMBER_DEAD, - AIM_MEMBER_ALREADY_HAVE_20_MERCS, + AIM_MEMBER_ALREADY_HAVE_18_MERCS, AIM_MEMBER_PRERECORDED_MESSAGE, AIM_MEMBER_MESSAGE_RECORDED,