protected StandardEntity retrieveEntity(EntityID id, StandardWorldModel worldModel) {
   StandardEntity entity = worldModel.getEntity(id);
   if (entity == null) {
     throw new IllegalArgumentException("Could not find entity in world model: " + id);
   }
   return entity;
 }
Exemplo n.º 2
0
  private void computeBlocks(StandardWorldModel model) {
    for (EntityID areaID : pathIds) {
      // Skip non-area parts
      StandardEntity e = model.getEntity(areaID);
      if (!(e instanceof Area)) {
        continue;
      }

      // Find blockades and add them if their cost is > 0 (removed blockades may remain here
      // with a cost of 0)
      Area area = (Area) e;
      if (area.isBlockadesDefined()) {
        for (EntityID blockadeID : area.getBlockades()) {
          Blockade blockade = (Blockade) model.getEntity(blockadeID);
          if (blockade.getRepairCost() > 0) {
            pathBlocks.add(blockade);
          }
        }
      }
    }
  }