Opened 6 years ago

Last modified 5 years ago

#4939 new defect

Always use tile coordinates in rmgen instead of sometimes using fractions

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Maps Keywords:
Cc: Patch:

Description

Few functions in rmgen request fractional coordinates (0...1) rather than coordinates on the tilegrid.

For once, it should be uniform in order to make it as simple as possible.

Secondly, using tile coordinates everywhere has the advantage that one can use

  • absolute sizes like 10 without having to use fractionToTiles
  • scaleByMapSize

and one can confirm sizes by counting polygons in the wireframe view.

Also in the light of #4845, a Vector2D should be used ideally whenever coordinates are passed, rather than x and z individually, allowing to use the vector operations to simplify the math and reducing the number of arguments.

Luckily these are only very few instances.

Change History (4)

comment:1 by elexis, 6 years ago

In 20871:

paintRiver cleanup.

Pass vectors, refs #4845.
Pass tile sizes rather than percent numbers of the map, refs #4939.
Replace some water- and land-functions with more common createArea+RectPlacer and paintTerrainBasedOnHeight calls.

Implement getMapBounds to make references easier to read, refs #4854 (and thus less error-prone, refs rP20465).
Move height constants to the top of the files.

Fix Aegean Sea, English Channel and Danubius fadeWidth off by factor of 2 in rP20185.
Fix forgotton clWater in unknown_common of rP20866 and move that createUnknownObjects call to common.

comment:2 by elexis, 6 years ago

In 20882:

Merge all playerX and playerZ arrays into one array of Vector2D items.

This way random map scripts can do vector math and pass the result to library functions that do further vector math on them and leave shorter code, refs #4845.
Pass tilegrid coordinates rather than percent numbers to the playerbase functions too, refs #4939.
Some more mapCenter calls, refs #4854.

comment:3 by elexis, 6 years ago

In 20911:

Cleanup volcano sizes, refs #4939.

in reply to:  description comment:4 by FeXoR, 5 years ago

Replying to elexis:

Few functions in rmgen request fractional coordinates (0...1) rather than coordinates on the tilegrid.

I guess you mean relative coordinates to the map size (map size being the length unit) compared to absolute coordinated in tiles (tile width as length units) which can still be fractions and do not correspond to a specific tile (as I would understand "tile coordinate", though they get to be on a specific tile, the one with floored coordinates)?

Yea, great changes so far. Thanks!

Last edited 5 years ago by FeXoR (previous) (diff)
Note: See TracTickets for help on using tickets.