mirror of
https://github.com/glest/glest-source.git
synced 2025-02-23 11:15:02 +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 {
|
||||
Selection *selection= gui.getSelectionPtr();
|
||||
if(selection != NULL) {
|
||||
result = selection->select(unit);
|
||||
result = selection->select(unit,true);
|
||||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
|
@ -588,7 +588,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
|
||||
|
||||
if(previousFound == true) {
|
||||
if(unit->isInteresting(iut)) {
|
||||
selection.select(unit);
|
||||
selection.select(unit,false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -605,7 +605,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
|
||||
Unit* unit = thisFaction->getUnit(index);
|
||||
|
||||
if(unit->isInteresting(iut)) {
|
||||
selection.select(unit);
|
||||
selection.select(unit,false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1154,7 +1154,7 @@ void Gui::computeSelected(bool doubleClick, bool force){
|
||||
|
||||
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__);
|
||||
selection.select(units);
|
||||
selection.select(units,shiftDown);
|
||||
if(!selection.isEmpty()){
|
||||
selectedResourceObject=NULL;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ bool Selection::canSelectUnitFactionCheck(const Unit *unit) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Selection::select(Unit *unit) {
|
||||
bool Selection::select(Unit *unit, bool addToSelection) {
|
||||
bool result = false;
|
||||
if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
|
||||
return result;
|
||||
@ -84,8 +84,13 @@ bool Selection::select(Unit *unit) {
|
||||
//check if multitypesel
|
||||
if(selectedUnits.size() > 0) {
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
@ -135,11 +140,11 @@ bool Selection::select(Unit *unit) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Selection::select(const UnitContainer &units){
|
||||
void Selection::select(const UnitContainer &units, bool addToSelection){
|
||||
|
||||
//add units to gui
|
||||
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();
|
||||
}
|
||||
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);
|
||||
virtual ~Selection();
|
||||
|
||||
bool select(Unit *unit);
|
||||
void select(const UnitContainer &units);
|
||||
bool select(Unit *unit, bool addToSelection);
|
||||
void select(const UnitContainer &units, bool addToSelection);
|
||||
void unSelect(const UnitContainer &units);
|
||||
void unSelect(int unitIndex);
|
||||
void clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user