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

Merge pull request #1484 from kambala-decapitator/shipyard-fixes

Shipyard dialog fixes
This commit is contained in:
Andrii Danylchenko 2023-01-25 10:42:04 +02:00 committed by GitHub
commit 1a7ec728d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -16,6 +16,10 @@
#include "CAnimation.h"
#include "../../lib/CConfigHandler.h"
#ifdef VCMI_APPLE
#include <dispatch/dispatch.h>
#endif
std::unique_ptr<ICursor> CursorHandler::createCursor()
{
if (settings["video"]["cursor"].String() == "auto")
@ -401,10 +405,16 @@ CursorHardware::~CursorHardware()
void CursorHardware::setVisible(bool on)
{
#ifdef VCMI_APPLE
dispatch_async(dispatch_get_main_queue(), ^{
#endif
if (on)
SDL_ShowCursor(SDL_ENABLE);
else
SDL_ShowCursor(SDL_DISABLE);
#ifdef VCMI_APPLE
});
#endif
}
void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivotOffset)
@ -422,10 +432,16 @@ void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivot
logGlobal->error("Failed to set cursor! SDL says %s", SDL_GetError());
SDL_FreeSurface(cursorSurface);
#ifdef VCMI_APPLE
dispatch_async(dispatch_get_main_queue(), ^{
#endif
SDL_SetCursor(cursor);
if (oldCursor)
SDL_FreeCursor(oldCursor);
#ifdef VCMI_APPLE
});
#endif
}
void CursorHardware::setCursorPosition( const Point & newPos )

View File

@ -1594,7 +1594,6 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
LOCPLINT->openTownWindow(static_cast<const CGTownInstance*>(topBlocking));
else if(canSelect)
select(static_cast<const CArmedInstance*>(topBlocking), false);
return;
}
else if(const CGHeroInstance * currentHero = curHero()) //hero is selected
{

View File

@ -1316,7 +1316,7 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> & cost, int state, int
goldPic = std::make_shared<CAnimImage>("RESOURCE", Res::GOLD, 0, 100, 244);
woodPic = std::make_shared<CAnimImage>("RESOURCE", Res::WOOD, 0, 196, 244);
quit = std::make_shared<CButton>(Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), SDLK_RETURN);
quit = std::make_shared<CButton>(Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), SDLK_ESCAPE);
build = std::make_shared<CButton>(Point(42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this), SDLK_RETURN);
build->addCallback(onBuy);