_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

editor.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 2002-2006 by Lutz Sammer
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __EDITOR_H__
31 #define __EDITOR_H__
32 
34 
35 #include <vector>
36 #include <string>
37 #include <tuple>
38 #include "icons.h"
39 #ifndef __VEC2I_H__
40 #include "vec2i.h"
41 #endif
42 /*----------------------------------------------------------------------------
43 -- Declarations
44 ----------------------------------------------------------------------------*/
45 
46 class CUnitType;
47 
48 
54 };
55 
61 };
62 
63 class CEditor
64 {
65 public:
66  CEditor();
67  ~CEditor() {}
68 
69  void Init();
70 
72  void CreateRandomMap(bool shuffleTransitions = false) const;
75  std::vector<std::tuple<int, int, int>> RandomTiles;
76  std::vector<std::tuple<std::string, int, int, int>> RandomUnits;
77 
78  std::vector<std::string> UnitTypes;
79  std::vector<const CUnitType *> ShownUnitTypes;
80  std::vector<unsigned int> ShownTileTypes;
81 
85  std::string StartUnitName;
87 
88  int UnitIndex;
91 
92  int TileIndex;
95 
98 
99  bool MapLoaded;
101 
103 
105 
106  int PopUpX;
107  int PopUpY;
108 
109 };
110 
111 /*----------------------------------------------------------------------------
112 -- Variables
113 ----------------------------------------------------------------------------*/
114 
115 extern CEditor Editor;
116 
117 extern bool TileToolNoFixup;
118 extern char TileToolRandom;
119 
120 /*----------------------------------------------------------------------------
121 -- Functions
122 ----------------------------------------------------------------------------*/
123 
125 extern void StartEditor(const char *filename);
126 
128 extern void EditorMainLoop();
130 extern void EditorUpdateDisplay();
131 
133 extern int EditorSaveMap(const std::string &file);
134 extern int EditorSaveMapWithResize(const std::string &file, Vec2i sz = {0, 0}, Vec2i off = {0, 0});
135 
137 extern void EditorCclRegister();
138 
140 extern void EditorTileChanged(const Vec2i &pos);
141 
142 extern void EditorChangeTile(const Vec2i &pos, int tileIndex, int d, bool changeSurroundings);
143 
145 
146 #endif // !__EDITOR_H__
CEditor::PopUpX
int PopUpX
Current editor state.
Definition: editor.h:106
EditorStarted
@ EditorStarted
Not Running.
Definition: editor.h:51
CEditor::MapLoaded
bool MapLoaded
Player selected for draw.
Definition: editor.h:99
CEditor::PopUpY
int PopUpY
Definition: editor.h:107
EditorUpdateDisplay
void EditorUpdateDisplay()
Update editor display.
Definition: editloop.cpp:1030
CEditor::UnitTypes
std::vector< std::string > UnitTypes
neutral units to add randomly. (name, count, initial resources, tile under unit)
Definition: editor.h:78
CEditor::CreateRandomMap
void CreateRandomMap(bool shuffleTransitions=false) const
Make random map.
Definition: edmap.cpp:432
EditorSetStartLocation
@ EditorSetStartLocation
Edit units.
Definition: editor.h:60
IconConfig
Icon reference (used in config tables)
Definition: icons.h:172
EditorEditTile
@ EditorEditTile
Select.
Definition: editor.h:58
CEditor::SelectedTileIndex
int SelectedTileIndex
tile icon under cursor.
Definition: editor.h:94
CEditor::Units
IconConfig Units
Editor's select icon.
Definition: editor.h:84
CEditor::StartUnit
const CUnitType * StartUnit
name of the Unit used to display the start location.
Definition: editor.h:86
CEditor::CursorPlayer
int CursorPlayer
tile type to draw.
Definition: editor.h:96
vec2i.h
EditorCclRegister
void EditorCclRegister()
Register ccl features.
Definition: script_editor.cpp:155
EditorChangeTile
void EditorChangeTile(const Vec2i &pos, int tileIndex, int d, bool changeSurroundings)
CEditor::CursorTileIndex
int CursorTileIndex
tile icon draw index.
Definition: editor.h:93
CEditor::ShownTileTypes
std::vector< unsigned int > ShownTileTypes
Shown editor unit-type table.
Definition: editor.h:80
EditorMainLoop
void EditorMainLoop()
Editor main event loop.
Definition: editloop.cpp:1940
CEditor::Select
IconConfig Select
Is the terrain editable ?
Definition: editor.h:83
EditorTileChanged
void EditorTileChanged(const Vec2i &pos)
Update surroundings for tile changes.
Definition: edmap.cpp:262
CUnitType
Definition: unittype.h:508
Vec2T
Definition: vec2i.h:36
EditorStateType
EditorStateType
Definition: editor.h:56
CEditor::WriteCompressedMaps
bool WriteCompressedMaps
Map loaded in editor.
Definition: editor.h:100
CEditor::SelectedUnitIndex
int SelectedUnitIndex
Unit icon under cursor.
Definition: editor.h:90
TileToolNoFixup
bool TileToolNoFixup
Definition: editloop.cpp:96
CEditor::ShownUnitTypes
std::vector< const CUnitType * > ShownUnitTypes
Sorted editor unit-type table.
Definition: editor.h:79
EditorSaveMap
int EditorSaveMap(const std::string &file)
Save a map from editor.
Definition: editloop.cpp:1911
EditorSelecting
@ EditorSelecting
Definition: editor.h:57
TileToolRandom
char TileToolRandom
Allow setting every tile, no fixups.
Definition: editloop.cpp:97
CEditor::RandomTiles
std::vector< std::tuple< int, int, int > > RandomTiles
Tile to fill the map with initially;.
Definition: editor.h:75
CEditor::StartUnitName
std::string StartUnitName
Editor's units icon.
Definition: editor.h:85
CEditor::Running
EditorRunningType Running
Use compression when saving.
Definition: editor.h:102
CEditor::SelectedPlayer
int SelectedPlayer
Player under the cursor.
Definition: editor.h:97
EditorCommandLine
@ EditorCommandLine
Editor Enabled at all.
Definition: editor.h:52
CEditor::State
EditorStateType State
Editor is running.
Definition: editor.h:104
EditorRunningType
EditorRunningType
Definition: editor.h:49
CEditor::Init
void Init()
Definition: editloop.cpp:1800
EditorEditing
@ EditorEditing
Called from Command Line.
Definition: editor.h:53
CEditor::CEditor
CEditor()
Definition: editor.cpp:76
CEditor::~CEditor
~CEditor()
Definition: editor.h:67
icons.h
CEditor::BaseTileIndex
int BaseTileIndex
Variables for random map creation.
Definition: editor.h:74
EditorSaveMapWithResize
int EditorSaveMapWithResize(const std::string &file, Vec2i sz={0, 0}, Vec2i off={0, 0})
Definition: editloop.cpp:1922
EditorEditUnit
@ EditorEditUnit
Edit tiles.
Definition: editor.h:59
CEditor::TerrainEditable
bool TerrainEditable
Shown editor tile-type table.
Definition: editor.h:82
Editor
CEditor Editor
Definition: script_editor.cpp:44
CEditor::UnitIndex
int UnitIndex
Unit used to display the start location.
Definition: editor.h:88
CEditor
Definition: editor.h:63
CEditor::TileIndex
int TileIndex
Unit type to draw.
Definition: editor.h:92
CEditor::CursorUnitIndex
int CursorUnitIndex
Unit icon draw index.
Definition: editor.h:89
CEditor::RandomUnits
std::vector< std::tuple< std::string, int, int, int > > RandomUnits
other tiles to fill randomly. (tile, count, area size)
Definition: editor.h:76
StartEditor
void StartEditor(const char *filename)
Start the editor.
Definition: editloop.cpp:2185
EditorNotRunning
@ EditorNotRunning
Definition: editor.h:50
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.