Exemplo n.º 1
0
 public int getol(Coord tc) {
   Grid g = getgridt(tc);
   int ol = g.getol(tc.sub(g.ul));
   for (Overlay lol : ols) {
     if (tc.isect(lol.c1, lol.c2.add(lol.c1.inv()).add(new Coord(1, 1)))) ol |= lol.mask;
   }
   return (ol);
 }
Exemplo n.º 2
0
 public void ctick() {
   long now = System.currentTimeMillis();
   int dt = (int) (now - lastctick);
   synchronized (grids) {
     for (Grid g : grids.values()) {
       g.tick(dt);
     }
   }
   lastctick = now;
 }
Exemplo n.º 3
0
 public void mapdata2(Message msg) {
   Coord c = msg.coord();
   synchronized (grids) {
     synchronized (req) {
       if (req.containsKey(c)) {
         Grid g = grids.get(c);
         if (g == null) grids.put(c, g = new Grid(c));
         g.fill(msg);
         req.remove(c);
         olseq++;
       }
     }
   }
 }
Exemplo n.º 4
0
 private void invalidate() {
   for (int y = 0; y < cutn.y; y++) {
     for (int x = 0; x < cutn.x; x++) buildcut(new Coord(x, y));
   }
   fo = null;
   for (Coord ic :
       new Coord[] {
         new Coord(-1, -1),
         new Coord(0, -1),
         new Coord(1, -1),
         new Coord(-1, 0),
         new Coord(1, 0),
         new Coord(-1, 1),
         new Coord(0, 1),
         new Coord(1, 1)
       }) {
     Grid ng = grids.get(gc.add(ic));
     if (ng != null) ng.ivneigh(ic.inv());
   }
   loaded = true;
 }
Exemplo n.º 5
0
 public int getz(Coord tc) {
   Grid g = getgridt(tc);
   return (g.getz(tc.sub(g.ul)));
 }