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); }
public void ctick() { long now = System.currentTimeMillis(); int dt = (int) (now - lastctick); synchronized (grids) { for (Grid g : grids.values()) { g.tick(dt); } } lastctick = now; }
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++; } } } }
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; }
public int getz(Coord tc) { Grid g = getgridt(tc); return (g.getz(tc.sub(g.ul))); }