2014-06-14 18:42:13 +03:00
|
|
|
/*
|
2021-05-16 19:53:11 +02:00
|
|
|
* CommonConstructors.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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-06 17:32:53 +02:00
|
|
|
#include "CDefaultObjectTypeHandler.h"
|
2023-06-02 20:47:37 +02:00
|
|
|
#include "../LogicalExpression.h"
|
2014-06-14 18:42:13 +03:00
|
|
|
|
2023-06-08 16:29:29 +02:00
|
|
|
#include "../mapObjects/MiscObjects.h"
|
2023-07-15 18:29:11 +02:00
|
|
|
#include "../mapObjects/CGCreature.h"
|
2023-06-08 16:29:29 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2023-06-07 23:42:47 +02:00
|
|
|
class CGArtifact;
|
2014-07-06 23:14:37 +03:00
|
|
|
class CGObjectInstance;
|
2014-06-14 18:42:13 +03:00
|
|
|
class CGTownInstance;
|
|
|
|
class CGHeroInstance;
|
2023-06-07 23:42:47 +02:00
|
|
|
class CGMarket;
|
2014-06-14 18:42:13 +03:00
|
|
|
class CHeroClass;
|
2023-07-15 13:50:09 +02:00
|
|
|
class CGCreature;
|
2014-06-22 13:39:40 +03:00
|
|
|
class CBank;
|
2023-06-07 23:42:47 +02:00
|
|
|
class CGBoat;
|
2023-06-02 20:47:37 +02:00
|
|
|
class CFaction;
|
2014-06-22 13:39:40 +03:00
|
|
|
class CStackBasicDescriptor;
|
2014-06-14 18:42:13 +03:00
|
|
|
|
|
|
|
class CObstacleConstructor : public CDefaultObjectTypeHandler<CGObjectInstance>
|
|
|
|
{
|
|
|
|
public:
|
2015-10-12 15:47:10 +02:00
|
|
|
bool isStaticObject() override;
|
2014-06-14 18:42:13 +03:00
|
|
|
};
|
|
|
|
|
2023-07-15 13:50:09 +02:00
|
|
|
class CreatureInstanceConstructor : public CDefaultObjectTypeHandler<CGCreature>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool hasNameTextID() const override;
|
|
|
|
std::string getNameTextID() const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ResourceInstanceConstructor : public CDefaultObjectTypeHandler<CGResource>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool hasNameTextID() const override;
|
|
|
|
std::string getNameTextID() const override;
|
|
|
|
};
|
|
|
|
|
2014-06-14 18:42:13 +03:00
|
|
|
class CTownInstanceConstructor : public CDefaultObjectTypeHandler<CGTownInstance>
|
|
|
|
{
|
|
|
|
JsonNode filtersJson;
|
|
|
|
protected:
|
2023-02-12 22:39:17 +02:00
|
|
|
bool objectFilter(const CGObjectInstance * obj, std::shared_ptr<const ObjectTemplate> tmpl) const override;
|
2015-10-12 15:47:10 +02:00
|
|
|
void initTypeData(const JsonNode & input) override;
|
2014-06-14 18:42:13 +03:00
|
|
|
|
|
|
|
public:
|
2023-12-31 23:43:35 +02:00
|
|
|
const CFaction * faction = nullptr;
|
2014-06-14 18:42:13 +03:00
|
|
|
std::map<std::string, LogicalExpression<BuildingID>> filters;
|
|
|
|
|
2023-06-07 23:42:47 +02:00
|
|
|
void initializeObject(CGTownInstance * object) const override;
|
|
|
|
void randomizeObject(CGTownInstance * object, CRandomGenerator & rng) const override;
|
2015-10-12 15:47:10 +02:00
|
|
|
void afterLoadFinalization() override;
|
2014-06-16 19:27:26 +03:00
|
|
|
|
2023-07-15 13:50:09 +02:00
|
|
|
bool hasNameTextID() const override;
|
|
|
|
std::string getNameTextID() const override;
|
2014-06-14 18:42:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHeroInstanceConstructor : public CDefaultObjectTypeHandler<CGHeroInstance>
|
|
|
|
{
|
2014-06-16 19:27:26 +03:00
|
|
|
JsonNode filtersJson;
|
2014-06-14 18:42:13 +03:00
|
|
|
protected:
|
2023-02-12 22:39:17 +02:00
|
|
|
bool objectFilter(const CGObjectInstance * obj, std::shared_ptr<const ObjectTemplate> tmpl) const override;
|
2015-10-12 15:47:10 +02:00
|
|
|
void initTypeData(const JsonNode & input) override;
|
2014-06-14 18:42:13 +03:00
|
|
|
|
|
|
|
public:
|
2023-12-31 23:43:35 +02:00
|
|
|
const CHeroClass * heroClass = nullptr;
|
2014-06-16 19:27:26 +03:00
|
|
|
std::map<std::string, LogicalExpression<HeroTypeID>> filters;
|
2014-06-14 18:42:13 +03:00
|
|
|
|
2023-06-07 23:42:47 +02:00
|
|
|
void initializeObject(CGHeroInstance * object) const override;
|
|
|
|
void randomizeObject(CGHeroInstance * object, CRandomGenerator & rng) const override;
|
2015-10-12 15:47:10 +02:00
|
|
|
void afterLoadFinalization() override;
|
2014-06-16 19:27:26 +03:00
|
|
|
|
2023-07-15 13:50:09 +02:00
|
|
|
bool hasNameTextID() const override;
|
|
|
|
std::string getNameTextID() const override;
|
2014-06-14 18:42:13 +03:00
|
|
|
};
|
|
|
|
|
2023-06-07 18:51:44 +02:00
|
|
|
class DLL_LINKAGE BoatInstanceConstructor : public CDefaultObjectTypeHandler<CGBoat>
|
2023-04-18 15:27:39 +02:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
void initTypeData(const JsonNode & config) override;
|
|
|
|
|
2023-04-18 23:11:51 +02:00
|
|
|
std::vector<Bonus> bonuses;
|
2023-04-18 22:14:15 +02:00
|
|
|
EPathfindingLayer layer;
|
2023-04-19 00:11:24 +02:00
|
|
|
bool onboardAssaultAllowed; //if true, hero can attack units from transport
|
|
|
|
bool onboardVisitAllowed; //if true, hero can visit objects from transport
|
2023-04-18 23:11:51 +02:00
|
|
|
|
2023-08-23 14:07:50 +02:00
|
|
|
AnimationPath actualAnimation; //for OH3 boats those have actual animations
|
|
|
|
AnimationPath overlayAnimation; //waves animations
|
|
|
|
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
|
2023-04-18 15:27:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-06-07 23:42:47 +02:00
|
|
|
void initializeObject(CGBoat * object) const override;
|
2023-06-07 18:51:44 +02:00
|
|
|
|
|
|
|
/// Returns boat preview animation, for use in Shipyards
|
2023-08-23 14:07:50 +02:00
|
|
|
AnimationPath getBoatAnimationName() const;
|
2023-04-18 15:27:39 +02:00
|
|
|
};
|
|
|
|
|
2023-04-28 03:16:10 +02:00
|
|
|
class MarketInstanceConstructor : public CDefaultObjectTypeHandler<CGMarket>
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
void initTypeData(const JsonNode & config) override;
|
|
|
|
|
2023-08-19 20:43:50 +02:00
|
|
|
std::set<EMarketMode> marketModes;
|
2023-04-28 03:16:10 +02:00
|
|
|
JsonNode predefinedOffer;
|
2023-05-01 02:07:31 +02:00
|
|
|
int marketEfficiency;
|
2023-04-28 03:16:10 +02:00
|
|
|
|
2024-01-10 00:38:54 +02:00
|
|
|
std::string title;
|
|
|
|
std::string speech;
|
2023-04-28 03:16:10 +02:00
|
|
|
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
CGMarket * createObject(IGameCallback * cb) const override;
|
2023-06-07 23:42:47 +02:00
|
|
|
void initializeObject(CGMarket * object) const override;
|
|
|
|
void randomizeObject(CGMarket * object, CRandomGenerator & rng) const override;
|
2023-04-28 03:16:10 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_END
|