예제 #1
0
  public void run() {
    Foodistan fdistan = Foodistan.getfoodistan();
    while (System.currentTimeMillis() <= Foodistan.getfoodistan().getFoodistanEndTime()) {
      for (int z = 0; z < fdistan.getFoodies().size(); z++) {
        Foodie f = fdistan.foodies.get(z);
        if (f.getfStatus() == foodieStatus.WAITING) {
          /*	if((f.getMaxWaitTime() + f.getWaitStartTime()) - System.currentTimeMillis() < 10000l)
          {
          	if(fdistan.getMg().hasInventory(fdistan.getInv(), 1)){
          		fdistan.setAvgWaitingTime(fdistan.getAvgWaitingTime()+(System.currentTimeMillis()-f.getWaitStartTime()));
          		fdistan.getFoodies().get(z).consumeItem(fdistan.getMg().getItem(fdistan.getInv(), 1));
          		fdistan.getOdrsOnHold().remove(0).setOrdrStatus(orderStatus.COMPLETE);
          		fdistan.getFoodiesOnHold().remove(0);
          		fdistan.setBurgerNeeded(fdistan.getBurgerNeeded()-1);
          		fdistan.setOrdersDelivered(Foodistan.getfoodistan().getOrdersDelivered()+1);

          	}

          }*/
          if ((f.getMaxWaitTime() + f.getWaitStartTime()) < System.currentTimeMillis()) {
            fdistan.foodies.get(z).setfStatus(foodieStatus.DEAD);
            fdistan.getFoodiesOnHold().remove(0);
            fdistan.getOdrsOnHold().remove(0);
            fdistan.setBurgerNeeded(fdistan.getBurgerNeeded() - 1);
            fdistan.setAvgWaitingTime(fdistan.getAvgWaitingTime() + (f.getMaxWaitTime()));
            fdistan.setDeathPenalty(fdistan.getDeathPenalty() + 1);
          }
        }
      }
    }
  }