# genworld.h

Go to the documentation of this file.

    00001 /* $Id: genworld.h 15718 2009-03-15 00:32:18Z rubidium $ */
    00002
    00005 #ifndef GENWORLD_H
    00006 #define GENWORLD_H
    00007
    00008 #include "company_type.h"
    00009
    00010 /*
    00011  * Order of these enums has to be the same as in lang/english.txt
    00012  * Otherwise you will get inconsistent behaviour.
    00013  */
    00014 enum {
    00015   LG_ORIGINAL     = 0,
    00016   LG_TERRAGENESIS = 1,
    00017
    00018   GENERATE_NEW_SEED = UINT_MAX,
    00019 };
    00020
    00021 /* Modes for GenerateWorld */
    00022 enum GenerateWorldMode {
    00023   GW_NEWGAME   = 0,
    00024   GW_EMPTY     = 1,
    00025   GW_RANDOM    = 2,
    00026   GW_HEIGHTMAP = 3,
    00027 };
    00028
    00029 typedef void gw_done_proc();
    00030 typedef void gw_abort_proc();
    00031
    00032 struct gw_info {
    00033   bool active;
    00034   bool abort;
    00035   bool wait_for_draw;
    00036   bool quit_thread;
    00037   bool threaded;
    00038   GenerateWorldMode mode;
    00039   CompanyID lc;
    00040   uint size_x;
    00041   uint size_y;
    00042   gw_done_proc *proc;
    00043   gw_abort_proc *abortp;
    00044   class ThreadObject *thread;
    00045 };
    00046
    00047 enum gwp_class {
    00048   GWP_MAP_INIT,
    00049   GWP_LANDSCAPE,
    00050   GWP_ROUGH_ROCKY,
    00051   GWP_TOWN,
    00052   GWP_INDUSTRY,
    00053   GWP_UNMOVABLE,
    00054   GWP_TREE,
    00055   GWP_GAME_INIT,
    00056   GWP_RUNTILELOOP,
    00057   GWP_GAME_START,
    00058   GWP_CLASS_COUNT
    00059 };
    00060
    00064 static inline bool IsGeneratingWorld()
    00065 {
    00066   extern gw_info _gw;
    00067
    00068   return _gw.active;
    00069 }
    00070
    00071 /* genworld.cpp */
    00072 void SetGeneratingWorldPaintStatus(bool status);
    00073 bool IsGeneratingWorldReadyForPaint();
    00074 bool IsGenerateWorldThreaded();
    00075 void GenerateWorldSetCallback(gw_done_proc *proc);
    00076 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
    00077 void WaitTillGeneratedWorld();
    00078 void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y);
    00079 void AbortGeneratingWorld();
    00080 bool IsGeneratingWorldAborted();
    00081 void HandleGeneratingWorldAbortion();
    00082
    00083 /* genworld_gui.cpp */
    00084 void SetGeneratingWorldProgress(gwp_class cls, uint total);
    00085 void IncreaseGeneratingWorldProgress(gwp_class cls);
    00086 void PrepareGenerateWorldProgress();
    00087 void ShowGenerateWorldProgress();
    00088 void StartNewGameWithoutGUI(uint seed);
    00089 void ShowCreateScenario();
    00090 void StartScenarioEditor();
    00091
    00092 #endif /* GENWORLD_H */