OpenTTD
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 
19  /* Order of these enums has to be the same as in lang/english.txt
20  * Otherwise you will get inconsistent behaviour. */
23 };
24 
25 static const uint GENERATE_NEW_SEED = UINT_MAX;
26 
30  GWM_EMPTY = 1,
31  GWM_RANDOM = 2,
33 };
34 
42 
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;
60  uint size_x;
61  uint size_y;
65 };
66 
81  GWP_CLASS_COUNT
82 };
83 
84 /* genworld.cpp */
89 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
93 
94 /* genworld_gui.cpp */
95 void SetNewLandscapeType(byte landscape);
96 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total);
100 void StartNewGameWithoutGUI(uint seed);
101 void ShowCreateScenario();
102 void StartScenarioEditor();
103 
104 extern bool _generating_world;
105 
106 #endif /* GENWORLD_H */
void PrepareGenerateWorldProgress()
Initializes the progress counters to the starting point.
Generate trees.
Definition: genworld.h:76
Generate industries.
Definition: genworld.h:74
void GWDoneProc()
Procedure called when the genworld process finishes.
Definition: genworld.h:50
GenWorldProgress
Current stage of world generation process.
Definition: genworld.h:68
Generate objects (radio tower, light houses)
Definition: genworld.h:75
void StartNewGameWithoutGUI(uint seed)
Start a normal game without the GUI.
Generate a map for a new game.
Definition: genworld.h:29
void GenerateWorldSetAbortCallback(GWAbortProc *proc)
Set here the function, if any, that you want to be called when landscape generation is aborted...
Definition: genworld.cpp:233
uint size_y
Y-size of the map.
Definition: genworld.h:61
GenWorldMode
Modes for GenerateWorld.
Definition: genworld.h:28
static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY
Value for custom sea level in difficulty settings.
Definition: genworld.h:46
Create the rivers.
Definition: genworld.h:71
Initialize/allocate the map, start economy.
Definition: genworld.h:69
bool IsGeneratingWorldAborted()
Is the generation being aborted?
Definition: genworld.cpp:269
Smoothness preset &#39;smooth&#39;.
Definition: genworld.h:39
void ShowGenerateWorldProgress()
Show the window where a user can follow the process of the map generation.
Generate a newgame from a heightmap.
Definition: genworld.h:32
static const uint GENERATE_NEW_SEED
Create a new random seed.
Definition: genworld.h:25
GenWorldMode mode
What mode are we making a world in.
Definition: genworld.h:58
bool quit_thread
Do we want to quit the active thread.
Definition: genworld.h:56
uint size_x
X-size of the map.
Definition: genworld.h:60
Smoothness preset &#39;rough&#39;.
Definition: genworld.h:40
Smoothness preset &#39;very rough&#39;.
Definition: genworld.h:41
bool abort
Whether to abort the thread ASAP.
Definition: genworld.h:55
Create the landscape.
Definition: genworld.h:70
GWDoneProc * proc
Proc that is called when done (can be NULL)
Definition: genworld.h:62
TgenSmoothness
Smoothness presets.
Definition: genworld.h:36
Generate towns.
Definition: genworld.h:73
bool _generating_world
Whether we are generating the map or not.
Definition: genworld.cpp:61
bool IsGenerateWorldThreaded()
Tells if the world generation is done in a thread or not.
Definition: genworld.cpp:67
TerraGenesis Perlin landscape generator.
Definition: genworld.h:22
bool threaded
Whether we run _GenerateWorld threaded.
Definition: genworld.h:57
Properties of current genworld process.
Definition: genworld.h:54
Generate an empty map (sea-level)
Definition: genworld.h:30
void StartScenarioEditor()
Start with a scenario editor.
void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings=true)
Generate a world.
Definition: genworld.cpp:298
Runs the tile loop 1280 times to make snow etc.
Definition: genworld.h:78
Used to iterate.
Definition: genworld.h:43
void GWAbortProc()
Called when genworld is aborted.
Definition: genworld.h:51
GWAbortProc * abortp
Proc that is called when aborting (can be NULL)
Definition: genworld.h:63
First smoothness value.
Definition: genworld.h:37
LandscapeGenerator
Constants related to world generation.
Definition: genworld.h:18
void HandleGeneratingWorldAbortion()
Really handle the abortion, i.e.
Definition: genworld.cpp:277
void ShowCreateScenario()
Show the window to create a scenario.
Runs the game script at most 2500 times, or when ever the script sleeps.
Definition: genworld.h:79
static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE
Minimum percentage a user can specify for custom sea level.
Definition: genworld.h:47
CompanyID lc
The local_company before generating.
Definition: genworld.h:59
class ThreadObject * thread
The thread we are in (can be NULL)
Definition: genworld.h:64
void AbortGeneratingWorld()
Initializes the abortion process.
Definition: genworld.cpp:260
Make rough and rocky areas.
Definition: genworld.h:72
Types related to companies.
The original landscape generator.
Definition: genworld.h:21
static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE
Maximum percentage a user can specify for custom sea level.
Definition: genworld.h:48
void WaitTillGeneratedWorld()
This will wait for the thread to finish up his work.
Definition: genworld.cpp:242
Owner
Enum for all companies/owners.
Definition: company_type.h:20
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
void GenerateWorldSetCallback(GWDoneProc *proc)
Set here the function, if any, that you want to be called when landscape generation is done...
Definition: genworld.cpp:223
void SetNewLandscapeType(byte landscape)
Changes landscape type and sets genworld window dirty.
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
Initialize the game.
Definition: genworld.h:77
A Thread Object which works on all our supported OSes.
Definition: thread.h:24
Generate a random map for SE.
Definition: genworld.h:31
Really prepare to start the game.
Definition: genworld.h:80
Smoothness preset &#39;very smooth&#39;.
Definition: genworld.h:38