|
|
@@ -1708,7 +1708,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|
|
else
|
|
|
CCS->curh->set(Cursor::Map::POINTER);
|
|
|
}
|
|
|
- else if(const CGHeroInstance * h = curHero())
|
|
|
+ else if(const CGHeroInstance * hero = curHero())
|
|
|
{
|
|
|
std::array<Cursor::Map, 4> cursorMove = { Cursor::Map::T1_MOVE, Cursor::Map::T2_MOVE, Cursor::Map::T3_MOVE, Cursor::Map::T4_MOVE, };
|
|
|
std::array<Cursor::Map, 4> cursorAttack = { Cursor::Map::T1_ATTACK, Cursor::Map::T2_ATTACK, Cursor::Map::T3_ATTACK, Cursor::Map::T4_ATTACK, };
|
|
|
@@ -1718,28 +1718,21 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|
|
std::array<Cursor::Map, 4> cursorVisit = { Cursor::Map::T1_VISIT, Cursor::Map::T2_VISIT, Cursor::Map::T3_VISIT, Cursor::Map::T4_VISIT, };
|
|
|
std::array<Cursor::Map, 4> cursorSailVisit = { Cursor::Map::T1_SAIL_VISIT, Cursor::Map::T2_SAIL_VISIT, Cursor::Map::T3_SAIL_VISIT, Cursor::Map::T4_SAIL_VISIT, };
|
|
|
|
|
|
- const CGPathNode * pnode = LOCPLINT->cb->getPathsInfo(h)->getPathInfo(mapPos);
|
|
|
- assert(pnode);
|
|
|
+ const CGPathNode * pathNode = LOCPLINT->cb->getPathsInfo(hero)->getPathInfo(mapPos);
|
|
|
+ assert(pathNode);
|
|
|
|
|
|
- if(LOCPLINT->altPressed() && pnode->reachable()) //overwrite status bar text with movement info
|
|
|
+ if(LOCPLINT->altPressed() && pathNode->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));
|
|
|
+ ShowMoveDetailsInStatusbar(*hero, *pathNode);
|
|
|
}
|
|
|
|
|
|
- int turns = pnode->turns;
|
|
|
+ int turns = pathNode->turns;
|
|
|
vstd::amin(turns, 3);
|
|
|
- switch(pnode->action)
|
|
|
+ switch(pathNode->action)
|
|
|
{
|
|
|
case CGPathNode::NORMAL:
|
|
|
case CGPathNode::TELEPORT_NORMAL:
|
|
|
- if(pnode->layer == EPathfindingLayer::LAND)
|
|
|
+ if(pathNode->layer == EPathfindingLayer::LAND)
|
|
|
CCS->curh->set(cursorMove[turns]);
|
|
|
else
|
|
|
CCS->curh->set(cursorSailVisit[turns]);
|
|
|
@@ -1755,7 +1748,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|
|
else
|
|
|
CCS->curh->set(cursorExchange[turns]);
|
|
|
}
|
|
|
- else if(pnode->layer == EPathfindingLayer::LAND)
|
|
|
+ else if(pathNode->layer == EPathfindingLayer::LAND)
|
|
|
CCS->curh->set(cursorVisit[turns]);
|
|
|
else
|
|
|
CCS->curh->set(cursorSailVisit[turns]);
|
|
|
@@ -1796,6 +1789,21 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void CAdvMapInt::ShowMoveDetailsInStatusbar(const CGHeroInstance & hero, const CGPathNode & pathNode)
|
|
|
+{
|
|
|
+ const int maxMovementPointsAtStartOfLastTurn = pathNode.turns > 0 ? hero.maxMovePoints(pathNode.layer == EPathfindingLayer::LAND) : hero.movement;
|
|
|
+ const int movementPointsLastTurnCost = maxMovementPointsAtStartOfLastTurn - pathNode.moveRemains;
|
|
|
+ const int remainingPointsAfterMove = pathNode.turns == 0 ? pathNode.moveRemains : 0;
|
|
|
+
|
|
|
+ std::string result = VLC->generaltexth->translate("vcmi.adventureMap", pathNode.turns > 0 ? "moveCostDetails" : "moveCostDetailsNoTurns");
|
|
|
+
|
|
|
+ boost::replace_first(result, "%TURNS", std::to_string(pathNode.turns));
|
|
|
+ boost::replace_first(result, "%POINTS", std::to_string(movementPointsLastTurnCost));
|
|
|
+ boost::replace_first(result, "%REMAINING", std::to_string(remainingPointsAfterMove));
|
|
|
+
|
|
|
+ statusbar->write(result);
|
|
|
+}
|
|
|
+
|
|
|
void CAdvMapInt::tileRClicked(const int3 &mapPos)
|
|
|
{
|
|
|
if(mode != EAdvMapMode::NORMAL)
|