diff --git a/src/core/GameImpl.ts b/src/core/GameImpl.ts index 429b88ea4..86706765a 100644 --- a/src/core/GameImpl.ts +++ b/src/core/GameImpl.ts @@ -190,22 +190,6 @@ class TerraNulliusImpl implements TerraNullius { } -export class TerrainMapImpl implements TerrainMap { - - constructor(public readonly tiles: TerrainType[][]) { } - - terrain(cell: Cell): TerrainType { - return this.tiles[cell.x][cell.y] - } - - width(): number { - return this.tiles.length - } - - height(): number { - return this.tiles[0].length - } -} export class GameImpl implements MutableGame { private ticks = 0 diff --git a/src/core/TerrainMapLoader.ts b/src/core/TerrainMapLoader.ts index 578e71afe..7ba7c1701 100644 --- a/src/core/TerrainMapLoader.ts +++ b/src/core/TerrainMapLoader.ts @@ -1,12 +1,28 @@ import {Jimp as JimpType, JimpConstructors} from '@jimp/core'; import 'jimp'; -import {TerrainMapImpl} from './GameImpl'; import {TerrainTile} from '../../generated/protos'; import {Cell} from './Game'; declare const Jimp: JimpType & JimpConstructors; +export class TerrainMap { + + constructor(public readonly tiles: TerrainType[][]) { } + + terrain(cell: Cell): TerrainType { + return this.tiles[cell.x][cell.y] + } + + width(): number { + return this.tiles.length + } + + height(): number { + return this.tiles[0].length + } +} + // TODO: make terrain api better. export class Terrain { constructor( @@ -22,12 +38,6 @@ export const TerrainTypes = { Water: new Terrain(0, 0) } -export interface TerrainMap { - terrain(cell: Cell): Terrain - width(): number - height(): number -} - export async function loadTerrainMap(): Promise { const imageModule = await import(`../../resources/maps/World.png`); const imageUrl = imageModule.default; @@ -45,5 +55,5 @@ export async function loadTerrainMap(): Promise { } }) - return new TerrainMapImpl(terrain); + return new TerrainMap(terrain); } \ No newline at end of file