summaryrefslogtreecommitdiff
path: root/src/roadstop_base.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-02 23:53:15 +0000
committerrubidium <rubidium@openttd.org>2009-12-02 23:53:15 +0000
commitaa40d8e3adf23556810c2e6f975a514fac66ac62 (patch)
tree9f4aeabe164869f700cadf5dcc30fa55ed0b6092 /src/roadstop_base.h
parentedc7de7936ef56250199ce924c8f496675a5b8e1 (diff)
downloadopenttd-aa40d8e3adf23556810c2e6f975a514fac66ac62.tar.xz
(svn r18388) -Codechange: move entering/leaving of road stops to functions of RoadStop
Diffstat (limited to 'src/roadstop_base.h')
-rw-r--r--src/roadstop_base.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/roadstop_base.h b/src/roadstop_base.h
index 4548de4bf..c3cd359bd 100644
--- a/src/roadstop_base.h
+++ b/src/roadstop_base.h
@@ -63,6 +63,32 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
}
/**
+ * Checks whether the entrance of the road stop is occupied by a vehicle
+ * @return is entrance busy?
+ */
+ FORCEINLINE bool IsEntranceBusy() const
+ {
+ return HasBit(this->status, RSSFB_ENTRY_BUSY);
+ }
+
+ /**
+ * Makes an entrance occupied or free
+ * @param busy if true, marks busy; free otherwise
+ */
+ FORCEINLINE void SetEntranceBusy(bool busy)
+ {
+ SB(this->status, RSSFB_ENTRY_BUSY, 1, busy);
+ }
+
+ void Leave(RoadVehicle *rv);
+ bool Enter(RoadVehicle *rv);
+
+ RoadStop *GetNextRoadStop(const struct RoadVehicle *v) const;
+
+ static RoadStop *GetByTile(TileIndex tile, RoadStopType type);
+
+private:
+ /**
* Allocates a bay
* @return the allocated bay number
* @pre this->HasFreeBay()
@@ -98,29 +124,6 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
assert(nr < RSSFB_BAY_COUNT);
SetBit(this->status, nr);
}
-
-
- /**
- * Checks whether the entrance of the road stop is occupied by a vehicle
- * @return is entrance busy?
- */
- FORCEINLINE bool IsEntranceBusy() const
- {
- return HasBit(this->status, RSSFB_ENTRY_BUSY);
- }
-
- /**
- * Makes an entrance occupied or free
- * @param busy if true, marks busy; free otherwise
- */
- FORCEINLINE void SetEntranceBusy(bool busy)
- {
- SB(this->status, RSSFB_ENTRY_BUSY, 1, busy);
- }
-
- RoadStop *GetNextRoadStop(const struct RoadVehicle *v) const;
-
- static RoadStop *GetByTile(TileIndex tile, RoadStopType type);
};
#define FOR_ALL_ROADSTOPS_FROM(var, start) FOR_ALL_ITEMS_FROM(RoadStop, roadstop_index, var, start)