Mercurial > hg > openttd
changeset 5896:f4881d5663d1 draft
(svn r8514) -Codechange: Turn IsBuoy into a method of stations
author | celestar <celestar@openttd.org> |
---|---|
date | Thu, 01 Feb 2007 16:48:38 +0000 |
parents | b940c84fa359 |
children | bc46ad759678 |
files | src/order_cmd.cpp src/station.cpp src/station.h src/station_cmd.cpp src/vehicle_gui.cpp |
diffstat | 5 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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 */
--- 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 */
--- 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.
--- 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);