mirror of
https://github.com/glest/glest-source.git
synced 2025-02-23 19:22:40 +01:00
Fix for uniform-selection
This commit is contained in:
parent
4d99f5900d
commit
990df3b49b
@ -3341,7 +3341,7 @@ bool Game::addUnitToSelection(Unit *unit) {
|
|||||||
try {
|
try {
|
||||||
Selection *selection= gui.getSelectionPtr();
|
Selection *selection= gui.getSelectionPtr();
|
||||||
if(selection != NULL) {
|
if(selection != NULL) {
|
||||||
result = selection->select(unit);
|
result = selection->select(unit,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
|
@ -588,7 +588,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
|
|||||||
|
|
||||||
if(previousFound == true) {
|
if(previousFound == true) {
|
||||||
if(unit->isInteresting(iut)) {
|
if(unit->isInteresting(iut)) {
|
||||||
selection.select(unit);
|
selection.select(unit,false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -605,7 +605,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
|
|||||||
Unit* unit = thisFaction->getUnit(index);
|
Unit* unit = thisFaction->getUnit(index);
|
||||||
|
|
||||||
if(unit->isInteresting(iut)) {
|
if(unit->isInteresting(iut)) {
|
||||||
selection.select(unit);
|
selection.select(unit,false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1154,7 +1154,7 @@ void Gui::computeSelected(bool doubleClick, bool force){
|
|||||||
|
|
||||||
if(!controlDown){
|
if(!controlDown){
|
||||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to call selection.select(units)\n",__FILE__,__FUNCTION__,__LINE__);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to call selection.select(units)\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
selection.select(units);
|
selection.select(units,shiftDown);
|
||||||
if(!selection.isEmpty()){
|
if(!selection.isEmpty()){
|
||||||
selectedResourceObject=NULL;
|
selectedResourceObject=NULL;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ bool Selection::canSelectUnitFactionCheck(const Unit *unit) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Selection::select(Unit *unit) {
|
bool Selection::select(Unit *unit, bool addToSelection) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
|
if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
|
||||||
return result;
|
return result;
|
||||||
@ -84,8 +84,13 @@ bool Selection::select(Unit *unit) {
|
|||||||
//check if multitypesel
|
//check if multitypesel
|
||||||
if(selectedUnits.size() > 0) {
|
if(selectedUnits.size() > 0) {
|
||||||
if(selectedUnits.front()->getType()->getUniformSelect() == true && selectedUnits.front()->getType() != unit->getType()) {
|
if(selectedUnits.front()->getType()->getUniformSelect() == true && selectedUnits.front()->getType() != unit->getType()) {
|
||||||
return false;
|
if(addToSelection)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(selectedUnits.size() > 0) {
|
||||||
if(unit->getType()->getUniformSelect() == true && selectedUnits.front()->getType() != unit->getType()) {
|
if(unit->getType()->getUniformSelect() == true && selectedUnits.front()->getType() != unit->getType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -135,11 +140,11 @@ bool Selection::select(Unit *unit) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Selection::select(const UnitContainer &units){
|
void Selection::select(const UnitContainer &units, bool addToSelection){
|
||||||
|
|
||||||
//add units to gui
|
//add units to gui
|
||||||
for(UnitIterator it = units.begin(); it != units.end(); ++it) {
|
for(UnitIterator it = units.begin(); it != units.end(); ++it) {
|
||||||
select(*it);
|
select(*it,addToSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +337,7 @@ void Selection::recallGroup(int groupIndex,bool clearSelection){
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
for(int i = 0; i < (int)groups[groupIndex].size(); ++i) {
|
for(int i = 0; i < (int)groups[groupIndex].size(); ++i) {
|
||||||
select(groups[groupIndex][i]);
|
select(groups[groupIndex][i],!clearSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
void init(Gui *gui, int factionIndex, int teamIndex, bool allowSharedTeamUnits);
|
void init(Gui *gui, int factionIndex, int teamIndex, bool allowSharedTeamUnits);
|
||||||
virtual ~Selection();
|
virtual ~Selection();
|
||||||
|
|
||||||
bool select(Unit *unit);
|
bool select(Unit *unit, bool addToSelection);
|
||||||
void select(const UnitContainer &units);
|
void select(const UnitContainer &units, bool addToSelection);
|
||||||
void unSelect(const UnitContainer &units);
|
void unSelect(const UnitContainer &units);
|
||||||
void unSelect(int unitIndex);
|
void unSelect(int unitIndex);
|
||||||
void clear();
|
void clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user