mirror of https://github.com/OpenTTD/OpenTTD
(svn r18861) -Doc: more doxygen documentation in genworld files
parent
a1f28ec88b
commit
a39a446e8f
|
@ -48,10 +48,12 @@ void StartupDisasters();
|
||||||
|
|
||||||
void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings);
|
void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings);
|
||||||
|
|
||||||
/* Please only use this variable in genworld.h and genworld.cpp and
|
/**
|
||||||
|
* Please only use this variable in genworld.h and genworld.cpp and
|
||||||
* nowhere else. For speed improvements we need it to be global, but
|
* nowhere else. For speed improvements we need it to be global, but
|
||||||
* in no way the meaning of it is to use it anywhere else besides
|
* in no way the meaning of it is to use it anywhere else besides
|
||||||
* in the genworld.h and genworld.cpp! -- TrueLight */
|
* in the genworld.h and genworld.cpp! -- TrueLight
|
||||||
|
*/
|
||||||
GenWorldInfo _gw;
|
GenWorldInfo _gw;
|
||||||
|
|
||||||
/** Rights for the map generation */
|
/** Rights for the map generation */
|
||||||
|
@ -61,6 +63,7 @@ ThreadMutex *_genworld_paint_mutex = ThreadMutex::New();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the world generation is done in a thread or not.
|
* Tells if the world generation is done in a thread or not.
|
||||||
|
* @return the 'threaded' status
|
||||||
*/
|
*/
|
||||||
bool IsGenerateWorldThreaded()
|
bool IsGenerateWorldThreaded()
|
||||||
{
|
{
|
||||||
|
@ -91,7 +94,7 @@ static void CleanupGeneration()
|
||||||
/**
|
/**
|
||||||
* The internal, real, generate function.
|
* The internal, real, generate function.
|
||||||
*/
|
*/
|
||||||
static void _GenerateWorld(void *arg)
|
static void _GenerateWorld(void *)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
_generating_world = true;
|
_generating_world = true;
|
||||||
|
@ -191,6 +194,7 @@ static void _GenerateWorld(void *arg)
|
||||||
/**
|
/**
|
||||||
* Set here the function, if any, that you want to be called when landscape
|
* Set here the function, if any, that you want to be called when landscape
|
||||||
* generation is done.
|
* generation is done.
|
||||||
|
* @param proc callback procedure
|
||||||
*/
|
*/
|
||||||
void GenerateWorldSetCallback(GWDoneProc *proc)
|
void GenerateWorldSetCallback(GWDoneProc *proc)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +204,7 @@ void GenerateWorldSetCallback(GWDoneProc *proc)
|
||||||
/**
|
/**
|
||||||
* Set here the function, if any, that you want to be called when landscape
|
* Set here the function, if any, that you want to be called when landscape
|
||||||
* generation is aborted.
|
* generation is aborted.
|
||||||
|
* @param proc callback procedure
|
||||||
*/
|
*/
|
||||||
void GenerateWorldSetAbortCallback(GWAbortProc *proc)
|
void GenerateWorldSetAbortCallback(GWAbortProc *proc)
|
||||||
{
|
{
|
||||||
|
@ -235,6 +240,7 @@ void AbortGeneratingWorld()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the generation being aborted?
|
* Is the generation being aborted?
|
||||||
|
* @return the 'aborted' status
|
||||||
*/
|
*/
|
||||||
bool IsGeneratingWorldAborted()
|
bool IsGeneratingWorldAborted()
|
||||||
{
|
{
|
||||||
|
@ -261,7 +267,7 @@ void HandleGeneratingWorldAbortion()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a world.
|
* Generate a world.
|
||||||
* @param mode The mode of world generation (see GenerateWorldModes).
|
* @param mode The mode of world generation (see GenWorldMode).
|
||||||
* @param size_x The X-size of the map.
|
* @param size_x The X-size of the map.
|
||||||
* @param size_y The Y-size of the map.
|
* @param size_y The Y-size of the map.
|
||||||
* @param reset_settings Whether to reset the game configuration (used for restart)
|
* @param reset_settings Whether to reset the game configuration (used for restart)
|
||||||
|
|
|
@ -14,11 +14,10 @@
|
||||||
|
|
||||||
#include "company_type.h"
|
#include "company_type.h"
|
||||||
|
|
||||||
/*
|
/** Constants related to world generation */
|
||||||
* Order of these enums has to be the same as in lang/english.txt
|
|
||||||
* Otherwise you will get inconsistent behaviour.
|
|
||||||
*/
|
|
||||||
enum {
|
enum {
|
||||||
|
/* Order of these enums has to be the same as in lang/english.txt
|
||||||
|
* Otherwise you will get inconsistent behaviour. */
|
||||||
LG_ORIGINAL = 0, ///< The original landscape generator
|
LG_ORIGINAL = 0, ///< The original landscape generator
|
||||||
LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator
|
LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ enum {
|
||||||
GENWORLD_REDRAW_TIMEOUT = 200, ///< Timeout between redraws
|
GENWORLD_REDRAW_TIMEOUT = 200, ///< Timeout between redraws
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Modes for GenerateWorld */
|
/** Modes for GenerateWorld */
|
||||||
enum GenWorldMode {
|
enum GenWorldMode {
|
||||||
GWM_NEWGAME = 0, ///< Generate a map for a new game
|
GWM_NEWGAME = 0, ///< Generate a map for a new game
|
||||||
GWM_EMPTY = 1, ///< Generate an empty map (sea-level)
|
GWM_EMPTY = 1, ///< Generate an empty map (sea-level)
|
||||||
|
@ -35,9 +34,10 @@ enum GenWorldMode {
|
||||||
GWM_HEIGHTMAP = 3, ///< Generate a newgame from a heightmap
|
GWM_HEIGHTMAP = 3, ///< Generate a newgame from a heightmap
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void GWDoneProc();
|
typedef void GWDoneProc(); ///< Procedure called when the genworld process finishes
|
||||||
typedef void GWAbortProc();
|
typedef void GWAbortProc(); ///< Called when genworld is aborted
|
||||||
|
|
||||||
|
/** Properties of current genworld process */
|
||||||
struct GenWorldInfo {
|
struct GenWorldInfo {
|
||||||
bool active; ///< Is generating world active
|
bool active; ///< Is generating world active
|
||||||
bool abort; ///< Whether to abort the thread ASAP
|
bool abort; ///< Whether to abort the thread ASAP
|
||||||
|
@ -52,6 +52,7 @@ struct GenWorldInfo {
|
||||||
class ThreadObject *thread; ///< The thread we are in (can be NULL)
|
class ThreadObject *thread; ///< The thread we are in (can be NULL)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Current stage of world generation process */
|
||||||
enum GenWorldProgress {
|
enum GenWorldProgress {
|
||||||
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy
|
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy
|
||||||
GWP_LANDSCAPE, ///< Create the landscape
|
GWP_LANDSCAPE, ///< Create the landscape
|
||||||
|
@ -68,6 +69,7 @@ enum GenWorldProgress {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we are currently in the process of generating a world.
|
* Check if we are currently in the process of generating a world.
|
||||||
|
* @return are we generating world?
|
||||||
*/
|
*/
|
||||||
static inline bool IsGeneratingWorld()
|
static inline bool IsGeneratingWorld()
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,15 +40,18 @@
|
||||||
* In what 'mode' the GenerateLandscapeWindowProc is.
|
* In what 'mode' the GenerateLandscapeWindowProc is.
|
||||||
*/
|
*/
|
||||||
enum GenenerateLandscapeWindowMode {
|
enum GenenerateLandscapeWindowMode {
|
||||||
GLWM_GENERATE,
|
GLWM_GENERATE, ///< Generate new game
|
||||||
GLWM_HEIGHTMAP,
|
GLWM_HEIGHTMAP, ///< Load from heightmap
|
||||||
GLWM_SCENARIO,
|
GLWM_SCENARIO, ///< Generate flat land
|
||||||
GLWM_END
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void SwitchToMode(SwitchMode new_mode);
|
extern void SwitchToMode(SwitchMode new_mode);
|
||||||
extern void MakeNewgameSettingsLive();
|
extern void MakeNewgameSettingsLive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes landscape type and sets genworld window dirty
|
||||||
|
* @param landscape new landscape type
|
||||||
|
*/
|
||||||
static inline void SetNewLandscapeType(byte landscape)
|
static inline void SetNewLandscapeType(byte landscape)
|
||||||
{
|
{
|
||||||
_settings_newgame.game_creation.landscape = landscape;
|
_settings_newgame.game_creation.landscape = landscape;
|
||||||
|
@ -56,51 +59,53 @@ static inline void SetNewLandscapeType(byte landscape)
|
||||||
SetWindowClassesDirty(WC_GENERATE_LANDSCAPE);
|
SetWindowClassesDirty(WC_GENERATE_LANDSCAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Widgets of GenerateLandscapeWindow */
|
||||||
enum GenerateLandscapeWindowWidgets {
|
enum GenerateLandscapeWindowWidgets {
|
||||||
GLAND_TEMPERATE,
|
GLAND_TEMPERATE, ///< Button with icon "Temperate"
|
||||||
GLAND_ARCTIC,
|
GLAND_ARCTIC, ///< Button with icon "Arctic"
|
||||||
GLAND_TROPICAL,
|
GLAND_TROPICAL, ///< Button with icon "Tropical"
|
||||||
GLAND_TOYLAND,
|
GLAND_TOYLAND, ///< Button with icon "Toyland"
|
||||||
|
|
||||||
GLAND_MAPSIZE_X_PULLDOWN,
|
GLAND_MAPSIZE_X_PULLDOWN, ///< Dropdown 'map X size'
|
||||||
GLAND_MAPSIZE_Y_PULLDOWN,
|
GLAND_MAPSIZE_Y_PULLDOWN, ///< Dropdown 'map Y size'
|
||||||
|
|
||||||
GLAND_TOWN_PULLDOWN,
|
GLAND_TOWN_PULLDOWN, ///< Dropdown 'No. of towns'
|
||||||
GLAND_INDUSTRY_PULLDOWN,
|
GLAND_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries'
|
||||||
|
|
||||||
GLAND_RANDOM_EDITBOX,
|
GLAND_RANDOM_EDITBOX, ///< 'Random seed' editbox
|
||||||
GLAND_RANDOM_BUTTON,
|
GLAND_RANDOM_BUTTON, ///< 'Randomise' button
|
||||||
|
|
||||||
GLAND_GENERATE_BUTTON,
|
GLAND_GENERATE_BUTTON, ///< 'Generate' button
|
||||||
|
|
||||||
GLAND_START_DATE_DOWN,
|
GLAND_START_DATE_DOWN, ///< Decrease start year
|
||||||
GLAND_START_DATE_TEXT,
|
GLAND_START_DATE_TEXT, ///< Start year
|
||||||
GLAND_START_DATE_UP,
|
GLAND_START_DATE_UP, ///< Increase start year
|
||||||
|
|
||||||
GLAND_SNOW_LEVEL_DOWN,
|
GLAND_SNOW_LEVEL_DOWN, ///< Docrease snow level
|
||||||
GLAND_SNOW_LEVEL_TEXT,
|
GLAND_SNOW_LEVEL_TEXT, ///< Snow level
|
||||||
GLAND_SNOW_LEVEL_UP,
|
GLAND_SNOW_LEVEL_UP, ///< Increase snow level
|
||||||
|
|
||||||
GLAND_TREE_PULLDOWN,
|
GLAND_TREE_PULLDOWN, ///< Dropdown 'Tree algorithm'
|
||||||
GLAND_LANDSCAPE_PULLDOWN,
|
GLAND_LANDSCAPE_PULLDOWN, ///< Dropdown 'Land generator'
|
||||||
GLAND_HEIGHTMAP_NAME_TEXT,
|
|
||||||
GLAND_HEIGHTMAP_NAME_SPACER,
|
|
||||||
GLAND_HEIGHTMAP_SIZE_TEXT,
|
|
||||||
GLAND_HEIGHTMAP_ROTATION_PULLDOWN,
|
|
||||||
|
|
||||||
GLAND_TERRAIN_PULLDOWN,
|
GLAND_HEIGHTMAP_NAME_TEXT, ///< Heightmap name
|
||||||
GLAND_WATER_PULLDOWN,
|
GLAND_HEIGHTMAP_NAME_SPACER, ///< Spacer used for aligning items in the second column nicely
|
||||||
GLAND_SMOOTHNESS_PULLDOWN,
|
GLAND_HEIGHTMAP_SIZE_TEXT, ///< Size of heightmap
|
||||||
GLAND_VARIETY_PULLDOWN,
|
GLAND_HEIGHTMAP_ROTATION_PULLDOWN, ///< Dropdown 'Heightmap rotation'
|
||||||
|
|
||||||
GLAND_BORDER_TYPES,
|
GLAND_TERRAIN_PULLDOWN, ///< Dropdown 'Terrain type'
|
||||||
GLAND_BORDERS_RANDOM,
|
GLAND_WATER_PULLDOWN, ///< Dropdown 'Sea level'
|
||||||
GLAND_WATER_NW,
|
GLAND_SMOOTHNESS_PULLDOWN, ///< Dropdown 'Smoothness'
|
||||||
GLAND_WATER_NE,
|
GLAND_VARIETY_PULLDOWN, ///< Dropdown 'Variety distribution'
|
||||||
GLAND_WATER_SE,
|
|
||||||
GLAND_WATER_SW,
|
GLAND_BORDERS_RANDOM, ///< 'Random'/'Manual' borders
|
||||||
|
GLAND_WATER_NW, ///< NW 'Water'/'Freeform'
|
||||||
|
GLAND_WATER_NE, ///< NE 'Water'/'Freeform'
|
||||||
|
GLAND_WATER_SE, ///< SE 'Water'/'Freeform'
|
||||||
|
GLAND_WATER_SW, ///< SW 'Water'/'Freeform'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Widgets of GenerateLandscapeWindow when generating world */
|
||||||
static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||||
|
@ -133,7 +138,7 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
|
||||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
|
||||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
|
||||||
NWidget(WWT_TEXT, COLOUR_ORANGE, GLAND_BORDER_TYPES), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
|
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
/* Widgets at the right of the labels. */
|
/* Widgets at the right of the labels. */
|
||||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||||
|
@ -213,6 +218,7 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Widgets of GenerateLandscapeWindow when loading heightmap */
|
||||||
static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
||||||
/* Window header. */
|
/* Window header. */
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
|
|
Loading…
Reference in New Issue