mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-05 01:26:08 +00:00
Add Italia and Straight of Gibraltar maps (#1285)
## Description: Add Italia and Straight of Gibraltar Merging this directly into v23 because the map generation logic changed. Also removed last pixel if odd. The map dimensions must be even. ## 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:
@@ -29,6 +29,8 @@ export const MapDescription: Record<keyof typeof GameMapType, string> = {
|
||||
FalklandIslands: "Falkland Islands",
|
||||
Baikal: "Baikal",
|
||||
Halkidiki: "Halkidiki",
|
||||
Italia: "Italia",
|
||||
StraitOfGibraltar: "Strait of Gibraltar",
|
||||
};
|
||||
|
||||
@customElement("map-display")
|
||||
|
||||
@@ -13,6 +13,7 @@ import faroeislands from "../../../resources/maps/FaroeIslandsThumb.webp";
|
||||
import gatewayToTheAtlantic from "../../../resources/maps/GatewayToTheAtlanticThumb.webp";
|
||||
import halkidiki from "../../../resources/maps/HalkidikiThumb.webp";
|
||||
import iceland from "../../../resources/maps/IcelandThumb.webp";
|
||||
import italia from "../../../resources/maps/ItaliaThumb.webp";
|
||||
import japan from "../../../resources/maps/JapanThumb.webp";
|
||||
import mars from "../../../resources/maps/MarsThumb.webp";
|
||||
import mena from "../../../resources/maps/MenaThumb.webp";
|
||||
@@ -20,6 +21,7 @@ import northAmerica from "../../../resources/maps/NorthAmericaThumb.webp";
|
||||
import oceania from "../../../resources/maps/OceaniaThumb.webp";
|
||||
import pangaea from "../../../resources/maps/PangaeaThumb.webp";
|
||||
import southAmerica from "../../../resources/maps/SouthAmericaThumb.webp";
|
||||
import straitOfGibraltar from "../../../resources/maps/StraitOfGibraltarThumb.webp";
|
||||
import worldmapgiant from "../../../resources/maps/WorldMapGiantThumb.webp";
|
||||
import world from "../../../resources/maps/WorldMapThumb.webp";
|
||||
|
||||
@@ -75,6 +77,10 @@ export function getMapsImage(map: GameMapType): string {
|
||||
return baikal;
|
||||
case GameMapType.Halkidiki:
|
||||
return halkidiki;
|
||||
case GameMapType.Italia:
|
||||
return italia;
|
||||
case GameMapType.StraitOfGibraltar:
|
||||
return straitOfGibraltar;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ const numPlayersConfig = {
|
||||
[GameMapType.World]: [150, 80, 50],
|
||||
[GameMapType.WorldMapGiant]: [150, 100, 60],
|
||||
[GameMapType.Halkidiki]: [50, 40, 30],
|
||||
[GameMapType.Italia]: [50, 40, 30],
|
||||
[GameMapType.StraitOfGibraltar]: [50, 40, 30],
|
||||
} as const satisfies Record<GameMapType, [number, number, number]>;
|
||||
|
||||
export abstract class DefaultServerConfig implements ServerConfig {
|
||||
|
||||
@@ -77,6 +77,8 @@ export enum GameMapType {
|
||||
FalklandIslands = "Falkland Islands",
|
||||
Baikal = "Baikal",
|
||||
Halkidiki = "Halkidiki",
|
||||
StraitOfGibraltar = "Strait of Gibraltar",
|
||||
Italia = "Italia",
|
||||
}
|
||||
|
||||
export const mapCategories: Record<string, GameMapType[]> = {
|
||||
@@ -104,6 +106,8 @@ export const mapCategories: Record<string, GameMapType[]> = {
|
||||
GameMapType.FalklandIslands,
|
||||
GameMapType.Baikal,
|
||||
GameMapType.Halkidiki,
|
||||
GameMapType.Italia,
|
||||
GameMapType.StraitOfGibraltar,
|
||||
],
|
||||
fantasy: [
|
||||
GameMapType.Pangaea,
|
||||
|
||||
@@ -47,6 +47,8 @@ const MAP_FILE_NAMES: Record<GameMapType, string> = {
|
||||
[GameMapType.FalklandIslands]: "FalklandIslands",
|
||||
[GameMapType.Baikal]: "Baikal",
|
||||
[GameMapType.Halkidiki]: "Halkidiki",
|
||||
[GameMapType.Italia]: "Italia",
|
||||
[GameMapType.StraitOfGibraltar]: "StraitOfGibraltar",
|
||||
};
|
||||
|
||||
class GameMapLoader {
|
||||
|
||||
@@ -36,12 +36,15 @@ export async function generateMap(
|
||||
`Processing Map: ${name}, dimensions: ${img.width}x${img.height}`,
|
||||
);
|
||||
|
||||
const terrain: Terrain[][] = Array(img.width)
|
||||
.fill(null)
|
||||
.map(() => Array(img.height).fill(null));
|
||||
const width = img.width - (img.width % 2);
|
||||
const height = img.height - (img.height % 2);
|
||||
|
||||
for (let x = 0; x < img.width; x++) {
|
||||
for (let y = 0; y < img.height; y++) {
|
||||
const terrain: Terrain[][] = Array(width)
|
||||
.fill(null)
|
||||
.map(() => Array(height).fill(null));
|
||||
|
||||
for (let x = 0; x < width; x++) {
|
||||
for (let y = 0; y < height; y++) {
|
||||
const color = img.getPixelRGBA(x, y);
|
||||
const alpha = color & 0xff;
|
||||
const blue = (color >> 8) & 0xff;
|
||||
|
||||
@@ -29,6 +29,8 @@ const maps = [
|
||||
"FalklandIslands",
|
||||
"Baikal",
|
||||
"Halkidiki",
|
||||
"Italia",
|
||||
"StraitOfGibraltar",
|
||||
];
|
||||
|
||||
const removeSmall = true;
|
||||
|
||||
Reference in New Issue
Block a user