1#ifndef GAME_EDITOR_AUTO_MAP_H
2#define GAME_EDITOR_AUTO_MAP_H
3
4#include <vector>
5
6#include "component.h"
7
8class CAutoMapper : public CEditorComponent
9{
10 struct CIndexInfo
11 {
12 int m_Id;
13 int m_Flag;
14 bool m_TestFlag;
15 };
16
17 struct CPosRule
18 {
19 int m_X;
20 int m_Y;
21 int m_Value;
22 std::vector<CIndexInfo> m_vIndexList;
23
24 enum
25 {
26 NORULE = 0,
27 INDEX,
28 NOTINDEX
29 };
30 };
31
32 struct CIndexRule
33 {
34 int m_Id;
35 std::vector<CPosRule> m_vRules;
36 int m_Flag;
37 float m_RandomProbability;
38 bool m_DefaultRule;
39 bool m_SkipEmpty;
40 bool m_SkipFull;
41 };
42
43 struct CRun
44 {
45 std::vector<CIndexRule> m_vIndexRules;
46 bool m_AutomapCopy;
47 };
48
49 struct CConfiguration
50 {
51 std::vector<CRun> m_vRuns;
52 char m_aName[128];
53 int m_StartX;
54 int m_StartY;
55 int m_EndX;
56 int m_EndY;
57 };
58
59public:
60 explicit CAutoMapper(CEditor *pEditor);
61
62 void Load(const char *pTileName);
63 void ProceedLocalized(class CLayerTiles *pLayer, int ConfigId, int Seed = 0, int X = 0, int Y = 0, int Width = -1, int Height = -1);
64 void Proceed(class CLayerTiles *pLayer, int ConfigId, int Seed = 0, int SeedOffsetX = 0, int SeedOffsetY = 0);
65
66 int ConfigNamesNum() const { return m_vConfigs.size(); }
67 const char *GetConfigName(int Index);
68
69 bool IsLoaded() const { return m_FileLoaded; }
70
71private:
72 std::vector<CConfiguration> m_vConfigs = {};
73 bool m_FileLoaded = false;
74};
75
76#endif
77