コード例 #1
0
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if (CMath.bset(flags(), Area.FLAG_INSTANCE_CHILD)) return true;
   if ((--childCheckDown) <= 0) {
     childCheckDown = CHILD_CHECK_INTERVAL;
     synchronized (children) {
       for (int i = children.size() - 1; i >= 0; i--) {
         StdThinInstance childA = (StdThinInstance) children.elementAt(i, 2);
         if (childA.getAreaState() > Area.STATE_ACTIVE) {
           Vector V = (Vector) children.elementAt(i, 3);
           boolean anyInside = false;
           for (int v = 0; v < V.size(); v++) {
             MOB M = (MOB) V.elementAt(v);
             if (CMLib.flags().isInTheGame(M, true)
                 && (M.location() != null)
                 && (M.location().getArea() == childA)) anyInside = true;
           }
           if (!anyInside) {
             children.removeElementsAt(i);
             for (int v = 0; v < V.size(); v++) {
               MOB M = (MOB) V.elementAt(v);
               if ((M.location() != null) && (M.location().getArea() == this))
                 M.setLocation(M.getStartRoom());
             }
             MOB mob = CMClass.sampleMOB();
             for (Enumeration e = childA.getProperMap(); e.hasMoreElements(); ) {
               Room R = (Room) e.nextElement();
               R.executeMsg(mob, CMClass.getMsg(mob, R, null, CMMsg.MSG_EXPIRE, null));
             }
             CMLib.map().delArea(childA);
             childA.destroy();
           }
         }
       }
     }
   }
   return true;
 }