 
C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LRL_SET_OVPIX    **
C**************************
C
CD-Routine: Set No. of Overload Pixels for a Spot - LRL_SET_OVPIX
C This routine sets the number of overloaded pixels in a spot for
C use within an integration routine for a spot in the Laue Reflections List.
CD-end
CD-Fortran:
      SUBROUTINE LRL_SET_OVPIX (ISPOT, NOVLD, IERR)
CD-end
       INCLUDE 'implicit_none.finc'
C
C Purpose: Sets the  no. of overloaded pixels if set 
C
C Author:  John W. Campbell, June 1997
C
C
      INTEGER ISPOT
      INTEGER NOVLD
      INTEGER IERR
CD-Parameters:
C ISPOT   i (R)   Spot index number (in current sort order)
C NOVLD   i (R)   The number of overloaded pixels in the spot. 
C                 If there are more than 255 pixels overloaded,
C                 a value of 255 will be stored. -1 clears the 
C                 count in the list.
C IERR    i (W)   Error flag =  0,  OK
C                            =  1,  Invalid spot number
CD-end
C====== GLOBALS:
C
      INCLUDE 'lrl_data.finc'
C
C====== FUNCTION TYPES:
C
      EXTERNAL LRL_BDAT
C
C====== LOCALS:
C
      INTEGER I
      INTEGER NOV
C
C-------------------------------------------------------------------------------
C
      IERR = 0
      IF (ISPOT.LT.1.OR.ISPOT.GT.NUM_SPOTS) THEN
         IERR = 1
         RETURN
      END IF
      I = INDX(ISPOT)
      IF (NOVLD.LT.0) THEN
         CALL STBITS (FLAGS(I),20,1,0)
         CALL STBITS (FLAGS(I),21,8,0)
      ELSE
         NOV = NOVLD
         IF (NOV.GT.255) NOV = 255
         CALL STBITS (FLAGS(I),20,1,1)
         CALL STBITS (FLAGS(I),21,8,NOV)
      END IF
      RETURN
      END 
