00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __EDITOR_H__
00029 #define __EDITOR_H__
00030
00032
00033 #include <vector>
00034 #include <string>
00035 #include "icons.h"
00036
00037
00038
00039
00040
00041 class CUnitType;
00042 class CPatchType;
00043
00044 enum EditorRunningType {
00045 EditorNotRunning = 0,
00046 EditorStarted = 1,
00047 EditorCommandLine = 2,
00048 EditorEditing = 4,
00049 };
00050
00051 enum EditorStateType {
00052 EditorSelecting,
00053 EditorEditPatch,
00054 EditorEditUnit,
00055 EditorSetStartLocation
00056 };
00057
00058 struct CPatchIcon
00059 {
00060 CPatchIcon(CPatchType *patchType, CGraphic *g) :
00061 PatchType(patchType), G(g)
00062 {}
00063
00064 CPatchType *PatchType;
00065 CGraphic *G;
00066 };
00067
00068 class CEditor {
00069 public:
00070 CEditor() : StartUnit(NULL),
00071 UnitIndex(0), CursorUnitIndex(-1), SelectedUnitIndex(-1),
00072 PatchIndex(0), CursorPatchIndex(-1), SelectedPatchIndex(-1),
00073 CursorPlayer(-1), SelectedPlayer(-1), MapLoaded(false),
00074 ShowPatchOutlines(false)
00075 {};
00076 ~CEditor() {};
00077
00078 void Init();
00079
00080 std::vector<std::string> UnitTypes;
00081 std::vector<const CUnitType *> ShownUnitTypes;
00082
00083 std::vector<CPatchIcon> ShownPatchTypes;
00084
00085 IconConfig Select;
00086 IconConfig Units;
00087 IconConfig Patch;
00088 std::string StartUnitName;
00089 const CUnitType *StartUnit;
00090
00091 int UnitIndex;
00092 int CursorUnitIndex;
00093 int SelectedUnitIndex;
00094
00095 int PatchIndex;
00096 int CursorPatchIndex;
00097 int SelectedPatchIndex;
00098
00099 int CursorPlayer;
00100 int SelectedPlayer;
00101
00102 bool MapLoaded;
00103
00104 bool ShowPatchOutlines;
00105 Uint32 PatchOutlineColor;
00106
00107 EditorRunningType Running;
00108
00109 EditorStateType State;
00110 };
00111
00112
00113
00114
00115
00116 extern CEditor Editor;
00117
00118 extern const char *EditorStartFile;
00119
00120 extern bool PatchEditorRunning;
00121
00122
00123
00124
00125
00126 extern void SetEditorSelectIcon(const std::string &icon);
00127 extern void SetEditorUnitsIcon(const std::string &icon);
00128 extern void SetEditorPatchIcon(const std::string &icon);
00129 extern void SetEditorStartUnit(const std::string &name);
00130
00132 extern void StartEditor(const std::string &filename);
00133
00135 extern int EditorSaveMap(const std::string &file);
00136
00138 extern void StartPatchEditor(const std::string &patchName);
00139
00141
00142 #endif // !__EDITOR_H__