Program: 44437
Project: 44437
Buggy source:
protected void activateTarget(Glyphs.Target target){
  if (_active != null) {
    _active.layer.setVisible(true);
  }
  _active=target;
  _active.layer.setVisible(false);
  int mypidx=_gobj.turnHolder.get();
  restoreZoom();
  if (_ctrls == null) {
    GroupLayer scores=_glyph.layer.parent();
    scores.remove(_glyph.layer);
    flight.add(_glyph.layer);
    _glyph.layer.setZOrder(+1);
    _glyph.layer.transform().translate(scores.transform().tx() - tiles.transform().tx(),scores.transform().ty() - tiles.transform().ty());
    _ctrls=new Glyphs.Tile();
    _ctrls.layer.setZOrder(+2);
    float twidth=Media.TERRAIN_WIDTH, theight=Media.TERRAIN_HEIGHT;
    float awidth=Media.ACTION_WIDTH, aheight=Media.ACTION_HEIGHT;
    _ctrls.layer.add(_rotate=Atlantis.media.getActionTile(Media.ROTATE_ACTION));
    _ctrls.layer.add(_nopiecen=Atlantis.media.getActionTile(Media.NOPIECEN_ACTION));
    _nopiecen.setTranslation(twidth,theight);
    _ctrls.layer.add(_cancel=Atlantis.media.getActionTile(Media.CANCEL_ACTION));
    _cancel.setTranslation(0,theight);
    _ctrls.layer.add(_placep=Atlantis.media.getPiecenTile(mypidx));
    _placep.setTranslation(twidth,theight);
    _placep.setAlpha(0.5f);
    tiles.add(_ctrls.layer);
    _piecens=graphics().createGroupLayer();
    Rectangle pbounds=new Rectangle(Media.PIECEN_SIZE);
    for (int fidx=0; fidx < _placing.terrain.features.length; fidx++) {
      Feature f=_placing.terrain.features[fidx];
      ImageLayer pimg=Atlantis.media.getPiecenTile(mypidx);
      pimg.setTranslation(f.piecenSpot.getX(),f.piecenSpot.getY());
      _piecens.add(pimg);
      final Piecen p=new Piecen(mypidx,_active.loc,fidx);
      Atlantis.input.register(new Input.LayerReactor(pimg,pbounds){
        @Override public boolean hitTest(        IPoint p){
          return _piecens.visible() && super.hitTest(p);
        }
        public void onTrigger(){
          commitPlacement(p);
        }
      }
);
    }
    _glyph.layer.add(_piecens);
    IRectangle abounds=new Rectangle(Media.ACTION_SIZE);
    Atlantis.input.register(_rotate,abounds,new Input.Action(){
      public void onTrigger(){
        int cidx=_orients.indexOf(_glyph.getOrient());
        _glyph.setOrient(_orients.get((cidx + 1) % _orients.size()),true);
      }
    }
);
    Atlantis.input.register(_nopiecen,abounds,new Input.Action(){
      public void onTrigger(){
        commitPlacement(null);
      }
    }
);
    Atlantis.input.register(_cancel,abounds,new Input.Action(){
      public void onTrigger(){
        restoreZoom();
        showConsiderControls();
      }
    }
);
    Atlantis.input.register(_placep,pbounds,new Input.Action(){
      public void onTrigger(){
        zoomInOn(_active);
        showCommitControls();
      }
    }
);
  }
  _ctrls.layer.setVisible(false);
  _ctrls.setLocation(_active.loc,false,null);
  _orients=_ctrl.logic.computeLegalOrients(_placing,_active.loc);
  if (!_orients.contains(_glyph.getOrient())) {
    _glyph.setOrient(_orients.get(0),true);
  }
  _glyph.setLocation(_active.loc,true,new Runnable(){
    public void run(){
      if (_glyph.layer.parent() == flight) {
        flight.remove(_glyph.layer);
        tiles.add(_glyph.layer);
      }
      _ctrls.layer.setVisible(true);
    }
  }
);
  showConsiderControls();
}

Fixed version (ground truth):
protected void activateTarget(Glyphs.Target target){
  if (_active != null) {
    _active.layer.setVisible(true);
  }
  _active=target;
  _active.layer.setVisible(false);
  final int mypidx=_gobj.turnHolder.get();
  restoreZoom();
  if (_ctrls == null) {
    GroupLayer scores=_glyph.layer.parent();
    scores.remove(_glyph.layer);
    flight.add(_glyph.layer);
    _glyph.layer.setDepth(+1);
    _glyph.layer.transform().translate(scores.transform().tx() - tiles.transform().tx(),scores.transform().ty() - tiles.transform().ty());
    _ctrls=new Glyphs.Tile();
    _ctrls.layer.setDepth(+2);
    float twidth=Media.TERRAIN_WIDTH, theight=Media.TERRAIN_HEIGHT;
    float awidth=Media.ACTION_WIDTH, aheight=Media.ACTION_HEIGHT;
    _ctrls.layer.add(_rotate=Atlantis.media.getActionTile(Media.ROTATE_ACTION));
    _ctrls.layer.add(_nopiecen=Atlantis.media.getActionTile(Media.NOPIECEN_ACTION));
    _nopiecen.setTranslation(twidth,theight);
    _ctrls.layer.add(_cancel=Atlantis.media.getActionTile(Media.CANCEL_ACTION));
    _cancel.setTranslation(0,theight);
    _ctrls.layer.add(_placep=Atlantis.media.getPiecenTile(mypidx));
    _placep.setTranslation(twidth,theight);
    _placep.setAlpha(0.5f);
    tiles.add(_ctrls.layer);
    _piecens=graphics().createGroupLayer();
    Rectangle pbounds=new Rectangle(Media.PIECEN_SIZE);
    for (    final Feature f : _placing.terrain.features) {
      ImageLayer pimg=Atlantis.media.getPiecenTile(mypidx);
      pimg.setTranslation(f.piecenSpot.getX(),f.piecenSpot.getY());
      _piecens.add(pimg);
      Atlantis.input.register(new Input.LayerReactor(pimg,pbounds){
        @Override public boolean hitTest(        IPoint p){
          return _piecens.visible() && super.hitTest(p);
        }
        public void onTrigger(){
          commitPlacement(f);
        }
      }
);
    }
    _glyph.layer.add(_piecens);
    IRectangle abounds=new Rectangle(Media.ACTION_SIZE);
    Atlantis.input.register(_rotate,abounds,new Input.Action(){
      public void onTrigger(){
        int cidx=_orients.indexOf(_glyph.getOrient());
        _glyph.setOrient(_orients.get((cidx + 1) % _orients.size()),true);
      }
    }
);
    Atlantis.input.register(_nopiecen,abounds,new Input.Action(){
      public void onTrigger(){
        commitPlacement(null);
      }
    }
);
    Atlantis.input.register(_cancel,abounds,new Input.Action(){
      public void onTrigger(){
        restoreZoom();
        showConsiderControls();
      }
    }
);
    Atlantis.input.register(_placep,pbounds,new Input.Action(){
      public void onTrigger(){
        zoomInOn(_active);
        showCommitControls();
      }
    }
);
  }
  _ctrls.layer.setVisible(false);
  _ctrls.setLocation(_active.loc,false,null);
  _orients=_ctrl.logic.computeLegalOrients(_placing,_active.loc);
  if (!_orients.contains(_glyph.getOrient())) {
    _glyph.setOrient(_orients.get(0),true);
  }
  _glyph.setLocation(_active.loc,true,new Runnable(){
    public void run(){
      if (_glyph.layer.parent() == flight) {
        flight.remove(_glyph.layer);
        tiles.add(_glyph.layer);
      }
      _ctrls.layer.setVisible(true);
    }
  }
);
  showConsiderControls();
}