1#ifndef GAME_EDITOR_AUTO_MAP_H
2#define GAME_EDITOR_AUTO_MAP_H
3
4#include <game/editor/map_object.h>
5
6#include <vector>
7
8class CAutoMapper : public CMapObject
9{
10 class CIndexInfo
11 {
12 public:
13 int m_Id;
14 int m_Flag;
15 bool m_TestFlag;
16 };
17
18 class CPosRule
19 {
20 public:
21 int m_X;
22 int m_Y;
23 int m_Value;
24 std::vector<CIndexInfo> m_vIndexList;
25 bool m_IsGuide;
26
27 enum
28 {
29 NORULE = 0,
30 INDEX,
31 NOTINDEX
32 };
33 };
34
35 class CModuloRule
36 {
37 public:
38 int m_ModX;
39 int m_ModY;
40 int m_OffsetX;
41 int m_OffsetY;
42 };
43
44 class CIndexRule
45 {
46 public:
47 int m_Id;
48 std::vector<CPosRule> m_vRules;
49 int m_Flag;
50 float m_RandomProbability;
51 std::vector<CModuloRule> m_vModuloRules;
52 bool m_DefaultRule;
53 bool m_SkipEmpty;
54 bool m_SkipFull;
55 };
56 class CRun
57 {
58 public:
59 std::vector<CIndexRule> m_vIndexRules;
60 bool m_AutomapCopy;
61 };
62
63 class CConfiguration
64 {
65 public:
66 std::vector<CRun> m_vRuns;
67 char m_aName[128];
68 int m_StartX;
69 int m_StartY;
70 int m_EndX;
71 int m_EndY;
72 };
73
74public:
75 explicit CAutoMapper(CEditorMap *pMap);
76
77 void Load(const char *pTileName);
78 void Unload();
79 int CheckIndexFlag(int Flag, const char *pFlag, bool CheckNone) const;
80 void ProceedLocalized(class CLayerTiles *pLayer, class CLayerTiles *pGameLayer, int ReferenceId, int ConfigId, int Seed = 0, int X = 0, int Y = 0, int Width = -1, int Height = -1);
81 void Proceed(class CLayerTiles *pLayer, class CLayerTiles *pGameLayer, int ReferenceId, int ConfigId, int Seed = 0, int SeedOffsetX = 0, int SeedOffsetY = 0);
82 int ConfigNamesNum() const { return m_vConfigs.size(); }
83 const char *GetConfigName(int Index) const;
84
85 bool IsLoaded() const { return m_FileLoaded; }
86
87private:
88 std::vector<CConfiguration> m_vConfigs;
89 bool m_FileLoaded = false;
90};
91
92#endif
93