summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2008-02-25 15:09:22 +0000
committerKUDr <KUDr@openttd.org>2008-02-25 15:09:22 +0000
commitff7e789f83ccd0d2caf71e54b73f290fdb6f2f0b (patch)
treedfcde58a820400b90b5897f28f90326ae4b54aca
parentbde573d1e95cf3e7a8910e2accd1e9794503d94d (diff)
downloadopenttd-ff7e789f83ccd0d2caf71e54b73f290fdb6f2f0b.tar.xz
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
-Fixed by removing FollowTrack_t structure and all related functions. Their purpose was to allow to call track followers from C code. They were: 1. never used 2. obsoleted by switching to C++
-rw-r--r--projects/openttd_vs80.vcproj4
-rw-r--r--projects/openttd_vs90.vcproj4
-rw-r--r--source.list1
-rw-r--r--src/yapf/follow_track.cpp47
-rw-r--r--src/yapf/follow_track.hpp22
-rw-r--r--src/yapf/yapf.h48
6 files changed, 21 insertions, 105 deletions
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index 564688bbe..c51f6c5cc 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -2176,10 +2176,6 @@
Name="YAPF"
>
<File
- RelativePath=".\..\src\yapf\follow_track.cpp"
- >
- </File>
- <File
RelativePath=".\..\src\yapf\follow_track.hpp"
>
</File>
diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj
index 08089e90a..2551d8a8f 100644
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -2173,10 +2173,6 @@
Name="YAPF"
>
<File
- RelativePath=".\..\src\yapf\follow_track.cpp"
- >
- </File>
- <File
RelativePath=".\..\src\yapf\follow_track.hpp"
>
</File>
diff --git a/source.list b/source.list
index 4a736e9d0..ba30958e4 100644
--- a/source.list
+++ b/source.list
@@ -466,7 +466,6 @@ network/core/udp.cpp
network/core/udp.h
# YAPF
-yapf/follow_track.cpp
yapf/follow_track.hpp
yapf/nodelist.hpp
yapf/track_dir.hpp
diff --git a/src/yapf/follow_track.cpp b/src/yapf/follow_track.cpp
deleted file mode 100644
index ad2f0b724..000000000
--- a/src/yapf/follow_track.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $Id$ */
-
-#include "../stdafx.h"
-#include "yapf.hpp"
-#include "follow_track.hpp"
-
-void FollowTrackInit(FollowTrack_t *This, const Vehicle* v)
-{
- CFollowTrackWater& F = *(CFollowTrackWater*) This;
- F.Init(v, NULL);
-}
-
-bool FollowTrackWater(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackWater& F = *(CFollowTrackWater*) This;
- return F.Follow(old_tile, old_td);
-}
-
-bool FollowTrackRoad(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackRoad& F = *(CFollowTrackRoad*) This;
- return F.Follow(old_tile, old_td);
-}
-
-bool FollowTrackRail(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackRail& F = *(CFollowTrackRail*) This;
- return F.Follow(old_tile, old_td);
-}
-
-bool FollowTrackWaterNo90(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackWaterNo90& F = *(CFollowTrackWaterNo90*) This;
- return F.Follow(old_tile, old_td);
-}
-
-bool FollowTrackRoadNo90(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackRoadNo90& F = *(CFollowTrackRoadNo90*) This;
- return F.Follow(old_tile, old_td);
-}
-
-bool FollowTrackRailNo90(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td)
-{
- CFollowTrackRailNo90& F = *(CFollowTrackRailNo90*) This;
- return F.Follow(old_tile, old_td);
-}
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index 6987c24a4..afde47dd7 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -7,12 +7,32 @@
#include "yapf.hpp"
+
/** Track follower helper template class (can serve pathfinders and vehicle
* controllers). See 6 different typedefs below for 3 different transport
* types w/ of w/o 90-deg turns allowed */
template <TransportType Ttr_type_, bool T90deg_turns_allowed_ = true>
-struct CFollowTrackT : public FollowTrack_t
+struct CFollowTrackT
{
+ enum ErrorCode {
+ EC_NONE,
+ EC_OWNER,
+ EC_RAIL_TYPE,
+ EC_90DEG,
+ EC_NO_WAY,
+ };
+
+ const Vehicle* m_veh; ///< moving vehicle
+ TileIndex m_old_tile; ///< the origin (vehicle moved from) before move
+ Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move
+ TileIndex m_new_tile; ///< the new tile (the vehicle has entered)
+ TrackdirBits m_new_td_bits; ///< the new set of available trackdirs
+ DiagDirection m_exitdir; ///< exit direction (leaving the old tile)
+ bool m_is_tunnel; ///< last turn passed tunnel
+ bool m_is_bridge; ///< last turn passed bridge ramp
+ bool m_is_station; ///< last turn passed station
+ int m_tiles_skipped; ///< number of skipped tunnel or station tiles
+ ErrorCode m_err;
CPerformanceTimer* m_pPerf;
FORCEINLINE CFollowTrackT(const Vehicle* v = NULL, CPerformanceTimer* pPerf = NULL)
diff --git a/src/yapf/yapf.h b/src/yapf/yapf.h
index 632c55586..51ba06b92 100644
--- a/src/yapf/yapf.h
+++ b/src/yapf/yapf.h
@@ -73,54 +73,6 @@ extern int _aystar_stats_open_size;
extern int _aystar_stats_closed_size;
-/** Track followers. They should help whenever any new code will need to walk through
- * tracks, road or water tiles (pathfinders, signal controllers, vehicle controllers).
- * It is an attempt to introduce API that should simplify tasks listed above.
- * If you will need to use it:
- * 1. allocate/declare FollowTrack_t structure;
- * 2. call FollowTrackInit() and provide vehicle (if relevant)
- * 3. call one of 6 FollowTrackXxxx() APIs below
- * 4. check return value (if true then continue else stop)
- * 5. look at FollowTrack_t structure for the result
- * 6. optionally repeat steps 3..5
- * 7. in case of troubles contact KUDr
- */
-
-/** Base struct for track followers. */
-struct FollowTrack_t
-{
- enum ErrorCode {
- EC_NONE,
- EC_OWNER,
- EC_RAIL_TYPE,
- EC_90DEG,
- EC_NO_WAY,
- };
-
- const Vehicle* m_veh; ///< moving vehicle
- TileIndex m_old_tile; ///< the origin (vehicle moved from) before move
- Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move
- TileIndex m_new_tile; ///< the new tile (the vehicle has entered)
- TrackdirBits m_new_td_bits; ///< the new set of available trackdirs
- DiagDirection m_exitdir; ///< exit direction (leaving the old tile)
- bool m_is_tunnel; ///< last turn passed tunnel
- bool m_is_bridge; ///< last turn passed bridge ramp
- bool m_is_station; ///< last turn passed station
- int m_tiles_skipped; ///< number of skipped tunnel or station tiles
- ErrorCode m_err;
-};
-
-/** Initializes FollowTrack_t structure */
-void FollowTrackInit(FollowTrack_t *This, const Vehicle* v);
-
-/** Main track follower routines */
-bool FollowTrackWater (FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-bool FollowTrackRoad (FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-bool FollowTrackRail (FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-bool FollowTrackWaterNo90(FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-bool FollowTrackRoadNo90 (FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-bool FollowTrackRailNo90 (FollowTrack_t *This, TileIndex old_tile, Trackdir old_td);
-
/** Base tile length units */
enum {
YAPF_TILE_LENGTH = 100,