cinderblocks / libremetaverse

An fork of the libopenmetaverse library striving for performance improvements and up-to-date compatibility with SL/OS/Halcyon
BSD 3-Clause "New" or "Revised" License
60 stars 40 forks source link

Add support of region size info (ie, varregion) #85

Closed Misterblue closed 11 months ago

Misterblue commented 1 year ago

This adds the fields RegionSizeX and RegionSizeY to the Simulator class and the logic to collect that information from the new region messages. If the region size info is not supplied in the event messages (like in SL), the region size is defaulted to Simulator.DefaultRegionSizeX (or Y) which is 256.

The OpenSimulator message that contain the region size are LoginResponse, EnableSimulator, TeleportFinishMessage, and CrossedRegionMessage. These are all event messages. The binary, UDP packet versions of these messages do not contain the region size info so old, old, old sims might not get the correct info.

Also added the display of the region size in the TestClient "regioninfo" command.

zangetsu-oe commented 1 year ago

I think you are missing a change to size of the Simulator.Terrain Array initialization in the Simulator Constructor.

if (client.Settings.STORE_LAND_PATCHES)
{
    Terrain = new TerrainPatch[16 * 16]; // something like: new TerrainPatch[SizeY /16 * SizeX /16];
    WindSpeeds = new Vector2[16 * 16];
}