Exemplo n.º 1
0
  /** Get list of all bots on map in a certain team */
  public Iterable<BotEntity> getTeamBots(final Team team) {
    List<BotEntity> ret = new ArrayList<>();

    for (AbsPos botPos : botIndex.values()) {
      BotEntity bot = (BotEntity) grid.get(botPos);
      if (bot.getTeam().equals(team)) {
        ret.add(bot);
      }
    }

    return ret;
  }
Exemplo n.º 2
0
  private void flushRemoveBuffer() {
    while (!removeBuffer.isEmpty()) {
      Entity fakeEntToDie = removeBuffer.remove();

      Entry<Entity> entry = grid.get(fakeEntToDie);
      AbsPos pos = entry.getPosition();
      Entity entToDie = entry.getContents();

      if (entToDie instanceof BotEntity) {
        BotEntity botToDie = ((BotEntity) entToDie);
        botIndex.remove(botToDie.getID());
      }

      grid.set(pos, null);

      MatchLog.removeEntity(entToDie);
    }
  }
Exemplo n.º 3
0
  private void flushAddBuffer() {
    while (!addBuffer.isEmpty()) {
      Entry<Entity> entry = addBuffer.remove();
      Entity toAdd = entry.getContents();
      AbsPos addPos = entry.getPosition();

      assert (!grid.contains(toAdd));
      assert (grid.get(addPos) == DEBUG_PENDING_CHANGE_PLACEHOLDER);

      if (toAdd instanceof BotEntity) {
        BotEntity newBot = (BotEntity) toAdd;
        botIndex.put(newBot.getID(), addPos);
      }

      grid.set(addPos, toAdd);

      MatchLog.addEntity(toAdd, addPos);
    }
  }