Commit Graph

338 Commits

Author SHA1 Message Date
glx22 04ee86d3ac Add: 'font' console command to configure fonts 2022-12-23 23:23:03 +01:00
larryfenn d738cd235f
Change: Automatic screenshot numbering with a filename ending in '#' (#9781) 2022-11-08 11:13:16 +00:00
Charles Pigott 9059215b3b Fix #10073: Stop truncating output of list_ai and friends commands 2022-10-10 13:42:07 +01:00
Charles Pigott 24f3022ee0 Fix #10074: list_ai console commands and friends were missing help text 2022-10-10 13:42:07 +01:00
Niels Martin Hansen c6953f13e4 Fix #9940: Print debuglevel parse errors to console when changed from console 2022-08-27 09:17:09 +02:00
Dave Shifflett 25ae42ae8a
Feature: Add/extend console commands to enable screenshot automation (#9771)
* Add: `zoomto` console command for main viewport

Similar in spirit to `scrollto`, `zoomto` takes an absolute zoom level
from the user and sets the main viewport to that level while respecting
both the absolute minimum and maximum zoom levels supported by the game
and any limitations imposed by the local client settings.

* Add: optional `instant` flag for `scrollto` command

Using this flag has two effects:

- if the user has smooth scrolling enabled, the scroll action will take
  place as if it were not enabled
- the viewport is redrawn immediately, so any successive `screenshot`
  command will actually work correctly

The original positional arguments are processed like same before.
2022-02-02 21:24:29 +00:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 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 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 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Niels Martin Hansen 5e3ed3a05e Add: Console command to list search directories for various things 2021-09-26 23:39:45 +02:00
Patric Stout 4c1ea4020d
Change: remove the ability to control "max spectators" (#9466)
Soon we will make "join game" join the game as spectator first,
so limiting the amount of spectators makes no sense anymore in
that context. Not sure it ever did make sense.
2021-08-10 20:03:13 +02:00
Patric Stout b6a116a247
Add: allow setting your server visibility to "invite-only" (#9434)
In this mode you do register to the Game Coordinator, but your
server will not show up in the public server listing. You can give
your friends the invite code of the server with which they can
join.
2021-07-11 21:57:05 +02:00
Patric Stout e4d216e44b Feature: join servers based on their invite code
This removes the need to know a server IP to join it. Invite codes
are small (~7 characters) indentifiers for servers, which can be
exchanged with other players to join the servers.
2021-07-11 20:38:42 +02:00
rubidium42 fc63432a11 Codechange: improve style/writing of IConsolePrint strings 2021-06-13 15:25:31 +02:00
rubidium42 75afd25e16 Change: do not print the '-' in front of help messages and make help messages more uniform 2021-06-13 15:25:31 +02:00
rubidium42 eb6cdadc4d Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
Also make some strings more consistent with the rest of the console strings.
2021-06-13 15:25:31 +02:00
rubidium42 efd4ba4797 Change: unify the style of console error messages and convert to fmt
Always start with a capital, do not add "ERROR: " in front of it.
2021-06-13 15:25:31 +02:00
rubidium42 de49727ae8 Change: not performing a command is worthy of an error, not a warning
If a command cannot be executed for whatever reason, it makes no sense to call it a warning. Something has been done wrong.
Also make writing of these error message consistent while changing their "type".
2021-06-13 15:25:31 +02:00
Patric Stout 849a10520c
Change: allow pause/unpause console command in single player too (#9342) 2021-06-10 20:11:50 +02:00
rubidium42 e3717ae903 Codechange: [ContentInfo] Use std::string instead of string buffers 2021-06-10 20:09:44 +02:00
rubidium42 fd95736bac Codechange: [Network] Use std::string for server side logic of kicking and banning clients 2021-05-30 00:01:49 +02:00
rubidium42 8b9f1147df Codechange: [Network] Let server changing a client name use std::string 2021-05-30 00:01:49 +02:00
rubidium42 aa5a8fe28a Codechange: use thread safe time functions
Functions like localtime, gmtime and asctime are not thread safe as they (might) reuse the same buffer. So use the safer _s/_r variant for localtime and gmtime, and use strftime in favour of asctime.
2021-05-14 23:22:29 +02:00
rubidium42 297d6e20bf Codechange: [Network] Pass passwords as std::string to the network code 2021-05-14 23:22:04 +02:00
rubidium42 98283116fa Codechange: [Network] Make company state password std::string 2021-05-14 23:22:04 +02:00
rubidium42 16437b7c0d Codechange: move client name in settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42 cc6c078dec Codechange: move hostnames in settings to std::string 2021-05-13 23:13:17 +02:00
Rubidium 495d73a67f Fix: leaking file descriptors 2021-05-10 16:03:31 +02:00
William Davis 881e1da51d
Change: Use gender-neutral pronouns in console command messages (and comments) (#9203) 2021-05-08 11:02:30 +01:00
Michael Lutz 1f159f79de Fix #9147: Delay making screenshots until the next draw tick as we may not access the video buffer from the game thread. 2021-05-02 17:57:24 +02:00
rubidium42 39c51c35f4 Fix #6598: Do not disconnect before company number validation
NetworkClientConnectGame already does a NetworkDisconnect, so no reason to do it here
2021-05-01 18:30:08 +02:00
rubidium42 3bd416bfdb Change: [Console] Show help when passing invalid company number 2021-05-01 18:30:08 +02:00
PeterN f018471b36
Cleanup: Remove old FiosList helper methods. (#9139) 2021-04-29 22:46:42 +01:00
rubidium42 a61696d6c5 Change: [Network] Encapsulate logic about the connection string to the network code (#23) 2021-04-29 20:12:11 +02:00
Patric Stout be37a2cab8 Codechange: use NetworkAddress instead of two host/port variables where possible
This also means we no longer need last_host/last_port, but can
just use a single last_joined setting.
2021-04-29 20:12:11 +02:00
Patric Stout cb2ef1ea4b Codechange: move all NetworkGameInfo related functions to a single file
It currently was a bit scattered over the place. Part of
NetworkGameInfo is also the GRF Identifiers that goes with it.
2021-04-27 20:18:53 +02:00
rubidium42 cbad518bf3 Codechange: [Network] Do not leak os_abstraction.h via network_func 2021-04-27 18:17:34 +01:00
Loïc Guilloux 888389c28d
Codechange: Use std::string in console commands/aliases registration, and std::map instead our sorted linked list (#9057)
* Codechange: Use std::string in console commands and aliases registration

* Codechange: Use std::map to register console commands

* Codechange: Use std::map to register console aliases

* Cleanup: Remove now unused function
2021-04-24 15:19:57 +02:00
rubidium42 2e0f3799a8 Change: [Network] Prevent invalid client names being sent to the server when changing it using the console/settings 2021-04-24 08:02:54 +02:00
Patric Stout 31897eaa7d Codechange: split ParseConnectionString into two functions
One also looks for a company, the other doesn't. There were more
uses of the latter than the first, leaving very weird code all
over the place.
2021-04-20 17:34:04 +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 5056e963ba Fix #8851: don't allow infinite "exec" depth in script, but limit to 10 deep
This means if you execute a script from a script from a script, ..
for more than 10 times, it bails out now. This should be sufficient
for even the most complex scripts.
2021-03-13 10:01:05 +01:00
Patric Stout 8230cd009d Fix: calling "exec" from script never returned
Example:

exec other.script
echo hello

The "echo" was never executed.
2021-03-13 10:01:05 +01: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 06a3c0cb26 Fix dddf885f: use IConsoleError to produce console errors 2021-03-04 22:23:05 +01:00
Patric Stout 8c6b5e52fd Add: allow making heightmap screenshot via console 2021-03-04 22:23:05 +01:00
Patric Stout ac5e77ea3b Feature: allow custom width/height of screenshot via console
Reworked how the screenshot command works while keeping it backwards
compatible. It can now more freely understand arguments, and has
the ability to make SC_DEFAULTZOOM screenshots.
2021-03-04 22:23:05 +01:00
SamuXarick a4035af337
Codechange: Apply coding style (#8640)
* Fix: Missing or needed spaces

* Codechange: Remove space

* Codechange: Remove space

* Codechange: More missing spaces

* Codechange: Missing spaces

* Codechange: Remove space

* Codechange: Remove space
2021-02-05 11:00:36 +01:00
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 2021-01-22 22:19:55 +01:00
glx22 07385c3662 Fix: Use the same safety checks as 'stop_ai' for 'reload_ai' 2021-01-22 22:19:55 +01:00
Jonathan G Rennison 1411f878ab
Add: Console command to dump debugging information (#8548) 2021-01-13 21:16:47 +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
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
Patric Stout 4319d31036 Fix #6468: don't store version of AIs-started-via-console in name
You can do: "startai myai.3", which starts version 3 of "myai".
This is very useful for testing save/load code between different
versions of your AI.

However, when using this syntax, the AI got saved as "myai.3" as
name of the AI, instead of "myai". This caused several problems,
like indicating to the user the AI could not be found, but still
load the AI. But in all cases, the AI never got the chance to
load the saved data, making the whole reason this exists pointless.

By splitting the name and version already in the console command,
the code becomes simpler and AIs started this way now follow the
normal flow after initialization.
2020-12-25 17:03:44 +01:00
Patric Stout dddf885fb4
Remove: console command "content select all" (#8363)
The intention of this function was that you could download
everything after a filter was applied; but this never really
took off. Instead, a select few people used this functionality
to download every available package on BaNaNaS. This is not in
the spirit of this service. Additionally, these few people were
good for 70% of the consumed bandwidth of BaNaNaS.
2020-12-07 14:48:13 +01:00
Miguel Horta 40436019fd Fix: Display banlist's indexes correctly
Bug introduced via commit ab711e6942
2020-06-08 21:56:57 +01:00
Charles Pigott 8800225bdb Fix #7993: Compile warning in kick/ban debug messages 2020-02-09 23:25:53 +00:00
Niels Martin Hansen 805ecd32be Fix 5880f147: Integer width warnings 2020-02-06 16:09:36 +00:00
Bjarni Thor 5880f1479f Feature #7756: Allow server to supply a reason to kicked/banned clients
This commit adds the missing feature of allowing the server owner to
    provide a reason for kicking/banning a client, which the client sees in
    a pop-up window after being kicked. The implementation extends the
    network protocol by adding a new network action called
    NETWORK_ACTION_KICKED that is capable of having an error string, unlike
    the other network error packages.  Additionally, the kick function
    broadcasts a message to all clients about the kicked client and the
    reason for the kick.
2020-02-04 22:17:39 +00:00
Niels Martin Hansen c8779fb311
Feature: NewGRF callback profiling (#7868)
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
2020-01-26 13:45:51 +01:00
TELK e04ca904a9 Feature: Minimap screenshot 2020-01-04 18:21:38 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +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
TELK bcc73bd40d Add: 'getsysdate' console command (#7658)
Add `getsysdate` console command to display system's local time, which is might be useful to check current time in script logging.
2019-08-04 20:35:56 +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
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 2019-04-09 22:45:15 +02:00
glx22 a1e492d0d8
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465) 2019-04-05 15:11:52 +02:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson aa7ca7fe64 Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 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
glx 8e7fe3973f Add: CompanyCtrlAction enum for CMD_COMPANY_CTRL actions 2019-02-04 21:08:36 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
Niels Martin Hansen 2a868b9f3b Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
2018-07-19 21:17:07 +02:00
adf88 56ffa35511 (svn r27914) -Fix/Feature: 'unban' console command - fix invalid help text and be more verbose 2017-09-10 14:03:29 +00:00
adf88 f3fbf6beb8 (svn r27913) -Fix: 'unban' console command was not handling IPv6 adresses properly 2017-09-10 14:02:13 +00:00
alberth 0adfb1ac6f (svn r27653) -Fix(r27647): Rename FileOperation enum and values to SaveLoadOperation to avoid nameclash with windows compiler toolkit. 2016-09-04 16:06:50 +00:00
alberth 6f201ce4a8 (svn r27651) -Codechange: Introduce methods for setting the name and title of _file_to_saveload. 2016-09-04 12:58:04 +00:00
alberth 597380e099 (svn r27650) -Codechange: Replace SaveOrLoadMode by FileOperation and DetailedFileType. 2016-09-04 12:57:43 +00:00
alberth df9a9f074a (svn r27649) -Codechange: Introduce detailed file type enum, rebuild FiosType with it. 2016-09-04 12:57:20 +00:00
alberth 75ad6d0100 (svn r27647) -Codechange: Introduce file operations, and use it to replace most of SaveLoadDialogMode 2016-09-04 12:56:23 +00:00
alberth 5969685954 (svn r27645) -Add: Give console commands their own file list storage. 2016-09-04 12:55:21 +00:00
alberth d6cd3b1605 (svn r27644) -Codechange: Split GetFiosItem into BuildFileList and FindItem, and move both to FileList. 2016-09-04 12:54:52 +00:00
alberth caf3379746 (svn r27642) -Codechange: FiosGet* file query functions take a destination file list. 2016-09-04 12:54:03 +00:00
alberth bc08fe7c5f (svn r27641) -Codechange: Fold the _fios_items file list vector into its own class. 2016-09-04 12:50:22 +00:00
alberth 2fa0fdb176 (svn r27638) -Codechange: Move FiosType enum, move and rename SetFiosType function. 2016-09-04 12:47:07 +00:00
alberth a52864ef27 (svn r27633) -Codechange: Extract _saveload_mode use from BuildFileList 2016-09-04 12:44:42 +00:00
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 2014-04-25 15:40: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
zuu a31b46ba84 (svn r26000) -Add: Optional filter parameter to the 'content state' console command, to limit the content list to only content where the name match the filter 2013-11-14 22:50:16 +00:00
zuu 9088972738 (svn r25999) -Add: When calling the 'content select' console command without args, display all selected content 2013-11-14 22:48:03 +00:00
rubidium 13855f0a09 (svn r25705) -Fix: a number of typos (inspired by 90c920601c84975acb694f3673e2beb08b013753) 2013-08-09 18:43:44 +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
frosch 870eab53d2 (svn r24807) -Add [FS#2820]: Enable usage of 'companies' console command also in singleplayer. 2012-12-09 16:53:41 +00:00
frosch 4aa17c5109 (svn r24722) -Add: Display unique ID and md5sum in console content info. 2012-11-13 21:46:09 +00:00
rubidium d8d2f74559 (svn r23741) -Revert (r23740): the few parts that the Windows / non-network compiles stumble on 2012-01-03 21:47:01 +00:00