src/genworld.h
changeset 9409 a4fc0d50c588
parent 9111 48ce04029fe4
child 10207 c291a21b304e
equal deleted inserted replaced
9408:e9ac1e9138e1 9409:a4fc0d50c588
    16 	LG_TERRAGENESIS = 1,  ///< TerraGenesis Perlin landscape generator
    16 	LG_TERRAGENESIS = 1,  ///< TerraGenesis Perlin landscape generator
    17 
    17 
    18 	GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
    18 	GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
    19 };
    19 };
    20 
    20 
       
    21 /* Modes for GenerateWorld */
       
    22 enum GenerateWorldMode {
       
    23 	GW_NEWGAME   = 0,    /* Generate a map for a new game */
       
    24 	GW_EMPTY     = 1,    /* Generate an empty map (sea-level) */
       
    25 	GW_RANDOM    = 2,    /* Generate a random map for SE */
       
    26 	GW_HEIGHTMAP = 3,    /* Generate a newgame from a heightmap */
       
    27 };
       
    28 
    21 typedef void gw_done_proc();
    29 typedef void gw_done_proc();
    22 typedef void gw_abort_proc();
    30 typedef void gw_abort_proc();
    23 
    31 
    24 struct gw_info {
    32 struct gw_info {
    25 	bool active;           ///< Is generating world active
    33 	bool active;           ///< Is generating world active
    26 	bool abort;            ///< Whether to abort the thread ASAP
    34 	bool abort;            ///< Whether to abort the thread ASAP
    27 	bool wait_for_draw;    ///< Are we waiting on a draw event
    35 	bool wait_for_draw;    ///< Are we waiting on a draw event
    28 	bool quit_thread;      ///< Do we want to quit the active thread
    36 	bool quit_thread;      ///< Do we want to quit the active thread
    29 	bool threaded;         ///< Whether we run _GenerateWorld threaded
    37 	bool threaded;         ///< Whether we run _GenerateWorld threaded
    30 	int mode;              ///< What mode are we making a world in
    38 	GenerateWorldMode mode;///< What mode are we making a world in
    31 	PlayerID lp;           ///< The local_player before generating
    39 	PlayerID lp;           ///< The local_player before generating
    32 	uint size_x;           ///< X-size of the map
    40 	uint size_x;           ///< X-size of the map
    33 	uint size_y;           ///< Y-size of the map
    41 	uint size_y;           ///< Y-size of the map
    34 	gw_done_proc *proc;    ///< Proc that is called when done (can be NULL)
    42 	gw_done_proc *proc;    ///< Proc that is called when done (can be NULL)
    35 	gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
    43 	gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
    65 bool IsGeneratingWorldReadyForPaint();
    73 bool IsGeneratingWorldReadyForPaint();
    66 bool IsGenerateWorldThreaded();
    74 bool IsGenerateWorldThreaded();
    67 void GenerateWorldSetCallback(gw_done_proc *proc);
    75 void GenerateWorldSetCallback(gw_done_proc *proc);
    68 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
    76 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
    69 void WaitTillGeneratedWorld();
    77 void WaitTillGeneratedWorld();
    70 void GenerateWorld(int mode, uint size_x, uint size_y);
    78 void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y);
    71 void AbortGeneratingWorld();
    79 void AbortGeneratingWorld();
    72 bool IsGeneratingWorldAborted();
    80 bool IsGeneratingWorldAborted();
    73 void HandleGeneratingWorldAbortion();
    81 void HandleGeneratingWorldAbortion();
    74 
    82 
    75 /* genworld_gui.cpp */
    83 /* genworld_gui.cpp */