mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 23:45:14 +02:00
- fixed null pointer discovered by titi
This commit is contained in:
@@ -1089,7 +1089,10 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
|||||||
else if(obj != NULL){
|
else if(obj != NULL){
|
||||||
targetUnit= NULL;
|
targetUnit= NULL;
|
||||||
highlightedResourceObjectPos=Map::toSurfCoords(obj->getMapPos());
|
highlightedResourceObjectPos=Map::toSurfCoords(obj->getMapPos());
|
||||||
getHighlightedResourceObject()->resetHighlight();
|
|
||||||
|
Object *selObj = getHighlightedResourceObject();
|
||||||
|
if(selObj != NULL) {
|
||||||
|
selObj->resetHighlight();
|
||||||
// get real click pos
|
// get real click pos
|
||||||
renderer.computePosition(screenPos, targetPos);
|
renderer.computePosition(screenPos, targetPos);
|
||||||
|
|
||||||
@@ -1176,7 +1179,10 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
|||||||
targetPos= obj->getMapPos();
|
targetPos= obj->getMapPos();
|
||||||
posObjWorld= targetPos;
|
posObjWorld= targetPos;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
targetUnit= NULL;
|
targetUnit= NULL;
|
||||||
@@ -1184,10 +1190,13 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
|||||||
validPosObjWorld= true;
|
validPosObjWorld= true;
|
||||||
posObjWorld= targetPos;
|
posObjWorld= targetPos;
|
||||||
|
|
||||||
if(world->getMap()->getSurfaceCell(Map::toSurfCoords(targetPos))->getResource()!=NULL)
|
if(world->getMap()->getSurfaceCell(Map::toSurfCoords(targetPos))->getResource() != NULL) {
|
||||||
{
|
|
||||||
highlightedResourceObjectPos=Map::toSurfCoords(targetPos);
|
highlightedResourceObjectPos=Map::toSurfCoords(targetPos);
|
||||||
getHighlightedResourceObject()->resetHighlight();
|
|
||||||
|
Object *selObj = getHighlightedResourceObject();
|
||||||
|
if(selObj != NULL) {
|
||||||
|
selObj->resetHighlight();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user