Commit Graph

234 Commits

Author SHA1 Message Date
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 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 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 4fc055d6e9 Codechange: Align parameter order of command callbacks to command handlers. 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 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
dP 39662aabef
Add: allow gamescripts to build neutral objects (#9568) 2021-09-25 13:39:40 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
peter1138 c56fce70b4 Codechange: Replace CMD_SET_GROUP_REPLACE_PROTECTION with generic CMD_SET_GROUP_FLAG. 2021-04-22 22:57:00 +02:00
dP bab7de6cf2 Feature: Allow GameScripts to add additional text to Industry view window 2021-01-22 09:50:53 +00:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
Niels Martin Hansen b7751c483e
Feature: Influence industry production changes from GS (#7912) 2020-12-22 14:21:31 +01:00
frosch d8182b7e15 Change: Allow command cost-estimation while paused. 2020-06-18 08:59:27 +01:00
Niels Martin Hansen 800ade7702
Feature: Push-buttons on storybook pages (#7896)
Allow more direct player-initiated interaction for Game Scripts, by letting the GS put push-buttons on storybook pages. These buttons can either trigger an immediate event, or require the player to first select a tile on the map, or a vehicle.

Additionally this reworks how the storybook pages are layouted and rendered, to allow for slightly more complex layouts, and maybe speeding drawing up a bit.
2020-05-22 22:22:55 +02:00
Pavel Stupnikov d7a928a08b Feature: GS method to control engine availability for a specific company (#7791)
* Feature: GS method to allow company to use an engine before its introduction date

* Feature: GS method to retire an engine early for a specific company
2020-01-15 18:46:26 +01:00
Niels Martin Hansen f401622149 Feature: Script API to change town rating of companies 2020-01-04 19:07:13 +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
Max Maton e4414471dd Add: Allow GameScript to demolish without a company
This allows GameScripts to shrink towns as well as grow them.
2019-09-08 10:09:19 +02:00
glx22 b3fd787959 Fix #7188: check the validity of command callback for scripts (#7701) 2019-09-07 17:37:01 +01:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02: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
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00: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
Peter Nelson b1e40b6b56 Fix #7151: Hang when concurrently starting AIs in multiplayer, or with shift pressed. 2019-02-05 14:49:04 +01:00
PeterN 23960d0f2c Feature: Group liveries, and livery window usability enhancements. (#7108)
* Change: Replace checkbox in livery selection window with Default option in drop down selection.

This reduces clutter in the UI and allows for primary/secondary colours to independently follow the default scheme if desired.

* Feature: Add vehicle group liveries.
2019-01-31 14:57:44 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
Pavel Stupnikov 8e4bce58ea Feature: GS methods to scroll viewport for players (#6745) 2018-04-24 19:19:00 +02:00
alberth f72ad87540 (svn r26802) -Add: Command to set visibility of an engine for a company (based on patch by Juanjo). 2014-09-07 16:12:58 +00:00
frosch b996c24387 (svn r26716) -Fix: CMD_CLEAR_ORDER_BACKUP should not be suppressed by pause modes. 2014-08-03 14:26:32 +00: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
peter1138 567d0ff3a7 (svn r26450) -Feature: Hierarchical vehicle subgroups. 2014-04-08 21:09:06 +00:00
frosch a32d18cbb9 (svn r26371) -Fix [FS#5831]: Calling DoCommandP during the gameloop cleared pending persistent storage changes. 2014-02-23 22:03:08 +00:00
zuu 1dbd59e6ab (svn r26306) -Add: [nogo] More story APIs: RemovePageElement, GetCompany, GetDate, SetDate 2014-02-06 19:48:19 +00:00
zuu 425197a19c (svn r26299) -Fix: [nogo] CmdRemoveStoryPage does not use the string parameter 2014-02-06 19:03:04 +00:00
frosch ba1779b978 (svn r26241) -Codechange: Remember the GRFFile which filled the TextRefStack in the TextRefStack. 2014-01-12 18:00:39 +00:00
frosch eca86d1baf (svn r26174) -Codechange: Rename BaseStorageArray to BasePersistentStorageArray 2013-12-23 18:09:03 +00:00
rubidium 168fa4129d (svn r26092) -Fix [FS#5818]: prevent scripts from crashing OpenTTD when they send text with command codes to user editable texts such as sign and station names 2013-11-24 19:46:16 +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 67ab3108d6 (svn r25785) -Feature: [Script] Allow AIs and GS to found towns. Allow GS to rename towns 2013-09-19 18:48:05 +00:00