Program: 56398
Project: 56398
Buggy source:
/** 
 * Draws a map object at a given position.
 * @param context The context.
 * @param map For these damned arrwos
 * @param pos THe position to draw the object.
 * @param object The object (tree, ...) to draw.
 */
public void drawMapObject(IGraphicsGrid map,int x,int y,IMapObject object){
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus == 0) {
    return;
  }
  float color=getColor(fogstatus);
  EMapObjectType type=object.getObjectType();
  float progress=object.getStateProgress();
  if (type == EMapObjectType.ARROW) {
    drawArrow(context,(IArrowMapObject)object,color);
  }
 else {
switch (type) {
case TREE_ADULT:
      if (context.ENABLE_ORIGINAL) {
        drawTree(x,y,color);
      }
 else {
        drawTreeTest(x,y,color);
      }
    break;
case TREE_DEAD:
  playSound(object,4);
drawFallingTree(x,y,progress,color);
break;
case TREE_GROWING:
drawGrowingTree(x,y,progress,color);
break;
case CORN_GROWING:
drawGrowingCorn(x,y,object,color);
break;
case CORN_ADULT:
drawCorn(x,y,color);
break;
case CORN_DEAD:
drawDeadCorn(x,y,color);
break;
case WAVES:
drawWaves(x,y,color);
break;
case STONE:
drawStones(x,y,object,color);
break;
case GHOST:
drawPlayerableByProgress(x,y,12,27,object,color);
playSound(object,35);
break;
case BUILDING_DECONSTRUCTION_SMOKE:
drawByProgress(x,y,13,38,object.getStateProgress(),color);
playSound(object,35);
break;
case FOUND_COAL:
drawByProgress(x,y,FILE,94,object.getStateProgress(),color);
break;
case FOUND_GEMSTONE:
drawByProgress(x,y,FILE,95,object.getStateProgress(),color);
break;
case FOUND_GOLD:
drawByProgress(x,y,FILE,96,object.getStateProgress(),color);
break;
case FOUND_IRON:
drawByProgress(x,y,FILE,97,object.getStateProgress(),color);
break;
case FOUND_BRIMSTONE:
drawByProgress(x,y,FILE,98,object.getStateProgress(),color);
break;
case FOUND_NOTHING:
drawByProgress(x,y,FILE,99,object.getStateProgress(),color);
break;
case BUILDINGSITE_SIGN:
drawByProgress(x,y,FILE,93,object.getStateProgress(),color);
break;
case BUILDINGSITE_POST:
drawByProgress(x,y,FILE,92,object.getStateProgress(),color);
break;
case WORKAREA_MARK:
drawByProgress(x,y,FILE,91,object.getStateProgress(),color);
break;
case FLAG_DOOR:
drawPlayerableWaving(x,y,13,63,object,color);
break;
case CONSTRUCTION_MARK:
drawByProgress(x,y,4,6,object.getStateProgress(),color);
break;
case FLAG_ROOF:
float z=buffer.getZ();
buffer.setZ(.89f);
drawPlayerableWaving(x,y,13,64,object,color);
buffer.setZ(z);
break;
case BUILDING:
drawBuilding(x,y,(IBuilding)object,color);
break;
case STACK_OBJECT:
drawStack(x,y,(IStackMapObject)object,color);
break;
case SMOKE:
drawByProgress(x,y,13,42,progress,color);
break;
case WINE:
drawByProgress(x,y,1,25,progress,color);
break;
case PLANT_DECORATION:
{
int step=(x * 13 + y * 233) % 8;
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(1,27);
draw(seq.getImageSafe(step),x,y,color);
}
break;
case DESERT_DECORATION:
{
int step=(x * 13 + y * 233) % 5 + 10;
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(1,27);
draw(seq.getImageSafe(step),x,y,color);
}
break;
case PIG:
{
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(ANIMALS_FILE,PIG_SEQ);
if (seq.length() > 0) {
int i=getAnimationStep(x,y) / 2;
int step=i % seq.length();
draw(seq.getImageSafe(step),x,y,color);
}
}
break;
case FISH_DECORATION:
{
int step=getAnimationStep(x,y);
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(ANIMALS_FILE,FISH_SEQ);
int substep=step % 1024;
if (substep < 15) {
int subseq=(step / 1024) % 4;
draw(seq.getImageSafe(subseq * 15 + substep),x,y,color);
}
}
break;
case ATTACKABLE_TOWER:
{
IMovable movable=((IAttackableTowerMapObject)object).getMovable();
if (movable != null) {
Image image=this.imageMap.getImageForSettler(movable);
draw(image,x,y,color);
}
}
break;
default :
break;
}
}
if (object.getNextObject() != null) {
drawMapObject(map,x,y,object.getNextObject());
}
}

Fixed version (ground truth):
/** 
 * Draws a map object at a given position.
 * @param context The context.
 * @param map For these damned arrwos
 * @param pos THe position to draw the object.
 * @param object The object (tree, ...) to draw.
 */
public void drawMapObject(IGraphicsGrid map,int x,int y,IMapObject object){
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus == 0) {
    return;
  }
  float color=getColor(fogstatus);
  EMapObjectType type=object.getObjectType();
  float progress=object.getStateProgress();
  if (type == EMapObjectType.ARROW) {
    drawArrow(context,(IArrowMapObject)object,color);
  }
 else {
switch (type) {
case TREE_ADULT:
      if (context.ENABLE_ORIGINAL) {
        drawTree(x,y,color);
      }
 else {
        drawTreeTest(x,y,color);
      }
    break;
case TREE_DEAD:
  playSound(object,4);
drawFallingTree(x,y,progress,color);
break;
case TREE_GROWING:
drawGrowingTree(x,y,progress,color);
break;
case CORN_GROWING:
drawGrowingCorn(x,y,object,color);
break;
case CORN_ADULT:
drawCorn(x,y,color);
break;
case CORN_DEAD:
drawDeadCorn(x,y,color);
break;
case WAVES:
drawWaves(x,y,color);
break;
case STONE:
drawStones(x,y,object,color);
break;
case GHOST:
drawPlayerableByProgress(x,y,12,27,object,color);
playSound(object,35);
break;
case BUILDING_DECONSTRUCTION_SMOKE:
drawByProgress(x,y,13,38,object.getStateProgress(),color);
playSound(object,35);
break;
case FOUND_COAL:
drawByProgress(x,y,FILE,94,object.getStateProgress(),color);
break;
case FOUND_GEMSTONE:
drawByProgress(x,y,FILE,95,object.getStateProgress(),color);
break;
case FOUND_GOLD:
drawByProgress(x,y,FILE,96,object.getStateProgress(),color);
break;
case FOUND_IRON:
drawByProgress(x,y,FILE,97,object.getStateProgress(),color);
break;
case FOUND_BRIMSTONE:
drawByProgress(x,y,FILE,98,object.getStateProgress(),color);
break;
case FOUND_NOTHING:
drawByProgress(x,y,FILE,99,object.getStateProgress(),color);
break;
case BUILDINGSITE_SIGN:
drawByProgress(x,y,FILE,93,object.getStateProgress(),color);
break;
case BUILDINGSITE_POST:
drawByProgress(x,y,FILE,92,object.getStateProgress(),color);
break;
case WORKAREA_MARK:
drawByProgress(x,y,FILE,91,object.getStateProgress(),color);
break;
case FLAG_DOOR:
drawPlayerableWaving(x,y,13,63,object,color);
break;
case CONSTRUCTION_MARK:
drawByProgress(x,y,4,6,object.getStateProgress(),color);
break;
case FLAG_ROOF:
float z=buffer.getZ();
buffer.setZ(.89f);
drawPlayerableWaving(x,y,13,64,object,color);
buffer.setZ(z);
break;
case BUILDING:
drawBuilding(x,y,(IBuilding)object,color);
break;
case STACK_OBJECT:
drawStack(x,y,(IStackMapObject)object,color);
break;
case SMOKE:
drawByProgress(x,y,13,42,progress,color);
break;
case WINE:
drawByProgress(x,y,1,25,progress,color);
break;
case PLANT_DECORATION:
{
int step=(x * 13 + y * 233) % 8;
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(1,27);
draw(seq.getImageSafe(step),x,y,color);
}
break;
case DESERT_DECORATION:
{
int step=(x * 13 + y * 233) % 5 + 10;
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(1,27);
draw(seq.getImageSafe(step),x,y,color);
}
break;
case PIG:
{
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(ANIMALS_FILE,PIG_SEQ);
if (seq.length() > 0) {
int i=getAnimationStep(x,y) / 2;
int step=i % seq.length();
draw(seq.getImageSafe(step),x,y,color);
}
}
break;
case FISH_DECORATION:
{
int step=getAnimationStep(x,y);
Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(ANIMALS_FILE,FISH_SEQ);
int substep=step % 1024;
if (substep < 15) {
int subseq=(step / 1024) % 4;
draw(seq.getImageSafe(subseq * 15 + substep),x,y,color);
}
}
break;
case ATTACKABLE_TOWER:
{
IMovable movable=((IAttackableTowerMapObject)object).getMovable();
if (movable != null) {
Image image=this.imageMap.getImageForSettler(movable);
drawMovableAt(movable,image,x,y);
playMovableSound(movable);
}
}
break;
default :
break;
}
}
if (object.getNextObject() != null) {
drawMapObject(map,x,y,object.getNextObject());
}
}