2023-04-23 14:10:35 +02:00
|
|
|
/*
|
|
|
|
* CWindowWithArtifacts.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CArtifactHolder.h"
|
|
|
|
#include "CArtifactsOfHeroMain.h"
|
|
|
|
#include "CArtifactsOfHeroKingdom.h"
|
|
|
|
#include "CArtifactsOfHeroAltar.h"
|
|
|
|
#include "CArtifactsOfHeroMarket.h"
|
2023-07-06 21:14:12 +02:00
|
|
|
#include "CArtifactsOfHeroBackpack.h"
|
2023-04-23 14:10:35 +02:00
|
|
|
|
|
|
|
class CWindowWithArtifacts : public CArtifactHolder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using CArtifactsOfHeroPtr = std::variant<
|
|
|
|
std::weak_ptr<CArtifactsOfHeroMarket>,
|
|
|
|
std::weak_ptr<CArtifactsOfHeroAltar>,
|
|
|
|
std::weak_ptr<CArtifactsOfHeroKingdom>,
|
2023-07-06 21:14:12 +02:00
|
|
|
std::weak_ptr<CArtifactsOfHeroMain>,
|
2023-11-07 14:17:34 +02:00
|
|
|
std::weak_ptr<CArtifactsOfHeroBackpack>,
|
|
|
|
std::weak_ptr<CArtifactsOfHeroQuickBackpack>>;
|
2023-07-16 20:16:12 +02:00
|
|
|
using CloseCallback = std::function<void()>;
|
2023-04-23 14:10:35 +02:00
|
|
|
|
|
|
|
void addSet(CArtifactsOfHeroPtr artSet);
|
2023-09-18 21:58:08 +02:00
|
|
|
void addSetAndCallbacks(CArtifactsOfHeroPtr artSet);
|
2023-07-16 20:16:12 +02:00
|
|
|
void addCloseCallback(CloseCallback callback);
|
2023-04-23 14:10:35 +02:00
|
|
|
const CGHeroInstance * getHeroPickedArtifact();
|
|
|
|
const CArtifactInstance * getPickedArtifact();
|
2023-12-17 16:30:19 +02:00
|
|
|
void clickPressedArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
|
|
|
|
void showPopupArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
|
|
|
|
void gestureArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
|
2023-04-23 14:10:35 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2023-09-18 21:58:08 +02:00
|
|
|
protected:
|
2023-04-23 14:10:35 +02:00
|
|
|
std::vector<CArtifactsOfHeroPtr> artSets;
|
2023-07-16 20:16:12 +02:00
|
|
|
CloseCallback closeCallback;
|
2023-04-23 14:10:35 +02:00
|
|
|
|
2023-09-12 17:30:48 +02:00
|
|
|
void updateSlots();
|
2023-04-23 14:10:35 +02:00
|
|
|
std::optional<std::tuple<const CGHeroInstance*, const CArtifactInstance*>> getState();
|
|
|
|
std::optional<CArtifactsOfHeroPtr> findAOHbyRef(CArtifactsOfHeroBase & artsInst);
|
2023-09-03 20:41:00 +02:00
|
|
|
void markPossibleSlots();
|
2024-01-27 23:48:11 +02:00
|
|
|
bool checkSpecialArts(const CArtifactInstance & artInst, const CGHeroInstance * hero, bool isTrade);
|
2023-04-23 14:10:35 +02:00
|
|
|
};
|