# HG changeset patch # User celestar # Date 1170348518 0 # Node ID f4881d5663d1d234c0be2454bdea0e212d6ecd89 # Parent b940c84fa359beb5a89ae0e21605cc2db59df9ce (svn r8514) -Codechange: Turn IsBuoy into a method of stations diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -198,7 +198,7 @@ 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; } diff --git a/src/station.cpp b/src/station.cpp --- a/src/station.cpp +++ b/src/station.cpp @@ -179,6 +179,14 @@ } +/** 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 */ diff --git a/src/station.h b/src/station.h --- a/src/station.h +++ b/src/station.h @@ -161,6 +161,7 @@ void MarkDirty() const; void MarkTilesDirty() const; bool TileBelongsToRailStation(TileIndex tile) const; + bool IsBuoy() const; protected: static Station *AllocateRaw(void); @@ -272,11 +273,6 @@ 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 */ diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -541,7 +541,7 @@ 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 @@ 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. diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -939,7 +939,7 @@ 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);