src/yapf/yapf.h
author rubidium
Fri, 28 Mar 2008 16:32:27 +0000
changeset 9264 31f5792aa96b
parent 9132 6256752d5e80
child 9281 d8cd9ac52a68
permissions -rw-r--r--
(svn r12467) -Codechange: move DepotID to a more logical location.
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     1
/* $Id$ */
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     2
6447
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 5838
diff changeset
     3
/** @file yapf.h */
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 5838
diff changeset
     4
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     5
#ifndef  YAPF_H
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     6
#define  YAPF_H
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     7
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
     8
#include "../debug.h"
9264
31f5792aa96b (svn r12467) -Codechange: move DepotID to a more logical location.
rubidium
parents: 9132
diff changeset
     9
#include "../depot_type.h"
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    10
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    11
/** Finds the best path for given ship.
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    12
 * @param v        the ship that needs to find a path
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    13
 * @param tile     the tile to find the path from (should be next tile the ship is about to enter)
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    14
 * @param enterdir diagonal direction which the ship will enter this new tile from
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    15
 * @param tracks   available tracks on the new tile (to choose from)
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    16
 * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    17
 */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    18
Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks);
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    19
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    20
/** Finds the best path for given road vehicle.
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    21
 * @param v        the RV that needs to find a path
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    22
 * @param tile     the tile to find the path from (should be next tile the RV is about to enter)
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    23
 * @param enterdir diagonal direction which the RV will enter this new tile from
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    24
 * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    25
 */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    26
Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir);
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    27
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    28
/** Finds the best path for given train.
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    29
 * @param v        the train that needs to find a path
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    30
 * @param tile     the tile to find the path from (should be next tile the train is about to enter)
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    31
 * @param enterdir diagonal direction which the RV will enter this new tile from
6980
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    32
 * @param tracks   available trackdirs on the new tile (to choose from)
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    33
 * @param path_not_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess')
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    34
 * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    35
 */
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    36
Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found);
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    37
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    38
/** Used by RV multistop feature to find the nearest road stop that has a free slot.
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    39
 * @param v      RV (its current tile will be the origin)
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    40
 * @param tile   destination tile
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    41
 * @return       distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    42
 */
3915
281c7ebd27e0 (svn r5033) -CodeChange: [YAPF] RoadFindPathToStop() can now use YAPF for multistop handling.
KUDr
parents: 3900
diff changeset
    43
uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile);
281c7ebd27e0 (svn r5033) -CodeChange: [YAPF] RoadFindPathToStop() can now use YAPF for multistop handling.
KUDr
parents: 3900
diff changeset
    44
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    45
/** Used when user sends RV to the nearest depot or if RV needs servicing.
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    46
 * Returns the nearest depot (or NULL if depot was not found).
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    47
 */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    48
Depot* YapfFindNearestRoadDepot(const Vehicle *v);
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    49
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    50
/** Used when user sends train to the nearest depot or if train needs servicing.
6980
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    51
 * @param v            train that needs to go to some depot
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    52
 * @param max_distance max distance (number of track tiles) from the current train position
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    53
 *                  (used also as optimization - the pathfinder can stop path finding if max_distance
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    54
 *                  was reached and no depot was seen)
6980
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    55
 * @param reverse_penalty penalty that should be added for the path that requires reversing the train first
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    56
 * @param depot_tile   receives the depot tile if depot was found
6b5dee376733 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections...
belugas
parents: 6574
diff changeset
    57
 * @param reversed     receives true if train needs to reversed first
4549
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    58
 * @return       the true if depot was found.
60410aa1aa88 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents: 4462
diff changeset
    59
 */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    60
bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed);
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    61
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    62
/** Returns true if it is better to reverse the train before leaving station */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    63
bool YapfCheckReverseTrain(Vehicle* v);
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    64
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    65
/** Use this function to notify YAPF that track layout (or signal configuration) has change */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    66
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track);
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    67
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    68
/** performance measurement helpers */
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6447
diff changeset
    69
void* NpfBeginInterval();
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    70
int NpfEndInterval(void* perf);
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    71
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    72
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    73
extern int _aystar_stats_open_size;
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    74
extern int _aystar_stats_closed_size;
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    75
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    76
4462
808d9d5fb7a3 (svn r6245) -Add: added comments for all YAPF C interface functions (yapf.h) used by other modules, added FollowTrackInit() into YAPF track followers.
KUDr
parents: 3977
diff changeset
    77
/** Base tile length units */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    78
enum {
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    79
	YAPF_TILE_LENGTH = 100,
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    80
	YAPF_TILE_CORNER_LENGTH = 71
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    81
};
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    82
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff changeset
    83
#endif /* YAPF_H */