station_cmd.c
changeset 1078 326bae748bcb
parent 1067 a083a6dd1419
child 1093 e8d26c7dc42f
equal deleted inserted replaced
1077:3a38f07dddcc 1078:326bae748bcb
  1749 	}
  1749 	}
  1750 
  1750 
  1751 	return _price.build_dock;
  1751 	return _price.build_dock;
  1752 }
  1752 }
  1753 
  1753 
       
  1754 /* Checks if any ship is servicing the buoy specified. Returns yes or no */
       
  1755 static bool CheckShipsOnBuoy(Station *st)
       
  1756 {
       
  1757 	const Vehicle *v;
       
  1758 	FOR_ALL_VEHICLES(v) {
       
  1759 		if (v->type == VEH_Ship) {
       
  1760 			const Order *order;
       
  1761 			FOR_VEHICLE_ORDERS(v, order) {
       
  1762 				if (order->type == OT_GOTO_STATION && order->station == st->index) {
       
  1763 					return true;
       
  1764 				}
       
  1765 			}
       
  1766 		}
       
  1767 	}
       
  1768 	return false;
       
  1769 }
       
  1770 
  1754 static int32 RemoveBuoy(Station *st, uint32 flags)
  1771 static int32 RemoveBuoy(Station *st, uint32 flags)
  1755 {
  1772 {
  1756 	uint tile;
  1773 	uint tile;
  1757 
  1774 
  1758 	if (_current_player >= MAX_PLAYERS) {
  1775 	if (_current_player >= MAX_PLAYERS) {
  1759 		/* XXX: strange stuff */
  1776 		/* XXX: strange stuff */
  1760 		return_cmd_error(INVALID_STRING_ID);
  1777 		return_cmd_error(INVALID_STRING_ID);
  1761 	}
  1778 	}
  1762 
  1779 
  1763 	tile = st->dock_tile;
  1780 	tile = st->dock_tile;
       
  1781 
       
  1782 	if (CheckShipsOnBuoy(st))
       
  1783 		return_cmd_error(STR_BUOY_IS_IN_USE);
  1764 
  1784 
  1765 	if (!EnsureNoVehicle(tile))
  1785 	if (!EnsureNoVehicle(tile))
  1766 		return CMD_ERROR;
  1786 		return CMD_ERROR;
  1767 
  1787 
  1768 	if (flags & DC_EXEC) {
  1788 	if (flags & DC_EXEC) {