Index: ps/trunk/binaries/data/mods/public/maps/random/danubius_triggers.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/danubius_triggers.js +++ ps/trunk/binaries/data/mods/public/maps/random/danubius_triggers.js @@ -500,7 +500,7 @@ let ungarrisonLeft = false; let ungarrisonRight = false; - let mapSize = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain).GetTilesPerSide() * 4; + let mapSize = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain).GetMapSize(); for (let ent of Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetNonGaiaEntities()) { Index: ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js +++ ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -135,7 +135,7 @@ let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain); if (cmpTerrain) - ret.mapSize = 4 * cmpTerrain.GetTilesPerSide(); + ret.mapSize = cmpTerrain.GetMapSize(); // Add timeElapsed let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); Index: ps/trunk/binaries/data/mods/public/simulation/components/UnitMotionFlying.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/UnitMotionFlying.js +++ ps/trunk/binaries/data/mods/public/simulation/components/UnitMotionFlying.js @@ -106,7 +106,7 @@ this.hasTarget = false; this.landing = false; // summon planes back from the edge of the map - var terrainSize = cmpTerrain.GetTilesPerSide() * 4; + var terrainSize = cmpTerrain.GetMapSize(); var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); if (cmpRangeManager.GetLosCircular()) { Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitMotionFlying.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitMotionFlying.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitMotionFlying.js @@ -71,7 +71,7 @@ AddMock(entity, IID_Terrain, { "GetGroundLevel": () => 4, - "GetTilesPerSide": () => 5 + "GetMapSize": () => 20 }); AddMock(entity, IID_WaterManager, { Index: ps/trunk/source/simulation2/components/CCmpTerrain.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpTerrain.cpp +++ ps/trunk/source/simulation2/components/CCmpTerrain.cpp @@ -102,6 +102,11 @@ return (u16)tiles; } + virtual u32 GetMapSize() const + { + return GetTilesPerSide() * TERRAIN_TILE_SIZE; + } + virtual u16 GetVerticesPerSide() const { ssize_t vertices = m_Terrain->GetVerticesPerSide(); Index: ps/trunk/source/simulation2/components/ICmpTerrain.h =================================================================== --- ps/trunk/source/simulation2/components/ICmpTerrain.h +++ ps/trunk/source/simulation2/components/ICmpTerrain.h @@ -52,6 +52,11 @@ */ virtual u16 GetVerticesPerSide() const = 0; + /** + * Returns the map size in metres (world space units). + */ + virtual u32 GetMapSize() const = 0; + virtual CTerrain* GetCTerrain() = 0; /** Index: ps/trunk/source/simulation2/components/ICmpTerrain.cpp =================================================================== --- ps/trunk/source/simulation2/components/ICmpTerrain.cpp +++ ps/trunk/source/simulation2/components/ICmpTerrain.cpp @@ -25,4 +25,5 @@ DEFINE_INTERFACE_METHOD_CONST_2("GetGroundLevel", entity_pos_t, ICmpTerrain, GetGroundLevel, entity_pos_t, entity_pos_t) DEFINE_INTERFACE_METHOD_CONST_2("CalcNormal", CFixedVector3D, ICmpTerrain, CalcNormal, entity_pos_t, entity_pos_t) DEFINE_INTERFACE_METHOD_CONST_0("GetTilesPerSide", u16, ICmpTerrain, GetTilesPerSide) +DEFINE_INTERFACE_METHOD_CONST_0("GetMapSize", u32, ICmpTerrain, GetMapSize) END_INTERFACE_WRAPPER(Terrain) Index: ps/trunk/source/simulation2/system/ComponentTest.h =================================================================== --- ps/trunk/source/simulation2/system/ComponentTest.h +++ ps/trunk/source/simulation2/system/ComponentTest.h @@ -212,6 +212,11 @@ return 16; } + virtual u32 GetMapSize() const + { + return GetTilesPerSide() * TERRAIN_TILE_SIZE; + } + virtual u16 GetVerticesPerSide() const { return 17;