baschi29 / streetlife

For educational purposes
GNU General Public License v3.0
3 stars 0 forks source link

[cleanUp] Cars should only be saved in one place, no possibleCars-Array etc #44

Open Dachgruber opened 2 years ago

Dachgruber commented 2 years ago

Currently the cars/objects get saved in lots of different places. Split Frogs/Animals from Cars/Traffic-Objects and save them in one place in the model. Then, only reference to the names of said save point

baschi29 commented 2 years ago

I don't quite understand, do you mean the saving method? Because all StreetObjects only exist in the StreetObjects Array List in the model and nowhere else.

Dachgruber commented 2 years ago

Currently, when adding a new possible car to the model, you need to:

1.) add the car-name to Controller.addMovingObjects() 2.) add the actual car to the method above 3.) add the car name to Controller.initatePossibleCars() 4.) add the car name to View.getImg()

It should be possible to reduce the amount of steps needed, maybe by introducing one enum for all the car names (so that strings arent used to find the right car to add etc) and doing some general cleanup. Essentially for the future as other vehicle types and animal types are (possibly) planned.

Dachgruber commented 2 years ago

The possible cars with the stats etc could also be loaded froma CSV file, but this is another idea for the future