Skip to content

Commit b5b71df

Browse files
Slightly optimize map rendering
1 parent 9c1ed28 commit b5b71df

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

client/src/playback/Map.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ export class CurrentMap {
7373
return this.staticMap.locationToIndex(x, y)
7474
}
7575

76+
locationToIndexUnchecked(x: number, y: number): number {
77+
return this.staticMap.locationToIndexUnchecked(x, y)
78+
}
79+
7680
applySymmetry(point: Vector): Vector {
7781
return this.staticMap.applySymmetry(point)
7882
}
@@ -96,7 +100,7 @@ export class CurrentMap {
96100
const dimension = this.dimension
97101
for (let i = 0; i < dimension.width; i++) {
98102
for (let j = 0; j < dimension.height; j++) {
99-
const schemaIdx = this.locationToIndex(i, j)
103+
const schemaIdx = this.locationToIndexUnchecked(i, j)
100104
const coords = renderUtils.getRenderCoords(i, j, dimension)
101105

102106
// Render rounded (clipped) paint
@@ -321,6 +325,10 @@ export class StaticMap {
321325
return Math.floor(y) * this.width + Math.floor(x)
322326
}
323327

328+
locationToIndexUnchecked(x: number, y: number): number {
329+
return y * this.width + x
330+
}
331+
324332
/**
325333
* Returns a point representing the reflection of the given point following the map's symmetry.
326334
*/
@@ -360,7 +368,7 @@ export class StaticMap {
360368

361369
for (let i = 0; i < this.dimension.width; i++) {
362370
for (let j = 0; j < this.dimension.height; j++) {
363-
const schemaIdx = this.locationToIndex(i, j)
371+
const schemaIdx = this.locationToIndexUnchecked(i, j)
364372
const coords = renderUtils.getRenderCoords(i, j, this.dimension)
365373

366374
// Render rounded (clipped) wall

0 commit comments

Comments
 (0)