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
00018 enum LandscapeGenerator {
00019
00020
00021 LG_ORIGINAL = 0,
00022 LG_TERRAGENESIS = 1,
00023 };
00024
00025 static const uint GENERATE_NEW_SEED = UINT_MAX;
00026 static const uint GENWORLD_REDRAW_TIMEOUT = 200;
00027
00029 enum GenWorldMode {
00030 GWM_NEWGAME = 0,
00031 GWM_EMPTY = 1,
00032 GWM_RANDOM = 2,
00033 GWM_HEIGHTMAP = 3,
00034 };
00035
00036 static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4;
00037 static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1;
00038 static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90;
00039
00040 typedef void GWDoneProc();
00041 typedef void GWAbortProc();
00042
00044 struct GenWorldInfo {
00045 bool active;
00046 bool abort;
00047 bool quit_thread;
00048 bool threaded;
00049 GenWorldMode mode;
00050 CompanyID lc;
00051 uint size_x;
00052 uint size_y;
00053 GWDoneProc *proc;
00054 GWAbortProc *abortp;
00055 class ThreadObject *thread;
00056 };
00057
00059 enum GenWorldProgress {
00060 GWP_MAP_INIT,
00061 GWP_LANDSCAPE,
00062 GWP_ROUGH_ROCKY,
00063 GWP_TOWN,
00064 GWP_INDUSTRY,
00065 GWP_OBJECT,
00066 GWP_TREE,
00067 GWP_GAME_INIT,
00068 GWP_RUNTILELOOP,
00069 GWP_GAME_START,
00070 GWP_CLASS_COUNT
00071 };
00072
00077 static inline bool IsGeneratingWorld()
00078 {
00079 extern GenWorldInfo _gw;
00080 return _gw.active;
00081 }
00082
00083
00084 bool IsGenerateWorldThreaded();
00085 void GenerateWorldSetCallback(GWDoneProc *proc);
00086 void GenerateWorldSetAbortCallback(GWAbortProc *proc);
00087 void WaitTillGeneratedWorld();
00088 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
00089 void AbortGeneratingWorld();
00090 bool IsGeneratingWorldAborted();
00091 void HandleGeneratingWorldAbortion();
00092
00093
00094 void SetNewLandscapeType(byte landscape);
00095 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total);
00096 void IncreaseGeneratingWorldProgress(GenWorldProgress cls);
00097 void PrepareGenerateWorldProgress();
00098 void ShowGenerateWorldProgress();
00099 void StartNewGameWithoutGUI(uint seed);
00100 void ShowCreateScenario();
00101 void StartScenarioEditor();
00102
00103 extern class ThreadMutex *_genworld_mapgen_mutex;
00104 extern class ThreadMutex *_genworld_paint_mutex;
00105 extern bool _generating_world;
00106
00107 #endif