Veilheim/Map/SharedMapSystem.cs
/// <summary>
///     Apply exploration data to local map (server and client)
/// </summary>
/// <param name="mapData"></param>
Apply exploration data to local map (server and client)
Apply exploration data to local map ( server and client )
public static void ApplyMapData(ZPackage mapData)
        {
            try
            {
                var isServer = ZNet.instance.IsServerInstance();
                mapData.SetPos(0);
                using (var gz = new ZlibStream(mapData.m_stream, CompressionMode.Decompress))
                {
                    using (var br = new BinaryReader(gz))
                    {
                        var state = br.ReadBoolean();
                        var idx = 0;
                        while (idx < Minimap.instance.m_explored.Length)
                        {
                            var count = br.ReadInt32();
                            while (count > 0)
                            {
                                if (state && !isServer)
                                {
                                    ExploreLocal(idx % Minimap.instance.m_textureSize, idx / Minimap.instance.m_textureSize);
                                }
                                else if (state)
                                {
                                    Minimap.instance.m_explored[idx] |= state;
                                }
                                idx++;
                                count--;
                            }
                            state = !state;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogError($"Application of mapdata gone wrong.{Environment.NewLine}{ex.Message}{Environment.NewLine}{ex.StackTrace}");
                Logger.LogError("Texture size: " + Minimap.instance.m_textureSize);
            }
        }
public static void ApplyMapData ( ZPackage mapData ) { try { var isServer = ZNet . instance . IsServerInstance ( ) ; mapData . SetPos ( 0 ) ; using ( var gz = new ZlibStream ( mapData . m_stream , CompressionMode . Decompress ) ) { using ( var br = new BinaryReader ( gz ) ) { var state = br . ReadBoolean ( ) ; var idx = 0 ; while ( idx < Minimap . instance . m_explored . Length ) { var count = br . ReadInt32 ( ) ; while ( count > 0 ) { if ( state && ! isServer ) { ExploreLocal ( idx % Minimap . instance . m_textureSize , idx / Minimap . instance . m_textureSize ) ; } else if ( state ) { Minimap . instance . m_explored [ idx ] |= state ; } idx ++ ; count -- ; } state = ! state ; } } } } catch ( Exception ex ) { Logger . LogError ( $" Application of mapdata gone wrong. { Environment . NewLine } { ex . Message } { Environment . NewLine } { ex . StackTrace } " ) ; Logger . LogError ( " " + Minimap . instance . m_textureSize ) ; } }
Apply exploration data to local map (server and client)
Apply exploration data to local map ( server and client )
// Use local helper to prevent enqueuing again for sending
mapData
ZPackage
None