beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
200 stars 98 forks source link

`Spring.SetSquareBuildingMask` has poor x/z interface #1186

Open sprunk opened 8 months ago

sprunk commented 8 months ago

Bill of materials to be done before starting this ticket:


It requires you to scale the x/z parameters by 16 (i.e. Game.buildSquareSize) manually. This requirement is obscure and mistake prone. You should be able to specify the actual x/z you want to affect without having to take internal implementation details into account.

lhog commented 8 months ago

Well our x/z interface is not consistent for example: SetMetalAmount() operates on double-square coordinates, while SetMapSquareTerrainType() uses world coordinates. I think we can harmonize everything to use world coordinates, but I don't know how to make this transition smooth.

sprunk commented 8 months ago

Perhaps a new set of interfaces with consistent names? SetPositionBuildMask, SetPositionMetalAmount, SetPositionTerrainType.

lhog commented 8 months ago

Good idea!