genworld.cpp File Reference

#include "stdafx.h"
#include "openttd.h"
#include "landscape.h"
#include "player_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 "debug.h"
#include "settings_func.h"
#include "heightmap.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "map_func.h"
#include "date_func.h"
#include "core/random_func.hpp"
#include "engine.h"
#include "settings_type.h"
#include "newgrf_storage.h"
#include "water.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 ()
bool GenerateTowns ()
void GenerateTrees ()
 Place new trees.
void StartupEconomy ()
void StartupPlayers ()
void StartupDisasters ()
void InitializeGame (int mode, uint size_x, uint size_y)
void SetGeneratingWorldPaintStatus (bool status)
 Set the status of the Paint flag.
bool IsGeneratingWorldReadyForPaint ()
 Returns true if the thread wants the main program to do a (full) paint.
bool IsGenerateWorldThreaded ()
 Tells if the world generation is done in a thread or not.
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 (int mode, uint size_x, uint size_y)
 Generate a world.

Variables

gw_info _gw


Detailed Description

Definition in file genworld.cpp.


Function Documentation

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 1742 of file industry_cmd.cpp.

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 GWP_TREE, PlaceMoreTrees(), PlaceTreesRandomly(), ScaleByMapSize(), SetGeneratingWorldProgress(), TP_IMPROVED, TP_NONE, and TP_ORIGINAL.

Referenced by _GenerateWorld().

void GenerateWorld ( int  mode,
uint  size_x,
uint  size_y 
)

Generate a world.

Parameters:
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 249 of file genworld.cpp.

References _GenerateWorld(), ConvertYMDToDate(), DeleteAllNonVitalWindows(), HideVitalWindows(), MapSizeX(), MapSizeY(), OWNER_NONE, PLAYER_SPECTATOR, PrepareGenerateWorldProgress(), SetLocalPlayer(), ShowGenerateWorldProgress(), and TileXY().

void HandleGeneratingWorldAbortion (  ) 

Really handle the abortion, i.e.

clean up some of the mess

Definition at line 221 of file genworld.cpp.

References MarkWholeScreenDirty().

bool IsGeneratingWorldReadyForPaint (  ) 

Returns true if the thread wants the main program to do a (full) paint.

If this returns false, please do not update the screen. Because we are writing in a thread, it can cause damaged data (reading and writing the same tile at the same time).

Definition at line 67 of file genworld.cpp.

Referenced by DrawDirtyBlocks().

void SetGeneratingWorldPaintStatus ( bool  status  ) 

Set the status of the Paint flag.

If it is true, the thread will hold with any futher generating till the drawing of the screen is done. This is handled by SetGeneratingWorldProgress(), so calling that function will stall from time to time.

Definition at line 56 of file genworld.cpp.

Referenced by DrawDirtyBlocks().

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 193 of file genworld.cpp.


Generated on Mon Sep 22 20:34:22 2008 for openttd by  doxygen 1.5.6