mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 11:19:48 +02:00
- added guard against NULL commandtype clicking in icon panel (discovered during testing)
This commit is contained in:
@@ -552,19 +552,20 @@ void Gui::clickCommonCommand(CommandClass commandClass){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::mouseDownDisplayUnitSkills(int posDisplay){
|
void Gui::mouseDownDisplayUnitSkills(int posDisplay) {
|
||||||
if(!selection.isEmpty()){
|
if(!selection.isEmpty()) {
|
||||||
if(posDisplay != cancelPos){
|
if(posDisplay != cancelPos) {
|
||||||
if(posDisplay!=meetingPointPos){
|
if(posDisplay!=meetingPointPos) {
|
||||||
const Unit *unit= selection.getFrontUnit();
|
const Unit *unit= selection.getFrontUnit();
|
||||||
|
|
||||||
//uniform selection
|
//uniform selection
|
||||||
if(selection.isUniform()){
|
if(selection.isUniform()) {
|
||||||
if(unit->getFaction()->reqsOk(display.getCommandType(posDisplay))){
|
const CommandType *ct = display.getCommandType(posDisplay);
|
||||||
|
if(ct != NULL && unit->getFaction()->reqsOk(ct)) {
|
||||||
activeCommandType= display.getCommandType(posDisplay);
|
activeCommandType= display.getCommandType(posDisplay);
|
||||||
activeCommandClass= activeCommandType->getClass();
|
activeCommandClass= activeCommandType->getClass();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
posDisplay= invalidPos;
|
posDisplay= invalidPos;
|
||||||
activeCommandType= NULL;
|
activeCommandType= NULL;
|
||||||
activeCommandClass= ccStop;
|
activeCommandClass= ccStop;
|
||||||
@@ -573,7 +574,7 @@ void Gui::mouseDownDisplayUnitSkills(int posDisplay){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//non uniform selection
|
//non uniform selection
|
||||||
else{
|
else {
|
||||||
activeCommandType= NULL;
|
activeCommandType= NULL;
|
||||||
activeCommandClass= display.getCommandClass(posDisplay);
|
activeCommandClass= display.getCommandClass(posDisplay);
|
||||||
}
|
}
|
||||||
|
@@ -213,6 +213,10 @@ int Faction::getCountForMaxUnitCount(const UnitType *unitType) const{
|
|||||||
|
|
||||||
bool Faction::reqsOk(const CommandType *ct) const {
|
bool Faction::reqsOk(const CommandType *ct) const {
|
||||||
assert(ct != NULL);
|
assert(ct != NULL);
|
||||||
|
if(ct == NULL) {
|
||||||
|
throw runtime_error("In [Faction::reqsOk] ct == NULL");
|
||||||
|
}
|
||||||
|
|
||||||
if(ct->getProduced() != NULL && reqsOk(ct->getProduced()) == false) {
|
if(ct->getProduced() != NULL && reqsOk(ct->getProduced()) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user