Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: orderlist Importing / Exporting. #678

Closed
wants to merge 11 commits into from

Conversation

lucaFiorini
Copy link

@lucaFiorini lucaFiorini commented Mar 26, 2024

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:

  • Incomplete GUI integration (current test orderlist is imported via a hardcoded json string)
  • No omission for some default-value fields during export
  • More output- fields need to be added to enanche readability
  • Importing is only limited to data which can fit into an order's Pack()
  • No separation between human-editable and pure data fields
  • No version number output
  • Virtually no error checking (this is a prototype)

Checklist for review

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

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@lucaFiorini lucaFiorini changed the title [Draft] Feature: rderlist Importing / Exporting. [Draft] Feature: orderlist Importing / Exporting. Mar 26, 2024
@lucaFiorini
Copy link
Author

Addresses #675

@lucaFiorini
Copy link
Author

lucaFiorini commented Mar 26, 2024

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
  1. Implement error-checking by adding error-lables to the orderlist instead of orders if anything goes wrong

@lucaFiorini
Copy link
Author

lucaFiorini commented Mar 26, 2024

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 lucaFiorini marked this pull request as draft March 26, 2024 19:07
@lucaFiorini lucaFiorini changed the title [Draft] Feature: orderlist Importing / Exporting. Feature: orderlist Importing / Exporting. Mar 26, 2024
@lucaFiorini
Copy link
Author

reopened as pull request here #679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant