mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r8514) -Codechange: Turn IsBuoy into a method of stations
This commit is contained in:
parent
33cadd5043
commit
5678febfe2
|
@ -198,7 +198,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (!IsValidStationID(new_order.dest)) return CMD_ERROR;
|
||||
st = GetStation(new_order.dest);
|
||||
|
||||
if (st->airport_type != AT_OILRIG && !IsBuoy(st) && !CheckOwnership(st->owner)) {
|
||||
if (st->airport_type != AT_OILRIG && !st->IsBuoy() && !CheckOwnership(st->owner)) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,6 +179,14 @@ bool Station::TileBelongsToRailStation(TileIndex tile) const
|
|||
}
|
||||
|
||||
|
||||
/** Determines whether a station is a buoy only.
|
||||
* @todo Ditch this encoding of buoys
|
||||
*/
|
||||
bool Station::IsBuoy() const
|
||||
{
|
||||
return (this->had_vehicle_of_type & HVOT_BUOY) != 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* StationRect implementation */
|
||||
|
|
|
@ -161,6 +161,7 @@ struct Station {
|
|||
void MarkDirty() const;
|
||||
void MarkTilesDirty() const;
|
||||
bool TileBelongsToRailStation(TileIndex tile) const;
|
||||
bool IsBuoy() const;
|
||||
|
||||
protected:
|
||||
static Station *AllocateRaw(void);
|
||||
|
@ -272,11 +273,6 @@ uint GetNumRoadStops(const Station* st, RoadStop::Type type);
|
|||
RoadStop * AllocateRoadStop( void );
|
||||
void ClearSlot(Vehicle *v);
|
||||
|
||||
static inline bool IsBuoy(const Station* st)
|
||||
{
|
||||
return (st->had_vehicle_of_type & HVOT_BUOY) != 0; /* XXX: We should really ditch this ugly coding and switch to something sane... */
|
||||
}
|
||||
|
||||
void DeleteOilRig(TileIndex t);
|
||||
|
||||
#endif /* STATION_H */
|
||||
|
|
|
@ -541,7 +541,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
|
|||
rect.min_y = MapSizeY();
|
||||
rect.max_x = rect.max_y = 0;
|
||||
// Don't update acceptance for a buoy
|
||||
if (IsBuoy(st)) return;
|
||||
if (st->IsBuoy()) return;
|
||||
|
||||
/* old accepted goods types */
|
||||
old_acc = GetAcceptanceMask(st);
|
||||
|
@ -2545,7 +2545,7 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount)
|
|||
|
||||
for (i = 0; i != lengthof(around); i++) {
|
||||
if (around[i] == NULL) {
|
||||
if (!IsBuoy(st) &&
|
||||
if (!st->IsBuoy() &&
|
||||
(st->town->exclusive_counter == 0 || st->town->exclusivity == st->owner) && // check exclusive transport rights
|
||||
st->goods[type].rating != 0 &&
|
||||
(!_patches.selectgoods || st->goods[type].last_speed > 0) && // if last_speed is 0, no vehicle has been there.
|
||||
|
|
|
@ -939,7 +939,7 @@ static void DrawSmallOrderList(const Vehicle *v, int x, int y)
|
|||
sel--;
|
||||
|
||||
if (order->type == OT_GOTO_STATION) {
|
||||
if (v->type == VEH_Ship && IsBuoy(GetStation(order->dest))) continue;
|
||||
if (v->type == VEH_Ship && GetStation(order->dest)->IsBuoy()) continue;
|
||||
|
||||
SetDParam(0, order->dest);
|
||||
DrawString(x, y, STR_A036, 0);
|
||||
|
|
Loading…
Reference in New Issue