Commit Graph

114 Commits

Author SHA1 Message Date
Rubidium eda10abc8c Codechange: pass command line arguments as std::span to openttd_main 2024-04-11 21:57:53 +02:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Patric Stout 3e625b5b1a
Add: track savegame size to report with survey (#12304) 2024-03-16 08:58:56 +01:00
Patric Stout 0dfba564ab
Add: "restart current" console command to regenerate the map based on current settings (#11963) 2024-02-03 14:48:54 +00:00
Patric Stout a0c480c4e4
Change: "restart" now uses your newgame settings, where "reload" uses the current settings (#11962) 2024-02-03 10:19:47 +00:00
rubidium42 27082f9efa Codechange: pass std::string references to OpenBrowser 2023-11-29 02:02:30 +01:00
Patric Stout 7634553d22 Feature: opt-in survey when exiting a game
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.

When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU

All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
Patric Stout f5fad88723
Change: base autosaves intervals on real time (instead of game time) (#10655)
There are two fundamental issues with autosave:
- When fast-forwarding, it saves way too often
- When paused, it never saves

Both makes no sense. Autosaves are meant to prevent you from
accidentally losing your work. The emphasis on "your" work.

To solve both issues, the autosave now works on real time. You
can select every 10 / 30 / 60 / 120 minutes, which are similar to
what the setting was in game-months.

When you pause, autosaving will stop. Unless you make any change
to the game; then it will continue to make autosaves, even so
the game is paused. Unpausing / pausing resets this mechanism.
2023-04-27 15:21:29 +00:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
Patric Stout c12a152ec9
Fix: thread safety issue during exiting the game (#9380)
_exit_game is read by the draw-thread to know when to exit, but
most of the time written by the game-thread.
2021-06-17 18:58:59 +02:00
rubidium42 05394d5216 Fix #6598: Prevent invalid memory accesses when abandoning a join from within a network game
One could join a network game from within an already running network game. This would call a NetworkDisconnect, but keeps the UI alive. If, during that process the join is aborted, e.g. by cancelling on a password dialog, you would still be in your network game but also get shown the server list.
Solve all the underlying problems by falling back to the main UI when (re)connecting to a(nother) server.
2021-05-01 18:30:08 +02:00
rubidium42 c4bccd4f70
Fix #8874: show a warning when a NewGRF scan is requested multiple times from the console (#9022) 2021-04-12 20:53:04 +02:00
Patric Stout 970fedd78c Add: make modal windows update more smooth
Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.

This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.

It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).

Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
2021-03-10 13:41:18 +01:00
Patric Stout 760b0cdc11 Change: change console command "restart" and add "reload"
The current "restart" command is now called "reload", as that is
what it does.
The old "restart" command is now called "restart", as that is what
it did.

As this has not been in any official release yet, this shouldn't
harm any kitten.
2021-01-11 20:11:08 +01:00
Jonathan G Rennison 0c5dc5d41e Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)
Check if the job is still running two date fract ticks before it is due
to join, and if so pause the game until its done.
When loading a game, check if the game would block immediately due to
a job which is scheduled to be joined within two date fract ticks,
and if so pause the game until its done.
This avoids the main thread being blocked on a thread join, which appears
to the user as if the game is unresponsive, as the UI does not repaint
and cannot be interacted with.
Show if pause is due to link graph job in status bar, update network
messages.
This does not apply for network clients.
2020-12-22 15:17:57 +01:00
Patric Stout c66bd18a10
Add: save openttd.cfg immediately on changing a setting (#8358)
Formally it was only done on exit. This means that if it crashes
changes in settings were not stored. This is often rather
frustrating. Additionally, targets (like emscripten) where people
are unlike to use "Exit Game", will never see their configuration
stored.

The drawback is that on every setting change there is some minor
I/O of writing the ini file to disk again.
2020-12-13 16:28:06 +01:00
Berbe 8f3d1ec970 Feature: Improve restart command
When the restart command is issued, a normal map is always spawned.

This improvement takes into account the current state of _file_to_saveload to check if a savegame/scenario/heightmap was previously loaded, and loads the same resource again.
2020-09-24 19:17:18 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott 327ff89808 Codechange: Remove PauseModeByte 2019-04-29 17:40:22 +01:00
rubidium 5b2a5ac790 (svn r25506) -Document: a function, and name it slightly better 2013-06-28 21:11:35 +00:00
truebrain 55de5d336c (svn r23618) -Add: ScriptGame::Pause, ScriptGame::Unpause, and ScriptGame::GetLandscape (GameScript only) 2011-12-19 20:58:59 +00:00
rubidium b231e80125 (svn r23470) -Codechange: move declaration of SwitchToMode to a header instead of declaring it in 6 other files 2011-12-10 08:31:14 +00:00
rubidium 02b884d923 (svn r23244) -Feature: if the installation is ananas, try to get the b without b installed 2011-11-17 21:17:17 +00:00
planetmaker 3fb66890ee (svn r22708) -Feature [FS#4701]: Display option to hide competitors' signs and station names (Zuu) 2011-08-01 18:41:21 +00:00
alberth f1cae9960f (svn r22512) -Add: Save heightmap. 2011-05-28 13:55:34 +00:00
alberth c8cbc8ef97 (svn r22507) -Doc: Document SwitchMode. 2011-05-28 09:56:14 +00:00
alberth 990ec6f0a9 (svn r22460) -Doc: Semantic documentation fixes, and doxygen additions (partly by planetmaker). 2011-05-14 18:38:54 +00:00
planetmaker 914f8e9f1d (svn r22080) -Doc: Add doxygen comments to a few functions and improve a few existing comments 2011-02-14 19:52:26 +00:00
rubidium ec9e0690eb (svn r22014) -Codechange: move some more functions out of functions.h 2011-02-07 22:15:46 +00:00
rubidium 7eadf07e44 (svn r21894) -Cleanup: get rid of the unused SM_START_SCENARIO 2011-01-22 23:08:18 +00:00
rubidium 398418b8fa (svn r19812) -Codechange: give some unnamed enums a name or, in case they consisted of unrelated values use static const (u)int 2010-05-13 09:44:44 +00:00
smatz 53aaabe6e9 (svn r19507) -Codechange: remove semicolon after DECLARE_POSTFIX_INCREMENT and DECLARE_ENUM_AS_BIT_SET 2010-03-23 22:25:43 +00:00
rubidium 36a20894aa (svn r18141) -Fix (r18051): one couldn't (easily) continue a game in single player that was 'not enough players'/'waiting on join'-paused 2009-11-17 14:06:28 +00:00
rubidium 934e6a295d (svn r18051) -Codechange: make the active clients pause use a separate bit in the pause mode 2009-11-12 17:46:04 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
rubidium ba4fd897b8 (svn r17097) -Fix [FS#3092] (r13256): make restart command work again and make the help show how it works and how it doesn't work 2009-08-06 22:00:32 +00:00
rubidium 65d4d8b46c (svn r16949) -Codechange: unify the way the DisplayOption enums are written 2009-07-25 10:54:42 +00:00
rubidium 2664f2a2d9 (svn r16242) -Codechange: rework pausing
-Fix [FS#2864]: autopause and manual pausing conflict with eachother
-Fix: new game + pause on new game + autopause make the game not unpause on the first join
2009-05-06 15:06:57 +00:00
yexo 3bb872e7dd (svn r15576) -Codechange: rename SwitchModes to SwitchMode and don't hardcode the values for that enum. 2009-02-25 00:45:52 +00:00
yexo 901230bde1 (svn r15575) -Codechange: Rename GameModes to GameMode and store _game_mode as GameMode instead of as byte. 2009-02-25 00:14:46 +00:00
rubidium 1ddfdda02c (svn r13370) -Codechange: move the VARDEF stuff from openttd.h to variables.h so one doesn't need to include openttd.h before variables.h. 2008-06-03 08:06:58 +00:00
rubidium 22d7b25296 (svn r13322) -Codechange: _no_scroll belongs more with the window code. 2008-05-29 11:13:11 +00:00
rubidium 34e2d8f1e1 (svn r13320) -Codechange: move some enums from openttd.h to more logical locations. 2008-05-29 09:54:47 +00:00
rubidium cd7c99452f (svn r12989) -Codechange: move ViewportSign to viewport_type.h. 2008-05-07 13:18:33 +00:00
rubidium 7ccda80b0b (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers. 2008-05-07 09:07:19 +00:00
rubidium d03994098b (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description. 2008-05-06 15:11:33 +00:00
rubidium 8ca1035316 (svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number. 2008-05-04 09:39:16 +00:00
rubidium 161b588631 (svn r12784) -Codechange: handle the asynchronious save 'handlers' in saveload.cpp instead of openttd.cpp. 2008-04-19 10:18:38 +00:00
rubidium dde68e922a (svn r12779) -Codechange: remove a few constants from openttd.h. 2008-04-18 21:49:38 +00:00
rubidium 93d59fe448 (svn r12476) -Codechange: split type engine related types from engine.h (and openttd.h) to engine_type.h. 2008-03-28 18:00:38 +00:00