示例#1
0
 public int getGridChildY(Room loc) {
   try {
     return ((Integer) rooms.elementAt(rooms.indexOf(loc), 3)).intValue();
   } catch (Exception x) {
   }
   DVector rs = rooms.copyOf();
   for (int i = 0; i < rs.size(); i++)
     if (rs.elementAt(i, 1) == loc) return ((Integer) rs.elementAt(i, 3)).intValue();
   return -1;
 }
示例#2
0
 public boolean isMyGridChild(Room loc) {
   if (loc == null) return false;
   if (loc.getGridParent() == this) return true;
   if (loc.getGridParent() != null) return false;
   try {
     return rooms.contains(loc);
   } catch (Exception e) {
   } // optimization
   DVector myRooms = rooms.copyOf();
   for (int i = 0; i < myRooms.size(); i++) if (loc == myRooms.elementAt(i, 1)) return true;
   return false;
 }
示例#3
0
 public void clearGrid(Room bringBackHere) {
   try {
     DVector myRooms = rooms.copyOf();
     for (int r = 0; r < myRooms.size(); r++) {
       Room room = (Room) myRooms.elementAt(r, 1);
       CMLib.map().emptyRoom(room, bringBackHere);
     }
     while (myRooms.size() > 0) {
       Room room = (Room) myRooms.elementAt(0, 1);
       room.destroy();
       myRooms.removeElementAt(0);
     }
     try {
       rooms.clear();
     } catch (Exception e) {
     }
   } catch (Exception e) {
     Log.debugOut("StdThinGrid", e);
   }
 }
示例#4
0
 public String getGridChildCode(Room loc) {
   if (roomID().length() == 0) return "";
   try {
     int x = rooms.indexOf(loc);
     return roomID()
         + "#("
         + ((Integer) rooms.elementAt(x, 2)).intValue()
         + ","
         + ((Integer) rooms.elementAt(x, 3)).intValue()
         + ")";
   } catch (Exception x) {
   }
   DVector rs = rooms.copyOf();
   for (int i = 0; i < rs.size(); i++)
     if (rs.elementAt(i, 1) == loc)
       return roomID()
           + "#("
           + ((Integer) rs.elementAt(i, 2)).intValue()
           + ","
           + ((Integer) rs.elementAt(i, 3)).intValue()
           + ")";
   return "";
 }