summaryrefslogtreecommitdiff
path: root/src/station_base.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-25 15:42:03 +0000
committersmatz <smatz@openttd.org>2009-06-25 15:42:03 +0000
commitfa1ad0fd3c4bb20af746d5ee7588afcb0e5f8375 (patch)
tree30ddcbb431fa267add60ae492912185023e803a3 /src/station_base.h
parent8bc244d14e14b898bfaff8bb3ba23704a1168669 (diff)
downloadopenttd-fa1ad0fd3c4bb20af746d5ee7588afcb0e5f8375.tar.xz
(svn r16654) -Codechange: cache industries in station's coverage area instead of searching them everytime payment is made
Diffstat (limited to 'src/station_base.h')
-rw-r--r--src/station_base.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/station_base.h b/src/station_base.h
index 7f2303b0a..6cd60094e 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -77,6 +77,8 @@ struct StationRect : public Rect {
StationRect& operator = (Rect src);
};
+typedef SmallVector<Industry *, 2> IndustryVector;
+
/** Station data structure */
struct Station : StationPool::PoolItem<&_station_pool> {
public:
@@ -132,6 +134,8 @@ public:
std::list<Vehicle *> loading_vehicles;
GoodsEntry goods[NUM_CARGO]; ///< Goods at this station
+ IndustryVector industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry()
+
uint16 random_bits;
byte waiting_triggers;
uint8 cached_anim_triggers; ///< Combined animation trigger bitmask, used to determine if trigger processing should happen.
@@ -161,6 +165,9 @@ public:
uint GetPlatformLength(TileIndex tile) const;
bool IsBuoy() const;
+ void RecomputeIndustriesNear();
+ static void RecomputeIndustriesNearForAll();
+
uint GetCatchmentRadius() const;
static FORCEINLINE Station *GetByTile(TileIndex tile)