Files
@ r3303:1bae0f5399a4
Branch filter:
Location: cpp/openttd-patchpack/source/pathfind.h - annotation
r3303:1bae0f5399a4
1.9 KiB
text/x-c
(svn r4060) -Codechange: [OSX] made the release target (in os/macosx/Makefile) easier to use since it gives the release disk image the right name automatically
it now uses REV instead of RELEASE, which means RELEASE is not needed to be set manaully anymore
it also automatically adds "-jaguar" when making a build aimed at OSX 10.2 (codenamed jaguar)
it now uses REV instead of RELEASE, which means RELEASE is not needed to be set manaully anymore
it also automatically adds "-jaguar" when making a build aimed at OSX 10.2 (codenamed jaguar)
r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3153:0f967897ff0f r3153:0f967897ff0f r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r2125:87ebf6378cb6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r926:fcf36609eb94 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r201:9dbb80b71da5 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3153:0f967897ff0f r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r2493:a844eec5cb6b r0:d63b455452f6 r3153:0f967897ff0f r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#ifndef PATHFIND_H
#define PATHFIND_H
#include "direction.h"
//#define PF_BENCH // perform simple benchmarks on the train pathfinder (not
//supported on all archs)
typedef struct TrackPathFinder TrackPathFinder;
typedef bool TPFEnumProc(TileIndex tile, void *data, int track, uint length, byte *state);
typedef void TPFAfterProc(TrackPathFinder *tpf);
typedef bool NTPEnumProc(TileIndex tile, void *data, int track, uint length);
#define PATHFIND_GET_LINK_OFFS(tpf, link) ((byte*)(link) - (byte*)tpf->links)
#define PATHFIND_GET_LINK_PTR(tpf, link_offs) (TrackPathFinderLink*)((byte*)tpf->links + (link_offs))
/* y7 y6 y5 y4 y3 y2 y1 y0 x7 x6 x5 x4 x3 x2 x1 x0
* y7 y6 y5 y4 y3 y2 y1 y0 x4 x3 x2 x1 x0 0 0 0
* 0 0 y7 y6 y5 y4 y3 y2 y1 y0 x4 x3 x2 x1 x0 0
* 0 0 0 0 y5 y4 y3 y2 y1 y0 x4 x3 x2 x1 x0 0
*/
#define PATHFIND_HASH_TILE(tile) (TileX(tile) & 0x1F) + ((TileY(tile) & 0x1F) << 5)
typedef struct TrackPathFinderLink {
TileIndex tile;
uint16 flags;
uint16 next;
} TrackPathFinderLink;
typedef struct RememberData {
uint16 cur_length;
byte depth;
byte pft_var6;
} RememberData;
struct TrackPathFinder {
int num_links_left;
TrackPathFinderLink *new_link;
TPFEnumProc *enum_proc;
void *userdata;
RememberData rd;
int the_dir;
byte tracktype;
byte var2;
bool disable_tile_hash;
bool hasbit_13;
uint16 hash_head[0x400];
TileIndex hash_tile[0x400]; /* stores the link index when multi link. */
TrackPathFinderLink links[0x400]; /* hopefully, this is enough. */
};
void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
typedef struct {
TileIndex tile;
int length;
} FindLengthOfTunnelResult;
FindLengthOfTunnelResult FindLengthOfTunnel(TileIndex tile, uint direction);
void NewTrainPathfind(TileIndex tile, TileIndex dest, DiagDirection direction, NTPEnumProc* enum_proc, void* data);
#endif /* PATHFIND_H */
|