Commit Graph
77 Commits
Author SHA1 Message Date
Cyprian KlimaszewskiandGitHub d490243c7f Codechange: Use ExtractCommandCost instead of std::get<0>. (#15542) 2026-05-26 20:00:29 +01:00
Rubidiumandrubidium42 6370859c7e Codechange: add missing documentation to destructors 2026-02-24 16:24:53 +01:00
Rubidiumandrubidium42 269633f77b Codechange: document network (adjacent) parameters/return types 2026-02-16 16:34:06 +01:00
Rubidiumandrubidium42 c7468a6922 Codechange: add missing @param and @return 2026-02-15 22:14:37 +01:00
Rubidiumandrubidium42 a42ba2493e Codefix: too many or too few documented parameters 2026-01-29 23:38:32 +01:00
Rubidiumandrubidium42 79588cbfe3 Codefix: CommandProc does not exist, so remove any references 2026-01-29 23:38:32 +01:00
Rubidiumandrubidium42 7d70d70e0e Codefix: remove unused parameter 2026-01-29 23:38:32 +01:00
Rubidiumandrubidium42 4adf494ebc Codechange: enum-class-ify Commands 2026-01-28 23:32:51 +01:00
glx22andLoïc Guilloux 95b913bbb7 Codechange: Check command callbacks registration even in single player 2025-12-21 16:24:24 +01:00
Cyprian KlimaszewskiandGitHub 99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
Rubidiumandrubidium42 49ef3eee13 Codechange: replace char* with std::string_view 2025-04-27 20:08:02 +02:00
Peter NelsonandGitHub a87b804386 Fix #13760: Store encoded error message inside CommandCost. (#13764)
Encoded error message was previously static to avoid memmory allocation, however this causes complications.
2025-03-15 20:09:11 +00:00
Peter NelsonandGitHub 04708736d9 Codechange: Use EnumBitSet for CommandFlags. (#13560) 2025-02-15 09:36:20 +00:00
Rubidiumandrubidium42 c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter NelsonandGitHub b653f875b0 Codechange: Space between template and < (#13278)
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Peter NelsonandGitHub 1e77fd0b61 Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
2024-12-08 18:02:30 +00:00
Patric StoutandGitHub 715f8c0218 Codefix: cast to "CommandCallback *" in a way cast-function-type-mismatch doesn't mind (#12529) 2024-04-18 16:41:36 +00:00
Rubidiumandrubidium42 bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
merni-nsandGitHub 5a88027a19 Feature: Infinite money mode (#11902) 2024-01-30 18:01:02 +00:00
Charles PigottandGitHub 1e60734660 Fix: Compilation with DEBUG_DUMP_COMMANDS enabled (#11607) 2023-12-30 17:46:32 +00:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
dPandGitHub e3169c73bd Fix: Restore using founder client name as company manager name (#10535) 2023-03-03 16:04:02 -05:00
dPandGitHub c73b88ddca Fix: Don't send unused tile field over the network (#10507) 2023-02-24 22:50:11 +01:00
dPandGitHub b5bc001d42 Codechange: Swap comments for CommandHelper::Post overloads (#10454) 2023-02-07 13:55:46 +00:00
Rubidiumandrubidium42 fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
Michael Lutz dd93244853 Fix: The first tile in commands received from a client wasn't validated properly. 2022-07-08 22:37:41 +02:00
Michael Lutz 2e39637db2 Codechange: Don't use a global for the 'not enough cash' message. 2021-12-16 22:28:32 +01:00
Michael Lutz 3e85e833a7 Codechange: Add support for additional command result values. 2021-12-16 22:28:32 +01:00
Michael Lutz 8503854655 Codechange: Pass unpacked command arguments to command callbacks (except Script). 2021-12-16 22:28:32 +01:00
Michael Lutz d85348b1d1 Codechange: Template the command callback function type to allow unpacked arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz de45a8729c Codechange: Add DoCommand::Post specialization for commands that take no TileIndex.
This adds a new Post overloads that still take a TileIndex which
is used to place any error windows or text effects.
2021-12-16 22:28:32 +01:00
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2021-12-16 22:28:32 +01:00
Michael Lutz ccefa76a46 Codechange: Template DoCommandPInternal. 2021-12-16 22:28:32 +01:00
Michael Lutz eab18f06a4 Codechange: Pass additional data as byte stream to command callbacks. 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 e740c24eb7 Codechange: Template DoCommand 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 c88b104ec6 Codechange: Use wrapper struct to automatically manage command depth tracking. 2021-12-16 22:28:32 +01:00
Michael Lutz 996b16de70 Codechange: Use lambdas instead of CommandContainer to manage station picker commands. 2021-12-16 22:28:32 +01:00
Michael Lutz a05fd7aa50 Change: [Network] Transfer command data as serialized byte stream without fixed structure.
The data will be transmitted as the length followed by the serialized data. This allows the command
data to be different for every command type in the future.
2021-12-16 22:28:32 +01:00
Michael Lutz 123c7f99c3 Codechange: Move command callback declarations to the cmd header files. 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 a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 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
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
rubidium42andrubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
froschandGitHub d9b4413bc9 Codechange: rename sound ids to make more sense. (#8701) 2021-02-20 19:01:04 +01:00
Patric StoutandPatric 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:
https://github.com/JGRennison/OpenTTD-patches/commit/f82054339124cc6b89c5f4f9dac2d9da62f0108b
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
S. D. CloudtandCharles Pigott 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry WilsonandMichael Lutz 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