1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge branch 'vcmi/beta' into 'vcmi/develop'

This commit is contained in:
Ivan Savenko 2024-09-23 14:25:53 +00:00
commit e93a060500
9 changed files with 31 additions and 14 deletions

View File

@ -21,6 +21,7 @@
"vcmi.adventureMap.playerAttacked" : "Player has been attacked: %s", "vcmi.adventureMap.playerAttacked" : "Player has been attacked: %s",
"vcmi.adventureMap.moveCostDetails" : "Movement points - Cost: %TURNS turns + %POINTS points, Remaining points: %REMAINING", "vcmi.adventureMap.moveCostDetails" : "Movement points - Cost: %TURNS turns + %POINTS points, Remaining points: %REMAINING",
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Movement points - Cost: %POINTS points, Remaining points: %REMAINING", "vcmi.adventureMap.moveCostDetailsNoTurns" : "Movement points - Cost: %POINTS points, Remaining points: %REMAINING",
"vcmi.adventureMap.movementPointsHeroInfo" : "(Movement points: %REMAINING / %POINTS)",
"vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Sorry, replay opponent turn is not implemented yet!", "vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Sorry, replay opponent turn is not implemented yet!",
"vcmi.capitalColors.0" : "Red", "vcmi.capitalColors.0" : "Red",

View File

@ -20,6 +20,7 @@
"vcmi.adventureMap.playerAttacked" : "Gracz został zaatakowany: %s", "vcmi.adventureMap.playerAttacked" : "Gracz został zaatakowany: %s",
"vcmi.adventureMap.moveCostDetails" : "Punkty ruchu - Koszt: %TURNS tury + %POINTS punktów, Pozostanie: %REMAINING punktów", "vcmi.adventureMap.moveCostDetails" : "Punkty ruchu - Koszt: %TURNS tury + %POINTS punktów, Pozostanie: %REMAINING punktów",
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Punkty ruchu - Koszt: %POINTS punktów, Pozostanie: %REMAINING punktów", "vcmi.adventureMap.moveCostDetailsNoTurns" : "Punkty ruchu - Koszt: %POINTS punktów, Pozostanie: %REMAINING punktów",
"vcmi.adventureMap.movementPointsHeroInfo" : "(Punkty ruchu: %REMAINING / %POINTS)",
"vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Wybacz, powtórka ruchu wroga nie została jeszcze zaimplementowana!", "vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Wybacz, powtórka ruchu wroga nie została jeszcze zaimplementowana!",
"vcmi.capitalColors.0" : "Czerwony", "vcmi.capitalColors.0" : "Czerwony",

View File

@ -171,10 +171,11 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
void CPlayerInterface::closeAllDialogs() void CPlayerInterface::closeAllDialogs()
{ {
// remove all active dialogs that do not expect query answer // remove all active dialogs that do not expect query answer
for (;;) while(true)
{ {
auto adventureWindow = GH.windows().topWindow<AdventureMapInterface>(); auto adventureWindow = GH.windows().topWindow<AdventureMapInterface>();
auto infoWindow = GH.windows().topWindow<CInfoWindow>(); auto infoWindow = GH.windows().topWindow<CInfoWindow>();
auto topWindow = GH.windows().topWindow<WindowBase>();
if(adventureWindow != nullptr) if(adventureWindow != nullptr)
break; break;
@ -182,16 +183,8 @@ void CPlayerInterface::closeAllDialogs()
if(infoWindow && infoWindow->ID != QueryID::NONE) if(infoWindow && infoWindow->ID != QueryID::NONE)
break; break;
if (infoWindow) topWindow->close();
infoWindow->close();
else
GH.windows().popWindows(1);
} }
if(castleInt)
castleInt->close();
castleInt = nullptr;
} }
void CPlayerInterface::playerEndsTurn(PlayerColor player) void CPlayerInterface::playerEndsTurn(PlayerColor player)
@ -1460,6 +1453,7 @@ void CPlayerInterface::playerBlocked(int reason, bool start)
cmp.push_back(std::make_shared<CComponent>(ComponentType::FLAG, playerID)); cmp.push_back(std::make_shared<CComponent>(ComponentType::FLAG, playerID));
makingTurn = true; //workaround for stiff showInfoDialog implementation makingTurn = true; //workaround for stiff showInfoDialog implementation
showInfoDialog(msg, cmp); showInfoDialog(msg, cmp);
waitWhileDialog();
makingTurn = false; makingTurn = false;
} }
} }

View File

@ -557,7 +557,8 @@ void AdventureMapInterface::onTileLeftClicked(const int3 &targetPosition)
else //still here? we need to move hero if we clicked end of already selected path or calculate a new path otherwise else //still here? we need to move hero if we clicked end of already selected path or calculate a new path otherwise
{ {
if(LOCPLINT->localState->hasPath(currentHero) && if(LOCPLINT->localState->hasPath(currentHero) &&
LOCPLINT->localState->getPath(currentHero).endPos() == targetPosition)//we'll be moving LOCPLINT->localState->getPath(currentHero).endPos() == targetPosition &&
!GH.isKeyboardShiftDown())//we'll be moving
{ {
assert(!CGI->mh->hasOngoingAnimations()); assert(!CGI->mh->hasOngoingAnimations());
if(!CGI->mh->hasOngoingAnimations() && LOCPLINT->localState->getPath(currentHero).nextNode().turns == 0) if(!CGI->mh->hasOngoingAnimations() && LOCPLINT->localState->getPath(currentHero).nextNode().turns == 0)

View File

@ -266,7 +266,7 @@ void CHeroList::CHeroItem::showTooltip()
std::string CHeroList::CHeroItem::getHoverText() std::string CHeroList::CHeroItem::getHoverText()
{ {
return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated()); return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated()) + hero->getMovementPointsTextIfOwner(hero->getOwner());
} }
void CHeroList::CHeroItem::gesture(bool on, const Point & initialPosition, const Point & finalPosition) void CHeroList::CHeroItem::gesture(bool on, const Point & initialPosition, const Point & finalPosition)

View File

@ -343,6 +343,6 @@ WindowBase::WindowBase(int used_, Point pos_)
void WindowBase::close() void WindowBase::close()
{ {
if(!GH.windows().isTopWindow(this)) if(!GH.windows().isTopWindow(this))
logGlobal->error("Only top interface must be closed"); throw std::runtime_error("Only top interface can be closed");
GH.windows().popWindows(1); GH.windows().popWindows(1);
} }

View File

@ -148,7 +148,6 @@ class WindowBase : public CIntObject
{ {
public: public:
WindowBase(int used_ = 0, Point pos_ = Point()); WindowBase(int used_ = 0, Point pos_ = Point());
protected:
virtual void close(); virtual void close();
}; };

View File

@ -567,6 +567,25 @@ std::string CGHeroInstance::getObjectName() const
return VLC->objtypeh->getObjectName(ID, 0); return VLC->objtypeh->getObjectName(ID, 0);
} }
std::string CGHeroInstance::getHoverText(PlayerColor player) const
{
std::string hoverText = CArmedInstance::getHoverText(player) + getMovementPointsTextIfOwner(player);
return hoverText;
}
std::string CGHeroInstance::getMovementPointsTextIfOwner(PlayerColor player) const
{
std::string output = "";
if(player == getOwner())
{
output += " " + VLC->generaltexth->translate("vcmi.adventureMap.movementPointsHeroInfo");
boost::replace_first(output, "%POINTS", std::to_string(movementPointsLimit(!boat)));
boost::replace_first(output, "%REMAINING", std::to_string(movementPointsRemaining()));
}
return output;
}
ui8 CGHeroInstance::maxlevelsToMagicSchool() const ui8 CGHeroInstance::maxlevelsToMagicSchool() const
{ {
return type->heroClass->isMagicHero() ? 3 : 4; return type->heroClass->isMagicHero() ? 3 : 4;

View File

@ -301,6 +301,8 @@ public:
void pickRandomObject(vstd::RNG & rand) override; void pickRandomObject(vstd::RNG & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
std::string getObjectName() const override; std::string getObjectName() const override;
std::string getHoverText(PlayerColor player) const override;
std::string getMovementPointsTextIfOwner(PlayerColor player) const;
void afterAddToMap(CMap * map) override; void afterAddToMap(CMap * map) override;
void afterRemoveFromMap(CMap * map) override; void afterRemoveFromMap(CMap * map) override;