genworld.h

Go to the documentation of this file.
00001 /* $Id: genworld.h 18861 2010-01-18 14:58:32Z smatz $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef GENWORLD_H
00013 #define GENWORLD_H
00014 
00015 #include "company_type.h"
00016 
00018 enum {
00019   /* Order of these enums has to be the same as in lang/english.txt
00020    * Otherwise you will get inconsistent behaviour. */
00021   LG_ORIGINAL     = 0,  
00022   LG_TERRAGENESIS = 1,  
00023 
00024   GENERATE_NEW_SEED = UINT_MAX, 
00025 
00026   GENWORLD_REDRAW_TIMEOUT = 200, 
00027 };
00028 
00030 enum GenWorldMode {
00031   GWM_NEWGAME   = 0, 
00032   GWM_EMPTY     = 1, 
00033   GWM_RANDOM    = 2, 
00034   GWM_HEIGHTMAP = 3, 
00035 };
00036 
00037 typedef void GWDoneProc();  
00038 typedef void GWAbortProc(); 
00039 
00041 struct GenWorldInfo {
00042   bool active;           
00043   bool abort;            
00044   bool quit_thread;      
00045   bool threaded;         
00046   GenWorldMode mode;     
00047   CompanyID lc;          
00048   uint size_x;           
00049   uint size_y;           
00050   GWDoneProc *proc;      
00051   GWAbortProc *abortp;   
00052   class ThreadObject *thread; 
00053 };
00054 
00056 enum GenWorldProgress {
00057   GWP_MAP_INIT,    
00058   GWP_LANDSCAPE,   
00059   GWP_ROUGH_ROCKY, 
00060   GWP_TOWN,        
00061   GWP_INDUSTRY,    
00062   GWP_UNMOVABLE,   
00063   GWP_TREE,        
00064   GWP_GAME_INIT,   
00065   GWP_RUNTILELOOP, 
00066   GWP_GAME_START,  
00067   GWP_CLASS_COUNT
00068 };
00069 
00074 static inline bool IsGeneratingWorld()
00075 {
00076   extern GenWorldInfo _gw;
00077   return _gw.active;
00078 }
00079 
00080 /* genworld.cpp */
00081 bool IsGenerateWorldThreaded();
00082 void GenerateWorldSetCallback(GWDoneProc *proc);
00083 void GenerateWorldSetAbortCallback(GWAbortProc *proc);
00084 void WaitTillGeneratedWorld();
00085 void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
00086 void AbortGeneratingWorld();
00087 bool IsGeneratingWorldAborted();
00088 void HandleGeneratingWorldAbortion();
00089 
00090 /* genworld_gui.cpp */
00091 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total);
00092 void IncreaseGeneratingWorldProgress(GenWorldProgress cls);
00093 void PrepareGenerateWorldProgress();
00094 void ShowGenerateWorldProgress();
00095 void StartNewGameWithoutGUI(uint seed);
00096 void ShowCreateScenario();
00097 void StartScenarioEditor();
00098 
00099 extern class ThreadMutex *_genworld_mapgen_mutex;
00100 extern class ThreadMutex *_genworld_paint_mutex;
00101 
00102 #endif /* GENWORLD_H */

Generated on Sat Jun 5 21:52:04 2010 for OpenTTD by  doxygen 1.6.1