JGRennison / OpenTTD-patches

OpenTTD - http://www.openttd.org/ - with additional patches
Other
572 stars 130 forks source link

Feature: orderlist Importing / Exporting. #678

Closed lucaFiorini closed 6 months ago

lucaFiorini commented 6 months ago

Motivation / Problem

Long order lists on complex networks are hard to manage, some external tools have been created to help with scheduling but the game has no common data format through which order lists can be exchanged.

Furthermore, in multiplayer games especially, it is often quite beneficial to test a new vehicle's schedule or perform a complete rescheduling of all your services in single player or a in different save and then re-import it in the main save/mp game.

Lastly, this system can proove effective when adding a new service to already busy routes, as it allows users to stitch together different orderlists that will come pre-loaded with the correct travel times for each section.

Description

This is a proof-of concept and this PR is created only as a way to discuss this feature.

Allows users to Import or Export their orderlists to a unified JSON format.

This allows for easier managment of large complicated order lists with their associated schedule dispatches and travel times creates a common format to import/export oder lists to and from external programs.

Limitations

Current issues:

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

lucaFiorini commented 6 months ago

Addresses #675

lucaFiorini commented 6 months ago

Planned next steps:

  1. Complete orderlist importing

  2. Fix GUI

  3. Re-write orderlist importing functions to work as follows:

    • Order::FromJSON will return an Order object instead of adding the order to an orderlist
    • OrderList::FromJSON will:
      1. Take a vehicle pointer as a parameter and it will empty it's orderlist
      2. Add all orders found by Order::FromJSON to the orderlist by using CmdInsertOrderIntl() as a command (TODO: implement command properly)
      3. If the scheduled dispatch data is found in the json, replace all of the vehicle's schedules
  4. Implement error-checking by adding error-lables to the orderlist instead of orders if anything goes wrong

lucaFiorini commented 6 months ago

I am looking for someone to help me with completing orderlist importing, as I am trying to trigger out how the serializer works to allow the encoding of an order object. I can't find any working examples as it seems like it's never been used, and I haven't managed to trigger out how it works on my own yet

lucaFiorini commented 6 months ago

reopened as pull request here #679