diff --git a/Locomotives/Locomotives/SetLocomotivesGeneric.cs b/Locomotives/Locomotives/SetLocomotivesGeneric.cs index 08f13cc..4acfef9 100644 --- a/Locomotives/Locomotives/SetLocomotivesGeneric.cs +++ b/Locomotives/Locomotives/SetLocomotivesGeneric.cs @@ -27,6 +27,18 @@ public bool Insert(T locomotive) { // TODO проверка на наличие свободных мест + T testLocomotive = _places[0]; + for (int i = 0; i < Count; i++) + { + if (_places[i] == null) + { + testLocomotive = _places[i]; + } + } + if (testLocomotive != null) + { + return false; + } for (int i = Count - 2; i >= 0; i--) { _places[i + 1] = _places[i];