Move map metadata to map manifest (#1262)

## Description:

To simply the map binary data, remove height & width data to the
manifest

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
evan
This commit is contained in:
evanpelle
2025-06-23 14:50:18 -07:00
committed by GitHub
parent ecabdfe4bc
commit 1ce282d41b
89 changed files with 1523 additions and 1259 deletions
+16 -3
View File
@@ -10,7 +10,10 @@ import {
PlayerType,
} from "../../src/core/game/Game";
import { createGame } from "../../src/core/game/GameImpl";
import { genTerrainFromBin } from "../../src/core/game/TerrainMapLoader";
import {
genTerrainFromBin,
MapManifest,
} from "../../src/core/game/TerrainMapLoader";
import { UserSettings } from "../../src/core/game/UserSettings";
import { GameConfig } from "../../src/core/Schemas";
import { TestConfig } from "./TestConfig";
@@ -33,16 +36,26 @@ export async function setup(
__dirname,
`../testdata/maps/${mapName}/mini_map.bin`,
);
const manifestPath = path.join(
__dirname,
`../testdata/maps/${mapName}/manifest.json`,
);
const mapBinBuffer = fs.readFileSync(mapBinPath);
const miniMapBinBuffer = fs.readFileSync(miniMapBinPath);
const manifest = JSON.parse(
fs.readFileSync(manifestPath, "utf8"),
) satisfies MapManifest;
// Convert Buffer to string (binary encoding)
const mapBinString = mapBinBuffer.toString("binary");
const miniMapBinString = miniMapBinBuffer.toString("binary");
const gameMap = await genTerrainFromBin(mapBinString);
const miniGameMap = await genTerrainFromBin(miniMapBinString);
const gameMap = await genTerrainFromBin(manifest.map, mapBinString);
const miniGameMap = await genTerrainFromBin(
manifest.mini_map,
miniMapBinString,
);
// Configure the game
const serverConfig = new TestServerConfig();