Page MenuHomeWildfire Games

Implement GetTerrainTileSize function, allowing rmgen code to parse footprint sizes of templates
ClosedPublic

Authored by elexis on Nov 23 2017, 7:31 PM.

Details

Summary

As requested in rP20396 / D900, template footprint sizes can be used to test for entity collisions.
Since the simulation templates use the metres coordinate system, but the map the tile grid system, expose the conversion factor as an rmgen constant, allowing that use case.

Test Plan

cpp part doesn't look like it could use a const, does it? warn(TERRAIN_TILE_SIZE);.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Nov 23 2017, 7:31 PM
elexis added inline comments.Nov 23 2017, 7:35 PM
source/graphics/MapGenerator.cpp
25 ↗(On Diff #4343)

alphabetic order, can fix when committing.

281 ↗(On Diff #4343)

The CMapGeneratorWorker functions above LoadScripts are public, the ones below aren't. Can remove the newline too if prefered.

Vulcan added a subscriber: Vulcan.Nov 23 2017, 8:10 PM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Executing section Default...
Executing section Source...
Executing section JS...
s0600204 accepted this revision.Nov 23 2017, 8:40 PM

Looks good, and works as expected, thank you.

binaries/data/mods/public/maps/random/rmgen/library.js
18 ↗(On Diff #4343)

g_TerrainTileSize? (If you're wanting globals to have a g_Foo style)

This revision is now accepted and ready to land.Nov 23 2017, 8:40 PM

Thanks for the review.

binaries/data/mods/public/maps/random/rmgen/library.js
18 ↗(On Diff #4343)

If it was GUI code I would certainly agree.
I really couldn't convince myself of using it here though.

In rP20437 I have even used Elevation_ExcludeMin_IncludeMax.

In this case it would be the first engine constant that would not use upper case.

I believe those constants won't be used that often and the case could be changed afterwards without too much hassle. At least.

elexis added inline comments.Nov 23 2017, 9:53 PM
binaries/data/mods/public/maps/random/rmgen/library.js
16 ↗(On Diff #4343)

s/relative to/used\ by
s/the mapsize/getMapSize

source/graphics/MapGenerator.cpp
112 ↗(On Diff #4343)

(moving 2 lines below for consistency)

This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Nov 23 2017, 9:55 PM