1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

template editor

This commit is contained in:
Laserlicht
2025-05-22 23:26:34 +02:00
parent 43844e2371
commit ddd422a075
30 changed files with 4618 additions and 7 deletions

View File

@@ -12,6 +12,7 @@
#include "../int3.h"
#include "../GameConstants.h"
#include "../Point.h"
#include "../ResourceSet.h"
#include "ObjectInfo.h"
#include "ObjectConfig.h"
@@ -21,6 +22,7 @@ VCMI_LIB_NAMESPACE_BEGIN
class JsonSerializeFormat;
struct CompoundMapObjectID;
class TemplateEditor;
enum class ETemplateZoneType
{
@@ -93,6 +95,10 @@ enum class ERoadOption
class DLL_LINKAGE ZoneConnection
{
#ifdef ENABLE_TEMPLATE_EDITOR
friend class ::TemplateEditor;
#endif
public:
ZoneConnection();
@@ -120,11 +126,18 @@ private:
class DLL_LINKAGE ZoneOptions
{
#ifdef ENABLE_TEMPLATE_EDITOR
friend class ::TemplateEditor;
#endif
public:
static const TRmgTemplateZoneId NO_ZONE;
class DLL_LINKAGE CTownInfo
{
#ifdef ENABLE_TEMPLATE_EDITOR
friend class ::TemplateEditor;
#endif
public:
CTownInfo();
@@ -228,6 +241,12 @@ public:
TRmgTemplateZoneId getCustomObjectsLikeZone() const;
TRmgTemplateZoneId getTownsLikeZone() const;
Point getVisPosition() const;
void setVisPosition(Point value);
float getVisSize() const;
void setVisSize(float value);
protected:
TRmgTemplateZoneId id;
ETemplateZoneType type;
@@ -235,6 +254,9 @@ protected:
ui32 maxTreasureValue;
std::optional<int> owner;
Point visPosition;
float visSize;
ObjectConfig objectConfig;
CTownInfo playerTowns;
CTownInfo neutralTowns;
@@ -268,11 +290,18 @@ protected:
/// The CRmgTemplate describes a random map template.
class DLL_LINKAGE CRmgTemplate : boost::noncopyable
{
#ifdef ENABLE_TEMPLATE_EDITOR
friend class ::TemplateEditor;
#endif
public:
using Zones = std::map<TRmgTemplateZoneId, std::shared_ptr<rmg::ZoneOptions>>;
class DLL_LINKAGE CPlayerCountRange
{
#ifdef ENABLE_TEMPLATE_EDITOR
friend class ::TemplateEditor;
#endif
public:
void addRange(int lower, int upper);
void addNumber(int value);