Фикс бага задания размера списка, удаление лишних строк

This commit is contained in:
Danil Malin 2022-10-18 17:42:24 +04:00
parent 9e1d8bf1ac
commit 7082b3197b
4 changed files with 3 additions and 12 deletions

View File

@ -74,8 +74,8 @@ namespace WarmlyLocomotive
FormLocomotive form = new(); FormLocomotive form = new();
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
DrawningObjectLocomotive car = new(form.SelectedLocomotive); DrawningObjectLocomotive locomotive = new(form.SelectedLocomotive);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + car != -1) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + locomotive != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();

View File

@ -42,7 +42,7 @@ namespace WarmlyLocomotive
/// <param name="map"></param> /// <param name="map"></param>
public MapWithSetLocomotivesGeneric(int picWidth, int picHeight, U map) public MapWithSetLocomotivesGeneric(int picWidth, int picHeight, U map)
{ {
int width = picWidth / _placeSizeWidth; int width = picWidth / (_placeSizeWidth + 30);
int height = picHeight / _placeSizeHeight; int height = picHeight / _placeSizeHeight;
_setLocomotives = new SetLocomotivesGeneric<T>(width * height); _setLocomotives = new SetLocomotivesGeneric<T>(width * height);
_pictureWidth = picWidth; _pictureWidth = picWidth;

View File

@ -56,7 +56,6 @@ namespace WarmlyLocomotive
/// <param name="name">Название карты</param> /// <param name="name">Название карты</param>
public void DelMap(string name) public void DelMap(string name)
{ {
// TODO Прописать логику для удаления
if (_mapStorages.ContainsKey(name)) if (_mapStorages.ContainsKey(name))
{ {
_mapStorages.Remove(name); _mapStorages.Remove(name);
@ -71,7 +70,6 @@ namespace WarmlyLocomotive
{ {
get get
{ {
// TODO Продумать логику получения объекта
if (ind != String.Empty) if (ind != String.Empty)
{ {
MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, AbstractMap> value; MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, AbstractMap> value;

View File

@ -34,8 +34,6 @@ namespace WarmlyLocomotive
/// <returns></returns> /// <returns></returns>
public int Insert(T locomotive) public int Insert(T locomotive)
{ {
// TODO вставка в начало набора
// TODO проверка на _maxCount
if (_maxCount == Count) if (_maxCount == Count)
{ {
return -1; return -1;
@ -51,8 +49,6 @@ namespace WarmlyLocomotive
/// <returns></returns> /// <returns></returns>
public int Insert(T locomotive, int position) public int Insert(T locomotive, int position)
{ {
// TODO проверка позиции
// TODO вставка по позиции
if (position < 0 || position >= Count || _maxCount == Count) if (position < 0 || position >= Count || _maxCount == Count)
{ {
return -1; return -1;
@ -67,7 +63,6 @@ namespace WarmlyLocomotive
/// <returns></returns> /// <returns></returns>
public T Remove(int position) public T Remove(int position)
{ {
// TODO проверка позиции
if (position < 0 || position >= Count) if (position < 0 || position >= Count)
{ {
return null; return null;
@ -93,8 +88,6 @@ namespace WarmlyLocomotive
} }
set set
{ {
// TODO проверка позиции
// TODO вставка в список по позиции
if (position >= 0 && position < Count) if (position >= 0 && position < Count)
{ {
_places[position] = value; _places[position] = value;