Program: 56416
Project: 56416
Buggy source:
/** 
 * Draws a given buildng to the context.
 * @param context
 * @param building
 * @param color Gray color shade
 */
private void drawBuilding(int x,int y,IBuilding building,float color){
  EBuildingType type=building.getBuildingType();
  float state=building.getStateProgress();
  float maskState;
  if (state < 0.5f) {
    maskState=state * 2;
    for (    ImageLink link : type.getBuildImages()) {
      Image image=imageProvider.getImage(link);
      drawWithConstructionMask(x,y,maskState,image,color);
    }
  }
 else   if (state < 0.99) {
    maskState=state * 2 - 1;
    for (    ImageLink link : type.getBuildImages()) {
      Image image=imageProvider.getImage(link);
      draw(image,x,y,color);
    }
    for (    ImageLink link : type.getImages()) {
      Image image=imageProvider.getImage(link);
      drawWithConstructionMask(x,y,maskState,image,color);
    }
  }
 else {
    if (type == EBuildingType.MILL && ((IBuilding.IMill)building).isWorking()) {
      Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(MILL_FILE,MILL_SEQ);
      if (seq.length() > 0) {
        int i=getAnimationStep(x,y);
        int step=i % seq.length();
        draw(seq.getImageSafe(step),x,y,color);
      }
      playSound(building,42);
    }
 else {
      ImageLink[] images=type.getImages();
      if (images.length > 0) {
        Image image=imageProvider.getImage(images[0]);
        draw(image,x,y,color);
      }
      if (building instanceof IBuilding.IOccupyed) {
        drawOccupyers(x,y,(IBuilding.IOccupyed)building,color);
      }
      for (int i=1; i < images.length; i++) {
        Image image=imageProvider.getImage(images[i]);
        draw(image,x,y,color);
      }
    }
  }
  if (building.isSelected()) {
    drawBuildingSelectMarker(x,y);
  }
}

Fixed version (ground truth):
/** 
 * Draws a given buildng to the context.
 * @param context
 * @param building
 * @param color Gray color shade
 */
private void drawBuilding(int x,int y,IBuilding building,float color){
  EBuildingType type=building.getBuildingType();
  float state=building.getStateProgress();
  float maskState;
  if (state < 0.5f) {
    maskState=state * 2;
    for (    ImageLink link : type.getBuildImages()) {
      Image image=imageProvider.getImage(link);
      drawWithConstructionMask(x,y,maskState,image,color);
    }
  }
 else   if (state < 0.99) {
    maskState=state * 2 - 1;
    for (    ImageLink link : type.getBuildImages()) {
      Image image=imageProvider.getImage(link);
      draw(image,x,y,color);
    }
    for (    ImageLink link : type.getImages()) {
      Image image=imageProvider.getImage(link);
      drawWithConstructionMask(x,y,maskState,image,color);
    }
  }
 else {
    if (type == EBuildingType.MILL && ((IBuilding.IMill)building).isWorking()) {
      Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(MILL_FILE,MILL_SEQ);
      if (seq.length() > 0) {
        int i=getAnimationStep(x,y);
        int step=i % seq.length();
        draw(seq.getImageSafe(step),x,y,color);
      }
      playSound(building,42);
    }
 else {
      ImageLink[] images=type.getImages();
      if (images.length > 0) {
        Image image=imageProvider.getImage(images[0]);
        draw(image,x,y,color);
      }
      if (building instanceof IBuilding.IOccupyed) {
        drawOccupiers(x,y,(IBuilding.IOccupyed)building,color);
      }
      for (int i=1; i < images.length; i++) {
        Image image=imageProvider.getImage(images[i]);
        draw(image,x,y,color);
      }
    }
  }
  if (building.isSelected()) {
    drawBuildingSelectMarker(x,y);
  }
}