diff --git a/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java b/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java index 4eb6a8b..9bec88c 100644 --- a/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java +++ b/ProjectElectricLocomotive/src/CollectionGenericObjects/LocomotiveDepotService.java @@ -41,17 +41,16 @@ public class LocomotiveDepotService extends AbstractCompany @Override protected void SetObjectsPosition() { if (locCoord == null || _collection == null) return; - int row = 1, col = 1; - for (int i = 0; i < _collection.getCount(); i++, col++) - { - if(_collection.get(i) == null) continue; + int row = countInRow, col = 1; + for (int i = 0; i < _collection.getCount(); i++, col++) { + if (_collection.get(i) == null) continue; _collection.get(i).SetPictureSize(_pictureWidth, _pictureHeight); - _collection.get(i).SetPosition(locCoord.get(row * countInRow - col).getKey() + 5, locCoord.get(row * countInRow - col).getValue() + 5); - if (col == countInRow) - { + _collection.get(i).SetPosition(locCoord.get((row - 1) * countInRow + (col - 1)).getKey() + 5, locCoord.get((row - 1) * countInRow + (col - 1)).getValue() + 5); + if (col == countInRow) { col = 0; - row++; + row--; } } } + } diff --git a/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java b/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java index 4256d97..8c51498 100644 --- a/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java +++ b/ProjectElectricLocomotive/src/CollectionGenericObjects/SpecialGenerateLocomotive.java @@ -24,7 +24,7 @@ public class SpecialGenerateLocomotive