1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-09 13:14:02 +02:00

removed CAdvMapInt::handleRightClick method

This commit is contained in:
Ivan Savenko 2023-02-10 15:50:46 +02:00
parent d0f57fed6f
commit f8c1c46562
9 changed files with 27 additions and 29 deletions

View File

@ -251,6 +251,9 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
return; return;
} }
adventureInt->minimap.updateTile(hero->convertToVisitablePos(details.start));
adventureInt->minimap.updateTile(hero->convertToVisitablePos(details.end));
bool directlyAttackingCreature = bool directlyAttackingCreature =
details.attackedFrom details.attackedFrom
&& adventureInt->terrain.currentPath //in case if movement has been canceled in the meantime and path was already erased && adventureInt->terrain.currentPath //in case if movement has been canceled in the meantime and path was already erased
@ -1194,7 +1197,7 @@ void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &p
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
//FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas //FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas
for (auto & po : pos) for (auto & po : pos)
adventureInt->minimap.showTile(po); adventureInt->minimap.updateTile(po);
if (!pos.empty()) if (!pos.empty())
GH.totalRedraw(); GH.totalRedraw();
} }
@ -1203,7 +1206,7 @@ void CPlayerInterface::tileHidden(const std::unordered_set<int3, ShashInt3> &pos
{ {
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
for (auto & po : pos) for (auto & po : pos)
adventureInt->minimap.hideTile(po); adventureInt->minimap.updateTile(po);
if (!pos.empty()) if (!pos.empty())
GH.totalRedraw(); GH.totalRedraw();
} }
@ -1409,7 +1412,7 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
for(auto & po : pos) for(auto & po : pos)
{ {
if(cb->isVisible(po)) if(cb->isVisible(po))
adventureInt->minimap.showTile(po); adventureInt->minimap.updateTile(po);
} }
if(obj->ID == Obj::TOWN) if(obj->ID == Obj::TOWN)
{ {

View File

@ -256,17 +256,17 @@ void CAdvMapInt::fworldViewBack()
void CAdvMapInt::fworldViewScale1x() void CAdvMapInt::fworldViewScale1x()
{ {
// TODO set corresponding scale button to "selected" mode // TODO set corresponding scale button to "selected" mode
changeMode(EAdvMapMode::WORLD_VIEW, 0.22f); changeMode(EAdvMapMode::WORLD_VIEW, 0.22f); // 7 pixels per tile
} }
void CAdvMapInt::fworldViewScale2x() void CAdvMapInt::fworldViewScale2x()
{ {
changeMode(EAdvMapMode::WORLD_VIEW, 0.36f); changeMode(EAdvMapMode::WORLD_VIEW, 0.36f); // 11 pixels per tile
} }
void CAdvMapInt::fworldViewScale4x() void CAdvMapInt::fworldViewScale4x()
{ {
changeMode(EAdvMapMode::WORLD_VIEW, 0.5f); changeMode(EAdvMapMode::WORLD_VIEW, 0.5f); // 16 pixels per tile
} }
void CAdvMapInt::fswitchLevel() void CAdvMapInt::fswitchLevel()
@ -928,13 +928,6 @@ boost::optional<Point> CAdvMapInt::keyToMoveDirection(const SDL_Keycode & key)
return boost::none; return boost::none;
} }
void CAdvMapInt::handleRightClick(std::string text, tribool down)
{
if(down)
{
CRClickPopup::createAndPush(text);
}
}
int3 CAdvMapInt::verifyPos(int3 ver) int3 CAdvMapInt::verifyPos(int3 ver)
{ {
if (ver.x<0) if (ver.x<0)
@ -1274,7 +1267,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
if(GH.isKeyboardAltDown() && pathNode->reachable()) //overwrite status bar text with movement info if(GH.isKeyboardAltDown() && pathNode->reachable()) //overwrite status bar text with movement info
{ {
ShowMoveDetailsInStatusbar(*hero, *pathNode); showMoveDetailsInStatusbar(*hero, *pathNode);
} }
int turns = pathNode->turns; int turns = pathNode->turns;
@ -1340,7 +1333,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
} }
} }
void CAdvMapInt::ShowMoveDetailsInStatusbar(const CGHeroInstance & hero, const CGPathNode & pathNode) 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 maxMovementPointsAtStartOfLastTurn = pathNode.turns > 0 ? hero.maxMovePoints(pathNode.layer == EPathfindingLayer::LAND) : hero.movement;
const int movementPointsLastTurnCost = maxMovementPointsAtStartOfLastTurn - pathNode.moveRemains; const int movementPointsLastTurnCost = maxMovementPointsAtStartOfLastTurn - pathNode.moveRemains;

View File

@ -159,7 +159,6 @@ public:
void centerOn(int3 on, bool fade = false); void centerOn(int3 on, bool fade = false);
void centerOn(const CGObjectInstance *obj, bool fade = false); void centerOn(const CGObjectInstance *obj, bool fade = false);
int3 verifyPos(int3 ver); int3 verifyPos(int3 ver);
void handleRightClick(std::string text, tribool down);
void keyPressed(const SDL_Keycode & key) override; void keyPressed(const SDL_Keycode & key) override;
void keyReleased(const SDL_Keycode & key) override; void keyReleased(const SDL_Keycode & key) override;
void mouseMoved (const Point & cursorPosition) override; void mouseMoved (const Point & cursorPosition) override;
@ -199,7 +198,7 @@ public:
void handleSwipeUpdate(); void handleSwipeUpdate();
private: private:
void ShowMoveDetailsInStatusbar(const CGHeroInstance & hero, const CGPathNode & pathNode); void showMoveDetailsInStatusbar(const CGHeroInstance & hero, const CGPathNode & pathNode);
}; };
extern std::shared_ptr<CAdvMapInt> adventureInt; extern std::shared_ptr<CAdvMapInt> adventureInt;

View File

@ -17,6 +17,7 @@
#include "../widgets/Images.h" #include "../widgets/Images.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../widgets/MiscWidgets.h" #include "../widgets/MiscWidgets.h"
#include "../windows/InfoWindows.h"
#include "../CGameInfo.h" #include "../CGameInfo.h"
#include "../CMusicHandler.h" #include "../CMusicHandler.h"
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
@ -234,7 +235,8 @@ void CInfoBar::clickLeft(tribool down, bool previousState)
void CInfoBar::clickRight(tribool down, bool previousState) void CInfoBar::clickRight(tribool down, bool previousState)
{ {
adventureInt->handleRightClick(CGI->generaltexth->allTexts[109], down); if (down)
CRClickPopup::createAndPush(CGI->generaltexth->allTexts[109]);
} }
void CInfoBar::hover(bool on) void CInfoBar::hover(bool on)

View File

@ -20,8 +20,8 @@
#include "../gui/CursorHandler.h" #include "../gui/CursorHandler.h"
#include "../gui/TextAlignment.h" #include "../gui/TextAlignment.h"
#include "../renderSDL/SDL_Extensions.h" #include "../renderSDL/SDL_Extensions.h"
#include "../adventureMap/CAdvMapInt.h"
#include "../windows/CMessage.h" #include "../windows/CMessage.h"
#include "../windows/InfoWindows.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../CGameInfo.h" #include "../CGameInfo.h"
@ -250,8 +250,8 @@ void CComponent::setSurface(std::string defName, int imgPos)
void CComponent::clickRight(tribool down, bool previousState) void CComponent::clickRight(tribool down, bool previousState)
{ {
if(!getDescription().empty()) if(down && !getDescription().empty())
adventureInt->handleRightClick(getDescription(), down); CRClickPopup::createAndPush(getDescription());
} }
void CSelectableComponent::clickLeft(tribool down, bool previousState) void CSelectableComponent::clickLeft(tribool down, bool previousState)

View File

@ -21,7 +21,6 @@
#include "../windows/CCastleInterface.h" #include "../windows/CCastleInterface.h"
#include "../windows/InfoWindows.h" #include "../windows/InfoWindows.h"
#include "../renderSDL/SDL_Extensions.h" #include "../renderSDL/SDL_Extensions.h"
#include "../adventureMap/CAdvMapInt.h"
#include "../../CCallback.h" #include "../../CCallback.h"
@ -57,8 +56,8 @@ void LRClickableAreaWText::clickLeft(tribool down, bool previousState)
} }
void LRClickableAreaWText::clickRight(tribool down, bool previousState) void LRClickableAreaWText::clickRight(tribool down, bool previousState)
{ {
if (!text.empty()) if (down && !text.empty())
adventureInt->handleRightClick(text, down); CRClickPopup::createAndPush(text);
} }
LRClickableAreaWText::LRClickableAreaWText() LRClickableAreaWText::LRClickableAreaWText()

View File

@ -15,12 +15,13 @@
#include "../CGameInfo.h" #include "../CGameInfo.h"
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
#include "../adventureMap/CResDataBar.h"
#include "../gui/CGuiHandler.h" #include "../gui/CGuiHandler.h"
#include "../widgets/CComponent.h" #include "../widgets/CComponent.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../widgets/MiscWidgets.h" #include "../widgets/MiscWidgets.h"
#include "../widgets/Buttons.h" #include "../widgets/Buttons.h"
#include "../adventureMap/CAdvMapInt.h" #include "../widgets/ObjectLists.h"
#include "../renderSDL/SDL_Extensions.h" #include "../renderSDL/SDL_Extensions.h"
#include "../../CCallback.h" #include "../../CCallback.h"
@ -95,7 +96,7 @@ void InfoBox::clickRight(tribool down, bool previousState)
if (comp) if (comp)
CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp)); CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp));
else if (!text.empty()) else if (!text.empty())
adventureInt->handleRightClick(text, down); CRClickPopup::createAndPush(text);
} }
} }

View File

@ -57,7 +57,8 @@ void CSpellWindow::InteractiveArea::clickLeft(tribool down, bool previousState)
void CSpellWindow::InteractiveArea::clickRight(tribool down, bool previousState) void CSpellWindow::InteractiveArea::clickRight(tribool down, bool previousState)
{ {
adventureInt->handleRightClick(helpText, down); if (down)
CRClickPopup::createAndPush(helpText);
} }
void CSpellWindow::InteractiveArea::hover(bool on) void CSpellWindow::InteractiveArea::hover(bool on)

View File

@ -13,11 +13,11 @@
#include "../gui/CGuiHandler.h" #include "../gui/CGuiHandler.h"
#include "../gui/CursorHandler.h" #include "../gui/CursorHandler.h"
#include "../widgets/Images.h" #include "../widgets/Images.h"
#include "../adventureMap/CAdvMapInt.h"
#include "../renderSDL/SDL_Extensions.h" #include "../renderSDL/SDL_Extensions.h"
#include "../gui/TextAlignment.h" #include "../gui/TextAlignment.h"
#include "../widgets/Buttons.h" #include "../widgets/Buttons.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../windows/InfoWindows.h"
#include "../CGameInfo.h" #include "../CGameInfo.h"
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
@ -272,7 +272,7 @@ void CTradeWindow::CTradeableItem::clickRight(tribool down, bool previousState)
case ARTIFACT_PLACEHOLDER: case ARTIFACT_PLACEHOLDER:
//TODO: it's would be better for market to contain actual CArtifactInstance and not just ids of certain artifact type so we can use getEffectiveDescription. //TODO: it's would be better for market to contain actual CArtifactInstance and not just ids of certain artifact type so we can use getEffectiveDescription.
if(id >= 0) if(id >= 0)
adventureInt->handleRightClick(CGI->artifacts()->getByIndex(id)->getDescriptionTranslated(), down); CRClickPopup::createAndPush(CGI->artifacts()->getByIndex(id)->getDescriptionTranslated());
break; break;
} }
} }