mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +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:
@ -558,26 +558,19 @@ void CTerrainRect::clickLeft(tribool down, bool previousState)
|
|||||||
void CTerrainRect::clickRight(tribool down, bool previousState)
|
void CTerrainRect::clickRight(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
int3 mp = whichTileIsIt();
|
int3 mp = whichTileIsIt();
|
||||||
if ((mp.x<0)
|
|
||||||
|| (mp.y<0)
|
if (!CGI->mh->map->isInTheMap(mp) || down != true)
|
||||||
|| down != true
|
|
||||||
)
|
|
||||||
{
|
|
||||||
LOCPLINT->adventureInt->handleRightClick("",down,this);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
std::vector < const CGObjectInstance * > objs = LOCPLINT->cb->getBlockingObjs(mp);
|
std::vector < const CGObjectInstance * > objs = LOCPLINT->cb->getBlockingObjs(mp);
|
||||||
if(!objs.size()) {
|
if(!objs.size()) {
|
||||||
// Bare or undiscovered terrain
|
// Bare or undiscovered terrain
|
||||||
if (down) {
|
|
||||||
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
|
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
|
||||||
if (tile) {
|
if (tile) {
|
||||||
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype],LOCPLINT->playerID,true);
|
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype],LOCPLINT->playerID,true);
|
||||||
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
|
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
|
||||||
GH.pushInt(rcpi);
|
GH.pushInt(rcpi);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user