# genworld.h

Go to the documentation of this file.

    00001 /* $Id: genworld.h 11818 2008-01-12 14:10:35Z rubidium $ */
    00002
    00005 #ifndef GENWORLD_H
    00006 #define GENWORLD_H
    00007
    00008 /* If OTTDThread isn't defined, define it to a void, but make sure to undefine
    00009  *  it after this include. This makes including genworld.h easier, as you
    00010  *  don't need to include thread.h before it, while it stays possible to
    00011  *  include it after it, and still work.
    00012  */
    00013 #ifndef OTTDThread
    00014 #define TEMPORARY_OTTDTHREAD_DEFINITION
    00015 #define OTTDThread void
    00016 #endif
    00017
    00018 #include "player_type.h"
    00019
    00020 /*
    00021  * Order of these enums has to be the same as in lang/english.txt
    00022  * Otherwise you will get inconsistent behaviour.
    00023  */
    00024 enum {
    00025   LG_ORIGINAL     = 0,
    00026   LG_TERRAGENESIS = 1,
    00027
    00028   GENERATE_NEW_SEED = (uint)-1,
    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 wait_for_draw;
    00038   bool quit_thread;
    00039   bool threaded;
    00040   int mode;
    00041   PlayerID lp;
    00042   uint size_x;
    00043   uint size_y;
    00044   gw_done_proc *proc;
    00045   gw_abort_proc *abortp;
    00046   OTTDThread *thread;
    00047 };
    00048
    00049 #ifdef TEMPORARY_OTTDTHREAD_DEFINITION
    00050 #undef OTTDThread
    00051 #undef TEMPORARY_OTTDTHREAD_DEFINITION
    00052 #endif
    00053
    00054 enum gwp_class {
    00055   GWP_MAP_INIT,
    00056   GWP_LANDSCAPE,
    00057   GWP_ROUGH_ROCKY,
    00058   GWP_TOWN,
    00059   GWP_INDUSTRY,
    00060   GWP_UNMOVABLE,
    00061   GWP_TREE,
    00062   GWP_GAME_INIT,
    00063   GWP_RUNTILELOOP,
    00064   GWP_GAME_START,
    00065   GWP_CLASS_COUNT
    00066 };
    00067
    00071 static inline bool IsGeneratingWorld()
    00072 {
    00073   extern gw_info _gw;
    00074
    00075   return _gw.active;
    00076 }
    00077
    00078 /* genworld.cpp */
    00079 void SetGeneratingWorldPaintStatus(bool status);
    00080 bool IsGeneratingWorldReadyForPaint();
    00081 bool IsGenerateWorldThreaded();
    00082 void GenerateWorldSetCallback(gw_done_proc *proc);
    00083 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
    00084 void WaitTillGeneratedWorld();
    00085 void GenerateWorld(int mode, uint size_x, uint size_y);
    00086 void AbortGeneratingWorld();
    00087 bool IsGeneratingWorldAborted();
    00088 void HandleGeneratingWorldAbortion();
    00089
    00090 /* genworld_gui.cpp */
    00091 void SetGeneratingWorldProgress(gwp_class cls, uint total);
    00092 void IncreaseGeneratingWorldProgress(gwp_class cls);
    00093 void PrepareGenerateWorldProgress();
    00094 void ShowGenerateWorldProgress();
    00095 void StartNewGameWithoutGUI(uint seed);
    00096 void ShowCreateScenario();
    00097 void StartScenarioEditor();
    00098
    00099 #endif /* GENWORLD_H */