nus-yam/ex-repair huggingface dataset:
Program: 8849
Project: 8849
Buggy source:
/** 
 * Kicks out AI players that do not fit to the map, fixes Keepers so that they are in order
 * @param players the player list
 * @param maxPlayers the max player count
 * @return a list of players to kick
 */
public static Set<ClientInfo> compactPlayers(Set<ClientInfo> players,int maxPlayers){
  Set<ClientInfo> kickedPlayers=Collections.emptySet();
  if (players.size() > maxPlayers) {
    List<ClientInfo> keepers=new ArrayList<>(players);
    Collections.sort(keepers,(    ClientInfo o1,    ClientInfo o2) -> Short.compare(o2.getKeeper().getId(),o1.getKeeper().getId()));
    int playersToKick=players.size() - maxPlayers;
    int playersKicked=0;
    kickedPlayers=new HashSet<>(playersToKick);
    for (    ClientInfo keeper : keepers) {
      if (keeper.getKeeper().isAi()) {
        kickedPlayers.add(keeper);
        playersKicked++;
      }
      if (playersKicked == playersToKick) {
        break;
      }
    }
  }
  List<ClientInfo> keepers=new ArrayList<>(players);
  Collections.sort(keepers,(  ClientInfo o1,  ClientInfo o2) -> Short.compare(o1.getKeeper().getId(),o2.getKeeper().getId()));
  short id=Keeper.KEEPER1_ID;
  for (  ClientInfo keeper : keepers) {
    if (!kickedPlayers.contains(keeper)) {
      keeper.getKeeper().setId(id);
      id++;
    }
  }
  return kickedPlayers;
}

Fixed version (ground truth):
/** 
 * Kicks out AI players that do not fit to the map, fixes Keepers so that they are in order
 * @param players the player list
 * @param maxPlayers the max player count
 * @return a list of players to kick
 */
public static Set<ClientInfo> compactPlayers(Set<ClientInfo> players,int maxPlayers){
  Set<ClientInfo> kickedPlayers=Collections.emptySet();
  if (players.size() > maxPlayers) {
    List<ClientInfo> keepers=new ArrayList<>(players);
    Collections.sort(keepers,(    ClientInfo o1,    ClientInfo o2) -> Short.compare(o2.getKeeper().getId(),o1.getKeeper().getId()));
    int playersToKick=players.size() - maxPlayers;
    int playersKicked=0;
    kickedPlayers=new HashSet<>(playersToKick);
    for (    ClientInfo keeper : keepers) {
      if (keeper.getKeeper().isAi()) {
        kickedPlayers.add(keeper);
        playersKicked++;
      }
      if (playersKicked == playersToKick) {
        break;
      }
    }
  }
  List<ClientInfo> keepers=new ArrayList<>(players);
  Collections.sort(keepers,(  ClientInfo o1,  ClientInfo o2) -> Short.compare(o1.getKeeper().getId(),o2.getKeeper().getId()));
  short id=Player.KEEPER1_ID;
  for (  ClientInfo keeper : keepers) {
    if (!kickedPlayers.contains(keeper)) {
      keeper.getKeeper().setId(id);
      id++;
    }
  }
  return kickedPlayers;
}
Program: 8850
Project: 8850
Buggy source:
/** 
 * Get the next available keeper
 * @param ai AI or human
 * @param players the current player list
 * @return the next available Keeper
 */
public static Keeper getNextKeeper(boolean ai,Set<ClientInfo> players){
  short id=Keeper.KEEPER1_ID;
  List<Short> keepers=players.stream().map(c -> c.getKeeper().getId()).collect(toList());
  Collections.sort(keepers);
  while (Collections.binarySearch(keepers,id) >= 0) {
    id++;
  }
  return new Keeper(ai,id,null);
}

Fixed version (ground truth):
/** 
 * Get the next available keeper
 * @param ai AI or human
 * @param players the current player list
 * @return the next available Keeper
 */
public static Keeper getNextKeeper(boolean ai,Set<ClientInfo> players){
  short id=Player.KEEPER1_ID;
  List<Short> keepers=players.stream().map(c -> c.getKeeper().getId()).collect(toList());
  Collections.sort(keepers);
  while (Collections.binarySearch(keepers,id) >= 0) {
    id++;
  }
  return new Keeper(ai,id,null);
}
Program: 8851
Project: 8851
Buggy source:
public LocalLobby(){
  Keeper keeper=new Keeper(false,Keeper.KEEPER1_ID,null);
  ClientInfo clientInfo=createClientInfo(keeper,Utils.getMainTextResourceBundle().getString("String_Node_Str"));
  players.put(clientInfo.getId(),clientInfo);
  keeper=new Keeper(true,Keeper.KEEPER2_ID,null);
  clientInfo=createClientInfo(keeper,null);
  players.put(clientInfo.getId(),clientInfo);
}

Fixed version (ground truth):
public LocalLobby(){
  Keeper keeper=new Keeper(false,Player.KEEPER1_ID,null);
  ClientInfo clientInfo=createClientInfo(keeper,Utils.getMainTextResourceBundle().getString("String_Node_Str"));
  players.put(clientInfo.getId(),clientInfo);
  keeper=new Keeper(true,Player.KEEPER2_ID,null);
  clientInfo=createClientInfo(keeper,null);
  players.put(clientInfo.getId(),clientInfo);
}
Program: 8852
Project: 8852
Buggy source:
public void start() throws IOException {
  if (server == null) {
    server=Network.createServer(GAME_NAME,PROTOCOL_VERSION,port,port);
  }
  server.addChannel(port + 1);
  server.addChannel(port + 2);
  initialize();
  server.addConnectionListener(new ServerConnectionListener(this));
  server.getServices().addServices(new RpcHostedService(),new RmiHostedService(),new AccountHostedService(name),new LobbyHostedService(),new ChatHostedService());
  server.start();
  start=System.nanoTime();
}

Fixed version (ground truth):
@Override public void start(){
  System.out.println("String_Node_Str");
}
Program: 8853
Project: 8853
Buggy source:
/** 
 * Fill the list box with the objects of currently selected type
 * @param type the selected type
 */
private void fillList(Types type){
  getModelListBox().clear();
switch (type) {
case MODELS:
{
      fillWithFiles(models,AssetsConverter.getAssetsFolder(),AssetsConverter.getAssetsFolder() + AssetsConverter.MODELS_FOLDER + File.separator,"String_Node_Str");
      break;
    }
case TERRAIN:
{
    fillTerrain();
    break;
  }
case MAPS:
{
  fillWithFiles(maps,dkIIFolder,dkIIFolder.concat(AssetsConverter.MAPS_FOLDER),"String_Node_Str");
  break;
}
case EFFECTS:
{
fillEffects();
break;
}
}
}

Fixed version (ground truth):
/** 
 * Fill the list box with the objects of currently selected type
 * @param type the selected type
 */
private void fillList(Types type){
  getModelListBox().clear();
switch (type) {
case MODELS:
{
      fillWithFiles(models,AssetsConverter.getAssetsFolder(),AssetsConverter.getAssetsFolder() + AssetsConverter.MODELS_FOLDER + File.separator,"String_Node_Str");
      break;
    }
case TERRAIN:
{
    fillTerrain();
    break;
  }
case MAPS:
{
  fillWithFiles(maps,dkIIFolder,dkIIFolder.concat(AssetsConverter.MAPS_FOLDER),"String_Node_Str");
  break;
}
case OBJECTS:
{
fillObjects();
break;
}
case EFFECTS:
{
fillEffects();
break;
}
}
}
Program: 8854
Project: 8854
Buggy source:
@NiftyEventSubscriber(id="String_Node_Str") public void onListBoxSelectionChanged(final String id,final ListBoxSelectionChangedEvent<Object> event){
  effectManagerState.setEnabled(false);
  List<Object> selection=event.getSelection();
  if (selection.size() == 1) {
switch (getTypeDropDown().getSelection()) {
case MODELS:
{
        Node spat=(Node)AssetUtils.loadModel(assetManager,(String)selection.get(0));
        setupModel(spat,false);
        break;
      }
case TERRAIN:
{
      Node spat=(Node)new TerrainLoader().load(this.getAssetManager(),(Terrain)selection.get(0));
      setupModel(spat,false);
      break;
    }
case MAPS:
{
    String file=(String)selection.get(0) + "String_Node_Str";
    KwdFile kwd=new KwdFile(dkIIFolder,new File(dkIIFolder + AssetsConverter.MAPS_FOLDER + file));
    Node spat=(Node)new MapLoader(this.getAssetManager(),kwd,new EffectManagerState(kwd,this.getAssetManager()),null,new ObjectLoader(kwdFile,null)){
      @Override protected void updateProgress(      float progress){
      }
    }
.load(this.getAssetManager(),kwd);
    setupModel(spat,true);
    break;
  }
case EFFECTS:
{
  Node spat=new Node();
  effectManagerState.setEnabled(true);
  final int selectedIndex=event.getSelectionIndices().get(0) + 1;
  effectManagerState.loadSingleEffect(spat,new Vector3f(0,0,0),selectedIndex,true);
  setupModel(spat,false);
  break;
}
}
}
}

Fixed version (ground truth):
@NiftyEventSubscriber(id="String_Node_Str") public void onListBoxSelectionChanged(final String id,final ListBoxSelectionChangedEvent<Object> event){
  effectManagerState.setEnabled(false);
  List<Object> selection=event.getSelection();
  if (selection.size() == 1) {
switch (getTypeDropDown().getSelection()) {
case MODELS:
{
        Node spat=(Node)AssetUtils.loadAsset(assetManager,(String)selection.get(0));
        setupModel(spat,false);
        break;
      }
case TERRAIN:
{
      Node spat=(Node)new TerrainsLoader().load(this.getAssetManager(),(Terrain)selection.get(0));
      setupModel(spat,false);
      break;
    }
case MAPS:
{
    String file=(String)selection.get(0) + "String_Node_Str";
    KwdFile kwd=new KwdFile(dkIIFolder,new File(dkIIFolder + AssetsConverter.MAPS_FOLDER + file));
    Node spat=(Node)new MapLoader(this.getAssetManager(),kwd,new EffectManagerState(kwd,this.getAssetManager()),null,new ObjectLoader(kwdFile,null)){
      @Override protected void updateProgress(      float progress){
      }
    }
.load(this.getAssetManager(),kwd);
    setupModel(spat,true);
    break;
  }
case OBJECTS:
{
  Node spat=(Node)new ObjectsLoader().load(this.getAssetManager(),(toniarts.openkeeper.tools.convert.map.Object)selection.get(0));
  setupModel(spat,false);
  break;
}
case EFFECTS:
{
Node spat=new Node();
effectManagerState.setEnabled(true);
final int selectedIndex=event.getSelectionIndices().get(0) + 1;
effectManagerState.loadSingleEffect(spat,new Vector3f(0,0,0),selectedIndex,true);
setupModel(spat,false);
break;
}
}
}
}
Program: 8855
Project: 8855
Buggy source:
private void setupModel(final Node spat,boolean isMap){
  spat.setName(NODE_NAME);
  if (!isMap) {
    for (    Spatial subSpat : spat.getChildren()) {
      subSpat.setLocalScale(1);
      subSpat.setLocalTranslation(0,0,0);
    }
    RotatorControl rotator=new RotatorControl();
    rotator.setEnabled(rotate);
    spat.addControl(rotator);
  }
  floorGeom.setCullHint(!isMap ? Spatial.CullHint.Never : Spatial.CullHint.Always);
  spat.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
  rootNode.detachChildNamed(NODE_NAME);
  rootNode.attachChild(spat);
  toggleWireframe();
  toggleShowNormals();
  if (!spat.getChildren().isEmpty()) {
    final Spatial spatial=spat.getChild(0);
    AnimControl animControl=(AnimControl)spatial.getControl(AnimControl.class);
    if (animControl != null) {
      AnimChannel channel=animControl.createChannel();
      channel.setAnim("String_Node_Str");
      AnimationLoader.setLoopModeOnChannel(spatial,channel);
    }
  }
}

Fixed version (ground truth):
private void setupModel(final Node spat,boolean isMap){
  spat.setName(NODE_NAME);
  if (!isMap) {
    RotatorControl rotator=new RotatorControl();
    rotator.setEnabled(rotate);
    spat.addControl(rotator);
  }
  floorGeom.setCullHint(!isMap ? Spatial.CullHint.Never : Spatial.CullHint.Always);
  spat.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
  rootNode.detachChildNamed(NODE_NAME);
  rootNode.attachChild(spat);
  toggleWireframe();
  toggleShowNormals();
  if (!spat.getChildren().isEmpty()) {
    final Spatial spatial=spat.getChild(0);
    AnimControl animControl=(AnimControl)spatial.getControl(AnimControl.class);
    if (animControl != null) {
      AnimChannel channel=animControl.createChannel();
      channel.setAnim("String_Node_Str");
      AnimationLoader.setLoopModeOnChannel(spatial,channel);
    }
  }
}
Program: 8856
Project: 8856
Buggy source:
private void addIfValidCoordinate(final int x,final int y,List<Point> tileCoords){
  if ((x >= 0 && x < mapData.getWidth() && y >= 0 && y < mapData.getHeight())) {
    tileCoords.add(new Point(x,y));
  }
}

Fixed version (ground truth):
private void addIfValidCoordinate(final int x,final int y,List<Point> tileCoords){
  TileData tile=mapData.getTile(x,y);
  if (tile != null) {
    tileCoords.add(tile.getLocation());
  }
}
Program: 8857
Project: 8857
Buggy source:
private void handleTorch(TileData tile,Node pageNode){
  String name=null;
  float angleY=0;
  Vector3f position=Vector3f.ZERO;
  if (tile.getY() % 2 == 0 && tile.getX() % 2 != 0 && canPlaceTorch(tile.getX(),tile.getY() - 1)) {
    name="String_Node_Str";
    angleY=-FastMath.HALF_PI;
    position=new Vector3f(0,TORCH_HEIGHT,-TILE_WIDTH / 2);
  }
 else   if (tile.getX() % 2 == 0 && tile.getY() % 2 == 0 && canPlaceTorch(tile.getX() - 1,tile.getY())) {
    name="String_Node_Str";
    position=new Vector3f(-TILE_WIDTH / 2,TORCH_HEIGHT,0);
  }
 else   if (tile.getY() % 2 == 0 && tile.getX() % 2 != 0 && canPlaceTorch(tile.getX(),tile.getY() + 1)) {
    name="String_Node_Str";
    angleY=FastMath.HALF_PI;
    position=new Vector3f(0,TORCH_HEIGHT,TILE_WIDTH / 2);
  }
 else   if (tile.getX() % 2 == 0 && tile.getY() % 2 == 0 && canPlaceTorch(tile.getX() + 1,tile.getY())) {
    name="String_Node_Str";
    angleY=FastMath.PI;
    position=new Vector3f(TILE_WIDTH / 2,TORCH_HEIGHT,0);
  }
  if (name != null) {
    Spatial spatial=AssetUtils.loadModel(assetManager,name);
    spatial.addControl(new TorchControl(kwdFile,assetManager,angleY));
    spatial.rotate(0,angleY,0);
    spatial.move(position);
    AssetUtils.moveToTile(spatial,tile.getLocation());
    ((Node)getTileNode(tile.getLocation(),(Node)pageNode.getChild(WALL_INDEX))).attachChild(spatial);
  }
}

Fixed version (ground truth):
private void handleTorch(TileData tile,Node pageNode){
  String name=null;
  float angleY=0;
  Vector3f position=Vector3f.ZERO;
  if (tile.getY() % 2 == 0 && tile.getX() % 2 != 0 && canPlaceTorch(tile.getX(),tile.getY() - 1)) {
    name="String_Node_Str";
    angleY=-FastMath.HALF_PI;
    position=new Vector3f(0,TORCH_HEIGHT,-TILE_WIDTH / 2);
  }
 else   if (tile.getX() % 2 == 0 && tile.getY() % 2 == 0 && canPlaceTorch(tile.getX() - 1,tile.getY())) {
    name="String_Node_Str";
    position=new Vector3f(-TILE_WIDTH / 2,TORCH_HEIGHT,0);
  }
 else   if (tile.getY() % 2 == 0 && tile.getX() % 2 != 0 && canPlaceTorch(tile.getX(),tile.getY() + 1)) {
    name="String_Node_Str";
    angleY=FastMath.HALF_PI;
    position=new Vector3f(0,TORCH_HEIGHT,TILE_WIDTH / 2);
  }
 else   if (tile.getX() % 2 == 0 && tile.getY() % 2 == 0 && canPlaceTorch(tile.getX() + 1,tile.getY())) {
    name="String_Node_Str";
    angleY=FastMath.PI;
    position=new Vector3f(TILE_WIDTH / 2,TORCH_HEIGHT,0);
  }
  if (name != null) {
    Spatial spatial=AssetUtils.loadModel(assetManager,name);
    spatial.addControl(new TorchControl(kwdFile,assetManager,angleY));
    spatial.rotate(0,angleY,0);
    spatial.setLocalTranslation(WorldUtils.pointToVector3f(tile.getLocation()).addLocal(position));
    ((Node)getTileNode(tile.getLocation(),(Node)pageNode.getChild(WALL_INDEX))).attachChild(spatial);
  }
}
Program: 8859
Project: 8859
Buggy source:
private void handleSide(TileData tile,Node pageNode){
  Point p=tile.getLocation();
  Node sideTileNode=getTileNode(p,(Node)pageNode.getChild(WALL_INDEX));
  for (  WallDirection direction : WallDirection.values()) {
    Spatial wall=getWallSpatial(tile,direction);
    if (wall != null) {
      wall.rotate(0,direction.getAngle(),0);
      sideTileNode.attachChild(wall);
    }
  }
  setTileMaterialToGeometries(tile,sideTileNode);
  AssetUtils.moveToTile(sideTileNode,p);
  tile.setSideNode(sideTileNode);
}

Fixed version (ground truth):
private void handleSide(TileData tile,Node pageNode){
  Point p=tile.getLocation();
  Node sideTileNode=getTileNode(p,(Node)pageNode.getChild(WALL_INDEX));
  for (  WallDirection direction : WallDirection.values()) {
    Spatial wall=getWallSpatial(tile,direction);
    if (wall != null) {
      wall.rotate(0,direction.getAngle(),0);
      sideTileNode.attachChild(wall);
    }
  }
  setTileMaterialToGeometries(tile,sideTileNode);
  AssetUtils.translateToTile(sideTileNode,p);
  tile.setSideNode(sideTileNode);
}
Program: 8861
Project: 8861
Buggy source:
/** 
 * Heal a tile
 * @param point the point
 * @param playerId the player applying the healing
 */
public void healTile(Point point,short playerId){
  TileData tile=getMapData().getTile(point);
  Terrain terrain=tile.getTerrain();
  int healing;
  if (terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
    if (terrain.getFlags().contains(Terrain.TerrainFlag.OWNABLE)) {
      if (tile.getPlayerId() == playerId) {
        healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REPAIR_WALL_HEALTH);
      }
 else {
        healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.CLAIM_TILE_HEALTH);
      }
    }
 else {
      healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REINFORCE_WALL_HEALTH);
    }
  }
 else {
    healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REPAIR_TILE_HEALTH);
  }
  if (tile.applyHealing(healing)) {
    if (terrain.getMaxHealthEffectId() != 0) {
      effectManager.load(worldNode,WorldUtils.pointToVector3f(point),terrain.getMaxHealthEffectId(),false);
    }
    if (terrain.getMaxHealthTypeTerrainId() > 0) {
      tile.setTerrainId(terrain.getMaxHealthTypeTerrainId());
      tile.setPlayerId(playerId);
    }
    updateRoomWalls(tile);
    mapLoader.updateTiles(mapLoader.getSurroundingTiles(tile.getLocation(),true));
    notifyTileChange(point);
  }
 else   if (terrain.getFlags().contains(Terrain.TerrainFlag.DECAY)) {
    mapLoader.updateTiles(point);
  }
}

Fixed version (ground truth):
/** 
 * Heal a tile
 * @param point the point
 * @param playerId the player applying the healing
 */
public void healTile(Point point,short playerId){
  TileData tile=getMapData().getTile(point);
  Terrain terrain=tile.getTerrain();
  int healing;
  if (terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
    if (terrain.getFlags().contains(Terrain.TerrainFlag.OWNABLE)) {
      if (tile.getPlayerId() == playerId) {
        healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REPAIR_WALL_HEALTH);
      }
 else {
        healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.CLAIM_TILE_HEALTH);
      }
    }
 else {
      healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REINFORCE_WALL_HEALTH);
    }
  }
 else {
    healing=(int)getLevelVariable(Variable.MiscVariable.MiscType.REPAIR_TILE_HEALTH);
  }
  if (tile.applyHealing(healing)) {
    if (terrain.getMaxHealthEffectId() != 0) {
      effectManager.load(worldNode,WorldUtils.pointToVector3f(point).addLocal(0,MapLoader.FLOOR_HEIGHT,0),terrain.getMaxHealthEffectId(),false);
    }
    if (terrain.getMaxHealthTypeTerrainId() > 0) {
      tile.setTerrainId(terrain.getMaxHealthTypeTerrainId());
      tile.setPlayerId(playerId);
    }
    updateRoomWalls(tile);
    mapLoader.updateTiles(mapLoader.getSurroundingTiles(tile.getLocation(),true));
    notifyTileChange(point);
  }
 else   if (terrain.getFlags().contains(Terrain.TerrainFlag.DECAY)) {
    mapLoader.updateTiles(point);
  }
}
Program: 8862
Project: 8862
Buggy source:
@Override protected void controlUpdate(float tpf){
  if (steeringReady) {
    steeringReady=false;
    getSpatial().setLocalTranslation(position.x,0,position.y);
    getSpatial().setLocalRotation(getSpatial().getLocalRotation().fromAngles(0,-orientation,0));
  }
}

Fixed version (ground truth):
@Override protected void controlUpdate(float tpf){
  if (steeringReady) {
    steeringReady=false;
    getSpatial().setLocalTranslation(position.x,MapLoader.FLOOR_HEIGHT,position.y);
    getSpatial().setLocalRotation(getSpatial().getLocalRotation().fromAngles(0,-orientation,0));
  }
}
Program: 8863
Project: 8863
Buggy source:
protected void lockDoor(){
  locked=true;
  if (lockSpatial == null && lockObject != null) {
    lockSpatial=AssetUtils.loadModel(assetManager,lockObject.getMeshResource().getName());
    lockSpatial.move(0,MapLoader.TORCH_HEIGHT,0);
    lockSpatial.setUserData(AssetUtils.USER_DATA_KEY_REMOVABLE,false);
    ((Node)getSpatial()).attachChild(lockSpatial);
  }
  closeDoor();
}

Fixed version (ground truth):
protected void lockDoor(){
  locked=true;
  if (lockSpatial == null && lockObject != null) {
    lockSpatial=AssetUtils.loadModel(assetManager,lockObject.getMeshResource().getName());
    lockSpatial.move(0,MapLoader.TOP_HEIGHT,0);
    lockSpatial.setUserData(AssetUtils.USER_DATA_KEY_REMOVABLE,false);
    ((Node)getSpatial()).attachChild(lockSpatial);
  }
  closeDoor();
}
Program: 8864
Project: 8864
Buggy source:
@Override protected BatchNode constructFloor(){
  BatchNode root=new BatchNode();
  String modelName=roomInstance.getRoom().getCompleteResource().getName();
  for (  Point p : roomInstance.getCoordinates()) {
    boolean N=roomInstance.hasCoordinate(new Point(p.x,p.y - 1));
    boolean NE=roomInstance.hasCoordinate(new Point(p.x + 1,p.y - 1));
    boolean E=roomInstance.hasCoordinate(new Point(p.x + 1,p.y));
    boolean SE=roomInstance.hasCoordinate(new Point(p.x + 1,p.y + 1));
    boolean S=roomInstance.hasCoordinate(new Point(p.x,p.y + 1));
    boolean SW=roomInstance.hasCoordinate(new Point(p.x - 1,p.y + 1));
    boolean W=roomInstance.hasCoordinate(new Point(p.x - 1,p.y));
    boolean NW=roomInstance.hasCoordinate(new Point(p.x - 1,p.y - 1));
    Node model=constructQuad(assetManager,modelName,N,NE,E,SE,S,SW,W,NW);
    AssetUtils.scale(model);
    AssetUtils.moveToTile(model,p);
    root.attachChild(model);
  }
  return root;
}

Fixed version (ground truth):
@Override protected BatchNode constructFloor(){
  BatchNode root=new BatchNode();
  String modelName=roomInstance.getRoom().getCompleteResource().getName();
  for (  Point p : roomInstance.getCoordinates()) {
    boolean N=roomInstance.hasCoordinate(new Point(p.x,p.y - 1));
    boolean NE=roomInstance.hasCoordinate(new Point(p.x + 1,p.y - 1));
    boolean E=roomInstance.hasCoordinate(new Point(p.x + 1,p.y));
    boolean SE=roomInstance.hasCoordinate(new Point(p.x + 1,p.y + 1));
    boolean S=roomInstance.hasCoordinate(new Point(p.x,p.y + 1));
    boolean SW=roomInstance.hasCoordinate(new Point(p.x - 1,p.y + 1));
    boolean W=roomInstance.hasCoordinate(new Point(p.x - 1,p.y));
    boolean NW=roomInstance.hasCoordinate(new Point(p.x - 1,p.y - 1));
    Node model=constructQuad(assetManager,modelName,N,NE,E,SE,S,SW,W,NW);
    AssetUtils.translateToTile(model,p);
    root.attachChild(model);
  }
  return root;
}
Program: 8867
Project: 8867
Buggy source:
private boolean isPlayerAffordToBuild(Player player,Room room){
  int playerMoney=getWorldHandler().getGameState().getPlayer(player.getPlayerId()).getGoldControl().getGold();
  if (playerMoney == 0) {
    return false;
  }
  int buildablePlots=0;
  for (int x=(int)Math.max(0,selectionHandler.getSelectionArea().getStart().x); x < Math.min(getWorldHandler().getMapData().getWidth(),selectionHandler.getSelectionArea().getEnd().x + 1); x++) {
    for (int y=(int)Math.max(0,selectionHandler.getSelectionArea().getStart().y); y < Math.min(getWorldHandler().getMapData().getHeight(),selectionHandler.getSelectionArea().getEnd().y + 1); y++) {
      if (getWorldHandler().isBuildable(x,y,player,room)) {
        buildablePlots++;
      }
      if (buildablePlots > 3) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isPlayerAffordToBuild(Player player,Room room){
  int playerMoney=getWorldHandler().getGameState().getPlayer(player.getPlayerId()).getGoldControl().getGold();
  if (playerMoney == 0) {
    return false;
  }
  int buildablePlots=0;
  for (int x=(int)Math.max(0,selectionHandler.getSelectionArea().getStart().x); x < Math.min(getWorldHandler().getMapData().getWidth(),selectionHandler.getSelectionArea().getEnd().x + 1); x++) {
    for (int y=(int)Math.max(0,selectionHandler.getSelectionArea().getStart().y); y < Math.min(getWorldHandler().getMapData().getHeight(),selectionHandler.getSelectionArea().getEnd().y + 1); y++) {
      if (getWorldHandler().isBuildable(x,y,player,room)) {
        buildablePlots++;
      }
      if (playerMoney < buildablePlots * room.getCost()) {
        return false;
      }
    }
  }
  return true;
}
Program: 8869
Project: 8869
Buggy source:
protected void updateSelectedItem(PlayerInteractionState.InteractionState state){
  for (  PlayerInteractionState.InteractionState.Type interaction : PlayerInteractionState.InteractionState.Type.values()) {
    Element content=nifty.getScreen(HUD_SCREEN_ID).findElementById("String_Node_Str" + interaction.toString().toLowerCase() + "String_Node_Str");
    if (content == null || !content.isVisible()) {
      continue;
    }
    for (    Element e : content.getChildren()) {
      e.stopEffect(EffectEventId.onCustom);
    }
  }
  String itemId=state.toString().toLowerCase() + "String_Node_Str" + state.getItemId();
  Element item=nifty.getScreen(HUD_SCREEN_ID).findElementById(itemId);
  if (item != null) {
    item.startEffect(EffectEventId.onCustom,null,"String_Node_Str");
  }
}

Fixed version (ground truth):
protected void updateSelectedItem(PlayerInteractionState.InteractionState state){
  for (  PlayerInteractionState.InteractionState.Type interaction : PlayerInteractionState.InteractionState.Type.values()) {
    Element content=nifty.getScreen(HUD_SCREEN_ID).findElementById("String_Node_Str" + interaction.toString().toLowerCase() + "String_Node_Str");
    if (content == null || !content.isVisible()) {
      continue;
    }
    for (    Element e : content.getChildren()) {
      e.stopEffect(EffectEventId.onCustom);
    }
  }
  String itemId=state.getType().toString().toLowerCase() + "String_Node_Str" + state.getItemId();
  Element item=nifty.getScreen(HUD_SCREEN_ID).findElementById(itemId);
  if (item != null) {
    item.startEffect(EffectEventId.onCustom,null,"String_Node_Str");
  }
}
Program: 8870
Project: 8870
Buggy source:
@Override public void update(float tpf){
  if (enabled) {
    controlUpdate(tpf);
  }
}

Fixed version (ground truth):
@Override public void update(float tpf){
  if (enabled) {
    updateControl(tpf);
  }
}
Program: 8871
Project: 8871
Buggy source:
/** 
 * Sets the right material to tile (selected / decayed...)
 * @param node
 */
private void setTileMaterialToGeometries(final TileData tile,final Node node){
}

Fixed version (ground truth):
/** 
 * Sets the right material to tile (selected / decayed...)
 * @param node
 */
private void setTileMaterialToGeometries(final TileData tile,final Node node){
  if (!tile.isFlashed() && !tile.isSelected() && !tile.getTerrain().getFlags().contains(Terrain.TerrainFlag.DECAY)) {
    return;
  }
  node.depthFirstTraversal(new SceneGraphVisitor(){
    @Override public void visit(    Spatial spatial){
      if (!(spatial instanceof Geometry)) {
        return;
      }
      Material material=((Geometry)spatial).getMaterial();
      if (tile.getTerrain().getFlags().contains(Terrain.TerrainFlag.DECAY) && tile.getTerrain().getTextureFrames() > 1) {
        Integer texCount=spatial.getUserData(KmfModelLoader.MATERIAL_ALTERNATIVE_TEXTURES_COUNT);
        if (texCount != null) {
          int textureIndex=tile.getTerrain().getTextureFrames() - (int)Math.ceil(tile.getHealthPercent() / (100f / tile.getTerrain().getTextureFrames()));
          String diffuseTexture=((Texture)material.getParam("String_Node_Str").getValue()).getKey().getName().replaceFirst("String_Node_Str","String_Node_Str");
          if (textureIndex > 0) {
            if (textureIndex == 1) {
              diffuseTexture=diffuseTexture.replaceFirst("String_Node_Str","String_Node_Str");
            }
 else {
              diffuseTexture=diffuseTexture.replaceFirst("String_Node_Str","String_Node_Str" + textureIndex + "String_Node_Str");
            }
          }
          try {
            Texture texture=assetManager.loadTexture(new TextureKey(ConversionUtils.getCanonicalAssetKey(diffuseTexture),false));
            material.setTexture("String_Node_Str",texture);
            AssetUtils.assignMapsToMaterial(assetManager,material);
          }
 catch (          Exception e) {
            logger.log(Level.WARNING,"String_Node_Str",new Object[]{diffuseTexture,tile.getTerrain().getName(),e.getMessage()});
          }
        }
      }
      if (tile.isFlashed()) {
        material.setColor("String_Node_Str",COLOR_FLASH);
        material.setBoolean("String_Node_Str",true);
      }
      if (tile.isSelected()) {
        material.setColor("String_Node_Str",COLOR_TAG);
        material.setBoolean("String_Node_Str",true);
      }
    }
  }
);
}
Program: 8872
Project: 8872
Buggy source:
public void setFlashed(boolean flashed){
  this.flashed=flashed;
}

Fixed version (ground truth):
public void setFlashed(boolean flashed){
  if (!terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
    flashed=false;
  }
  this.flashed=flashed;
}
Program: 8873
Project: 8873
Buggy source:
@Override protected void setTerrainId(short terrainId){
  super.setTerrainId(terrainId);
  if (terrain.getTerrainId() != terrainId) {
    terrain=kwdFile.getTerrain(getTerrainId());
    setAttributesFromTerrain();
    if (!terrain.getFlags().contains(Terrain.TerrainFlag.TAGGABLE)) {
      setSelected(false,(short)0);
    }
  }
}

Fixed version (ground truth):
@Override protected void setTerrainId(short terrainId){
  super.setTerrainId(terrainId);
  if (terrain.getTerrainId() != terrainId) {
    terrain=kwdFile.getTerrain(getTerrainId());
    setAttributesFromTerrain();
    if (!terrain.getFlags().contains(Terrain.TerrainFlag.TAGGABLE)) {
      setSelected(false,(short)0);
    }
    if (!terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
      flashed=false;
    }
  }
}
Program: 8874
Project: 8874
Buggy source:
/** 
 * Dig a tile at x & y
 * @param x x coordinate
 * @param y y coordinate
 */
public void digTile(int x,int y){
}

Fixed version (ground truth):
/** 
 * Dig a tile at x & y
 * @param x x coordinate
 * @param y y coordinate
 */
public void digTile(int x,int y){
  TileData tile=getMapData().getTile(x,y);
  if (tile == null) {
    return;
  }
  Terrain terrain=tile.getTerrain();
  if (terrain.getFlags().contains(Terrain.TerrainFlag.IMPENETRABLE)) {
    return;
  }
  addPlayerGold(Keeper.KEEPER1_ID,terrain.getGoldValue());
  tile.setTerrainId(terrain.getDestroyedTypeTerrainId());
  tile.setSelected(false,Keeper.KEEPER1_ID);
  tile.setFlashed(false);
  updateRoomWalls(tile);
  mapLoader.updateTiles(mapLoader.getSurroundingTiles(tile.getLocation(),true));
}
Program: 8875
Project: 8875
Buggy source:
/** 
 * Called by the GUI, start the selected level
 * @param type where level selected. @TODO change campaign like others or otherwise
 */
public void startLevel(String type){
  if ("String_Node_Str".equals(type.toLowerCase())) {
    setEnabled(false);
    String level=String.format("String_Node_Str",selectedLevel.getType(),selectedLevel.getLevel(),selectedLevel.getVariation());
    GameState gameState=new GameState(level);
    stateManager.attach(gameState);
  }
 else   if ("String_Node_Str".equals(type.toLowerCase())) {
    if (mapSelector.getMap() == null) {
      logger.warning("String_Node_Str");
      return;
    }
    setEnabled(false);
    GameState gameState=new GameState(mapSelector.getMap(),skirmishPlayers);
    stateManager.attach(gameState);
  }
 else   if ("String_Node_Str".equals(type.toLowerCase())) {
    if (mapSelector.getMap() == null) {
      logger.warning("String_Node_Str");
      return;
    }
    setEnabled(false);
    GameState gameState=new GameState(mapSelector.getMap(),new ArrayList<>());
    stateManager.attach(gameState);
  }
 else {
    logger.warning("String_Node_Str" + type);
  }
}

Fixed version (ground truth):
/** 
 * Called by the GUI, start the selected level
 * @param type where level selected. @TODO change campaign like others orotherwise
 */
public void startLevel(String type){
  if ("String_Node_Str".equals(type.toLowerCase())) {
    setEnabled(false);
    String level=String.format("String_Node_Str",selectedLevel.getType(),selectedLevel.getLevel(),selectedLevel.getVariation());
    GameState gameState=new GameState(level);
    stateManager.attach(gameState);
  }
 else   if ("String_Node_Str".equals(type.toLowerCase())) {
    if (mapSelector.getMap() == null) {
      logger.warning("String_Node_Str");
      return;
    }
    setEnabled(false);
    GameState gameState=new GameState(mapSelector.getMap(),skirmishPlayers);
    stateManager.attach(gameState);
  }
 else   if ("String_Node_Str".equals(type.toLowerCase())) {
    if (mapSelector.getMap() == null) {
      logger.warning("String_Node_Str");
      return;
    }
    setEnabled(false);
    GameState gameState=new GameState(mapSelector.getMap(),new ArrayList<>());
    stateManager.attach(gameState);
  }
 else {
    logger.warning("String_Node_Str" + type);
  }
}
Program: 8877
Project: 8877
Buggy source:
public void selectRandomMap(){
  KwdFile map;
  List<KwdFile> maps;
  maps=skirmishMapSelect ? skirmishMaps : multiplayerMaps;
  if (maps.isEmpty()) {
    return;
  }
 else   if (maps.size() == 1) {
    map=maps.get(0);
  }
 else {
    do {
      map=maps.get(FastMath.nextRandomInt(0,maps.size() - 1));
    }
 while (map.equals(selectedMap));
  }
  selectedMap=map;
  setSkirmishMapDataToGUI();
  GameState gameState=new GameState(selectedMap,skirmishPlayers);
  stateManager.attach(gameState);
}

Fixed version (ground truth):
public void selectRandomMap(){
  KwdFile map;
  List<KwdFile> maps;
  maps=skirmishMapSelect ? skirmishMaps : multiplayerMaps;
  if (maps.isEmpty()) {
    return;
  }
 else   if (maps.size() == 1) {
    map=maps.get(0);
  }
 else {
    do {
      map=maps.get(FastMath.nextRandomInt(0,maps.size() - 1));
    }
 while (map.equals(selectedMap));
  }
  selectedMap=map;
  setSkirmishMapDataToGUI();
}
Program: 8878
Project: 8878
Buggy source:
/** 
 * Called by the GUI, start the selected level
 * @param type where level selected. @TODO change campaign like others or otherwise
 */
public void startLevel(String type){
  if ("String_Node_Str".equals(type.toLowerCase())) {
    setEnabled(false);
    String level=String.format("String_Node_Str",selectedLevel.getType(),selectedLevel.getLevel(),selectedLevel.getVariation());
    GameState gameState=new GameState(level);
    stateManager.attach(gameState);
  }
 else   if (selectedMap != null) {
    setEnabled(false);
    GameState gameState=new GameState(selectedMap);
    stateManager.attach(gameState);
  }
}

Fixed version (ground truth):
/** 
 * Called by the GUI, start the selected level
 * @param type where level selected. @TODO change campaign like others or otherwise
 */
public void startLevel(String type){
  if ("String_Node_Str".equals(type.toLowerCase())) {
    setEnabled(false);
    String level=String.format("String_Node_Str",selectedLevel.getType(),selectedLevel.getLevel(),selectedLevel.getVariation());
    GameState gameState=new GameState(level);
    stateManager.attach(gameState);
  }
 else   if (selectedMap != null) {
    setEnabled(false);
    GameState gameState=new GameState(selectedMap,skirmishPlayers);
    stateManager.attach(gameState);
  }
}
Program: 8879
Project: 8879
Buggy source:
@Override public Void onLoad(){
  try {
    if (level != null) {
      kwdFile=new KwdFile(Main.getDkIIFolder(),new File(Main.getDkIIFolder() + AssetsConverter.MAPS_FOLDER + level+ "String_Node_Str"));
    }
 else {
      kwdFile.load();
    }
    setProgress(0.1f);
    WorldState worldState=new WorldState(kwdFile,assetManager){
      @Override protected void updateProgress(      int progress,      int max){
        setProgress(0.1f + ((float)progress / max * 0.5f));
      }
    }
;
    GameState.this.stateManager.attach(worldState);
    GameState.this.stateManager.attach(new SoundState(false));
    setProgress(0.60f);
    GameState.this.stateManager.attach(new ActionPointState(false));
    setProgress(0.70f);
    GameState.this.stateManager.attach(new PartytState(false));
    setProgress(0.80f);
    int triggerId=kwdFile.getGameLevel().getTriggerId();
    if (triggerId != 0) {
      triggerControl=new TriggerControl(stateManager,triggerId);
      setProgress(0.90f);
    }
    setProgress(1.0f);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
@Override public Void onLoad(){
  try {
    if (level != null) {
      kwdFile=new KwdFile(Main.getDkIIFolder(),new File(ConversionUtils.getRealFileName(Main.getDkIIFolder(),AssetsConverter.MAPS_FOLDER + level + "String_Node_Str")));
    }
 else {
      kwdFile.load();
    }
    setProgress(0.1f);
    WorldState worldState=new WorldState(kwdFile,assetManager){
      @Override protected void updateProgress(      int progress,      int max){
        setProgress(0.1f + ((float)progress / max * 0.5f));
      }
    }
;
    GameState.this.stateManager.attach(worldState);
    GameState.this.stateManager.attach(new SoundState(false));
    setProgress(0.60f);
    GameState.this.stateManager.attach(new ActionPointState(false));
    setProgress(0.70f);
    GameState.this.stateManager.attach(new PartytState(false));
    setProgress(0.80f);
    int triggerId=kwdFile.getGameLevel().getTriggerId();
    if (triggerId != 0) {
      triggerControl=new TriggerControl(stateManager,triggerId);
      setProgress(0.90f);
    }
    setProgress(1.0f);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  return null;
}
Program: 8881
Project: 8881
Buggy source:
private String getRandomSoundFile(){
  int first, second, third;
  Random random=new Random();
  while (true) {
    first=random.nextInt(3);
switch (first) {
case 1:
      break;
case 3:
    break;
default :
  continue;
}
second=random.nextInt(4);
if (first == 1 && second == 1) {
third=random.nextInt(46);
}
 else if (first == 1 && second == 2) {
third=random.nextInt(35);
}
 else if (first == 1 && second == 3) {
third=random.nextInt(22);
}
 else if (first == 1 && second == 4) {
third=random.nextInt(13);
}
 else if (first == 3 && second == 1) {
third=random.nextInt(79);
}
 else if (first == 3 && second == 2) {
third=random.nextInt(20);
}
 else if (first == 3 && second == 3) {
third=random.nextInt(18);
}
 else {
third=random.nextInt(24);
}
return String.format("String_Node_Str",first,second,third);
}
}

Fixed version (ground truth):
private String getRandomSoundFile(){
  int first, second, third;
  Random random=new Random();
  while (true) {
    first=random.nextInt(2) + 1;
switch (first) {
case 1:
      break;
case 3:
    break;
default :
  continue;
}
second=random.nextInt(3) + 1;
if (first == 1 && second == 1) {
third=random.nextInt(45) + 1;
}
 else if (first == 1 && second == 2) {
third=random.nextInt(34) + 1;
}
 else if (first == 1 && second == 3) {
third=random.nextInt(21) + 1;
}
 else if (first == 1 && second == 4) {
third=random.nextInt(12) + 1;
}
 else if (first == 3 && second == 1) {
third=random.nextInt(78) + 1;
}
 else if (first == 3 && second == 2) {
third=random.nextInt(19) + 1;
}
 else if (first == 3 && second == 3) {
third=random.nextInt(17) + 1;
}
 else {
third=random.nextInt(23) + 1;
}
return String.format("String_Node_Str",first,second,third);
}
}
Program: 8882
Project: 8882
Buggy source:
@Override public void onAction(String name,boolean isPressed,float tpf){
  if (!isEnabled()) {
    return;
  }
  if (name.equals(Setting.USE_ATTACK.name())) {
    if (isPressed) {
      Cinematic transition=stateManager.getState(Cinematic.class);
      AudioNode speech=(AudioNode)((Main)stateManager.getApplication()).getRootNode().getChild("String_Node_Str");
      if (transition != null) {
        transition.stop();
        if (speech != null) {
          speech.stop();
          speech.removeFromParent();
        }
      }
    }
    return;
  }
switch (name) {
case SPECIAL_KEY_CONTROL:
    if (isPressed) {
      keys.add(KeyInput.KEY_LCONTROL);
      keys.add(KeyInput.KEY_RCONTROL);
    }
 else {
      keys.remove(Integer.valueOf(KeyInput.KEY_LCONTROL));
      keys.remove(Integer.valueOf(KeyInput.KEY_RCONTROL));
    }
  break;
case SPECIAL_KEY_ALT:
if (isPressed) {
  keys.add(KeyInput.KEY_LMENU);
  keys.add(KeyInput.KEY_RMENU);
}
 else {
  keys.remove(Integer.valueOf(KeyInput.KEY_LMENU));
  keys.remove(Integer.valueOf(KeyInput.KEY_RMENU));
}
break;
case SPECIAL_KEY_SHIFT:
if (isPressed) {
keys.add(KeyInput.KEY_LSHIFT);
keys.add(KeyInput.KEY_RSHIFT);
}
 else {
keys.remove(Integer.valueOf(KeyInput.KEY_LSHIFT));
keys.remove(Integer.valueOf(KeyInput.KEY_RSHIFT));
}
break;
}
}

Fixed version (ground truth):
@Override public void onAction(String name,boolean isPressed,float tpf){
  if (!isEnabled()) {
    return;
  }
  if (name.equals(Setting.USE_ATTACK.name())) {
    if (isPressed) {
      Cinematic transition=stateManager.getState(Cinematic.class);
      if (transition != null) {
        stateManager.getState(SoundState.class).stopSpeech();
        transition.stop();
      }
    }
    return;
  }
switch (name) {
case SPECIAL_KEY_CONTROL:
    if (isPressed) {
      keys.add(KeyInput.KEY_LCONTROL);
      keys.add(KeyInput.KEY_RCONTROL);
    }
 else {
      keys.remove(Integer.valueOf(KeyInput.KEY_LCONTROL));
      keys.remove(Integer.valueOf(KeyInput.KEY_RCONTROL));
    }
  break;
case SPECIAL_KEY_ALT:
if (isPressed) {
  keys.add(KeyInput.KEY_LMENU);
  keys.add(KeyInput.KEY_RMENU);
}
 else {
  keys.remove(Integer.valueOf(KeyInput.KEY_LMENU));
  keys.remove(Integer.valueOf(KeyInput.KEY_RMENU));
}
break;
case SPECIAL_KEY_SHIFT:
if (isPressed) {
keys.add(KeyInput.KEY_LSHIFT);
keys.add(KeyInput.KEY_RSHIFT);
}
 else {
keys.remove(Integer.valueOf(KeyInput.KEY_LSHIFT));
keys.remove(Integer.valueOf(KeyInput.KEY_RSHIFT));
}
break;
}
}
Program: 8883
Project: 8883
Buggy source:
private boolean isInteractable(){
  CreatureControl controller=getInteractiveObjectOnCursor();
  Vector2f v=null;
  if (controller != null) {
    tooltip.setText(controller.getTooltip());
  }
 else {
    v=handler.getRoundedMousePos();
    TileData tile=getWorldHandler().getMapLoader().getTile((int)v.x,(int)v.y);
    if (tile != null) {
      if (tile.getTerrain().getFlags().contains(Terrain.TerrainFlag.ROOM)) {
        RoomInstance roomInstance=getWorldHandler().getMapLoader().getRoomCoordinates().get(new Point((int)v.x,(int)v.y));
        GenericRoom room=getWorldHandler().getMapLoader().getRoomActuals().get(roomInstance);
        tooltip.setText(room.getTooltip());
      }
 else {
        ResourceBundle bundle=Main.getResourceBundle("String_Node_Str");
        tooltip.setText(bundle.getString(Integer.toString(tile.getTerrain().getTooltipStringId())));
      }
    }
 else {
      tooltip.setText("String_Node_Str");
    }
  }
  if (PlayerInteractionState.this.app.isDebug()) {
    StringBuilder sb=new StringBuilder();
    Point p;
    if (controller != null) {
      p=getWorldHandler().getTileCoordinates(controller.getSpatial().getWorldTranslation());
    }
 else {
      p=new Point((int)v.x,(int)v.y);
    }
    sb.append("String_Node_Str");
    sb.append(p.x);
    sb.append("String_Node_Str");
    sb.append(p.y);
    sb.append("String_Node_Str");
    sb.append(tooltip.getText());
    tooltip.setText(sb.toString());
  }
  return (controller != null);
}

Fixed version (ground truth):
private boolean isInteractable(){
  CreatureControl controller=getInteractiveObjectOnCursor();
  Vector2f v=null;
  if (controller != null) {
    tooltip.setText(controller.getTooltip());
  }
 else {
    v=handler.getRoundedMousePos();
    TileData tile=getWorldHandler().getMapData().getTile((int)v.x,(int)v.y);
    if (tile != null) {
      if (tile.getTerrain().getFlags().contains(Terrain.TerrainFlag.ROOM)) {
        RoomInstance roomInstance=getWorldHandler().getMapLoader().getRoomCoordinates().get(new Point((int)v.x,(int)v.y));
        GenericRoom room=getWorldHandler().getMapLoader().getRoomActuals().get(roomInstance);
        tooltip.setText(room.getTooltip());
      }
 else {
        ResourceBundle bundle=Main.getResourceBundle("String_Node_Str");
        tooltip.setText(bundle.getString(Integer.toString(tile.getTerrain().getTooltipStringId())));
      }
    }
 else {
      tooltip.setText("String_Node_Str");
    }
  }
  if (PlayerInteractionState.this.app.isDebug()) {
    StringBuilder sb=new StringBuilder();
    Point p;
    if (controller != null) {
      p=getWorldHandler().getTileCoordinates(controller.getSpatial().getWorldTranslation());
    }
 else {
      p=new Point((int)v.x,(int)v.y);
    }
    sb.append("String_Node_Str");
    sb.append(p.x);
    sb.append("String_Node_Str");
    sb.append(p.y);
    sb.append("String_Node_Str");
    sb.append(tooltip.getText());
    tooltip.setText(sb.toString());
  }
  return (controller != null);
}
Program: 8884
Project: 8884
Buggy source:
public MapData(KwdFile kwdFile){
  this.kwdFile=kwdFile;
  width=this.kwdFile.getMap().getWidth();
  height=this.kwdFile.getMap().getHeight();
  this.tiles=new TileData[getWidth()][getHeight()];
  for (int y=0; y < getHeight(); y++) {
    for (int x=0; x < getWidth(); x++) {
      Tile tile=this.kwdFile.getMap().getTile(x,y);
      tiles[x][y]=new TileData(tile,kwdFile.getTerrain(tile.getTerrainId()));
    }
  }
}

Fixed version (ground truth):
public MapData(KwdFile kwdFile){
  this.kwdFile=kwdFile;
  width=this.kwdFile.getMap().getWidth();
  height=this.kwdFile.getMap().getHeight();
  this.tiles=new TileData[getWidth()][getHeight()];
  for (int y=0; y < getHeight(); y++) {
    for (int x=0; x < getWidth(); x++) {
      Tile tile=this.kwdFile.getMap().getTile(x,y);
      tiles[x][y]=new TileData(kwdFile,tile,kwdFile.getTerrain(tile.getTerrainId()),x,y,y * getWidth() + x);
    }
  }
}
Program: 8885
Project: 8885
Buggy source:
public Spatial load(BulletAppState bulletAppState,AssetManager assetManager,KwdFile kwdFile){
  CreatureLoader creatureLoader=new CreatureLoader(kwdFile,worldState);
  List<Node> result=new ArrayList<>();
  for (  toniarts.openkeeper.tools.convert.map.Thing obj : kwdFile.getThings()) {
    try {
      if (obj instanceof Thing.Object) {
        Thing.Creature cr=(Thing.Creature)obj;
        nodeCreatures.attachChild(creatureLoader.load(assetManager,cr));
      }
    }
 catch (    Exception ex) {
      System.err.println(ex);
    }
  }
  return result;
}

Fixed version (ground truth):
public Spatial load(BulletAppState bulletAppState,AssetManager assetManager,KwdFile kwdFile){
  CreatureLoader creatureLoader=new CreatureLoader(kwdFile,worldState);
  Node root=new Node("String_Node_Str");
  Node nodeCreatures=new Node("String_Node_Str");
  Node nodeObjects=new Node("String_Node_Str");
  for (  toniarts.openkeeper.tools.convert.map.Thing obj : kwdFile.getThings()) {
    try {
      if (obj instanceof Thing.Creature) {
        Thing.Creature cr=(Thing.Creature)obj;
        nodeCreatures.attachChild(creatureLoader.load(assetManager,cr));
      }
 else       if (obj instanceof Thing.Object) {
        Thing.Object objectThing=(Thing.Object)obj;
        Object object=kwdFile.getObject(objectThing.getObjectId());
        Node nodeObject=(Node)assetManager.loadModel(AssetsConverter.MODELS_FOLDER + "String_Node_Str" + object.getMeshResource().getName()+ "String_Node_Str");
        nodeObject.setLocalTranslation(objectThing.getPosX() * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2f,0 * MapLoader.TILE_HEIGHT,objectThing.getPosY() * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2f);
        nodeObjects.attachChild(nodeObject);
      }
    }
 catch (    Exception ex) {
      System.err.println(ex);
    }
  }
  root.attachChild(nodeCreatures);
  root.attachChild(nodeObjects);
  return root;
}
Program: 8886
Project: 8886
Buggy source:
public ThingLoader(WorldState worldState){
  this.worldState=worldState;
}

Fixed version (ground truth):
public ThingLoader(WorldState worldHandler){
  this.worldState=worldHandler;
}