mirror of https://github.com/OpenTTD/OpenTTD
(svn r4515) -Codechange: TPFMode2 is currently only used for TRANSPORT_WATER. So remove all stuff that deals with other transport types and assert TRANSPORT_WATER
parent
eb4a4b2509
commit
a18e9ccf27
2
Makefile
2
Makefile
|
@ -809,7 +809,7 @@ ifndef NATIVE_OSX
|
||||||
# OSX links in os/macosx/Makefile to handle universal binaries better
|
# OSX links in os/macosx/Makefile to handle universal binaries better
|
||||||
$(TTD): $(OBJS) $(MAKE_CONFIG)
|
$(TTD): $(OBJS) $(MAKE_CONFIG)
|
||||||
@echo '===> Linking $@'
|
@echo '===> Linking $@'
|
||||||
$(Q)$(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
|
$(Q)$(CC) $(LDFLAGS) -lefence $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(STRGEN): strgen/strgen.c endian_host.h
|
$(STRGEN): strgen/strgen.c endian_host.h
|
||||||
|
|
35
pathfind.c
35
pathfind.c
|
@ -134,47 +134,14 @@ static void TPFMode2(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
|
||||||
uint bits;
|
uint bits;
|
||||||
int i;
|
int i;
|
||||||
RememberData rd;
|
RememberData rd;
|
||||||
int owner = -1;
|
|
||||||
|
|
||||||
/* XXX: Mode 2 is currently only used for ships, why is this code here? */
|
assert(tpf->tracktype == TRANSPORT_WATER);
|
||||||
if (tpf->tracktype == TRANSPORT_RAIL) {
|
|
||||||
switch (GetTileType(tile)) {
|
|
||||||
case MP_TUNNELBRIDGE:
|
|
||||||
// bridge middle has no owner
|
|
||||||
if (IsBridge(tile) && IsBridgeMiddle(tile)) break;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
|
|
||||||
case MP_RAILWAY:
|
|
||||||
case MP_STATION:
|
|
||||||
owner = GetTileOwner(tile);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break; // XXX can this occur?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This addition will sometimes overflow by a single tile.
|
// This addition will sometimes overflow by a single tile.
|
||||||
// The use of TILE_MASK here makes sure that we still point at a valid
|
// The use of TILE_MASK here makes sure that we still point at a valid
|
||||||
// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail.
|
// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail.
|
||||||
tile = TILE_MASK(tile + TileOffsByDir(direction));
|
tile = TILE_MASK(tile + TileOffsByDir(direction));
|
||||||
|
|
||||||
/* Check in case of rail if the owner is the same */
|
|
||||||
if (tpf->tracktype == TRANSPORT_RAIL) {
|
|
||||||
switch (GetTileType(tile)) {
|
|
||||||
case MP_TUNNELBRIDGE:
|
|
||||||
// bridge middle has no owner
|
|
||||||
if (IsBridge(tile) && IsBridgeMiddle(tile)) break;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
|
|
||||||
case MP_RAILWAY:
|
|
||||||
case MP_STATION:
|
|
||||||
if (owner != -1 && !IsTileOwner(tile, owner)) return;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break; // XXX can this occur?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++tpf->rd.cur_length > 50)
|
if (++tpf->rd.cur_length > 50)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue