mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CWindowWithArtifacts preparations
This commit is contained in:
parent
62d15ed23c
commit
25d2b468c3
@ -103,7 +103,7 @@ set(client_SRCS
|
||||
globalLobby/GlobalLobbyWindow.cpp
|
||||
|
||||
widgets/Buttons.cpp
|
||||
widgets/CArtifactHolder.cpp
|
||||
widgets/CArtPlace.cpp
|
||||
widgets/CComponent.cpp
|
||||
widgets/CExchangeController.cpp
|
||||
widgets/CGarrisonInt.cpp
|
||||
@ -293,7 +293,7 @@ set(client_HEADERS
|
||||
globalLobby/GlobalLobbyWindow.h
|
||||
|
||||
widgets/Buttons.h
|
||||
widgets/CArtifactHolder.h
|
||||
widgets/CArtPlace.h
|
||||
widgets/CComponent.h
|
||||
widgets/CExchangeController.h
|
||||
widgets/CGarrisonInt.h
|
||||
|
@ -1745,7 +1745,7 @@ void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
||||
|
||||
for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
||||
for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
||||
artWin->artifactRemoved(al);
|
||||
|
||||
waitWhileDialog();
|
||||
@ -1765,7 +1765,7 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
|
||||
redraw = false;
|
||||
}
|
||||
|
||||
for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
||||
for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
||||
artWin->artifactMoved(src, dst, redraw);
|
||||
|
||||
waitWhileDialog();
|
||||
@ -1781,7 +1781,7 @@ void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
||||
|
||||
for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
||||
for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
||||
artWin->artifactAssembled(al);
|
||||
}
|
||||
|
||||
@ -1790,7 +1790,7 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
||||
|
||||
for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
||||
for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
||||
artWin->artifactDisassembled(al);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* CArtifactHolder.cpp, part of VCMI engine
|
||||
* CArtPlace.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
@ -8,7 +8,7 @@
|
||||
*
|
||||
*/
|
||||
#include "StdInc.h"
|
||||
#include "CArtifactHolder.h"
|
||||
#include "CArtPlace.h"
|
||||
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../gui/Shortcut.h"
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* CArtifactHolder.h, part of VCMI engine
|
||||
* CArtPlace.h, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
@ -11,24 +11,8 @@
|
||||
|
||||
#include "MiscWidgets.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
struct ArtifactLocation;
|
||||
class CArtifactSet;
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
class CAnimImage;
|
||||
|
||||
class CArtifactHolder
|
||||
{
|
||||
public:
|
||||
virtual void artifactRemoved(const ArtifactLocation & artLoc)=0;
|
||||
virtual void artifactMoved(const ArtifactLocation & artLoc, const ArtifactLocation & destLoc, bool withRedraw)=0;
|
||||
virtual void artifactDisassembled(const ArtifactLocation & artLoc)=0;
|
||||
virtual void artifactAssembled(const ArtifactLocation & artLoc)=0;
|
||||
};
|
||||
|
||||
class CArtPlace : public SelectableSlot
|
||||
{
|
||||
public:
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "CArtifactHolder.h"
|
||||
#include "CArtPlace.h"
|
||||
|
||||
class CButton;
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "StdInc.h"
|
||||
#include "CComponent.h"
|
||||
|
||||
#include "CArtifactHolder.h"
|
||||
#include "Images.h"
|
||||
|
||||
#include <vcmi/spells/Service.h>
|
||||
|
@ -9,8 +9,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../windows/CWindowObject.h"
|
||||
#include "CWindowWithArtifacts.h"
|
||||
#include "../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
class CCallback;
|
||||
|
||||
|
@ -9,14 +9,13 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "CArtifactHolder.h"
|
||||
#include "CArtifactsOfHeroMain.h"
|
||||
#include "CArtifactsOfHeroKingdom.h"
|
||||
#include "CArtifactsOfHeroAltar.h"
|
||||
#include "CArtifactsOfHeroMarket.h"
|
||||
#include "CArtifactsOfHeroBackpack.h"
|
||||
|
||||
class CWindowWithArtifacts : public CArtifactHolder
|
||||
class CWindowWithArtifacts
|
||||
{
|
||||
public:
|
||||
using CArtifactsOfHeroPtr = std::variant<
|
||||
@ -38,10 +37,10 @@ public:
|
||||
void showPopupArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
|
||||
void gestureArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
|
||||
|
||||
void artifactRemoved(const ArtifactLocation & artLoc) override;
|
||||
void artifactMoved(const ArtifactLocation & srcLoc, const ArtifactLocation & destLoc, bool withRedraw) override;
|
||||
void artifactDisassembled(const ArtifactLocation & artLoc) override;
|
||||
void artifactAssembled(const ArtifactLocation & artLoc) override;
|
||||
virtual void artifactRemoved(const ArtifactLocation & artLoc);
|
||||
virtual void artifactMoved(const ArtifactLocation & srcLoc, const ArtifactLocation & destLoc, bool withRedraw);
|
||||
virtual void artifactDisassembled(const ArtifactLocation & artLoc);
|
||||
virtual void artifactAssembled(const ArtifactLocation & artLoc);
|
||||
|
||||
protected:
|
||||
std::vector<CArtifactsOfHeroPtr> artSets;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "../CPlayerInterface.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../widgets/Buttons.h"
|
||||
#include "../widgets/CArtifactHolder.h"
|
||||
#include "../widgets/CArtPlace.h"
|
||||
#include "../widgets/CComponent.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
|
@ -676,25 +676,25 @@ bool CKingdomInterface::holdsGarrison(const CArmedInstance * army)
|
||||
|
||||
void CKingdomInterface::artifactAssembled(const ArtifactLocation& artLoc)
|
||||
{
|
||||
if(auto arts = std::dynamic_pointer_cast<CArtifactHolder>(tabArea->getItem()))
|
||||
if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
|
||||
arts->artifactAssembled(artLoc);
|
||||
}
|
||||
|
||||
void CKingdomInterface::artifactDisassembled(const ArtifactLocation& artLoc)
|
||||
{
|
||||
if(auto arts = std::dynamic_pointer_cast<CArtifactHolder>(tabArea->getItem()))
|
||||
if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
|
||||
arts->artifactDisassembled(artLoc);
|
||||
}
|
||||
|
||||
void CKingdomInterface::artifactMoved(const ArtifactLocation& artLoc, const ArtifactLocation& destLoc, bool withRedraw)
|
||||
{
|
||||
if(auto arts = std::dynamic_pointer_cast<CArtifactHolder>(tabArea->getItem()))
|
||||
if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
|
||||
arts->artifactMoved(artLoc, destLoc, withRedraw);
|
||||
}
|
||||
|
||||
void CKingdomInterface::artifactRemoved(const ArtifactLocation& artLoc)
|
||||
{
|
||||
if(auto arts = std::dynamic_pointer_cast<CArtifactHolder>(tabArea->getItem()))
|
||||
if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
|
||||
arts->artifactRemoved(artLoc);
|
||||
}
|
||||
|
||||
@ -745,7 +745,7 @@ std::shared_ptr<CIntObject> CKingdHeroList::createHeroItem(size_t index)
|
||||
if(index < heroesList.size())
|
||||
{
|
||||
auto hero = std::make_shared<CHeroItem>(heroesList[index]);
|
||||
addSetAndCallbacks(hero->heroArts);
|
||||
//addSetAndCallbacks(hero->heroArts);
|
||||
return hero;
|
||||
}
|
||||
else
|
||||
|
@ -200,7 +200,7 @@ public:
|
||||
};
|
||||
|
||||
/// Class which holds all parts of kingdom overview window
|
||||
class CKingdomInterface : public CWindowObject, public IGarrisonHolder, public CArtifactHolder, public ITownHolder
|
||||
class CKingdomInterface : public CWindowObject, public IGarrisonHolder, public CWindowWithArtifacts, public ITownHolder
|
||||
{
|
||||
private:
|
||||
struct OwnedObjectInfo
|
||||
@ -330,7 +330,7 @@ public:
|
||||
};
|
||||
|
||||
/// Tab with all hero-specific data
|
||||
class CKingdHeroList : public CIntObject, public IGarrisonHolder, public CWindowWithArtifacts
|
||||
class CKingdHeroList : public CIntObject, public IGarrisonHolder
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<CListBox> heroes;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../widgets/CExchangeController.h"
|
||||
#include "../widgets/CWindowWithArtifacts.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../windows/CWindowObject.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user