mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-06 00:08:19 +07:00
Assignment of Chunk#tiles from pool
This commit is contained in:
@ -11,6 +11,8 @@ import com.riiablo.codec.util.BBox;
|
|||||||
import com.riiablo.map2.DT1.Tile;
|
import com.riiablo.map2.DT1.Tile;
|
||||||
import com.riiablo.map2.util.BucketPool;
|
import com.riiablo.map2.util.BucketPool;
|
||||||
|
|
||||||
|
import static com.riiablo.map2.DT1.Tile.SUBTILE_SIZE;
|
||||||
|
|
||||||
/** acts as a dt1 Tile cache chunk of zone */
|
/** acts as a dt1 Tile cache chunk of zone */
|
||||||
public class Chunk extends BBox implements Poolable, Disposable {
|
public class Chunk extends BBox implements Poolable, Disposable {
|
||||||
static final Pool<Chunk> pool = Pools.get(Chunk.class);
|
static final Pool<Chunk> pool = Pools.get(Chunk.class);
|
||||||
@ -18,7 +20,7 @@ public class Chunk extends BBox implements Poolable, Disposable {
|
|||||||
public static Chunk obtain(int x, int y, int width, int height) {
|
public static Chunk obtain(int x, int y, int width, int height) {
|
||||||
Chunk chunk = pool.obtain();
|
Chunk chunk = pool.obtain();
|
||||||
chunk.asBox(x, y, width, height);
|
chunk.asBox(x, y, width, height);
|
||||||
// chunk.tiles = tilePools.obtain(chunk.width * chunk.height);
|
chunk.tiles = tilePools.obtain(width * height / SUBTILE_SIZE);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user