OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

genworld.h
Go to the documentation of this file.
1 /* $Id: genworld.h 23611 2011-12-19 20:56:50Z truebrain $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef GENWORLD_H
13 #define GENWORLD_H
14
15 #include "company_type.h"
16
18 enum LandscapeGenerator {
19 /* Order of these enums has to be the same as in lang/english.txt
20 * Otherwise you will get inconsistent behaviour. */
21 LG_ORIGINAL = 0,
22 LG_TERRAGENESIS = 1,
23 };
24
25 static const uint GENERATE_NEW_SEED = UINT_MAX;
26
28 enum GenWorldMode {
29 GWM_NEWGAME = 0,
30 GWM_EMPTY = 1,
31 GWM_RANDOM = 2,
32 GWM_HEIGHTMAP = 3,
33 };
34
35 static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4;
36 static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1;
37 static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90;
38
39 typedef void GWDoneProc();
40 typedef void GWAbortProc();
41
43 struct GenWorldInfo {
44 bool abort;
45 bool quit_thread;
46 bool threaded;
47 GenWorldMode mode;
48 CompanyID lc;
49 uint size_x;
50 uint size_y;
51 GWDoneProc *proc;
52 GWAbortProc *abortp;
53 class ThreadObject *thread;
54 };
55
57 enum GenWorldProgress {
58 GWP_MAP_INIT,
59 GWP_LANDSCAPE,
60 GWP_RIVER,
61 GWP_ROUGH_ROCKY,
62 GWP_TOWN,
63 GWP_INDUSTRY,
64 GWP_OBJECT,
65 GWP_TREE,
66 GWP_GAME_INIT,
67 GWP_RUNTILELOOP,
68 GWP_RUNSCRIPT,
69 GWP_GAME_START,
70 GWP_CLASS_COUNT
71 };
72
73 /* genworld.cpp */
74 bool IsGenerateWorldThreaded();
75 void GenerateWorldSetCallback(GWDoneProc *proc);
76 void GenerateWorldSetAbortCallback(GWAbortProc *proc);
77 void WaitTillGeneratedWorld();
78 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
79 void AbortGeneratingWorld();
80 bool IsGeneratingWorldAborted();
81 void HandleGeneratingWorldAbortion();
82
83 /* genworld_gui.cpp */
84 void SetNewLandscapeType(byte landscape);
85 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total);
86 void IncreaseGeneratingWorldProgress(GenWorldProgress cls);
87 void PrepareGenerateWorldProgress();
88 void ShowGenerateWorldProgress();
89 void StartNewGameWithoutGUI(uint seed);
90 void ShowCreateScenario();
91 void StartScenarioEditor();
92
93 extern bool _generating_world;
94
95 #endif /* GENWORLD_H */