src/genworld.h
changeset 6248 e4a2ed7e5613
parent 6247 7d81e3a5d803
child 8254 1496654ca5e7
equal deleted inserted replaced
6247:7d81e3a5d803 6248:e4a2ed7e5613
    27 };
    27 };
    28 
    28 
    29 typedef void gw_done_proc();
    29 typedef void gw_done_proc();
    30 typedef void gw_abort_proc();
    30 typedef void gw_abort_proc();
    31 
    31 
    32 typedef struct gw_info {
    32 struct gw_info {
    33 	bool active;           ///< Is generating world active
    33 	bool active;           ///< Is generating world active
    34 	bool abort;            ///< Whether to abort the thread ASAP
    34 	bool abort;            ///< Whether to abort the thread ASAP
    35 	bool wait_for_draw;    ///< Are we waiting on a draw event
    35 	bool wait_for_draw;    ///< Are we waiting on a draw event
    36 	bool quit_thread;      ///< Do we want to quit the active thread
    36 	bool quit_thread;      ///< Do we want to quit the active thread
    37 	bool threaded;         ///< Whether we run _GenerateWorld threaded
    37 	bool threaded;         ///< Whether we run _GenerateWorld threaded
    40 	uint size_x;           ///< X-size of the map
    40 	uint size_x;           ///< X-size of the map
    41 	uint size_y;           ///< Y-size of the map
    41 	uint size_y;           ///< Y-size of the map
    42 	gw_done_proc *proc;    ///< Proc that is called when done (can be NULL)
    42 	gw_done_proc *proc;    ///< Proc that is called when done (can be NULL)
    43 	gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
    43 	gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
    44 	OTTDThread *thread;    ///< The thread we are in (can be NULL)
    44 	OTTDThread *thread;    ///< The thread we are in (can be NULL)
    45 } gw_info;
    45 };
    46 
    46 
    47 #ifdef TEMPORARY_OTTDTHREAD_DEFINITION
    47 #ifdef TEMPORARY_OTTDTHREAD_DEFINITION
    48 #undef OTTDThread
    48 #undef OTTDThread
    49 #undef TEMPORARY_OTTDTHREAD_DEFINITION
    49 #undef TEMPORARY_OTTDTHREAD_DEFINITION
    50 #endif
    50 #endif
    51 
    51 
    52 typedef enum gwp_classes {
    52 enum gwp_class {
    53 	GWP_MAP_INIT,    ///< Initialize/allocate the map, start economy
    53 	GWP_MAP_INIT,    ///< Initialize/allocate the map, start economy
    54 	GWP_LANDSCAPE,   ///< Create the landscape
    54 	GWP_LANDSCAPE,   ///< Create the landscape
    55 	GWP_ROUGH_ROCKY, ///< Make rough and rocky areas
    55 	GWP_ROUGH_ROCKY, ///< Make rough and rocky areas
    56 	GWP_TOWN,        ///< Generate towns
    56 	GWP_TOWN,        ///< Generate towns
    57 	GWP_INDUSTRY,    ///< Generate industries
    57 	GWP_INDUSTRY,    ///< Generate industries
    59 	GWP_TREE,        ///< Generate trees
    59 	GWP_TREE,        ///< Generate trees
    60 	GWP_GAME_INIT,   ///< Initialize the game
    60 	GWP_GAME_INIT,   ///< Initialize the game
    61 	GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc
    61 	GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc
    62 	GWP_GAME_START,  ///< Really prepare to start the game
    62 	GWP_GAME_START,  ///< Really prepare to start the game
    63 	GWP_CLASS_COUNT
    63 	GWP_CLASS_COUNT
    64 } gwp_class;
    64 };
    65 
    65 
    66 /**
    66 /**
    67  * Check if we are currently in the process of generating a world.
    67  * Check if we are currently in the process of generating a world.
    68  */
    68  */
    69 static inline bool IsGeneratingWorld()
    69 static inline bool IsGeneratingWorld()