Fixed essue

This commit is contained in:
ENDORFIT 2024-04-06 22:04:56 +04:00
parent 2894298cd5
commit 867bed0c7c
2 changed files with 10 additions and 2 deletions

6
ProjectMonorail/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -16,6 +16,7 @@ public class DrawingModernMonorail {
public EntityModernMonorail getMonorail() {return _entityMonorail;} public EntityModernMonorail getMonorail() {return _entityMonorail;}
public DrawingWheels getWheels() {return _wheels;} public DrawingWheels getWheels() {return _wheels;}
private int _wheelsSeed;
public void Initialization(int speed, float weight, Color bodyColor, Color additionalColor, boolean monorailTrack, boolean cabin) public void Initialization(int speed, float weight, Color bodyColor, Color additionalColor, boolean monorailTrack, boolean cabin)
{ {
@ -24,6 +25,7 @@ public class DrawingModernMonorail {
_wheels = new DrawingWheels(); _wheels = new DrawingWheels();
Random rnd = new Random(); Random rnd = new Random();
_wheels.SetCountWheels(2 + rnd.nextInt(0, 3)); _wheels.SetCountWheels(2 + rnd.nextInt(0, 3));
_wheelsSeed = rnd.nextInt(0, 2);
} }
public boolean SetPictureSize(int width, int height) public boolean SetPictureSize(int width, int height)
@ -165,7 +167,7 @@ public class DrawingModernMonorail {
} }
else if (coordinatesX.length == 3) { else if (coordinatesX.length == 3) {
Random rnd = new Random(); Random rnd = new Random();
if (rnd.nextInt(0, 2) == 1) { if (_wheelsSeed == 1) {
coordinatesX[2] = _startPositionX + 25; coordinatesX[2] = _startPositionX + 25;
} }
else { else {
@ -221,7 +223,7 @@ public class DrawingModernMonorail {
} }
else if (coordinatesX.length == 3) { else if (coordinatesX.length == 3) {
Random rnd = new Random(); Random rnd = new Random();
if (rnd.nextInt(0, 2) == 1) { if (_wheelsSeed == 1) {
coordinatesX[2] = _startPositionX - 35 + offset; coordinatesX[2] = _startPositionX - 35 + offset;
} }
else { else {