прверка на повторяющиеся ключи в словаре

This commit is contained in:
ityurner02@mail.ru 2022-10-09 19:26:24 +04:00
parent 40f345bcb8
commit d60cbc96e5

View File

@ -42,7 +42,7 @@ namespace AntiAircraftGun
/// <param name="map">Карта</param> /// <param name="map">Карта</param>
public void AddMap(string name, AbstractMap map) public void AddMap(string name, AbstractMap map)
{ {
_mapStorages.Add(name, new MapWithSetAntiAircraftGunsGeneric<DrawingObjectAntiAircraftGun, AbstractMap>(_pictureWidth, _pictureHeight, map)); if(!_mapStorages.ContainsKey(name)) _mapStorages.Add(name, new MapWithSetAntiAircraftGunsGeneric<DrawingObjectAntiAircraftGun, AbstractMap>(_pictureWidth, _pictureHeight, map));
} }
/// <summary> /// <summary>
/// Удаление карты /// Удаление карты