author | rubidium |
Wed, 09 Jul 2008 19:30:44 +0000 | |
branch | 0.6 |
changeset 11131 | d8136dad6b1c |
parent 8750 | fdd6054e7bae |
child 10172 | f93d3b7df6c8 |
permissions | -rw-r--r-- |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
2 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
3 |
/** @file genworld.h */ |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
4 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
5 |
#ifndef GENWORLD_H |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
6 |
#define GENWORLD_H |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
7 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
8 |
/* If OTTDThread isn't defined, define it to a void, but make sure to undefine |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
9 |
* it after this include. This makes including genworld.h easier, as you |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
10 |
* don't need to include thread.h before it, while it stays possible to |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
11 |
* include it after it, and still work. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
12 |
*/ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
13 |
#ifndef OTTDThread |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
14 |
#define TEMPORARY_OTTDTHREAD_DEFINITION |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
15 |
#define OTTDThread void |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
16 |
#endif |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
17 |
|
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
6574
diff
changeset
|
18 |
#include "player_type.h" |
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
6574
diff
changeset
|
19 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
20 |
/* |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
21 |
* Order of these enums has to be the same as in lang/english.txt |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
22 |
* Otherwise you will get inconsistent behaviour. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
23 |
*/ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
24 |
enum { |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
25 |
LG_ORIGINAL = 0, ///< The original landscape generator |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
26 |
LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
27 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
28 |
GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
29 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
30 |
|
6573 | 31 |
typedef void gw_done_proc(); |
32 |
typedef void gw_abort_proc(); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
33 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
34 |
struct gw_info { |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
35 |
bool active; ///< Is generating world active |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
36 |
bool abort; ///< Whether to abort the thread ASAP |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
37 |
bool wait_for_draw; ///< Are we waiting on a draw event |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
38 |
bool quit_thread; ///< Do we want to quit the active thread |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
39 |
bool threaded; ///< Whether we run _GenerateWorld threaded |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
40 |
int mode; ///< What mode are we making a world in |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
41 |
PlayerID lp; ///< The local_player before generating |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
42 |
uint size_x; ///< X-size of the map |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
43 |
uint size_y; ///< Y-size of the map |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
44 |
gw_done_proc *proc; ///< Proc that is called when done (can be NULL) |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
45 |
gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL) |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
46 |
OTTDThread *thread; ///< The thread we are in (can be NULL) |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
47 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
48 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
49 |
#ifdef TEMPORARY_OTTDTHREAD_DEFINITION |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
50 |
#undef OTTDThread |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
51 |
#undef TEMPORARY_OTTDTHREAD_DEFINITION |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
52 |
#endif |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
53 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
54 |
enum gwp_class { |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
55 |
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
56 |
GWP_LANDSCAPE, ///< Create the landscape |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
57 |
GWP_ROUGH_ROCKY, ///< Make rough and rocky areas |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
58 |
GWP_TOWN, ///< Generate towns |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
59 |
GWP_INDUSTRY, ///< Generate industries |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
60 |
GWP_UNMOVABLE, ///< Generate unmovables (radio tower, light houses) |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
61 |
GWP_TREE, ///< Generate trees |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
62 |
GWP_GAME_INIT, ///< Initialize the game |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
63 |
GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
64 |
GWP_GAME_START, ///< Really prepare to start the game |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
65 |
GWP_CLASS_COUNT |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
66 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
67 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
68 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
69 |
* Check if we are currently in the process of generating a world. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
70 |
*/ |
6573 | 71 |
static inline bool IsGeneratingWorld() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
72 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
73 |
extern gw_info _gw; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
74 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
75 |
return _gw.active; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
76 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
77 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
78 |
/* genworld.cpp */ |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
79 |
void SetGeneratingWorldPaintStatus(bool status); |
6573 | 80 |
bool IsGeneratingWorldReadyForPaint(); |
81 |
bool IsGenerateWorldThreaded(); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
82 |
void GenerateWorldSetCallback(gw_done_proc *proc); |
5145
4c5761bb0176
(svn r7237) -Fix: TGP landscape generation could leak memory if aborted during the generation of the heightmap.
rubidium
parents:
4300
diff
changeset
|
83 |
void GenerateWorldSetAbortCallback(gw_abort_proc *proc); |
6573 | 84 |
void WaitTillGeneratedWorld(); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
85 |
void GenerateWorld(int mode, uint size_x, uint size_y); |
6573 | 86 |
void AbortGeneratingWorld(); |
87 |
bool IsGeneratingWorldAborted(); |
|
88 |
void HandleGeneratingWorldAbortion(); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
89 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6150
diff
changeset
|
90 |
/* genworld_gui.cpp */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
91 |
void SetGeneratingWorldProgress(gwp_class cls, uint total); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
92 |
void IncreaseGeneratingWorldProgress(gwp_class cls); |
6573 | 93 |
void PrepareGenerateWorldProgress(); |
94 |
void ShowGenerateWorldProgress(); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
95 |
void StartNewGameWithoutGUI(uint seed); |
6573 | 96 |
void ShowCreateScenario(); |
97 |
void StartScenarioEditor(); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
98 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
99 |
#endif /* GENWORLD_H */ |