~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/water_map.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: water_map.h 12070 2008-02-06 15:32:06Z frosch $ */
 
1
/* $Id: water_map.h 15643 2009-03-08 16:10:39Z smatz $ */
2
2
 
3
 
/** @file water_map.h */
 
3
/** @file water_map.h Map accessors for water tiles. */
4
4
 
5
5
#ifndef WATER_MAP_H
6
6
#define WATER_MAP_H
16
16
        WATER_CLASS_SEA,
17
17
        WATER_CLASS_CANAL,
18
18
        WATER_CLASS_RIVER,
 
19
        WATER_CLASS_INVALID, ///< Used for industry tiles on land (also for oilrig if newgrf says so)
19
20
};
20
21
 
21
22
enum DepotPart {
45
46
 
46
47
static inline WaterClass GetWaterClass(TileIndex t)
47
48
{
48
 
        assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION));
49
 
        return (WaterClass)GB(_m[t].m3, 0, 2);
 
49
        assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY));
 
50
        return (WaterClass)(IsTileType(t, MP_INDUSTRY) ? GB(_m[t].m1, 5, 2) : GB(_m[t].m3, 0, 2));
50
51
}
51
52
 
52
53
static inline void SetWaterClass(TileIndex t, WaterClass wc)
53
54
{
54
 
        assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION));
55
 
        SB(_m[t].m3, 0, 2, wc);
 
55
        assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY));
 
56
        if (IsTileType(t, MP_INDUSTRY)) {
 
57
                SB(_m[t].m1, 5, 2, wc);
 
58
        } else {
 
59
                SB(_m[t].m3, 0, 2, wc);
 
60
        }
56
61
}
57
62
 
58
63
/** IsWater return true if any type of clear water like ocean, river, canal */
91
96
        return t + (HasBit(_m[t].m5, 0) ? -1 : 1) * (HasBit(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
92
97
}
93
98
 
94
 
static inline TileIndex IsShipDepot(TileIndex t)
 
99
static inline bool IsShipDepot(TileIndex t)
95
100
{
96
101
        return IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END);
97
102
}
98
103
 
 
104
static inline bool IsShipDepotTile(TileIndex t)
 
105
{
 
106
        return IsTileType(t, MP_WATER) && IsShipDepot(t);
 
107
}
 
108
 
99
109
static inline Axis GetShipDepotAxis(TileIndex t)
100
110
{
101
111
        return (Axis)GB(_m[t].m5, 1, 1);
136
146
        _m[t].m3 = WATER_CLASS_SEA;
137
147
        _m[t].m4 = 0;
138
148
        _m[t].m5 = 0;
 
149
        SB(_m[t].m6, 2, 4, 0);
 
150
        _me[t].m7 = 0;
139
151
}
140
152
 
141
153
static inline void MakeShore(TileIndex t)
146
158
        _m[t].m3 = 0;
147
159
        _m[t].m4 = 0;
148
160
        _m[t].m5 = 1;
 
161
        SB(_m[t].m6, 2, 4, 0);
 
162
        _me[t].m7 = 0;
149
163
}
150
164
 
151
165
static inline void MakeRiver(TileIndex t, uint8 random_bits)
156
170
        _m[t].m3 = WATER_CLASS_RIVER;
157
171
        _m[t].m4 = random_bits;
158
172
        _m[t].m5 = 0;
 
173
        SB(_m[t].m6, 2, 4, 0);
 
174
        _me[t].m7 = 0;
159
175
}
160
176
 
161
177
static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
167
183
        _m[t].m3 = WATER_CLASS_CANAL;
168
184
        _m[t].m4 = random_bits;
169
185
        _m[t].m5 = 0;
 
186
        SB(_m[t].m6, 2, 4, 0);
 
187
        _me[t].m7 = 0;
170
188
}
171
189
 
172
190
static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a, WaterClass original_water_class)
177
195
        _m[t].m3 = original_water_class;
178
196
        _m[t].m4 = 0;
179
197
        _m[t].m5 = base + a * 2;
 
198
        SB(_m[t].m6, 2, 4, 0);
 
199
        _me[t].m7 = 0;
180
200
}
181
201
 
182
202
static inline void MakeLockTile(TileIndex t, Owner o, byte section, WaterClass original_water_class)
187
207
        _m[t].m3 = original_water_class;
188
208
        _m[t].m4 = 0;
189
209
        _m[t].m5 = section;
 
210
        SB(_m[t].m6, 2, 4, 0);
 
211
        _me[t].m7 = 0;
190
212
}
191
213
 
192
214
static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper)