Sorry, for delay, I'm started to playing with GAE and didn't look at glest forum. Here are two patches for glest and gae trunks which add centering on group by pressing this groups number two or more times.
patch for gae:
Index: gui.cpp
===================================================================
--- gui.cpp (revision 302)
+++ gui.cpp (working copy)
@@ -99,6 +99,7 @@
shiftDown = false;
controlDown = false;
activePos= invalidPos;
+ currentGroup= invalidGroupIndex;
}
void Gui::init(Game *game){
@@ -382,7 +383,12 @@
selection.assignGroup(groupIndex);
}
else{
+ if(currentGroup == groupIndex){
+ centerCameraOnSelection();
+ }
+
selection.recallGroup(groupIndex);
+ currentGroup= groupIndex;
}
}
Index: gui.h
===================================================================
--- gui.h (revision 302)
+++ gui.h (working copy)
@@ -99,6 +99,7 @@
static const int imageCount= 16;
static const int invalidPos= -1;
static const int doubleClickSelectionRadius= 20;
+ static const int invalidGroupIndex= -1;
typedef vector<Vec2i> BuildPositions;
@@ -139,6 +140,7 @@
bool selectingMeetingPoint;
bool shiftDown;
bool controlDown;
+ int currentGroup;
public:
Gui();
@@ -213,6 +215,10 @@
computeDisplay();
}
+ void onSelectionUpdated(){
+ currentGroup= invalidGroupIndex;
+ }
+
void onSelectionStateChanged(){
selection.update();
computeDisplay();
Index: selection.cpp
===================================================================
--- selection.cpp (revision 302)
+++ selection.cpp (working copy)
@@ -258,6 +258,8 @@
meetable = uniform && commandable && frontUT->hasMeetingPoint();
}
+
+ gui->onSelectionUpdated();
}
}}//end namespace
patch for glest:
Index: gui.cpp
===================================================================
--- gui.cpp (revision 191)
+++ gui.cpp (working copy)
@@ -96,6 +96,7 @@
selectingPos= false;
selectingMeetingPoint= false;
activePos= invalidPos;
+ currentGroup= invalidGroupIndex;
}
void Gui::init(Game *game){
@@ -266,7 +267,12 @@
selection.assignGroup(groupIndex);
}
else{
+ if(currentGroup == groupIndex){
+ centerCameraOnSelection();
+ }
+
selection.recallGroup(groupIndex);
+ currentGroup= groupIndex;
}
}
@@ -303,6 +309,7 @@
void Gui::onSelectionChanged(){
resetState();
computeDisplay();
+ onSelectionUpdate();
}
// ================= PRIVATE =================
Index: gui.h
===================================================================
--- gui.h (revision 191)
+++ gui.h (working copy)
@@ -98,6 +98,7 @@
static const int imageCount= 16;
static const int invalidPos= -1;
static const int doubleClickSelectionRadius= 20;
+ static const int invalidGroupIndex= -1;
private:
//External objects
@@ -128,6 +129,7 @@
bool selectingBuilding;
bool selectingPos;
bool selectingMeetingPoint;
+ int currentGroup;
public:
Gui();
@@ -171,6 +173,10 @@
//misc
void onSelectionChanged();
+ void onSelectionUpdated(){
+ currentGroup= invalidGroupIndex;
+ }
+
private:
//orders
Index: selection.cpp
===================================================================
--- selection.cpp (revision 191)
+++ selection.cpp (working copy)
@@ -107,6 +107,7 @@
void Selection::clear(){
//clear list
selectedUnits.clear();
+ gui->onSelectionUpdated();
}
bool Selection::isUniform() const{