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