File diff r18781:e1de9a06f7cd → r18782:6453522c2154
src/roadstop_base.h
Show inline comments
 
@@ -43,22 +43,22 @@ struct RoadStop : RoadStopPool::PoolItem
 
		Entry() : length(0), occupied(0) {}
 

	
 
		/**
 
		 * Get the length of this drive through stop.
 
		 * @return the length in tile units.
 
		 */
 
		FORCEINLINE int GetLength() const
 
		inline int GetLength() const
 
		{
 
			return this->length;
 
		}
 

	
 
		/**
 
		 * Get the amount of occupied space in this drive through stop.
 
		 * @return the occupied space in tile units.
 
		 */
 
		FORCEINLINE int GetOccupied() const
 
		inline int GetOccupied() const
 
		{
 
			return this->occupied;
 
		}
 

	
 
		void Leave(const RoadVehicle *rv);
 
		void Enter(const RoadVehicle *rv);
 
@@ -68,73 +68,73 @@ struct RoadStop : RoadStopPool::PoolItem
 

	
 
	TileIndex       xy;     ///< Position on the map
 
	byte            status; ///< Current status of the Stop, @see RoadStopSatusFlag. Access using *Bay and *Busy functions.
 
	struct RoadStop *next;  ///< Next stop of the given type at this station
 

	
 
	/** Initializes a RoadStop */
 
	FORCEINLINE RoadStop(TileIndex tile = INVALID_TILE) :
 
	inline RoadStop(TileIndex tile = INVALID_TILE) :
 
		xy(tile),
 
		status((1 << RSSFB_BAY_COUNT) - 1)
 
	{ }
 

	
 
	~RoadStop();
 

	
 
	/**
 
	 * Checks whether there is a free bay in this road stop
 
	 * @return is at least one bay free?
 
	 */
 
	FORCEINLINE bool HasFreeBay() const
 
	inline bool HasFreeBay() const
 
	{
 
		return GB(this->status, 0, RSSFB_BAY_COUNT) != 0;
 
	}
 

	
 
	/**
 
	 * Checks whether the given bay is free in this road stop
 
	 * @param nr bay to check
 
	 * @return is given bay free?
 
	 */
 
	FORCEINLINE bool IsFreeBay(uint nr) const
 
	inline bool IsFreeBay(uint nr) const
 
	{
 
		assert(nr < RSSFB_BAY_COUNT);
 
		return HasBit(this->status, nr);
 
	}
 

	
 
	/**
 
	 * Checks whether the entrance of the road stop is occupied by a vehicle
 
	 * @return is entrance busy?
 
	 */
 
	FORCEINLINE bool IsEntranceBusy() const
 
	inline 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)
 
	inline void SetEntranceBusy(bool busy)
 
	{
 
		SB(this->status, RSSFB_ENTRY_BUSY, 1, busy);
 
	}
 

	
 
	/**
 
	 * Get the drive through road stop entry struct for the given direction.
 
	 * @param direction the direciton to get the entry for
 
	 * @return the entry
 
	 */
 
	FORCEINLINE const Entry *GetEntry(DiagDirection dir) const
 
	inline const Entry *GetEntry(DiagDirection dir) const
 
	{
 
		return HasBit((int)dir, 1) ? this->west : this->east;
 
	}
 

	
 
	/**
 
	 * Get the drive through road stop entry struct for the given direction.
 
	 * @param direction the direciton to get the entry for
 
	 * @return the entry
 
	 */
 
	FORCEINLINE Entry *GetEntry(DiagDirection dir)
 
	inline Entry *GetEntry(DiagDirection dir)
 
	{
 
		return HasBit((int)dir, 1) ? this->west : this->east;
 
	}
 

	
 
	void MakeDriveThrough();
 
	void ClearDriveThrough();
 
@@ -154,13 +154,13 @@ private:
 

	
 
	/**
 
	 * Allocates a bay
 
	 * @return the allocated bay number
 
	 * @pre this->HasFreeBay()
 
	 */
 
	FORCEINLINE uint AllocateBay()
 
	inline uint AllocateBay()
 
	{
 
		assert(this->HasFreeBay());
 

	
 
		/* Find the first free bay. If the bit is set, the bay is free. */
 
		uint bay_nr = 0;
 
		while (!HasBit(this->status, bay_nr)) bay_nr++;
 
@@ -170,23 +170,23 @@ private:
 
	}
 

	
 
	/**
 
	 * Allocates a bay in a drive-through road stop
 
	 * @param nr the number of the bay to allocate
 
	 */
 
	FORCEINLINE void AllocateDriveThroughBay(uint nr)
 
	inline void AllocateDriveThroughBay(uint nr)
 
	{
 
		assert(nr < RSSFB_BAY_COUNT);
 
		ClrBit(this->status, nr);
 
	}
 

	
 
	/**
 
	 * Frees the given bay
 
	 * @param nr the number of the bay to free
 
	 */
 
	FORCEINLINE void FreeBay(uint nr)
 
	inline void FreeBay(uint nr)
 
	{
 
		assert(nr < RSSFB_BAY_COUNT);
 
		SetBit(this->status, nr);
 
	}
 
};