tunnel_map.h

Go to the documentation of this file.
00001 /* $Id: tunnel_map.h 15643 2009-03-08 16:10:39Z smatz $ */
00002 
00005 #ifndef TUNNEL_MAP_H
00006 #define TUNNEL_MAP_H
00007 
00008 #include "direction_func.h"
00009 #include "rail_type.h"
00010 #include "road_type.h"
00011 #include "transport_type.h"
00012 #include "road_map.h"
00013 
00014 
00021 static inline bool IsTunnel(TileIndex t)
00022 {
00023   assert(IsTileType(t, MP_TUNNELBRIDGE));
00024   return !HasBit(_m[t].m5, 7);
00025 }
00026 
00032 static inline bool IsTunnelTile(TileIndex t)
00033 {
00034   return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
00035 }
00036 
00037 TileIndex GetOtherTunnelEnd(TileIndex);
00038 bool IsTunnelInWay(TileIndex, uint z);
00039 bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
00040 
00048 static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r)
00049 {
00050   SetTileType(t, MP_TUNNELBRIDGE);
00051   SetTileOwner(t, o);
00052   _m[t].m2 = 0;
00053   _m[t].m3 = 0;
00054   _m[t].m4 = 0;
00055   _m[t].m5 = TRANSPORT_ROAD << 2 | d;
00056   SB(_m[t].m6, 2, 4, 0);
00057   _me[t].m7 = 0;
00058   SetRoadOwner(t, ROADTYPE_ROAD, o);
00059   if (o != OWNER_TOWN) SetRoadOwner(t, ROADTYPE_TRAM, o);
00060   SetRoadTypes(t, r);
00061 }
00062 
00070 static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
00071 {
00072   SetTileType(t, MP_TUNNELBRIDGE);
00073   SetTileOwner(t, o);
00074   _m[t].m2 = 0;
00075   _m[t].m3 = r;
00076   _m[t].m4 = 0;
00077   _m[t].m5 = TRANSPORT_RAIL << 2 | d;
00078   SB(_m[t].m6, 2, 4, 0);
00079   _me[t].m7 = 0;
00080 }
00081 
00082 #endif /* TUNNEL_MAP_H */

Generated on Mon May 11 15:48:08 2009 for OpenTTD by  doxygen 1.5.6