From 0ca1f9efcb6b81ed4dc6661d539e3b7fe5323b08 Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Sat, 19 Nov 2022 12:58:00 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?UTF-8?q?=D1=81=D0=B0=20IDrawningObject=20=D0=B8=20=D0=B5=D0=B3=D0=BE=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?DrawningObjectLocomotive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrawningLocomotive.java | 2 +- DrawningObjectLocomotive.java | 5 +++++ IDrawningObject.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DrawningLocomotive.java b/DrawningLocomotive.java index e20d0ca..8f7e68d 100644 --- a/DrawningLocomotive.java +++ b/DrawningLocomotive.java @@ -180,7 +180,7 @@ public class DrawningLocomotive { if (strs[5] == "Simple") drawningExtra = new ExtraWheelsDraw(Integer.parseInt(strs[6]), Locomotive.getBodyColor()); if (strs[5] == "Star") drawningExtra = new ExtraStarWheelDraw(Integer.parseInt(strs[6]), Locomotive.getBodyColor()); if (strs[5] == "Round") drawningExtra = new ExtraRoundWheelDraw(Integer.parseInt(strs[6]), Locomotive.getBodyColor()); - if (drawningExtra == null) + if (drawningExtra == null) return null; if (strs.length == 7) { Locomotive = new EntityLocomotive( diff --git a/DrawningObjectLocomotive.java b/DrawningObjectLocomotive.java index 2695ed0..417cc14 100644 --- a/DrawningObjectLocomotive.java +++ b/DrawningObjectLocomotive.java @@ -39,4 +39,9 @@ public class DrawningObjectLocomotive implements IDrawningObject { { if (_locomotive != null) _locomotive.SetPosition(x, y, width, height); } + + public String getInfo(){ + if (_locomotive == null) return null; + return _locomotive.getDataForSave(); + } } diff --git a/IDrawningObject.java b/IDrawningObject.java index 80b49ff..1167973 100644 --- a/IDrawningObject.java +++ b/IDrawningObject.java @@ -8,6 +8,9 @@ public interface IDrawningObject { void MoveObject(Direction direction); /// Отрисовка объекта void DrawningObject(Graphics g); + + String getInfo(); + /// Получение текущей позиции объекта float[] GetCurrentPosition(); //0 - up