#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
#include "landscape.h"
#include "company_func.h"
#include "variables.h"
#include "thread.h"
#include "command_func.h"
#include "genworld.h"
#include "gfxinit.h"
#include "window_func.h"
#include "network/network.h"
#include "heightmap.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "date_func.h"
#include "core/random_func.hpp"
#include "engine_func.h"
#include "newgrf_storage.h"
#include "water.h"
#include "blitter/factory.hpp"
#include "tilehighlight_func.h"
#include "saveload/saveload.h"
#include "void_map.h"
#include "settings_type.h"
#include "town.h"
#include "table/sprites.h"
Go to the source code of this file.
Functions | |
void | GenerateClearTile () |
void | GenerateIndustries () |
This function will create ramdon industries during game creation. | |
void | GenerateUnmovables () |
void | GenerateTrees () |
Place new trees. | |
void | StartupEconomy () |
void | StartupCompanies () |
void | StartupDisasters () |
void | InitializeGame (uint size_x, uint size_y, bool reset_date, bool reset_settings) |
bool | IsGenerateWorldThreaded () |
Tells if the world generation is done in a thread or not. | |
static void | CleanupGeneration () |
Clean up the 'mess' of generation. | |
static void | _GenerateWorld (void *arg) |
The internal, real, generate function. | |
void | GenerateWorldSetCallback (gw_done_proc *proc) |
Set here the function, if any, that you want to be called when landscape generation is done. | |
void | GenerateWorldSetAbortCallback (gw_abort_proc *proc) |
Set here the function, if any, that you want to be called when landscape generation is aborted. | |
void | WaitTillGeneratedWorld () |
This will wait for the thread to finish up his work. | |
void | AbortGeneratingWorld () |
Initializes the abortion process. | |
bool | IsGeneratingWorldAborted () |
Is the generation being aborted? | |
void | HandleGeneratingWorldAbortion () |
Really handle the abortion, i.e. | |
void | GenerateWorld (GenerateWorldMode mode, uint size_x, uint size_y, bool reset_settings) |
Generate a world. | |
Variables | |
gw_info | _gw |
ThreadMutex * | _genworld_mapgen_mutex = ThreadMutex::New() |
Rights for the map generation. | |
ThreadMutex * | _genworld_paint_mutex = ThreadMutex::New() |
Rights for the painting. |
Definition in file genworld.cpp.
static void CleanupGeneration | ( | ) | [static] |
Clean up the 'mess' of generation.
That is show windows again, reset thread variables and delete the progress window.
Definition at line 68 of file genworld.cpp.
References DeleteWindowById(), ThreadMutex::EndCritical(), MarkWholeScreenDirty(), and CursorVars::sprite.
Referenced by _GenerateWorld(), and HandleGeneratingWorldAbortion().
void GenerateIndustries | ( | ) |
This function will create ramdon industries during game creation.
It will scale the amount of industries by map size as well as difficulty level
Definition at line 1772 of file industry_cmd.cpp.
References _settings_game, IndustrySpec::appear_creation, IndustrySpec::check_proc, GameSettings::difficulty, IndustrySpec::enabled, GameSettings::game_creation, GetIndustrySpec(), GWP_INDUSTRY, IACT_MAPGENERATION, GameCreationSettings::landscape, NUM_INDUSTRYTYPES, IndustrySpec::num_table, DifficultySettings::number_industries, PlaceInitialIndustry(), ScaleByMapSize(), ScaleByMapSize1D(), and SetGeneratingWorldProgress().
Referenced by _GenerateWorld().
void GenerateTrees | ( | ) |
Place new trees.
This function takes care of the selected tree placer algorithm and place randomly the trees for a new game.
Definition at line 294 of file tree_cmd.cpp.
References _settings_game, GameSettings::game_creation, GWP_TREE, GameCreationSettings::landscape, PlaceMoreTrees(), PlaceTreesRandomly(), ScaleByMapSize(), SetGeneratingWorldProgress(), TP_IMPROVED, TP_NONE, TP_ORIGINAL, and GameCreationSettings::tree_placer.
Referenced by _GenerateWorld().
void GenerateWorld | ( | GenerateWorldMode | mode, | |
uint | size_x, | |||
uint | size_y, | |||
bool | reset_settings | |||
) |
Generate a world.
mode | The mode of world generation (see GenerateWorldModes). | |
size_x | The X-size of the map. | |
size_y | The Y-size of the map. |
Definition at line 260 of file genworld.cpp.
References _GenerateWorld(), _settings_game, ThreadMutex::BeginCritical(), COMPANY_SPECTATOR, ConvertYMDToDate(), DeleteAllNonVitalWindows(), ThreadMutex::EndCritical(), FindWindowById(), GameSettings::game_creation, BlitterFactoryBase::GetCurrentBlitter(), HideVitalWindows(), LoadStringWidthTable(), MapSizeX(), MapSizeY(), ThreadObject::New(), OWNER_NONE, PrepareGenerateWorldProgress(), ResetWindowSystem(), SetLocalCompany(), ShowGenerateWorldProgress(), GameCreationSettings::starting_year, TileXY(), and VHM_NONE.
void HandleGeneratingWorldAbortion | ( | ) |
Really handle the abortion, i.e.
clean up some of the mess
Definition at line 239 of file genworld.cpp.
References _switch_mode, and CleanupGeneration().
Referenced by _GenerateWorld().
void WaitTillGeneratedWorld | ( | ) |
This will wait for the thread to finish up his work.
It will not continue till the work is done.
Definition at line 205 of file genworld.cpp.
References ThreadMutex::BeginCritical(), and ThreadMutex::EndCritical().