src/openttd.h
author rubidium
Wed, 19 Dec 2007 19:44:29 +0000
changeset 8106 e6790dd9e750
parent 7998 9cf9f9153262
child 8108 b42a0e5c67ef
permissions -rw-r--r--
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
2536
634914d741b4 (svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts.
celestar
parents: 2526
diff changeset
     2
/** @file openttd.h */
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     3
2075
21d2986569d1 (svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents: 2055
diff changeset
     4
#ifndef OPENTTD_H
21d2986569d1 (svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents: 2055
diff changeset
     5
#define OPENTTD_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#ifndef VARDEF
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#define VARDEF extern
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
    11
#include "helpers.hpp"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    13
struct Oblong {
4956
49ecd2a36222 (svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents: 4849
diff changeset
    14
	int x, y;
49ecd2a36222 (svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents: 4849
diff changeset
    15
	int width, height;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    16
};
4956
49ecd2a36222 (svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents: 4849
diff changeset
    17
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    18
struct BoundingRect {
4609
954fe701062f (svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents: 4554
diff changeset
    19
	int width;
954fe701062f (svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents: 4554
diff changeset
    20
	int height;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    21
};
4609
954fe701062f (svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents: 4554
diff changeset
    22
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    23
struct Pair {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
	int a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
	int b;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    26
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2153
diff changeset
    28
#include "map.h"
3636
a36cc46e754d (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3529
diff changeset
    29
#include "slope.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
// Forward declarations of structs.
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    32
struct Vehicle;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    33
struct Depot;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    34
struct Waypoint;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    35
struct Station;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    36
struct ViewPort;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    37
struct Town;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    38
struct NewsItem;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    39
struct Industry;
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    40
struct DrawPixelInfo;
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6591
diff changeset
    41
struct Group;
4401
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    42
typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    43
typedef byte CargoID;
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    44
typedef byte LandscapeID;
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    45
typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    46
struct PalSpriteID {
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5587
diff changeset
    47
	SpriteID sprite;
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5587
diff changeset
    48
	SpriteID pal;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
    49
};
4401
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    50
typedef uint16 EngineID;
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    51
typedef uint16 UnitID;
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    52
typedef uint16 StringID;
7393
f3d27c82fec3 (svn r10762) -Codechange: Change enum StringIDEnum { to static const StringID = for
peter1138
parents: 7335
diff changeset
    53
static const StringID INVALID_STRING_ID = 0xFFFF;
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
    54
5187
12dc9dfa6af6 (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents: 5108
diff changeset
    55
typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp)
4401
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    56
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    57
/* IDs used in Pools */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
typedef uint16 VehicleID;
3347
0ddacd451b81 (svn r4131) - CodeChange: Add proper semantics for StationID for such variables instead of using the general uint16-type. StationID was added for depots, waypoints and stations where necessary. We probably need to change GetDepot(), IsDepotIndex(), IsStationIndex(), GetWaypoint() and IsWaypointIndex() as well to use StationID.
Darkvater
parents: 3346
diff changeset
    59
typedef uint16 StationID;
7010
6f0d9f03180d (svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents: 7002
diff changeset
    60
static const StationID INVALID_STATION = 0xFFFF;
4397
4160539a3062 (svn r6150) -Codechange: introduced and used RoadStopID where needed
truelight
parents: 4394
diff changeset
    61
typedef uint16 RoadStopID;
3346
a0d4def7d934 (svn r4130) - CodeChange: Add proper semantics for TownID for such variables instead of using the general uint16-type. We probably need to change GetTown() and IsTownIndex() as well to use TownID.
Darkvater
parents: 3344
diff changeset
    62
typedef uint16 TownID;
4330
cf31daa8b321 (svn r6005) -Cleanup: introduce IndustryID and use it
rubidium
parents: 4326
diff changeset
    63
typedef uint16 IndustryID;
4388
c8a66d26e146 (svn r6141) -Codechange: introduced DepotID and used it as much as possible
truelight
parents: 4349
diff changeset
    64
typedef uint16 DepotID;
4389
18d6ccfb5335 (svn r6142) -Codechange: added WaypointID (sorry DV, couldn't splits it anymore)
truelight
parents: 4388
diff changeset
    65
typedef uint16 WaypointID;
4392
68ca7ef4f600 (svn r6145) -Codechange: added OrderID to indicate Order indexes out of the pool
truelight
parents: 4391
diff changeset
    66
typedef uint16 OrderID;
4401
ca197fcb332b (svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents: 4397
diff changeset
    67
typedef uint16 SignID;
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6591
diff changeset
    68
typedef uint16 GroupID;
4348
d9ddb0558a48 (svn r6049) -Codechange: forgot EngineRenew in r6047
truelight
parents: 4344
diff changeset
    69
typedef uint16 EngineRenewID;
4527
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    70
typedef uint16 DestinationID;
7763
342e5357b592 (svn r11312) -Codechange: implement a overflow safe integer and use that for money and don't misuses CommandCost to have a overflow safe integer. Based on a patch by Noldo.
rubidium
parents: 7742
diff changeset
    71
342e5357b592 (svn r11312) -Codechange: implement a overflow safe integer and use that for money and don't misuses CommandCost to have a overflow safe integer. Based on a patch by Noldo.
rubidium
parents: 7742
diff changeset
    72
typedef OverflowSafeInt<int64, INT64_MAX, INT64_MIN> OverflowSafeInt64;
342e5357b592 (svn r11312) -Codechange: implement a overflow safe integer and use that for money and don't misuses CommandCost to have a overflow safe integer. Based on a patch by Noldo.
rubidium
parents: 7742
diff changeset
    73
typedef OverflowSafeInt64 Money;
4389
18d6ccfb5335 (svn r6142) -Codechange: added WaypointID (sorry DV, couldn't splits it anymore)
truelight
parents: 4388
diff changeset
    74
4527
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    75
/* DestinationID must be at least as large as every these below, because it can
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    76
 * be any of them
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    77
 */
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    78
assert_compile(sizeof(DestinationID) == sizeof(DepotID));
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    79
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
fa30d19685c2 (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents: 4434
diff changeset
    80
assert_compile(sizeof(DestinationID) == sizeof(StationID));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
4293
4b7006c1b5eb (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 4268
diff changeset
    83
enum {
4b7006c1b5eb (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 4268
diff changeset
    84
	INVALID_YEAR = -1,
4326
2e2c9d21ed96 (svn r5999) -Feature: change the original date format to a 32 bits format based at the year 0.
rubidium
parents: 4323
diff changeset
    85
	INVALID_DATE = -1,
4293
4b7006c1b5eb (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 4268
diff changeset
    86
};
4b7006c1b5eb (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 4268
diff changeset
    87
4326
2e2c9d21ed96 (svn r5999) -Feature: change the original date format to a 32 bits format based at the year 0.
rubidium
parents: 4323
diff changeset
    88
typedef int32 Year;
2e2c9d21ed96 (svn r5999) -Feature: change the original date format to a 32 bits format based at the year 0.
rubidium
parents: 4323
diff changeset
    89
typedef int32 Date;
4261
28670f743746 (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents: 4238
diff changeset
    90
7734
627817106768 (svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents: 7494
diff changeset
    91
typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
enum SwitchModes {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    94
	SM_NONE            =  0,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    95
	SM_NEWGAME         =  1,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    96
	SM_EDITOR          =  2,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    97
	SM_LOAD            =  3,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    98
	SM_MENU            =  4,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
    99
	SM_SAVE            =  5,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   100
	SM_GENRANDLAND     =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   101
	SM_LOAD_SCENARIO   =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   102
	SM_START_SCENARIO  = 10,
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4297
diff changeset
   103
	SM_START_HEIGHTMAP = 11,
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   104
	SM_LOAD_HEIGHTMAP  = 12,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   106
2828
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   107
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   108
/* Modes for GenerateWorld */
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   109
enum GenerateWorldModes {
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4297
diff changeset
   110
	GW_NEWGAME   = 0,    /* Generate a map for a new game */
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4297
diff changeset
   111
	GW_EMPTY     = 1,    /* Generate an empty map (sea-level) */
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4297
diff changeset
   112
	GW_RANDOM    = 2,    /* Generate a random map for SE */
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4297
diff changeset
   113
	GW_HEIGHTMAP = 3,    /* Generate a newgame from a heightmap */
2828
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   114
};
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   115
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   116
/* Modes for InitializeGame, those are _bits_! */
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   117
enum InitializeGameModes {
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   118
	IG_NONE       = 0,  /* Don't do anything special */
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   119
	IG_DATE_RESET = 1,  /* Reset the date when initializing a game */
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   120
};
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   121
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   122
enum Owner {
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   123
	PLAYER_INACTIVE_CLIENT = 253,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   124
	PLAYER_NEW_COMPANY = 254,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   125
	PLAYER_SPECTATOR = 255,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   126
	OWNER_BEGIN     = 0x00,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   127
	PLAYER_FIRST    = 0x00,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   128
	MAX_PLAYERS     = 8,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   129
	OWNER_TOWN      = 0x0F, // a town owns the tile
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   130
	OWNER_NONE      = 0x10, // nobody owns the tile
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   131
	OWNER_WATER     = 0x11, // "water" owns the tile
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   132
	OWNER_END       = 0x12,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   133
	INVALID_OWNER   = 0xFF,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   134
	INVALID_PLAYER  = 0xFF,
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   135
	/* Player identifiers All players below MAX_PLAYERS are playable
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   136
	* players, above, they are special, computer controlled players */
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   137
};
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   138
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   139
typedef Owner PlayerID;
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   140
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   141
DECLARE_POSTFIX_INCREMENT(Owner);
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   142
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   143
/** Define basic enum properties */
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   144
template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   145
typedef TinyEnumT<Owner> OwnerByte;
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   146
typedef OwnerByte PlayerByte;
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   147
2828
342f02f7c0d4 (svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents: 2794
diff changeset
   148
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   149
enum TransportType {
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   150
	/* These constants are for now linked to the representation of bridges
3333
5feb21487332 (svn r4111) Fix/Remove some stale comments
tron
parents: 3173
diff changeset
   151
	 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
5feb21487332 (svn r4111) Fix/Remove some stale comments
tron
parents: 3173
diff changeset
   152
	 * In an ideal world, these constants would be used everywhere when
5feb21487332 (svn r4111) Fix/Remove some stale comments
tron
parents: 3173
diff changeset
   153
	 * accessing tunnels and bridges. For now, you should just not change
5feb21487332 (svn r4111) Fix/Remove some stale comments
tron
parents: 3173
diff changeset
   154
	 * the values for road and rail.
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   155
	 */
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   156
	TRANSPORT_BEGIN = 0,
3017
a75caf4efa2d (svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents: 2828
diff changeset
   157
	TRANSPORT_RAIL = 0,
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   158
	TRANSPORT_ROAD = 1,
4434
a08cb4b5c179 (svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents: 4401
diff changeset
   159
	TRANSPORT_WATER, // = 2
1967
a01f4d5dd957 (svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
matthijs
parents: 1932
diff changeset
   160
	TRANSPORT_END,
a01f4d5dd957 (svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
matthijs
parents: 1932
diff changeset
   161
	INVALID_TRANSPORT = 0xff,
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   162
};
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   163
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   164
/** Define basic enum properties */
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   165
template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   166
typedef TinyEnumT<TransportType> TransportTypeByte;
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   167
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
   168
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   169
struct TileInfo {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
	uint x;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
	uint y;
3636
a36cc46e754d (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3529
diff changeset
   172
	Slope tileh;
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   173
	TileIndex tile;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
	uint z;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   175
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
/* Display Options */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
enum {
6591
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   180
	DO_SHOW_TOWN_NAMES    = 0,
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   181
	DO_SHOW_STATION_NAMES = 1,
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   182
	DO_SHOW_SIGNS         = 2,
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   183
	DO_FULL_ANIMATION     = 3,
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   184
	DO_FULL_DETAIL        = 5,
514c1a22e10e (svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents: 6577
diff changeset
   185
	DO_WAYPOINTS          = 6,
6427
7dc1012757d8 (svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents: 6357
diff changeset
   186
};
7dc1012757d8 (svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents: 6357
diff changeset
   187
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
/* Landscape types */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
enum {
6357
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   190
	LT_TEMPERATE  = 0,
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   191
	LT_ARCTIC     = 1,
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   192
	LT_TROPIC     = 2,
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   193
	LT_TOYLAND    = 3,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
	NUM_LANDSCAPE = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
6571
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   198
/**
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   199
 * Town Layouts
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   200
 */
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   201
enum TownLayout {
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   202
	TL_NO_ROADS     = 0, ///< Build no more roads, but still build houses
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   203
	TL_ORIGINAL,         ///< Original algorithm (min. 1 distance between roads)
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   204
	TL_BETTER_ROADS,     ///< Extended original algorithm (min. 2 distance between roads)
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   205
	TL_2X2_GRID,         ///< Geometric 2x2 grid algorithm
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   206
	TL_3X3_GRID,         ///< Geometric 3x3 grid algorithm
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   207
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   208
	NUM_TLS,             ///< Number of town layouts
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   209
};
6a8a1d0835d9 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents: 6562
diff changeset
   210
6577
03c98094f41c (svn r9791) -Fix (r9779, FS#766): add TownLayoutByte to correctly save town layout value
glx
parents: 6571
diff changeset
   211
/* It needs to be 8bits, because we save and load it as such */
03c98094f41c (svn r9791) -Fix (r9779, FS#766): add TownLayoutByte to correctly save town layout value
glx
parents: 6571
diff changeset
   212
/** Define basic enum properties */
03c98094f41c (svn r9791) -Fix (r9779, FS#766): add TownLayoutByte to correctly save town layout value
glx
parents: 6571
diff changeset
   213
template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_NO_ROADS, NUM_TLS, NUM_TLS> {};
03c98094f41c (svn r9791) -Fix (r9779, FS#766): add TownLayoutByte to correctly save town layout value
glx
parents: 6571
diff changeset
   214
typedef TinyEnumT<TownLayout> TownLayoutByte; //typedefing-enumification of TownLayout
03c98094f41c (svn r9791) -Fix (r9779, FS#766): add TownLayoutByte to correctly save town layout value
glx
parents: 6571
diff changeset
   215
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
	NUM_PRICES = 49,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   218
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   220
struct Prices {
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   221
	Money station_value;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   222
	Money build_rail;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   223
	Money build_road;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   224
	Money build_signals;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   225
	Money build_bridge;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   226
	Money build_train_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   227
	Money build_road_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   228
	Money build_ship_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   229
	Money build_tunnel;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   230
	Money train_station_track;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   231
	Money train_station_length;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   232
	Money build_airport;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   233
	Money build_bus_station;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   234
	Money build_truck_station;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   235
	Money build_dock;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   236
	Money build_railvehicle;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   237
	Money build_railwagon;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   238
	Money aircraft_base;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   239
	Money roadveh_base;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   240
	Money ship_base;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   241
	Money build_trees;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   242
	Money terraform;
7977
4a4e11757be5 (svn r11533) -Codechange: Rename some unclear clear_x prices member names.
belugas
parents: 7849
diff changeset
   243
	Money clear_grass;
4a4e11757be5 (svn r11533) -Codechange: Rename some unclear clear_x prices member names.
belugas
parents: 7849
diff changeset
   244
	Money clear_roughland;
4a4e11757be5 (svn r11533) -Codechange: Rename some unclear clear_x prices member names.
belugas
parents: 7849
diff changeset
   245
	Money clear_rocks;
4a4e11757be5 (svn r11533) -Codechange: Rename some unclear clear_x prices member names.
belugas
parents: 7849
diff changeset
   246
	Money clear_fields;
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   247
	Money remove_trees;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   248
	Money remove_rail;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   249
	Money remove_signals;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   250
	Money clear_bridge;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   251
	Money remove_train_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   252
	Money remove_road_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   253
	Money remove_ship_depot;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   254
	Money clear_tunnel;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   255
	Money clear_water;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   256
	Money remove_rail_station;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   257
	Money remove_airport;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   258
	Money remove_bus_station;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   259
	Money remove_truck_station;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   260
	Money remove_dock;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   261
	Money remove_house;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   262
	Money remove_road;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   263
	Money running_rail[3];
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   264
	Money aircraft_running;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   265
	Money roadveh_running;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   266
	Money ship_running;
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   267
	Money build_industry;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   268
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   270
#define GAME_DIFFICULTY_NUM 18
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
7742
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   272
/** Specific type for Game Difficulty to ease changing the type */
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   273
typedef uint16 GDType;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   274
struct GameDifficulty {
7742
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   275
	GDType max_no_competitors;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   276
	GDType competitor_start_time;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   277
	GDType number_towns;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   278
	GDType number_industries;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   279
	GDType max_loan;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   280
	GDType initial_interest;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   281
	GDType vehicle_costs;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   282
	GDType competitor_speed;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   283
	GDType competitor_intelligence; // no longer in use
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   284
	GDType vehicle_breakdowns;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   285
	GDType subsidy_multiplier;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   286
	GDType construction_cost;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   287
	GDType terrain_type;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   288
	GDType quantity_sea_lakes;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   289
	GDType economy;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   290
	GDType line_reverse_mode;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   291
	GDType disasters;
ddea89a86f80 (svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents: 7734
diff changeset
   292
	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   293
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   294
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   295
enum {
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   296
	// Temperate
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   297
	CT_PASSENGERS   =  0,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   298
	CT_COAL         =  1,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   299
	CT_MAIL         =  2,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   300
	CT_OIL          =  3,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   301
	CT_LIVESTOCK    =  4,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   302
	CT_GOODS        =  5,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   303
	CT_GRAIN        =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   304
	CT_WOOD         =  7,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   305
	CT_IRON_ORE     =  8,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   306
	CT_STEEL        =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   307
	CT_VALUABLES    = 10,
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   308
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   309
	// Arctic
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   310
	CT_WHEAT        =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   311
	CT_HILLY_UNUSED =  8,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   312
	CT_PAPER        =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   313
	CT_GOLD         = 10,
6480
277af7b07386 (svn r9658) -Codechange: CT_FOOD is not part of temperate climate, place it accordingly in arctic.
belugas
parents: 6463
diff changeset
   314
	CT_FOOD         = 11,
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   315
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   316
	// Tropic
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   317
	CT_RUBBER       =  1,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   318
	CT_FRUIT        =  4,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   319
	CT_MAIZE        =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   320
	CT_COPPER_ORE   =  8,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   321
	CT_WATER        =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   322
	CT_DIAMONDS     = 10,
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   323
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   324
	// Toyland
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   325
	CT_SUGAR        =  1,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   326
	CT_TOYS         =  3,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   327
	CT_BATTERIES    =  4,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   328
	CT_CANDY        =  5,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   329
	CT_TOFFEE       =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   330
	CT_COLA         =  7,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   331
	CT_COTTON_CANDY =  8,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   332
	CT_BUBBLES      =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   333
	CT_PLASTIC      = 10,
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   334
	CT_FIZZY_DRINKS = 11,
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   335
6463
e986fe39dfe7 (svn r9638) -Feature: Increase cargo types from 12 to 32 and enable newcargo flag in NewGRF loader.
peter1138
parents: 6427
diff changeset
   336
	NUM_CARGO       = 32,
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 988
diff changeset
   337
4554
8342a6d0a366 (svn r6393) -Fix: [autoreplace] now refit costs are added to the estimated costs (could spend more than allowed when estimate and actual cost were not the same)
bjarni
parents: 4527
diff changeset
   338
	CT_NO_REFIT     = 0xFE,
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   339
	CT_INVALID      = 0xFF
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   340
};
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   341
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 395
diff changeset
   342
typedef uint AcceptedCargo[NUM_CARGO];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   344
struct TileDesc {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   345
	StringID str;
4849
1c6f21eb97f2 (svn r6775) -Codechange: Use some more proper types, especially Owner and PlayerID as
Darkvater
parents: 4659
diff changeset
   346
	Owner owner;
4297
d0311b62255c (svn r5934) -Cleanup: forgot some conversions to Year and to Date
rubidium
parents: 4293
diff changeset
   347
	Date build_date;
7002
1bf6a62b0fcb (svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents: 6998
diff changeset
   348
	uint64 dparam[2];
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   349
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   350
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   351
struct ViewportSign {
849
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   352
	int32 left;
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   353
	int32 top;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
	byte width_1, width_2;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   355
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   357
/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   358
 * Common return value for all commands. Wraps the cost and
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   359
 * a possible error message/state together.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   360
 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   361
class CommandCost {
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   362
	Money cost;       ///< The cost of this action
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   363
	StringID message; ///< Warning message for when success is unset
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   364
	bool success;     ///< Whether the comment went fine up to this moment
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   365
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   366
public:
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   367
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   368
	 * Creates a command cost return with no cost and no error
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   369
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   370
	CommandCost() : cost(0), message(INVALID_STRING_ID), success(true) {}
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   371
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   372
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   373
	 * Creates a command return value the is failed with the given message
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   374
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   375
	CommandCost(StringID msg) : cost(0), message(msg), success(false) {}
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   376
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   377
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   378
	 * Creates a command return value with the given start cost
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   379
	 * @param cst the initial cost of this command
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   380
	 */
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   381
	CommandCost(Money cst) : cost(cst), message(INVALID_STRING_ID), success(true) {}
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   382
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   383
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   384
	 * Adds the cost of the given command return value to this cost.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   385
	 * Also takes a possible error message when it is set.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   386
	 * @param ret the command to add the cost of.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   387
	 * @return this class.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   388
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   389
	CommandCost AddCost(CommandCost ret);
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   390
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   391
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   392
	 * Adds the given cost to the cost of the command.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   393
	 * @param cost the cost to add
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   394
	 * @return this class.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   395
	 */
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   396
	CommandCost AddCost(Money cost);
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   397
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   398
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   399
	 * Multiplies the cost of the command by the given factor.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   400
	 * @param cost factor to multiply the costs with
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   401
	 * @return this class
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   402
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   403
	CommandCost MultiplyCost(int factor);
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   404
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   405
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   406
	 * The costs as made up to this moment
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   407
	 * @return the costs
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   408
	 */
6953
230d1e3ac86c (svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents: 6950
diff changeset
   409
	Money GetCost() const;
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   410
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   411
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   412
	 * Sets the global error message *if* this class has one.
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   413
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   414
	void SetGlobalErrorMessage() const;
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   415
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   416
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   417
	 * Did this command succeed?
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   418
	 * @return true if and only if it succeeded
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   419
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   420
	bool Succeeded() const;
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   421
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   422
	/**
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   423
	 * Did this command fail?
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   424
	 * @return true if and only if it failed
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   425
	 */
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   426
	bool Failed() const;
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   427
};
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   428
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   429
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   430
typedef void DrawTileProc(TileInfo *ti);
4231
2823b3643862 (svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents: 4143
diff changeset
   431
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
6950
14ecb0acdfb4 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 6943
diff changeset
   432
typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   433
typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   434
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
6683
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   435
/**
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   436
 * GetTileTrackStatusProcs return a value that contains the possible tracks
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   437
 * that can be taken on a given tile by a given transport. The return value is
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   438
 * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs,
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   439
 * where bit n corresponds to trackdir n. ccdd are the trackdirs that are
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   440
 * present in the tile (1==present, 0==not present), aabb is the signal
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   441
 * status, if applicable (0==green/no signal, 1==red, note that this is
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   442
 * reversed from map3/2[tile] for railway signals).
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   443
 *
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   444
 * The result (let's call it ts) is often used as follows:
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   445
 * tracks = (byte)(ts | ts >>8)
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   446
 * This effectively converts the present part of the result (ccdd) to a
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   447
 * track bitmask, which disregards directions. Normally, this is the same as just
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 168
diff changeset
   448
 * doing (byte)ts I think, although I am not really sure
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   449
 *
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   450
 * A trackdir is combination of a track and a dir, where the lower three bits
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   451
 * are a track, the fourth bit is the direction. these give 12 (or 14)
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   452
 * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 168
diff changeset
   453
 * above.
6683
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   454
 * @param tile     the tile to get the track status from
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   455
 * @param mode     the mode of transportation
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   456
 * @param sub_mode used to differentiate between different kinds within the mode
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   457
 * @return the above mentions track status information
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
   458
 */
6683
b88ae30866ce (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6643
diff changeset
   459
typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode);
3344
fc86351d4641 (svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents: 3333
diff changeset
   460
typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   461
typedef void ClickTileProc(TileIndex tile);
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   462
typedef void AnimateTileProc(TileIndex tile);
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   463
typedef void TileLoopProc(TileIndex tile);
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2431
diff changeset
   464
typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
5991
ec2eebfe86de (svn r8698) -Codechange: enumify the returns of VehicleEnterTile
rubidium
parents: 5893
diff changeset
   465
/** @see VehicleEnterTileStatus to see what the return values mean */
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   466
typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7138
diff changeset
   467
typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
7494
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   468
/**
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   469
 * Called when a tile is affected by a terraforming operation.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   470
 * The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   471
 * With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   472
 *
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   473
 * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   474
 *
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   475
 * @param tile      The involved tile.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   476
 * @param flags     Command flags passed to the terraform command (DC_EXEC, DC_QUERY_COST, etc.).
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   477
 * @param z_new     TileZ after terraforming.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   478
 * @param tileh_new Slope after terraforming.
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   479
 * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   480
 */
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   481
typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   482
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   483
struct TileTypeProcs {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   484
	DrawTileProc *draw_tile_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   485
	GetSlopeZProc *get_slope_z_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   486
	ClearTileProc *clear_tile_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   487
	GetAcceptedCargoProc *get_accepted_cargo_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   488
	GetTileDescProc *get_tile_desc_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   489
	GetTileTrackStatusProc *get_tile_track_status_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   490
	ClickTileProc *click_tile_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   491
	AnimateTileProc *animate_tile_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   492
	TileLoopProc *tile_loop_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   493
	ChangeTileOwnerProc *change_tile_owner_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   494
	GetProducedCargoProc *get_produced_cargo_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   495
	VehicleEnterTileProc *vehicle_enter_tile_proc;
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 7138
diff changeset
   496
	GetFoundationProc *get_foundation_proc;
7494
ab05bad37410 (svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
rubidium
parents: 7393
diff changeset
   497
	TerraformTileProc *terraform_tile_proc;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   498
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   499
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   500
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   501
6562
077afce9a4ee (svn r9764) -Codechange: replace some lookup tables by functions.
rubidium
parents: 6480
diff changeset
   502
enum ExpensesType {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   503
	EXPENSES_CONSTRUCTION =  0,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   504
	EXPENSES_NEW_VEHICLES =  1,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   505
	EXPENSES_TRAIN_RUN    =  2,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   506
	EXPENSES_ROADVEH_RUN  =  3,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   507
	EXPENSES_AIRCRAFT_RUN =  4,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   508
	EXPENSES_SHIP_RUN     =  5,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   509
	EXPENSES_PROPERTY     =  6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   510
	EXPENSES_TRAIN_INC    =  7,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   511
	EXPENSES_ROADVEH_INC  =  8,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   512
	EXPENSES_AIRCRAFT_INC =  9,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   513
	EXPENSES_SHIP_INC     = 10,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   514
	EXPENSES_LOAN_INT     = 11,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   515
	EXPENSES_OTHER        = 12,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   516
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   517
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   518
enum {
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   519
	MAX_LANG = 64,
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   520
};
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   521
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   522
// special string constants
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   523
enum SpecialStrings {
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 168
diff changeset
   524
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   525
	// special strings for town names. the town name is generated dynamically on request.
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   526
	SPECSTR_TOWNNAME_START     = 0x20C0,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   527
	SPECSTR_TOWNNAME_ENGLISH   = SPECSTR_TOWNNAME_START,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   528
	SPECSTR_TOWNNAME_FRENCH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   529
	SPECSTR_TOWNNAME_GERMAN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   530
	SPECSTR_TOWNNAME_AMERICAN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   531
	SPECSTR_TOWNNAME_LATIN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   532
	SPECSTR_TOWNNAME_SILLY,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   533
	SPECSTR_TOWNNAME_SWEDISH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   534
	SPECSTR_TOWNNAME_DUTCH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   535
	SPECSTR_TOWNNAME_FINNISH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   536
	SPECSTR_TOWNNAME_POLISH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   537
	SPECSTR_TOWNNAME_SLOVAKISH,
948
02a654572ceb (svn r1438) Added norwegian townnames
miham
parents: 925
diff changeset
   538
	SPECSTR_TOWNNAME_NORWEGIAN,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   539
	SPECSTR_TOWNNAME_HUNGARIAN,
265
621017a720d1 (svn r271) another town name confusion fix
dominik
parents: 241
diff changeset
   540
	SPECSTR_TOWNNAME_AUSTRIAN,
621017a720d1 (svn r271) another town name confusion fix
dominik
parents: 241
diff changeset
   541
	SPECSTR_TOWNNAME_ROMANIAN,
621017a720d1 (svn r271) another town name confusion fix
dominik
parents: 241
diff changeset
   542
	SPECSTR_TOWNNAME_CZECH,
1030
24c0b0000bf0 (svn r1531) -Feature: [1039061] Swiss town-names (vulvulune)
darkvater
parents: 1004
diff changeset
   543
	SPECSTR_TOWNNAME_SWISS,
2431
447292e83ab3 (svn r2957) - Feature: [ 1263280 ] Danish town names (fey_dk)
Darkvater
parents: 2395
diff changeset
   544
	SPECSTR_TOWNNAME_DANISH,
3698
2f256fe23db9 (svn r4639) -Feature: Turkish town names (jnmbk)
celestar
parents: 3657
diff changeset
   545
	SPECSTR_TOWNNAME_TURKISH,
4143
b7535e12f27b (svn r5504) Feature : Added Italian town name generator. (sidew)
belugas
parents: 3825
diff changeset
   546
	SPECSTR_TOWNNAME_ITALIAN,
4312
9ac0363f38f5 (svn r5965) -Feature: FS#261 Catalan Town Names generator (arnau)
bjarni
parents: 4300
diff changeset
   547
	SPECSTR_TOWNNAME_CATALAN,
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   548
	SPECSTR_TOWNNAME_LAST      = SPECSTR_TOWNNAME_CATALAN,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   549
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   550
	// special strings for player names on the form "TownName transport".
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   551
	SPECSTR_PLAYERNAME_START   = 0x70EA,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   552
	SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   553
	SPECSTR_PLAYERNAME_FRENCH,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   554
	SPECSTR_PLAYERNAME_GERMAN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   555
	SPECSTR_PLAYERNAME_AMERICAN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   556
	SPECSTR_PLAYERNAME_LATIN,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   557
	SPECSTR_PLAYERNAME_SILLY,
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   558
	SPECSTR_PLAYERNAME_LAST    = SPECSTR_PLAYERNAME_SILLY,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   559
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   560
	SPECSTR_ANDCO_NAME         = 0x70E6,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   561
	SPECSTR_PRESIDENT_NAME     = 0x70E7,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   562
	SPECSTR_SONGNAME           = 0x70E8,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   563
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   564
	// reserve MAX_LANG strings for the *.lng files
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   565
	SPECSTR_LANGUAGE_START     = 0x7100,
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   566
	SPECSTR_LANGUAGE_END       = SPECSTR_LANGUAGE_START + MAX_LANG - 1,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   568
	// reserve 32 strings for various screen resolutions
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   569
	SPECSTR_RESOLUTION_START   = SPECSTR_LANGUAGE_END + 1,
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   570
	SPECSTR_RESOLUTION_END     = SPECSTR_RESOLUTION_START + 0x1F,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   571
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   572
	// reserve 32 strings for screenshot formats
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   573
	SPECSTR_SCREENSHOT_START   = SPECSTR_RESOLUTION_END + 1,
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4956
diff changeset
   574
	SPECSTR_SCREENSHOT_END     = SPECSTR_SCREENSHOT_START + 0x1F,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   575
2055
4926ed1a7562 (svn r2564) Fix: Fixed conceptual issue in network_gui.c. AllocateName is not meant to be used by GUI-code, because it modifies the "game-state".
ludde
parents: 1977
diff changeset
   576
	// Used to implement SetDParamStr
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   577
	STR_SPEC_DYNSTRING         = 0xF800,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   578
	STR_SPEC_USERSTRING        = 0xF808,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   579
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   580
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1967
diff changeset
   581
typedef void PlaceProc(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   582
2526
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   583
enum {
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   584
	SORT_ASCENDING  = 0,
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   585
	SORT_DESCENDING = 1,
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   586
	SORT_BY_DATE    = 0,
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   587
	SORT_BY_NAME    = 2
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   588
};
29eef390cabb (svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents: 2436
diff changeset
   589
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   590
VARDEF byte _savegame_sort_order;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   591
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   592
enum {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   593
	MAX_SCREEN_WIDTH  = 2048,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   594
	MAX_SCREEN_HEIGHT = 1200,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   595
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   596
1397
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   597
/* In certain windows you navigate with the arrow keys. Do not scroll the
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   598
 * gameview when here. Bitencoded variable that only allows scrolling if all
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   599
 * elements are zero */
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   600
enum {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4330
diff changeset
   601
	SCROLL_CON  = 0,
1397
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   602
	SCROLL_EDIT = 1,
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   603
	SCROLL_SAVE = 2,
1843
8e2628948b01 (svn r2348) - Fix: Do not scroll the game with the arrow keys when the chatbox is open
Darkvater
parents: 1802
diff changeset
   604
	SCROLL_CHAT = 4,
1397
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   605
};
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   606
VARDEF byte _no_scroll;
fa8539dcab46 (svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents: 1363
diff changeset
   607
2380
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   608
/** To have a concurrently running thread interface with the main program, use
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   609
 * the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   610
 * in the ProcessSentMessage() function */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   611
enum ThreadMsg {
4323
ae32c5fab67b (svn r5977) -Fix [FS#78]: never set I-am-a-thread bool to true IN the thread. Machines with
truelight
parents: 4312
diff changeset
   612
	MSG_OTTD_NO_MESSAGE,
ae32c5fab67b (svn r5977) -Fix [FS#78]: never set I-am-a-thread bool to true IN the thread. Machines with
truelight
parents: 4312
diff changeset
   613
	MSG_OTTD_SAVETHREAD_DONE,
ae32c5fab67b (svn r5977) -Fix [FS#78]: never set I-am-a-thread bool to true IN the thread. Machines with
truelight
parents: 4312
diff changeset
   614
	MSG_OTTD_SAVETHREAD_ERROR,
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5991
diff changeset
   615
};
2380
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   616
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   617
void OTTD_SendThreadMessage(ThreadMsg msg);
392bba57462d (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2254
diff changeset
   618
2075
21d2986569d1 (svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents: 2055
diff changeset
   619
#endif /* OPENTTD_H */