sh4rkman / SquadCalc

A Minimalist Squad Mortar Calculator
https://squadcalc.app
MIT License
26 stars 2 forks source link

The 'name' attr in MAPS objects had side effects #142

Closed peter5he1by closed 1 month ago

peter5he1by commented 2 months ago

Hey, sh4rkman.

Before the heightmap function updated, the only thing used to find the map file path is the mapURL attribute in MAPS object array.

And I was translating this project and sharing with players in my country without any masquerading, just by modifying the name attribute.

But now the way to find heightmap path is affecting by the name attribute. Is there any way to optimize this for internationalization?

I think adding an attribute like 'id' for inner use is better.

Thanks for your work and love, again. This project is awesome.

sh4rkman commented 2 months ago

Hi !

I can see the problem, would it work for you if i rename every heightmap files "heightmap.webp" and change the way i load them by replacing :

new squadHeightmap("maps"+ map.mapURL + map.name.toLowerCase() + ".webp", imageBounds, this)

with :

new squadHeightmap("maps"+ map.mapURL + "heightmap.webp", imageBounds, this)

That way you can continue to edit maps.js with chinese map names without breaking everything.

sh4rkman commented 2 months ago

That being said, i'll need to do some proper internalization one day. Probably in the next months.

peter5he1by commented 1 month ago

Yeah, it works. :)

I'll keep this temporarily. Expecting your commits~

sh4rkman commented 1 month ago

fixed with bfff285f4e18f941cea8ec26b0d2ee3beb4cba86