Commit Graph

125 Commits

Author SHA1 Message Date
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
merni-ns ccaa383e85
Fix #11938: Check infinite money setting in cases where it was missed (#11939) 2024-01-31 20:11:48 +01:00
dP 897b59c158
Add: [GS] Allow to set max loan for each company separately (#11224) 2024-01-30 19:15:19 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +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
Tyler Trahan 44848f4edf Add: CommandCost supports an optional second error string 2023-03-03 17:11:14 -05:00
Rubidium 1ed0b35520 Fix #10009: bad overflow protection when taking out loans 2023-01-15 12:04:50 +01:00
J0anJosep d9a37c915f Cleanup #9725: Replace cmd_helper related functions and remove cmd_helper.h. 2022-02-02 21:30:15 +01:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
Pavel Stupnikov 4b42ecb0f6
Feature: Add tile parameter for GSCompany.ChangeBankBalance to show text effect if needed (#8573) 2021-01-22 10:28:26 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Patric Stout 62cdadb582 Change: move "give money" from client-list to company window
This is a much better location for this button, as you send
money from one company to another company, not from player
to player.

This is based on work done by JGRPP in:
f820543391
and surrounding commits, which took the work from estys:
https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311

We did modify it to fix several bugs and clean up the code while
here anyway.

The callback was removed, as it meant a modified client could
prevent anyone from seeing money was transfered. The message
is now generated in the command itself, making that impossible.
2021-01-05 21:56:24 +01:00
glx22 f7e48cac87 Fix #8453: [Script] Don't truncate loan variation to 32bit 2020-12-28 16:51:15 +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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Charles Pigott 327ff89808 Codechange: Remove PauseModeByte 2019-04-29 17:40:22 +01:00
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
zuu ab69c6c2a0 (svn r25788) -Feature: [Script] Game Scripts can now charge fees and give money to companies 2013-09-21 13:07:42 +00:00
zuu 01dea4ec37 (svn r25787) -Doc: Doxygen comment was wrong 2013-09-21 10:06:23 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
zuu d219fdb875 (svn r24552) -Fix (r24537): Unpause do no longer continue scripts 2012-09-23 11:30:37 +00:00
truebrain 55de5d336c (svn r23618) -Add: ScriptGame::Pause, ScriptGame::Unpause, and ScriptGame::GetLandscape (GameScript only) 2011-12-19 20:58:59 +00:00
frosch 7bf8b1d96e (svn r22621) -Fix: When asking the user to confirm an unsafe unpausing, there is no need to execute a command if 'no' is choosed. This also prevents crashing when clicking unpause while the confirm window is shown. 2011-07-02 17:40:39 +00:00
rubidium 5286de116b (svn r22028) -Cleanup: remove traces of a debugging "feature" that got disabled a long time ago 2011-02-08 20:47:48 +00:00
rubidium 1d0d7635e0 (svn r22021) -Fix (r22019): ofcourse make doesn't notice files are gone, so it doesn't recompile everything that needs to be recompiled... 2011-02-07 22:49:38 +00:00
frosch ed4f806f1d (svn r20283) -Codechange: Unify start of doygen comments. 2010-08-01 19:22:34 +00:00
frosch 1d3adb2b66 (svn r19931) -Fix (r19914): Convert assertion in Backup<> destructor into DEBUG() output. It was triggered on exceptions, especially when aborting world generation. 2010-06-05 12:16:12 +00:00
frosch 406c2a9865 (svn r19930) -Codechange: Deduplicate magic command parameter casts. (rubidium) 2010-06-05 11:51:34 +00:00
frosch 9db3cde73a (svn r19914) -Codechange: Wrap a helper class around temporary assignments of _current_company to ensure proper restoration. 2010-05-31 20:22:57 +00:00
yexo 879057de25 (svn r19684) -Fix [FS#3779]: don't show an error message when trying to give another client an amount of 0 money 2010-04-20 18:02:08 +00:00
frosch 77486ee8d2 (svn r19658) -Fix: One could turn transport companies into credit banks. 2010-04-17 14:57:49 +00:00
yexo 8165737939 (svn r19544) -Feature [FS#3496]: add an input box to the AI Debug window where you can input a break string (patch by Zuu) 2010-04-02 17:35:20 +00:00
alberth f05a8635fd (svn r19483) -Codechange: Code layout fixes, and parentheses reduction. 2010-03-20 15:30:57 +00:00
rubidium 74ffe8647f (svn r18732) -Codechange: move the company related commands of misc_cmd.cpp to company_cmd.cpp 2010-01-05 17:11:56 +00:00
rubidium b00a5f1069 (svn r18330) -Cleanup: remove some unneeded includes 2009-11-28 20:35:25 +00:00
rubidium 2a1cab4d46 (svn r18052) -Codechange/Fix: make the 'pause' chat message when actually executing the pause command. This to prevent showing paused and especially unpaused to be shown when the state doesn't change. Output now mentions whether pause changes keep the game paused and what reasons for pausing there 'currently' are. 2009-11-12 20:33:30 +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 3f2dce581e (svn r18050) -Codechange: disallow 'pause on join' paused when not in a network game 2009-11-12 17:44:49 +00:00
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 2009-10-04 17:16:41 +00:00
rubidium 04d5b67eb6 (svn r17567) -Fix: some doxygen warnings 2009-09-18 14:23:58 +00:00