From 8c59159213ae569bb34a8e11e501a7cf5062ac45 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Thu, 20 Jan 2022 19:48:56 +0000 Subject: [PATCH] Added "select all" option for strategic movement popup box (by Asdow). git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9269 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface.cpp | 33 +++++++++++++++++++++++++++++- Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + 9 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 28a3b3b06..22afddb19 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -120,6 +120,7 @@ enum{ DONE_REGION, CANCEL_REGION, OTHER_REGION, + ALL_SQUADS }; UINT16 usVehicleY = 0; @@ -3858,6 +3859,10 @@ void AddStringsToMoveBox( void ) // blank line AddMonoString(&hStringHandle, L"" ); + // add Select all line + swprintf(sString, L"%s", pMovementMenuStrings[4]); + AddMonoString(&hStringHandle, sString); + // add squads for( iCount = 0; iCount < giNumberOfSquadsInSectorMoving; iCount++ ) @@ -4040,6 +4045,15 @@ void BuildMouseRegionsForMoveBox( void ) MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; + // Select all line + MSYS_DefineRegion(&gMoveMenuRegion[iCounter], (INT16)(iBoxXPosition), (INT16)(iBoxYPosition + iFontHeight * iCounter), (INT16)(iBoxXPosition + iBoxWidth), (INT16)(iBoxYPosition + iFontHeight * (iCounter + 1)), MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback); + // set user defines + MSYS_SetRegionUserData(&gMoveMenuRegion[iCounter], 0, iCounter); + MSYS_SetRegionUserData(&gMoveMenuRegion[iCounter], 1, ALL_SQUADS); + MSYS_SetRegionUserData(&gMoveMenuRegion[iCounter], 2, giNumberOfSquadsInSectorMoving); + iCounter++; + // calc total number of "moving" lines in the box iTotalNumberOfLines = giNumberOfSoldiersInSectorMoving + giNumberOfSquadsInSectorMoving + giNumberOfVehiclesInSectorMoving; // add the blank lines @@ -4243,7 +4257,24 @@ void MoveMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { giDblClickTimersForMoveBoxMouseRegions[ iMoveBoxLine ] = iClickTime; - if( iRegionType == SQUAD_REGION ) + if (iRegionType == ALL_SQUADS) + { + if (IsAnythingSelectedForMoving()) + { + for (int i = 0; i < iListIndex; i++) + { + DeselectSquadForMovement(iSquadMovingList[i]); + } + } + else + { + for (int i = 0; i < iListIndex; i++) + { + SelectSquadForMovement(iSquadMovingList[i]); + } + } + } + else if( iRegionType == SQUAD_REGION ) { // is the squad moving if( fSquadIsMoving[ iListIndex ] == TRUE ) diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index fafd383ca..1794f5d11 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -4375,6 +4375,7 @@ STR16 pMovementMenuStrings[] = L"安排行军路线", // done with movement menu, start plotting movement L"取消", // cancel this menu L"其它", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 55e49867c..5fb710f3a 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -4363,6 +4363,7 @@ STR16 pMovementMenuStrings[] = L"Teken Reisroute", // done with movement menu, start plotting movement L"Stop", // cancel this menu L"Anders", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 4d59e4f1e..b6db727f0 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -4375,6 +4375,7 @@ STR16 pMovementMenuStrings[] = L"Plot Travel Route", // done with movement menu, start plotting movement L"Cancel", // cancel this menu L"Other", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 20af109e6..3367862fe 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -4367,6 +4367,7 @@ STR16 pMovementMenuStrings[] = L"Route", // done with movement menu, start plotting movement L"Annuler", // cancel this menu L"Autre", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index e40c482d3..32c2fdd84 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -4381,6 +4381,7 @@ STR16 pMovementMenuStrings[] = L"Route planen", // done with movement menu, start plotting movement L"Abbruch", // cancel this menu L"Andere", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; STR16 pUpdateMercStrings[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 67944fcba..990d914e8 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -4357,6 +4357,7 @@ STR16 pMovementMenuStrings[] = L"Rotta spostamento esercito", // done with movement menu, start plotting movement L"Annulla", // cancel this menu L"Altro", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 1119ae0bb..2cf834e9f 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -4368,6 +4368,7 @@ STR16 pMovementMenuStrings[] = L"Nanieś trasę podróży", // done with movement menu, start plotting movement L"Anuluj", // cancel this menu L"Inni", // title for group of mercs not on squads nor in vehicles + L"Select all", // Select all squads TODO: Translate }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 02464b066..94336b8c3 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -4375,6 +4375,7 @@ STR16 pMovementMenuStrings[] = L"Путь", // done with movement menu, start plotting movement L"Отмена", // cancel this menu L"Другое", // title for group of mercs not on squads nor in vehicles + L"Выбрать все", // Select all squads };