From db9ecb102d371220d5cb61f1628f51cdbf3272aa Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 2 Mar 2014 09:54:55 +0000 Subject: [PATCH] Merged from revision: 7002 Editor Enhancement (by Buggler) - Hold shift to select previous merc instead of next merc when using hotkeys or associated buttons git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7003 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/EditorMercs.cpp | 73 ++++++++++++++++++++++++++++++++-------- Utils/_ChineseText.cpp | 4 +-- Utils/_DutchText.cpp | 4 +-- Utils/_EnglishText.cpp | 4 +-- Utils/_FrenchText.cpp | 4 +-- Utils/_GermanText.cpp | 4 +-- Utils/_ItalianText.cpp | 4 +-- Utils/_PolishText.cpp | 2 +- Utils/_RussianText.cpp | 4 +-- Utils/_TaiwaneseText.cpp | 4 +-- 10 files changed, 76 insertions(+), 31 deletions(-) diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index c490fe64..220380c6 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -63,6 +63,7 @@ #include "Timer Control.h" #include "message.h" #include "InterfaceItemImages.h" + #include "english.h" #endif //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -1540,6 +1541,7 @@ void IndicateSelectedMerc( INT16 sID ) { SOLDIERINITNODE *prev; INT8 bTeam; + BOOLEAN fSelectPrevious; //If we are trying to select a merc that is already selected, ignore. if( sID >= 0 && sID == gsSelectedMercGridNo ) @@ -1557,6 +1559,9 @@ void IndicateSelectedMerc( INT16 sID ) bTeam = -1; + // hotkey to select previous instead of next merc + fSelectPrevious = gfKeyState[ SHIFT ]; + //determine selection method switch( sID ) { @@ -1568,13 +1573,27 @@ void IndicateSelectedMerc( INT16 sID ) } else { //validate this merc in the list. - if( gpSelected->next ) - { //select the next merc in the list - gpSelected = gpSelected->next; + if( fSelectPrevious ) + { + if( gpSelected->prev ) + { //select the prev merc in the list + gpSelected = gpSelected->prev; + } + else + { //we are at the beginning of the list, so select the last merc in the list. + gpSelected = gSoldierInitTail; + } } else - { //we are at the end of the list, so select the first merc in the list. - gpSelected = gSoldierInitHead; + { + if( gpSelected->next ) + { //select the next merc in the list + gpSelected = gpSelected->next; + } + else + { //we are at the end of the list, so select the first merc in the list. + gpSelected = gSoldierInitHead; + } } } if( !gpSelected ) //list is empty @@ -1587,14 +1606,20 @@ void IndicateSelectedMerc( INT16 sID ) { if( !gpSelected ) { - gpSelected = gSoldierInitHead; + if( fSelectPrevious ) + gpSelected = gSoldierInitTail; + else + gpSelected = gSoldierInitHead; continue; } if( gpSelected->pSoldier && gpSelected->pSoldier->bVisible == 1 ) { //we have found a visible soldier, so select him. break; } - gpSelected = gpSelected->next; + if( fSelectPrevious ) + gpSelected = gpSelected->prev; + else + gpSelected = gpSelected->next; } //we have a valid merc now. break; @@ -1639,13 +1664,27 @@ void IndicateSelectedMerc( INT16 sID ) } else { //validate this merc in the list. - if( gpSelected->next ) - { //select the next merc in the list - gpSelected = gpSelected->next; + if( fSelectPrevious ) + { + if( gpSelected->prev ) + { //select the prev merc in the list + gpSelected = gpSelected->prev; + } + else + { //we are at the beginning of the list, so select the last merc in the list. + gpSelected = gSoldierInitTail; + } } else - { //we are at the end of the list, so select the first merc in the list. - gpSelected = gSoldierInitHead; + { + if( gpSelected->next ) + { //select the next merc in the list + gpSelected = gpSelected->next; + } + else + { //we are at the end of the list, so select the first merc in the list. + gpSelected = gSoldierInitHead; + } } } if( !gpSelected ) //list is empty @@ -1658,14 +1697,20 @@ void IndicateSelectedMerc( INT16 sID ) { if( !gpSelected ) { - gpSelected = gSoldierInitHead; + if( fSelectPrevious ) + gpSelected = gSoldierInitTail; + else + gpSelected = gSoldierInitHead; continue; } if( gpSelected->pSoldier && gpSelected->pSoldier->bVisible == 1 && gpSelected->pSoldier->bTeam == bTeam ) { //we have found a visible soldier on the desired team, so select him. break; } - gpSelected = gpSelected->next; + if( fSelectPrevious ) + gpSelected = gpSelected->prev; + else + gpSelected = gpSelected->next; } if( !gpSelected ) return; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 691174d1..7082d154 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -533,9 +533,9 @@ STR16 iEditorMercsToolbarText[] = L"删除", //L"DELETE", L"删除当前选中佣兵(|D|e|l)", //L"Delete currently selected merc (|D|e|l)", L"下一个", //20 //L"NEXT", - L"定位下一个佣兵(|S|p|a|c|e)", //L"Find next merc (|S|p|a|c|e)", + L"定位下一个佣兵(|S|p|a|c|e)\n定位上一个佣兵(|S|h|i|f|t+|S|p|a|c|e)", //L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"选择优先级", //L"Toggle priority existance", - L"选择此人是否可以开关门", //L"Toggle whether or not placement has/naccess to all doors", + L"选择此人是否可以开关门", //L"Toggle whether or not placement\nhas access to all doors", //Orders L"站立", //L"STATIONARY", diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index c2ba5d47..6ee7fa47 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -534,9 +534,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc (|S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY", diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index bd5714d3..4196cf57 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -533,9 +533,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc (|S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY", diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 06d83731..aacee012 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -537,9 +537,9 @@ STR16 iEditorMercsToolbarText[] = L"SUPPRIMER", L"Supprimer le mercenaire sélectionné (|S|u|p|p|r)", L"SUIVANT", //20 - L"Mercenaire suivant (|E|s|p|a|c|e)", + L"Mercenaire suivant (|E|s|p|a|c|e)\nMercenaire précédente (|M|a|j|+|E|s|p|a|c|e)", L"Changer l'existence prioritaire", - L"Changer, si le placement a/naccès à toutes les portes", + L"Changer, si le placement a\naccès à toutes les portes", //Orders L"STATIONNAIRE", diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 851a0868..e49c55c1 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -556,9 +556,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc (|S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY", diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 6a655415..7f540c01 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -532,9 +532,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc (|S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY", diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 48533cd5..9050ad9e 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -539,7 +539,7 @@ STR16 iEditorMercsToolbarText[] = L"Usuń", L"Usuń zaznaczonego najemnika (|D|e|l)", L"Kolejny", //20 - L"Znajdź następnego najemnika (|S|p|a|c|e)", + L"Znajdź następnego najemnika (|S|p|a|c|j|a)\nZnajdź poprzedniego najemnika (|S|h|i|f|t+|S|p|a|c|j|a)", L"Włącz priorytet egzystencji", L"Postać ma dostęp do wszystkich zamkniętych drzwi", diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 100789f6..7531743a 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -534,9 +534,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc (|S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY", diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index bc7dd75e..96c1c3fa 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -532,9 +532,9 @@ STR16 iEditorMercsToolbarText[] = L"DELETE", L"Delete currently selected merc (|D|e|l)", L"NEXT", //20 - L"Find next merc |S|p|a|c|e)", + L"Find next merc (|S|p|a|c|e)\nFind previous merc (|S|h|i|f|t+|S|p|a|c|e)", L"Toggle priority existance", - L"Toggle whether or not placement has/naccess to all doors", + L"Toggle whether or not placement\nhas access to all doors", //Orders L"STATIONARY",