src/bridge.h
author celestar
Tue, 19 Jun 2007 07:21:01 +0000
branchgamebalance
changeset 9913 e79cd19772dd
parent 9895 7bd07f43b0e3
child 6743 cabfaa4a0295
child 7814 fe643468ad64
permissions -rw-r--r--
(svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
2268
a28a946df64f (svn r2788) Fix Id tag
tron
parents: 2263
diff changeset
     1
/* $Id$ */
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     2
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     3
/** @file bridge.h Header file for bridges */
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     4
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     5
#ifndef BRIDGE_H
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     6
#define BRIDGE_H
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
     7
3359
d4316b1af327 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
     8
enum {
d4316b1af327 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
     9
	MAX_BRIDGES = 13
d4316b1af327 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
    10
};
d4316b1af327 (svn r4154) -Moved MAX_BRIDGES in bridge.h and made it an enum. This makes two drops ...
celestar
parents: 3355
diff changeset
    11
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    12
/** Struct containing information about a single bridge type
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    13
 */
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6486
diff changeset
    14
struct Bridge {
4293
2c24234a7aec (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents: 3977
diff changeset
    15
	Year avail_year;     ///< the year in which the bridge becomes available
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    16
	byte min_length;     ///< the minimum length of the bridge (not counting start and end tile)
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    17
	byte max_length;     ///< the maximum length of the bridge (not counting start and end tile)
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    18
	uint16 price;        ///< the relative price of the bridge
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    19
	uint16 speed;        ///< maximum travel speed
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5726
diff changeset
    20
	SpriteID sprite;     ///< the sprite which is used in the GUI
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5726
diff changeset
    21
	SpriteID pal;        ///< the palette which is used in the GUI
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    22
	StringID material;   ///< the string that contains the bridge description
2478
16b05f1de6bb (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    23
	PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
16b05f1de6bb (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    24
	byte flags;          ///< bit 0 set: disable drawing of far pillars.
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6486
diff changeset
    25
};
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    26
2478
16b05f1de6bb (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data.
peter1138
parents: 2268
diff changeset
    27
extern const Bridge orig_bridge[MAX_BRIDGES];
2763
d579caf58b59 (svn r3308) BAD
tron
parents: 2478
diff changeset
    28
extern Bridge _bridge[MAX_BRIDGES];
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    29
3636
d87b21df2944 (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3359
diff changeset
    30
uint GetBridgeFoundation(Slope tileh, Axis axis);
6467
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    31
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    32
static inline const Bridge *GetBridge(uint i)
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    33
{
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    34
	assert(i < lengthof(_bridge));
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    35
	return &_bridge[i];
6228b576422d (svn r8884) -Fix
tron
parents: 5919
diff changeset
    36
}
3355
a653b8e47f27 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2763
diff changeset
    37
6486
4f8af35b11eb (svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium
parents: 6467
diff changeset
    38
void DrawBridgeMiddle(const TileInfo* ti);
4f8af35b11eb (svn r8908) -Codechange: declaration of DrawBridgeMiddle does not belong in a map accessors header.
rubidium
parents: 6467
diff changeset
    39
2262
bd59b2d8d75f (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc)
celestar
parents:
diff changeset
    40
#endif /* BRIDGE_H */