예제 #1
0
 public boolean isReachableTo(StandardEntity se) {
   if (se instanceof Human) {
     Human hum = (Human) se;
     if (agent.getVisibleEntities(Human.class).contains(hum)
         && hum.isPositionDefined()
         && hum.getAreaPosition().isBlockadesDefined()) {
       for (Blockade blockade : hum.getAreaPosition().getBlockades()) {
         if (blockade.getShape().contains(hum.getPositionPoint().toGeomPoint())) return false;
       }
     }
     if (!hum.getImReachableToEdges().isEmpty())
       return agent
           .move
           .getMoveType(PoliceReachablityMove.class)
           .isReallyReachableTo(hum.getImReachableToEdges());
   }
   return isReachableTo(se.getPositionPair());
 }
예제 #2
0
파일: Move.java 프로젝트: jpollo/rcrss
  private void sendStockMessage(Path path) {
    if (me instanceof PoliceForceAgent) return;

    if (!(me.me() instanceof Human)) return;

    if (me.time() < 50) return;

    Human meEntity = (Human) me.me();

    if (meEntity.isBuriednessDefined() && meEntity.getBuriedness() > 0) return;

    if (meEntity.getImReachableToEdges().isEmpty()) return;

    if (me.isTimeToActFinished()) return;

    if (me.lastException != null) return;

    try {
      //			if (me.getMyClusterData().isCoverer())
      //				return;

      if (me.me().getAreaPosition().isBlockadesDefined()
          && me.me().getAreaPosition().getBlockadesID().isEmpty()) {
        boolean haveBlock = false;
        for (Area neighbour : me.me().getAreaPosition().getNeighbours()) {
          if (neighbour.isBlockadesDefined() && !neighbour.getBlockadesID().isEmpty())
            haveBlock = true;
        }
        if (!haveBlock) return;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    log().debug("Sending Stock Message");
    me.messageBlock = new MessageBlock(MessageXmlConstant.HEADER_AGENT_STOCK);
    me.messageBlock.addData(
        MessageXmlConstant.DATA_AREA_INDEX, me.me().getAreaPosition().getAreaIndex());
    me.messages.add(me.messageBlock);
    me.lowCommunicationMessages.add(me.messageBlock);
  }