Page 1 of 1

Spring.GetGroundExtreme & in-game heightmap changes

Posted: 31 Jan 2015, 23:38
by zoggop
I posted this as a mantis bug, but jK is certain Spring.GetGroundExtremes() is fine under all circumstances. To me it appears that Spring.GetGroundExtremes() returns the extremes of the heightmap when it's first loaded only. If the heightmap is changed with lua functions such as Spring.AdjustHeightMap(), or deformed by explosions in such a way as to create a new minimum or maximum, Spring.GetGroundExtremes() will return the same values as it did when the map loaded.

Attached is a screenshot showing a height at cursor of 92, yet a gadget prints the minimum height from Spring.GetGroundExtremes as 108. The height is 92 after a BA commander explosion.

here's the gadget used to test:

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Loony: Heightmap Test",
    desc      = "heightmap test.",
    author    = "zoggop",
    date      = "January 2015",
    license   = "whatever",
    layer     = 10,
    enabled   = true
   }
end

-- synced --------------------------------------------------------------------

if gadgetHandler:IsSyncedCode() then 

function gadget:UnitCreated()
  Spring.Echo(Spring.GetGroundExtremes())
end

end
am i doing something wrong?

Re: Spring.GetGroundExtreme & in-game heightmap changes

Posted: 31 Jan 2015, 23:48
by Kloot
Not at all, your description of the problem is accurate.

In 99.0 the current extrema will be available as the third and fourth return values of GetGroundExtremes.

Re: Spring.GetGroundExtreme & in-game heightmap changes

Posted: 31 Jan 2015, 23:50
by zoggop
ah, excellent. i was just reporting something that's already been addressed then