mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-13 01:20:34 +02:00
Merge branch 'develop' into SDL2
Conflicts: client/CPlayerInterface.cpp
This commit is contained in:
@ -1130,17 +1130,19 @@ void CAdvMapInt::endingTurn()
|
||||
LOCPLINT->cb->endTurn();
|
||||
}
|
||||
|
||||
const CGObjectInstance* CAdvMapInt::getBlockingObject(const int3 &mapPos)
|
||||
const CGObjectInstance* CAdvMapInt::getActiveObject(const int3 &mapPos)
|
||||
{
|
||||
std::vector < const CGObjectInstance * > bobjs = LOCPLINT->cb->getBlockingObjs(mapPos); //blocking objects at tile
|
||||
|
||||
if (bobjs.empty())
|
||||
return nullptr;
|
||||
|
||||
return *boost::range::max_element(bobjs, &CMapHandler::compareObjectBlitOrder);
|
||||
/*
|
||||
if (bobjs.back()->ID == Obj::HERO)
|
||||
return bobjs.back();
|
||||
else
|
||||
return bobjs.front();
|
||||
return bobjs.front();*/
|
||||
}
|
||||
|
||||
void CAdvMapInt::tileLClicked(const int3 &mapPos)
|
||||
@ -1150,7 +1152,7 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
|
||||
|
||||
const TerrainTile *tile = LOCPLINT->cb->getTile(mapPos);
|
||||
|
||||
const CGObjectInstance *topBlocking = getBlockingObject(mapPos);
|
||||
const CGObjectInstance *topBlocking = getActiveObject(mapPos);
|
||||
|
||||
int3 selPos = selection->getSightCenter();
|
||||
if(spellBeingCasted && isInScreenRange(selPos, mapPos))
|
||||
@ -1235,12 +1237,11 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
||||
statusbar.clear();
|
||||
return;
|
||||
}
|
||||
const CGObjectInstance *objAtTile = getBlockingObject(mapPos);
|
||||
const CGObjectInstance *objAtTile = getActiveObject(mapPos);
|
||||
|
||||
//std::vector<std::string> temp = LOCPLINT->cb->getObjDescriptions(mapPos);
|
||||
if (objAtTile)
|
||||
{
|
||||
std::string text = objAtTile->getHoverText();
|
||||
std::string text = curHero() ? objAtTile->getHoverText(curHero()) : objAtTile->getHoverText(LOCPLINT->playerID);
|
||||
boost::replace_all(text,"\n"," ");
|
||||
statusbar.setText(text);
|
||||
}
|
||||
@ -1436,7 +1437,7 @@ void CAdvMapInt::tileRClicked(const int3 &mapPos)
|
||||
return;
|
||||
}
|
||||
|
||||
const CGObjectInstance * obj = getBlockingObject(mapPos);
|
||||
const CGObjectInstance * obj = getActiveObject(mapPos);
|
||||
if(!obj)
|
||||
{
|
||||
// Bare or undiscovered terrain
|
||||
|
Reference in New Issue
Block a user