1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

* partial handling r-clicks on adv map

* minor fixes
This commit is contained in:
Michał W. Urbańczyk
2009-01-14 19:01:20 +00:00
parent b895fa35cb
commit a37ce5df9e
3 changed files with 44 additions and 2 deletions

View File

@ -435,6 +435,47 @@ endchkpt:
}
void CTerrainRect::clickRight(tribool down)
{
int3 mp = whichTileIsIt();
if ((mp.x<0)
|| (mp.y<0)
|| down != true
)
{
LOCPLINT->adventureInt->handleRightClick("",down,this);
return;
}
std::vector < const CGObjectInstance * > objs = LOCPLINT->cb->getBlockingObjs(mp);
if(!objs.size())
return;
const CGObjectInstance * obj = objs[objs.size()-1];
switch(obj->ID)
{
case 34:
{
CInfoPopup * ip = new CInfoPopup(graphics->heroWins[obj->subID],
LOCPLINT->current->motion.x-graphics->heroWins[obj->subID]->w,
LOCPLINT->current->motion.y-graphics->heroWins[obj->subID]->h,false
);
ip->activate();
break;
}
case 98:
{
CInfoPopup * ip = new CInfoPopup(graphics->townWins[obj->id],
LOCPLINT->current->motion.x-graphics->townWins[obj->id]->w,
LOCPLINT->current->motion.y-graphics->townWins[obj->id]->h,false
);
ip->activate();
break;
}
default:
{
LOCPLINT->adventureInt->handleRightClick(obj->getHoverText(),down,this);
break;
}
}
}
void CTerrainRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
{