1
0
Fork 0
Commit Graph

29490 Commits (dc26e407043e3e347e71a78ab17d7f45ecebbc5f)
 

Author SHA1 Message Date
Michal Charemza dc26e40704
Add: [Console] schedule command to execute a script file later
The change in https://github.com/OpenTTD/OpenTTD/pull/10655, released as part
of OpenTTD 14, changed how auto saving works from every X amount of game time,
to every X amount of real time. This is an improvement for normal play, but
there are cases where saving every X amount of game time is useful. For example
when developing and comparing AIs, or using OpenTTD to conduct experiments such
as via https://github.com/michalc/OpenTTDLab which extracts data from savegame
files.

This change adds a general "schedule" console command that makes it possible
for a console script to be scheduled for the future, where that script can, for
example, contain a "save" command to save the game. That script can also then
reschedule itself or another script, and thus making it possible to re-create
the pre-OpenTTD 14 behaviour of saving the game every X amount of game time.
(Possibly with a whole "suite" of game scripts that call each other in a chain,
each of them hard coded with a different filename to allow all the savegames to
be saved with different names, but that's a doable detail)

The current change only allows scheduling "on-next-calendar-month", since that
is my specific use case, but the syntax is hopefully friendly to this being
extended in the future. And by scheduling any console script, it is much more
general and so hopefully useful than just for saving games.

There was some discussion on what this should be called at
https://discord.com/channels/142724111502802944/1008473233844097104/1247278039927361546
(as well as some issues with an alternatively proposed solution using game
scripts at https://github.com/OpenTTD/OpenTTD/pull/12750). Instead of
"schedule", "trigger" was suggested for something to only be called once, but
after writing code and output to the user, it didn't make it immediately clear
that "trigger" means "once at some point in the future", and seemed too close
to "exec". Also I think "schedule" can be used _both_ for one-off or repeated
events in the future (in English it's common to say to "schedule an
appointment", even if it's just the one).

Or code-wise:

schedule on-next-calendar-month my.scr (the only current behaviour)
schedule every-calendar-month my.scr (possible future behaviour?)
schedule "* 1 * *" my.scr (possible future cron-like behaviour?)

Possible future extensions could include some mechanism for cancelling
something that has been scheduled, and I have no reason to think that mechanism
would be different for something scheduled to repeat or just as a one-off, so I
think also it makes sense to that we would have the one command for both.

The new "schedule" command:

- Only allows a single script to be scheduled - any (correct) usage of the
  "schedule" command will overwrite the previous, but hopefully the console
  messages make this clear
- Only allows a script to be scheduled once at the start of next month (but
  this could be extended if useful).
- Does not offer a way to unschedule, but hopefully since the script can only
  be scheduled to run once in the future, and relatively close in the future
  (at the start of next month), this shouldn't be too much of an annoying missing
  feature.

Co-authored-by: Patric Stout <github@truebrain.nl>
2024-07-01 09:51:38 +01:00
translators 8c7cf3bc75 Update: Translations from eints
chinese (simplified): 1 change by WenSimEHRP
french: 5 changes by ottdfevr, 1 change by ben20471
2024-07-01 04:42:17 +00:00
steve-goldman f5f488e778
Change: improve when to stops following vehicle (#12808)
- Changing zoom no longer stops following vehicle
- Key scrolling while following a vehicle stops following
- Autoscrolling while following a vehicle stops following
- Main viewport can begin following a vehicle at any zoom
2024-07-01 01:13:47 +02:00
Jeremy Gao 9e14f989f9
Fix: Wrong punctuation in Simplified Chinese (#12717) 2024-06-30 22:54:02 +00:00
translators b5f2004c26 Update: Translations from eints
norwegian (bokmal): 5 changes by eriksorngard
lithuanian: 3 changes by khamper
french: 3 changes by ben20471
2024-06-30 04:41:28 +00:00
Rubidium 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
translators 3819ab25bf Update: Translations from eints
norwegian (bokmal): 5 changes by eriksorngard
galician: 12 changes by pvillaverde
korean: 31 changes by telk5093
dutch: 14 changes by Afoklala
portuguese: 19 changes by azulcosta
2024-06-29 04:42:54 +00:00
Jonathan G Rennison dc258ecbe0 Fix #12825: Crash when opening road toolbar in scenario editor
Due to attempt to access missing road waypoint button
2024-06-28 21:30:38 +02:00
translators 95f2bec9a9 Update: Translations from eints
greek: 14 changes by gh658804
polish: 36 changes by pAter-exe
2024-06-28 04:42:00 +00:00
Peter Nelson a288644e20
Fix #12815, 7e914a0568: Fallback detection failed with sprite font. (#12816)
How missing glyphs were detected was changed, but the sprite font still substituted `?`, which to missing glyph looked like all characters are present.
2024-06-27 07:34:01 +01:00
translators da4b3bebee Update: Translations from eints
english (au): 2 changes by krysclarke
english (us): 2 changes by 2TallTyler
chinese (simplified): 2 changes by WenSimEHRP
russian: 2 changes by Ln-Wolf
finnish: 25 changes by hpiirai
portuguese (brazilian): 2 changes by pasantoro
2024-06-27 04:44:27 +00:00
glx22 564397645f Codefix: [CI] dubious ownership for emscripten 2024-06-26 23:02:27 +02:00
glx22 b52f778f20 Codefix: [Win32] Use correct range for version in rc file 2024-06-26 23:02:27 +02:00
Tyler Trahan 5ed2fcfb53 Change: Don't use house construction states in Scenario Editor 2024-06-26 16:27:02 -04:00
Tyler Trahan 06bd47af4f Revert d8771b3: Construction stage wrong for all houses 2024-06-26 16:27:02 -04:00
Patric Stout 21813fbe8b
Fix #12818: during Hostile Takeover, profit was calculated wrongly (#12819) 2024-06-26 14:19:53 +00:00
Peter Nelson 209b0320d5
Fix #12735: Default fonts should use default font size as-is. (#12814)
Minimum readable font size should only apply to fallback and configured fonts.
2024-06-26 12:45:39 +01:00
translators 88e53dbdc8 Update: Translations from eints
english (au): 10 changes by krysclarke
swedish: 13 changes by joeax910
english (us): 10 changes by 2TallTyler
chinese (simplified): 14 changes by WenSimEHRP
russian: 6 changes by Ln-Wolf
catalan: 14 changes by J0anJosep
latvian: 15 changes by lexuslatvia
portuguese (brazilian): 12 changes by pasantoro
2024-06-26 04:44:08 +00:00
Joan Josep a873a952aa
Codefix: Reorder comments of HasPowerOnRoad/Rail and IsCompatibleRail. (#12813) 2024-06-25 17:22:53 -04:00
rubidium42 d3c7b1015c Codefix cff48c0f6: unused variable remained after refactor 2024-06-25 22:26:37 +02:00
Steve Goldman 705207e2ce Add: Town window zoom with mouse wheel 2024-06-25 20:48:20 +02:00
Steve Goldman a23ff227e7 Add: Industry window zoom with mouse wheel 2024-06-25 20:48:07 +02:00
Edmond Chui ff3be45c23 Add: Toggle for showing industry names in small map 2024-06-25 20:43:28 +02:00
translators a1e94ccddb Update: Translations from eints
english (au): 2 changes by krysclarke
norwegian (bokmal): 2 changes by eriksorngard
english (us): 2 changes by 2TallTyler
russian: 2 changes by Ln-Wolf
finnish: 2 changes by hpiirai
french: 2 changes by ottdfevr
portuguese (brazilian): 2 changes by pasantoro
polish: 2 changes by pAter-exe
2024-06-25 04:41:42 +00:00
Tyler Trahan 9936b3728a
Change: Don't explain what "toggle" means in tooltips (#12805) 2024-06-24 16:28:58 -04:00
Jonathan G Rennison a43dacd988 Add: NewGRF custom road waypoint support 2024-06-24 22:12:08 +02:00
Jonathan G Rennison c35a5e5cb1 Change: Add variable ground types for road waypoints 2024-06-24 22:12:08 +02:00
Jonathan G Rennison eebd5e47db Add: Road waypoint default graphics 2024-06-24 22:12:08 +02:00
Jonathan G Rennison 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Jonathan G Rennison c6387c7784 Codechange: Use filter template struct for nearby station type filtering 2024-06-24 22:12:08 +02:00
Jonathan G Rennison 05b65703d3 Codechange: Increase size of StationType field in map array
Move can station have wires bit to make room
2024-06-24 22:12:08 +02:00
Steve Goldman 72276e2d3c Add: Vehicle window zoom with mouse wheel 2024-06-24 21:56:26 +02:00
Steve Goldman c3a051a213 Codechange: Referencing enum for 'scroll_mode' setting in gui_settings.ini 2024-06-24 21:56:26 +02:00
Steve Goldman c53ed9fad6 Codechange: Creating enum for 'scrollwheel_scrolling' setting 2024-06-24 21:56:26 +02:00
translators e8be933ee6 Update: Translations from eints 2024-06-24 04:42:12 +00:00
Peter Nelson e802c1a97f
Add: Show count of towns and industries in their directory window captions. (#12800)
These windows now show "(<visible> of <total>)" in the caption.
2024-06-23 17:55:37 +01:00
Peter Nelson 7116f143d5
Codefix: Hole in vehicle list window if dimensions are not as expected. (#12803)
The layouts for these windows assume that push buttons and dropdowns are the same height.
2024-06-23 08:14:06 +01:00
translators 97e9442d5e Update: Translations from eints
norwegian (bokmal): 32 changes by eriksorngard
galician: 2 changes by pvillaverde
2024-06-23 04:42:04 +00:00
Peter Nelson 91fd082e93
Fix: Apply widget's internal padding to scrollbar capacity/position. (#12801)
For non-WWT_MATRIX widgets, scrollbars need to take account of the internal padding used for the widget.

This is not normally noticeable as framerect padding is only 2 extra pixels
2024-06-22 15:42:13 +00:00
Björn Wärmedal e0bcb54a4b
Change: Allow bribing local authority when other company has exclusive rights (#12763) 2024-06-22 07:51:03 -04:00
translators 49d47b3b74 Update: Translations from eints
greek: 2 changes by gh658804
dutch: 2 changes by Afoklala
lithuanian: 4 changes by khamper
french: 9 changes by Lishouuu
2024-06-22 04:40:41 +00:00
translators 64781df29f Update: Translations from eints
english (us): 2 changes by 2TallTyler
2024-06-21 04:43:18 +00:00
translators e3e215b249 Update: Translations from eints
german: 3 changes by Wuzzy2
portuguese (brazilian): 4 changes by pasantoro
2024-06-20 04:41:06 +00:00
translators 2dab9ac7a5 Update: Translations from eints
swedish: 4 changes by joeax910
catalan: 2 changes by J0anJosep
2024-06-19 04:42:11 +00:00
Peter Nelson b56775f576
Codechange: Avoid making copies of intermediate layout runs. (#12796)
The vector of runs is not used after it is passed to the ParagraphLayout class, so pass with std::move to avoid an unnecessary copy.
2024-06-17 22:58:52 +01:00
Peter Nelson 731c56d116
Codefix: Add missing `const` inside script functions. (#12794)
Scripts do not modify items directly, marking them const enforces this.
2024-06-17 07:19:56 +01:00
translators 7db70f9c3f Update: Translations from eints
english (au): 2 changes by krysclarke
norwegian (bokmal): 6 changes by eriksorngard
korean: 3 changes by telk5093
russian: 2 changes by Ln-Wolf
finnish: 3 changes by hpiirai
portuguese: 2 changes by azulcosta
portuguese (brazilian): 2 changes by pasantoro
polish: 5 changes by pAter-exe
2024-06-17 04:43:34 +00:00
Tyler Trahan e3156546fa
Codefix: Don't claim to allocate new waypoint when just checking (#12792) 2024-06-16 16:07:57 -04:00
Peter Nelson 2f54904bab
Codefix: Incorrect indentation of NWidgetParts in load/save windows. (#12791)
Fix to use the "standard" layout of 1 tab for nesting widgets and 2 tabs for attributes that wrap on to the next line.
2024-06-16 18:54:19 +01:00
ladysadie 2bc3cc5b67
Codechange: Compiler check for _fios_colours/DetailedFileType (#12781) 2024-06-16 08:54:41 +02:00