mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r3816) Use existing accessors
This commit is contained in:
parent
6892e04d14
commit
929fae7b68
|
@ -3659,7 +3659,7 @@ pos_3:
|
|||
return;
|
||||
}
|
||||
|
||||
dir = _m[tile].m5 & 3;
|
||||
dir = GetRoadDepotDirection(tile);
|
||||
|
||||
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
DoCommandByTile(
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../../command.h"
|
||||
#include "trolly.h"
|
||||
#include "../../depot.h"
|
||||
#include "../../tunnel_map.h"
|
||||
#include "../../variables.h"
|
||||
#include "../ai.h"
|
||||
|
||||
|
@ -236,7 +237,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
// This problem only is valid for tunnels:
|
||||
// When the last tile was not yet a tunnel, check if we enter from the right side..
|
||||
if ((_m[atile].m5 & 0x80) == 0) {
|
||||
if (i != (_m[atile].m5 & 3U)) continue;
|
||||
if (GetTunnelDirection(atile) != i) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -798,7 +798,7 @@ static void AiNew_State_FindDepot(Player *p)
|
|||
if (IsTileType(t, MP_STREET) &&
|
||||
GetRoadType(t) == ROAD_DEPOT &&
|
||||
IsTileOwner(t, _current_player) &&
|
||||
GB(_m[t].m5, 0, 2) == ReverseDiagDir(j)) { // right direction?
|
||||
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
|
||||
p->ainew.depot_tile = t;
|
||||
p->ainew.depot_direction = ReverseDiagDir(j);
|
||||
p->ainew.state = AI_STATE_VERIFY_ROUTE;
|
||||
|
|
7
depot.h
7
depot.h
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "direction.h"
|
||||
#include "pool.h"
|
||||
#include "road_map.h"
|
||||
#include "tile.h"
|
||||
#include "variables.h"
|
||||
|
||||
|
@ -102,10 +103,8 @@ static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case TRANSPORT_RAIL:
|
||||
case TRANSPORT_ROAD:
|
||||
/* Rail and road store a diagonal direction in bits 0 and 1 */
|
||||
return (DiagDirection)GB(_m[tile].m5, 0, 2);
|
||||
case TRANSPORT_RAIL: return (DiagDirection)GB(_m[tile].m5, 0, 2);
|
||||
case TRANSPORT_ROAD: return GetRoadDepotDirection(tile);
|
||||
case TRANSPORT_WATER:
|
||||
/* Water is stubborn, it stores the directions in a different order. */
|
||||
switch (GB(_m[tile].m5, 0, 2)) {
|
||||
|
|
4
npf.c
4
npf.c
|
@ -508,7 +508,6 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
Trackdir src_trackdir = (Trackdir)current->path.node.direction;
|
||||
TileIndex src_tile = current->path.node.tile;
|
||||
DiagDirection src_exitdir = TrackdirToExitdir(src_trackdir);
|
||||
FindLengthOfTunnelResult flotr;
|
||||
TileIndex dst_tile;
|
||||
int i;
|
||||
TrackdirBits trackdirbits, ts;
|
||||
|
@ -524,8 +523,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
/* This is a tunnel. We know this tunnel is our type,
|
||||
* otherwise we wouldn't have got here. It is also facing us,
|
||||
* so we should skip it's body */
|
||||
flotr = FindLengthOfTunnel(src_tile, src_exitdir);
|
||||
dst_tile = flotr.tile;
|
||||
dst_tile = GetOtherTunnelEnd(src_tile);
|
||||
} else {
|
||||
if (type != TRANSPORT_WATER && (IsRoadStationTile(src_tile) || IsTileDepotType(src_tile, type))){
|
||||
/* This is a road station or a train or road depot. We can enter and exit
|
||||
|
|
|
@ -1976,7 +1976,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
|
|||
|
||||
case VEH_Road:
|
||||
if (v->u.road.state == 254) /* We'll assume the road vehicle is facing outwards */
|
||||
return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_ROAD)); /* Road vehicle in depot */
|
||||
return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
|
||||
|
||||
if (IsRoadStationTile(v->tile)) /* We'll assume the road vehicle is facing outwards */
|
||||
return DiagdirToDiagTrackdir(GetRoadStationDir(v->tile)); /* Road vehicle in a station */
|
||||
|
|
Loading…
Reference in New Issue