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

Implement movement points info on ALT hold + tile mouse hover

This commit is contained in:
Dydzio 2023-01-16 17:29:33 +01:00
parent 0a858d9a7c
commit c886a2a02b

View File

@ -1721,6 +1721,18 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
const CGPathNode * pnode = LOCPLINT->cb->getPathsInfo(h)->getPathInfo(mapPos);
assert(pnode);
if(LOCPLINT->altPressed() && pnode->reachable()) //overwrite status bar text with movement info
{
const int maxMovementPointsForDestinationLastTurn = pnode->turns > 0 ? h->maxMovePoints(pnode->layer == EPathfindingLayer::LAND) : h->movement;
const int movementPointsLastTurnCost = maxMovementPointsForDestinationLastTurn - pnode->moveRemains;
const int remainingPointsAfterMove = pnode->turns == 0 ? pnode->moveRemains : 0;
const std::string costWord = VLC->generaltexth->allTexts[346];
const std::string leftWord = VLC->generaltexth->allTexts[200];
const std::string turnsCount = pnode->turns > 0 ? std::to_string(pnode->turns) + "T + " : "";
statusbar->write(costWord + ": " + turnsCount + std::to_string(movementPointsLastTurnCost) + ", " + leftWord + ": " + std::to_string(remainingPointsAfterMove));
}
int turns = pnode->turns;
vstd::amin(turns, 3);
switch(pnode->action)