Veilheim/Map/PortalsOnMap.cs
/// <summary>
///     Add and remove pins on minimap based on the internal list
/// </summary>
Add and remove pins on minimap based on the internal list
Add and remove pins on minimap based on the internal list
public static void UpdateMinimap()
        {
            List<Minimap.PinData> copy;
            lock (portalPins)
            {
                copy = portalPins.ToList();
            }
            foreach (var pin in copy)
            {
                var foundPin = Minimap.instance.m_pins.FirstOrDefault(x => x.m_pos == pin.m_pos && x.m_type == pin.m_type);
                if (foundPin == null)
                {
                    Minimap.instance.AddPin(pin.m_pos, pin.m_type, pin.m_name, pin.m_save, pin.m_checked);
                }
                else if (foundPin.m_name != pin.m_name)
                {
                    Minimap.instance.RemovePin(foundPin);
                    Minimap.instance.AddPin(pin.m_pos, pin.m_type, pin.m_name, pin.m_save, pin.m_checked);
                }
            }
            foreach (var pin in Minimap.instance.m_pins.Where(x => !x.m_save && x.m_type == Minimap.PinType.Icon4).ToList()
                .Where(pin => Minimap.instance.m_locationPins.Values.All(x => x.m_pos != pin.m_pos)).Where(pin => copy.All(x => x.m_pos != pin.m_pos)))
            {
                Minimap.instance.RemovePin(pin);
            }
        }
public static void UpdateMinimap ( ) { List < Minimap . PinData > copy ; lock ( portalPins ) { copy = portalPins . ToList ( ) ; } foreach ( var pin in copy ) { var foundPin = Minimap . instance . m_pins . FirstOrDefault ( x => x . m_pos == pin . m_pos && x . m_type == pin . m_type ) ; if ( foundPin == null ) { Minimap . instance . AddPin ( pin . m_pos , pin . m_type , pin . m_name , pin . m_save , pin . m_checked ) ; } else if ( foundPin . m_name != pin . m_name ) { Minimap . instance . RemovePin ( foundPin ) ; Minimap . instance . AddPin ( pin . m_pos , pin . m_type , pin . m_name , pin . m_save , pin . m_checked ) ; } } foreach ( var pin in Minimap . instance . m_pins . Where ( x => ! x . m_save && x . m_type == Minimap . PinType . Icon4 ) . ToList ( ) . Where ( pin => Minimap . instance . m_locationPins . Values . All ( x => x . m_pos != pin . m_pos ) ) . Where ( pin => copy . All ( x => x . m_pos != pin . m_pos ) ) ) { Minimap . instance . RemovePin ( pin ) ; } }
Add and remove pins on minimap based on the internal list
Add and remove pins on minimap based on the internal list
// Pin not on map, add // Pin name change, remove and add new // remove all teleporter pins (type 4, position in copy list)