truelight@4300: /* $Id$ */ truelight@4300: rubidium@9111: /** @file genworld.h Functions related to world/map generation. */ belugas@6179: truelight@4300: #ifndef GENWORLD_H truelight@4300: #define GENWORLD_H truelight@4300: rubidium@8254: #include "player_type.h" rubidium@8254: truelight@4300: /* truelight@4300: * Order of these enums has to be the same as in lang/english.txt truelight@4300: * Otherwise you will get inconsistent behaviour. truelight@4300: */ truelight@4300: enum { belugas@6179: LG_ORIGINAL = 0, ///< The original landscape generator belugas@6179: LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator truelight@4300: belugas@6179: GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed truelight@4300: }; truelight@4300: rubidium@6247: typedef void gw_done_proc(); rubidium@6247: typedef void gw_abort_proc(); truelight@4300: rubidium@6248: struct gw_info { belugas@6179: bool active; ///< Is generating world active belugas@6179: bool abort; ///< Whether to abort the thread ASAP belugas@6179: bool wait_for_draw; ///< Are we waiting on a draw event belugas@6179: bool quit_thread; ///< Do we want to quit the active thread belugas@6179: bool threaded; ///< Whether we run _GenerateWorld threaded belugas@6179: int mode; ///< What mode are we making a world in belugas@6179: PlayerID lp; ///< The local_player before generating belugas@6179: uint size_x; ///< X-size of the map belugas@6179: uint size_y; ///< Y-size of the map belugas@6179: gw_done_proc *proc; ///< Proc that is called when done (can be NULL) belugas@6179: gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL) rubidium@8934: class ThreadObject *thread; ///< The thread we are in (can be NULL) rubidium@6248: }; truelight@4300: rubidium@6248: enum gwp_class { belugas@6179: GWP_MAP_INIT, ///< Initialize/allocate the map, start economy belugas@6179: GWP_LANDSCAPE, ///< Create the landscape belugas@6179: GWP_ROUGH_ROCKY, ///< Make rough and rocky areas belugas@6179: GWP_TOWN, ///< Generate towns belugas@6179: GWP_INDUSTRY, ///< Generate industries belugas@6179: GWP_UNMOVABLE, ///< Generate unmovables (radio tower, light houses) belugas@6179: GWP_TREE, ///< Generate trees belugas@6179: GWP_GAME_INIT, ///< Initialize the game belugas@6179: GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc belugas@6179: GWP_GAME_START, ///< Really prepare to start the game truelight@4300: GWP_CLASS_COUNT rubidium@6248: }; truelight@4300: truelight@4300: /** truelight@4300: * Check if we are currently in the process of generating a world. truelight@4300: */ rubidium@6247: static inline bool IsGeneratingWorld() truelight@4300: { truelight@4300: extern gw_info _gw; truelight@4300: truelight@4300: return _gw.active; truelight@4300: } truelight@4300: belugas@6179: /* genworld.cpp */ truelight@4300: void SetGeneratingWorldPaintStatus(bool status); rubidium@6247: bool IsGeneratingWorldReadyForPaint(); rubidium@6247: bool IsGenerateWorldThreaded(); truelight@4300: void GenerateWorldSetCallback(gw_done_proc *proc); rubidium@5145: void GenerateWorldSetAbortCallback(gw_abort_proc *proc); rubidium@6247: void WaitTillGeneratedWorld(); truelight@4300: void GenerateWorld(int mode, uint size_x, uint size_y); rubidium@6247: void AbortGeneratingWorld(); rubidium@6247: bool IsGeneratingWorldAborted(); rubidium@6247: void HandleGeneratingWorldAbortion(); truelight@4300: belugas@6179: /* genworld_gui.cpp */ rubidium@5587: void SetGeneratingWorldProgress(gwp_class cls, uint total); rubidium@5587: void IncreaseGeneratingWorldProgress(gwp_class cls); rubidium@6247: void PrepareGenerateWorldProgress(); rubidium@6247: void ShowGenerateWorldProgress(); truelight@4300: void StartNewGameWithoutGUI(uint seed); rubidium@6247: void ShowCreateScenario(); rubidium@6247: void StartScenarioEditor(); truelight@4300: truelight@4300: #endif /* GENWORLD_H */