Commit Graph

61 Commits

Author SHA1 Message Date
Patric Stout 715f8c0218
Codefix: cast to "CommandCallback *" in a way cast-function-type-mismatch doesn't mind (#12529) 2024-04-18 16:41:36 +00:00
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
merni-ns 5a88027a19
Feature: Infinite money mode (#11902) 2024-01-30 18:01:02 +00:00
Charles Pigott 1e60734660
Fix: Compilation with DEBUG_DUMP_COMMANDS enabled (#11607) 2023-12-30 17:46:32 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
dP e3169c73bd
Fix: Restore using founder client name as company manager name (#10535) 2023-03-03 16:04:02 -05:00
dP c73b88ddca
Fix: Don't send unused tile field over the network (#10507) 2023-02-24 22:50:11 +01:00
dP b5bc001d42
Codechange: Swap comments for CommandHelper::Post overloads (#10454) 2023-02-07 13:55:46 +00:00
Rubidium 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
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
frosch d9b4413bc9
Codechange: rename sound ids to make more sense. (#8701) 2021-02-20 19:01:04 +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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00: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
frosch 9aa33862a7 (svn r27571) -Codechange: Consistent naming for command callbacks which play a sound effect. 2016-05-22 10:07:48 +00:00
michi_cc 37e321044a (svn r24139) -Add: Creating a new vehicle group by drag and drop. (Based on patch by Juanjo) 2012-04-17 19:44:16 +00:00
truebrain 12aa5b6a58 (svn r23604) -Add: initial support for GameScripts 2011-12-19 20:50:54 +00:00
truebrain ae8540f5e0 (svn r23361) -Codechange: move multiplayer DoCommand callback code so other script users can call their own 2011-11-29 23:21:42 +00:00
rubidium f600429424 (svn r23215) -Codechange: stricter type safety for CommandFlags 2011-11-14 20:38:56 +00:00
rubidium 6c9078fd30 (svn r21844) -Codechange: move documentation towards the code to make it more likely to be updates [a-c]. 2011-01-18 22:17:15 +00:00
rubidium e170b1d83e (svn r21427) -Add: helper function to determine whether a command may be executed 2010-12-07 21:08:35 +00:00
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 2010-11-30 13:38:46 +00:00
smatz e3c89df398 (svn r19714) -Feature: ctrl+click on a vehicle to start/stop it 2010-04-24 20:55:51 +00:00
rubidium 5c7aaf11ba (svn r19602) -Codechange: add the name of the command to the desync logs 2010-04-11 10:11:26 +00:00
alberth 05d705e077 (svn r19494) -Codechange: Remove _error_message. 2010-03-20 17:58:24 +00:00
alberth db1c6b7a81 (svn r19423) -Codechange: Move error message reporting of industry build in SE to a callback. 2010-03-14 19:59:45 +00:00
terkhen 524a10b375 (svn r19227) -Codechange: Reorganization of parameters at CmdBuildRoadStop. 2010-02-24 21:45:23 +00:00
rubidium 4d93b704d9 (svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions 2010-01-18 22:57:21 +00:00
rubidium 2365819312 (svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos. 2010-01-11 20:39:38 +00:00
rubidium ebe99fd493 (svn r18784) -Codechange: make NetworkSend_Command accept a company instead of using _local_company to pass that information, with the whole mess when you don't want the company to be _local_company. 2010-01-11 20:32:32 +00:00