genworld.h
Go to the documentation of this file.00001
00002
00005 #ifndef GENWORLD_H
00006 #define GENWORLD_H
00007
00008 #include "company_type.h"
00009
00010
00011
00012
00013
00014 enum {
00015 LG_ORIGINAL = 0,
00016 LG_TERRAGENESIS = 1,
00017
00018 GENERATE_NEW_SEED = UINT_MAX,
00019
00020 GENWORLD_REDRAW_TIMEOUT = 200,
00021 };
00022
00023
00024 enum GenerateWorldMode {
00025 GW_NEWGAME = 0,
00026 GW_EMPTY = 1,
00027 GW_RANDOM = 2,
00028 GW_HEIGHTMAP = 3,
00029 };
00030
00031 typedef void gw_done_proc();
00032 typedef void gw_abort_proc();
00033
00034 struct gw_info {
00035 bool active;
00036 bool abort;
00037 bool quit_thread;
00038 bool threaded;
00039 GenerateWorldMode mode;
00040 CompanyID lc;
00041 uint size_x;
00042 uint size_y;
00043 gw_done_proc *proc;
00044 gw_abort_proc *abortp;
00045 class ThreadObject *thread;
00046 };
00047
00048 enum gwp_class {
00049 GWP_MAP_INIT,
00050 GWP_LANDSCAPE,
00051 GWP_ROUGH_ROCKY,
00052 GWP_TOWN,
00053 GWP_INDUSTRY,
00054 GWP_UNMOVABLE,
00055 GWP_TREE,
00056 GWP_GAME_INIT,
00057 GWP_RUNTILELOOP,
00058 GWP_GAME_START,
00059 GWP_CLASS_COUNT
00060 };
00061
00065 static inline bool IsGeneratingWorld()
00066 {
00067 extern gw_info _gw;
00068
00069 return _gw.active;
00070 }
00071
00072
00073 bool IsGenerateWorldThreaded();
00074 void GenerateWorldSetCallback(gw_done_proc *proc);
00075 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
00076 void WaitTillGeneratedWorld();
00077 void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
00078 void AbortGeneratingWorld();
00079 bool IsGeneratingWorldAborted();
00080 void HandleGeneratingWorldAbortion();
00081
00082
00083 void SetGeneratingWorldProgress(gwp_class cls, uint total);
00084 void IncreaseGeneratingWorldProgress(gwp_class cls);
00085 void PrepareGenerateWorldProgress();
00086 void ShowGenerateWorldProgress();
00087 void StartNewGameWithoutGUI(uint seed);
00088 void ShowCreateScenario();
00089 void StartScenarioEditor();
00090
00091 extern class ThreadMutex *_genworld_mapgen_mutex;
00092 extern class ThreadMutex *_genworld_paint_mutex;
00093
00094 #endif