Editing (game port, OpenTTDClient): a core of JGRPP's scheduled dispatch DoCommands — set_scheduled_dispatch (enable/disable), add/remove schedule, add/remove/clear slots, and set duration/start date. Adds the command IDs to protocol.py. Viewing (admin, OpenTTDAdminClient.get_dispatch): the GameScript API has no dispatch support, so a new server patch (docker/patches/0002-*) adds read-only GSOrder.GetScheduledDispatch* / IsScheduledDispatchEnabled getters, an AdminBridge GameScript get_dispatch handler exposes them, and get_dispatch() returns the live schedules and slots (mirrors get_timetable). Note: set_dispatch_start_date values are normalised by the engine relative to current game time, so they read back offset from the requested value. Includes unit + e2e tests, a demo in main.py, and protocol/timetable docs. The AdminBridge GameScript and the patched OpenTTD-patches clone live outside this repo; the 0002 patch file is the durable source for the latter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.9 KiB
Markdown
37 lines
1.9 KiB
Markdown
# Local JGRPP patches
|
|
|
|
The `docker/OpenTTD-patches/` directory is an **untracked** clone of
|
|
[JGRennison/OpenTTD-patches](https://github.com/JGRennison/OpenTTD-patches) checked out at tag
|
|
`jgrpp-0.71.1`. The patches in this directory are the local modifications this project needs on
|
|
top of that tag; they are the durable source of truth (the clone itself is not committed).
|
|
|
|
Current patches:
|
|
|
|
- `0001-Add-GameScript-API-timetable-getters-to-ScriptOrder.patch` — adds read-only timetable
|
|
getters (`GetTimetableWaitTime`, `GetTimetableTravelTime`, `IsWaitTimetabled`,
|
|
`IsTravelTimetabled`, `IsWaitFixed`, `IsTravelFixed`, `GetLeaveType`, `GetTimetableMaxSpeed`,
|
|
`GetTimetableLateness`, `GetTimetableStartTick`, `GetCurrentOrderTime`,
|
|
`GetTimetableTotalDuration`) to the `GSOrder` GameScript class. Required by the AdminBridge
|
|
GameScript's `get_timetable` command and the Python client's
|
|
`OpenTTDAdminClient.get_timetable()`.
|
|
|
|
- `0002-Add-GameScript-API-scheduled-dispatch-getters-to-Scr.patch` — adds read-only scheduled
|
|
dispatch getters (`GetScheduledDispatchScheduleCount`, `IsScheduledDispatchEnabled`,
|
|
`GetScheduledDispatchDuration`, `GetScheduledDispatchStartTick`, `GetScheduledDispatchDelay`,
|
|
`GetScheduledDispatchReuseSlots`, `GetScheduledDispatchSlotCount`,
|
|
`GetScheduledDispatchSlotOffset`, `GetScheduledDispatchSlotFlags`) to the `GSOrder` GameScript
|
|
class. Required by the AdminBridge GameScript's `get_dispatch` command and the Python client's
|
|
`OpenTTDAdminClient.get_dispatch()`.
|
|
|
|
## Applying after a fresh clone
|
|
|
|
```bash
|
|
git clone --branch jgrpp-0.71.1 https://github.com/JGRennison/OpenTTD-patches docker/OpenTTD-patches
|
|
git -C docker/OpenTTD-patches am ../patches/*.patch
|
|
```
|
|
|
|
Then build the image as usual (`docker-compose up -d --build` from `docker/`).
|
|
|
|
If the clone is updated past `jgrpp-0.71.1`, `git am` may conflict — the patches were generated
|
|
against that tag and need rebasing in that case.
|