OpenTTD: src/genworld.h Source File

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 27231 2015-04-11 18:45:18Z alberth $ */
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
36 enum TgenSmoothness {
37 TGEN_SMOOTHNESS_BEGIN,
38 TGEN_SMOOTHNESS_VERY_SMOOTH = TGEN_SMOOTHNESS_BEGIN,
39 TGEN_SMOOTHNESS_SMOOTH,
40 TGEN_SMOOTHNESS_ROUGH,
41 TGEN_SMOOTHNESS_VERY_ROUGH,
42
43 TGEN_SMOOTHNESS_END,
44 };
45
46 static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4;
47 static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1;
48 static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90;
49
50 typedef void GWDoneProc();
51 typedef void GWAbortProc();
52
54 struct GenWorldInfo {
55 bool abort;
56 bool quit_thread;
57 bool threaded;
58 GenWorldMode mode;
59 CompanyID lc;
60 uint size_x;
61 uint size_y;
62 GWDoneProc *proc;
63 GWAbortProc *abortp;
64 class ThreadObject *thread;
65 };
66
68 enum GenWorldProgress {
69 GWP_MAP_INIT,
70 GWP_LANDSCAPE,
71 GWP_RIVER,
72 GWP_ROUGH_ROCKY,
73 GWP_TOWN,
74 GWP_INDUSTRY,
75 GWP_OBJECT,
76 GWP_TREE,
77 GWP_GAME_INIT,
78 GWP_RUNTILELOOP,
79 GWP_RUNSCRIPT,
80 GWP_GAME_START,
81 GWP_CLASS_COUNT
82 };
83
84 /* genworld.cpp */
85 bool IsGenerateWorldThreaded();
86 void GenerateWorldSetCallback(GWDoneProc *proc);
87 void GenerateWorldSetAbortCallback(GWAbortProc *proc);
88 void WaitTillGeneratedWorld();
89 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
90 void AbortGeneratingWorld();
91 bool IsGeneratingWorldAborted();
92 void HandleGeneratingWorldAbortion();
93
94 /* genworld_gui.cpp */
95 void SetNewLandscapeType(byte landscape);
96 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total);
97 void IncreaseGeneratingWorldProgress(GenWorldProgress cls);
98 void PrepareGenerateWorldProgress();
99 void ShowGenerateWorldProgress();
100 void StartNewGameWithoutGUI(uint seed);
101 void ShowCreateScenario();
102 void StartScenarioEditor();
103
104 extern bool _generating_world;
105
106 #endif /* GENWORLD_H */