1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Check if a right click is in the map, so clicking on the border no longer opens an empty info windows.

This commit is contained in:
Frank Zago 2009-10-22 02:25:12 +00:00
parent e412619ce7
commit 336fee48aa

View File

@ -558,25 +558,18 @@ void CTerrainRect::clickLeft(tribool down, bool previousState)
void CTerrainRect::clickRight(tribool down, bool previousState)
{
int3 mp = whichTileIsIt();
if ((mp.x<0)
|| (mp.y<0)
|| down != true
)
{
LOCPLINT->adventureInt->handleRightClick("",down,this);
if (!CGI->mh->map->isInTheMap(mp) || down != true)
return;
}
std::vector < const CGObjectInstance * > objs = LOCPLINT->cb->getBlockingObjs(mp);
if(!objs.size()) {
// Bare or undiscovered terrain
if (down) {
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
if (tile) {
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype],LOCPLINT->playerID,true);
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
GH.pushInt(rcpi);
}
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
if (tile) {
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype],LOCPLINT->playerID,true);
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
GH.pushInt(rcpi);
}
return;
}