src/water_map.h
author KUDr
Sat, 21 Apr 2007 08:23:57 +0000
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
child 6720 35756db7e577
permissions -rw-r--r--
(svn r9708) [cpp_gui] -Sync with trunk (r9633:9707)
3111
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
     1
/* $Id$ */
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
     2
6307
f40e88cff863 (svn r9639) [cpp_gui] -Sync with trunk (r9476:9633)
KUDr
parents: 6298
diff changeset
     3
/** @file water_map.h */
f40e88cff863 (svn r9639) [cpp_gui] -Sync with trunk (r9476:9633)
KUDr
parents: 6298
diff changeset
     4
3111
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
     5
#ifndef WATER_MAP_H
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
     6
#define WATER_MAP_H
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
     7
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
     8
enum WaterTileType {
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
     9
	WATER_TILE_CLEAR,
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    10
	WATER_TILE_COAST,
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    11
	WATER_TILE_LOCK,
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    12
	WATER_TILE_DEPOT,
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
    13
};
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    14
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
    15
enum DepotPart {
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
    16
	DEPOT_NORTH = 0x80,
3373
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    17
	DEPOT_SOUTH = 0x81,
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    18
	DEPOT_END   = 0x84,
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
    19
};
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
    20
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
    21
enum LockPart {
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
    22
	LOCK_MIDDLE = 0x10,
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
    23
	LOCK_LOWER  = 0x14,
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    24
	LOCK_UPPER  = 0x18,
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    25
	LOCK_END    = 0x1C
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 6285
diff changeset
    26
};
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
    27
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    28
static inline WaterTileType GetWaterTileType(TileIndex t)
3373
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    29
{
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    30
	if (_m[t].m5 == 0) return WATER_TILE_CLEAR;
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    31
	if (_m[t].m5 == 1) return WATER_TILE_COAST;
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    32
	if (IS_INT_INSIDE(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK;
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    33
3424
142ded56d7e7 (svn r4251) -Fix: Silence a warning in GetWaterTileType
celestar
parents: 3423
diff changeset
    34
	assert(IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END));
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    35
	return WATER_TILE_DEPOT;
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    36
}
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    37
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    38
static inline bool IsWater(TileIndex t)
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    39
{
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    40
	return GetWaterTileType(t) == WATER_TILE_CLEAR;
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    41
}
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    42
3423
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    43
static inline bool IsCoast(TileIndex t)
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    44
{
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    45
	return GetWaterTileType(t) == WATER_TILE_COAST;
3423
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    46
}
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    47
3402
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    48
static inline bool IsClearWaterTile(TileIndex t)
0b72e324d300 (svn r4212) -Codechange: Add and make use of an accessor that retrieves the type of a water tile. Add an enum describing the different water tiles
celestar
parents: 3373
diff changeset
    49
{
3636
d87b21df2944 (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3425
diff changeset
    50
	return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT;
3373
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    51
}
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    52
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    53
static inline TileIndex GetOtherShipDepotTile(TileIndex t)
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    54
{
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    55
	return t + (HASBIT(_m[t].m5, 0) ? -1 : 1) * (HASBIT(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    56
}
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    57
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    58
static inline TileIndex IsShipDepot(TileIndex t)
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    59
{
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    60
	return IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END);
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    61
}
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    62
3423
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    63
static inline Axis GetShipDepotAxis(TileIndex t)
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    64
{
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    65
	return (Axis)GB(_m[t].m5, 1, 1);
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    66
}
03e0e97abf41 (svn r4250) -Codechange: Further use of map accessors for water tiles
celestar
parents: 3402
diff changeset
    67
3953
db302c2d1a2a (svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
tron
parents: 3940
diff changeset
    68
static inline DiagDirection GetShipDepotDirection(TileIndex t)
db302c2d1a2a (svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
tron
parents: 3940
diff changeset
    69
{
db302c2d1a2a (svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
tron
parents: 3940
diff changeset
    70
	return XYNSToDiagDir(GetShipDepotAxis(t), GB(_m[t].m5, 0, 1));
db302c2d1a2a (svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
tron
parents: 3940
diff changeset
    71
}
db302c2d1a2a (svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
tron
parents: 3940
diff changeset
    72
3373
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    73
static inline DiagDirection GetLockDirection(TileIndex t)
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    74
{
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    75
	return (DiagDirection)GB(_m[t].m5, 0, 2);
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    76
}
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    77
3425
b972214fde4f (svn r4252) -Codechange: Make more use of map accessors. water_cmd is now map access free
celestar
parents: 3424
diff changeset
    78
static inline byte GetSection(TileIndex t)
b972214fde4f (svn r4252) -Codechange: Make more use of map accessors. water_cmd is now map access free
celestar
parents: 3424
diff changeset
    79
{
6285
187e3ef04cc9 (svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents: 5726
diff changeset
    80
	assert(GetWaterTileType(t) == WATER_TILE_LOCK || GetWaterTileType(t) == WATER_TILE_DEPOT);
3425
b972214fde4f (svn r4252) -Codechange: Make more use of map accessors. water_cmd is now map access free
celestar
parents: 3424
diff changeset
    81
	return GB(_m[t].m5, 0, 4);
b972214fde4f (svn r4252) -Codechange: Make more use of map accessors. water_cmd is now map access free
celestar
parents: 3424
diff changeset
    82
}
b972214fde4f (svn r4252) -Codechange: Make more use of map accessors. water_cmd is now map access free
celestar
parents: 3424
diff changeset
    83
3373
f95cf3549591 (svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
celestar
parents: 3372
diff changeset
    84
3111
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    85
static inline void MakeWater(TileIndex t)
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    86
{
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    87
	SetTileType(t, MP_WATER);
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    88
	SetTileOwner(t, OWNER_WATER);
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    89
	_m[t].m2 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    90
	_m[t].m3 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    91
	_m[t].m4 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    92
	_m[t].m5 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    93
}
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    94
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    95
static inline void MakeShore(TileIndex t)
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    96
{
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    97
	SetTileType(t, MP_WATER);
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    98
	SetTileOwner(t, OWNER_WATER);
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
    99
	_m[t].m2 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
   100
	_m[t].m3 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
   101
	_m[t].m4 = 0;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
   102
	_m[t].m5 = 1;
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
   103
}
1edf71aa942e (svn r3714) Add functions to turn tiles into water and shore tiles
tron
parents:
diff changeset
   104
3940
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   105
static inline void MakeCanal(TileIndex t, Owner o)
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   106
{
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   107
	SetTileType(t, MP_WATER);
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   108
	SetTileOwner(t, o);
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   109
	_m[t].m2 = 0;
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   110
	_m[t].m3 = 0;
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   111
	_m[t].m4 = 0;
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   112
	_m[t].m5 = 0;
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   113
}
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   114
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   115
static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a)
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   116
{
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   117
	SetTileType(t, MP_WATER);
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   118
	SetTileOwner(t, o);
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   119
	_m[t].m2 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   120
	_m[t].m3 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   121
	_m[t].m4 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   122
	_m[t].m5 = base + a * 2;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   123
}
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   124
3940
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   125
static inline void MakeLockTile(TileIndex t, Owner o, byte section)
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   126
{
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   127
	SetTileType(t, MP_WATER);
3940
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   128
	SetTileOwner(t, o);
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   129
	_m[t].m2 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   130
	_m[t].m3 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   131
	_m[t].m4 = 0;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   132
	_m[t].m5 = section;
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   133
}
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   134
3940
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   135
static inline void MakeLock(TileIndex t, Owner o, DiagDirection d)
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   136
{
4559
c853d2440065 (svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents: 3953
diff changeset
   137
	TileIndexDiff delta = TileOffsByDiagDir(d);
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   138
3940
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   139
	MakeLockTile(t, o, LOCK_MIDDLE + d);
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   140
	MakeLockTile(t - delta, o, LOCK_LOWER + d);
f3aa8e2969d4 (svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
peter1138
parents: 3636
diff changeset
   141
	MakeLockTile(t + delta, o, LOCK_UPPER + d);
3372
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   142
}
e9eaf986b264 (svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
celestar
parents: 3111
diff changeset
   143
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4559
diff changeset
   144
#endif /* WATER_MAP_H */