Commit graph

18777 commits

Author SHA1 Message Date
furo a87db4f026 Move tele cursor behaviour to /tc and /telecursor 2023-11-30 22:34:36 +01:00
furo 7a6e368b7f Scale TargetX and TargetY with camera zoom 2023-11-30 22:34:36 +01:00
Robert Müller 1d7c0fad49 Check SHA256 of downloaded maps and community icons
Add `CHttpRequest::ExpectSha256` function to specify expected SHA256 for HTTP downloads. If the download completes with a different SHA256 hash than expected, then the download fails and the file is deleted.

Closes #7485.
2023-11-30 21:31:48 +01:00
Robert Müller 159ddf5534 Refactor config manager, move config variable handling
Move all code for handling of config variables from console to config manager. The console no longer depends on the config manager, instead the config manager now depends on the console.

Add `struct`s to manage config variables of different types (int, color and string). The config manager now keeps a list of all config variables, so usage of the preprocessor can be avoided except for code to initially create all config variables. Additionally, a separate list of just the game config variables (config variables with `CFGFLAG_GAME`) is kept to optimize the `ResetGameSettings` function, as this function is called whenever connecting to a server and should be fast. Previously, this function was even less efficient because it preformed a linear search for every individual game config variable to find the respective command data.

Move console commands that opperate only on config variables (`reset`, `toggle` and `+toggle`) to config manager. Ensure that these commands only opperate on the desired config variables (client or server, respectively) by checking `IConsole::FlagMask`.

Add `IConfigManager::SetReadOnly` function to set/unset config variables as read-only instead of manually overriding the command handlers for the `sv_rescue` and `sv_test_cmds` config variables. This also fixes that read-only config variables could still be changed by using the `reset` command. A console message is now printed when trying to change a read-only config variable. Removing the special handling for these two config variables is additionally useful so the console does not need to keep a pointer to config values and manager.

Use a `CHeap` for the config variables, their help texts and the previous values of string config variables to avoid many separate allocations as well usage of static variables. Also use the heap to store the unknown commands instead of using `std::string`s.

Properly trigger command chain when resetting config variables with the `reset` command and when resetting game settings on map loading. Closes #7461.

Format default value for color variables as RGB/RGBA hex with dollar sign prefix. Closes #5523.

Add log message when using `reset` with a variable that does not exist. Use `log_error` instead of `dbg_msg` when saving config file fails.

Support unlimited number of config save callbacks instead of at most 16. The code also becomes more readable by using an `std::vector` instead of a fixed-size array and a separate num variable.

Consistently name `MACRO_CONFIG_*` parameters when declaring the macros.

Add `IConsole::CMDLINE_LENGTH` constant to represent the maximum length of the console input and thereby reduce usage of magic numbers for buffer sizes.
2023-11-30 20:26:00 +01:00
Dennis Felsing 1cf80edb2a
Merge pull request #7561 from Robyt3/Console-Minor-Fixes
Also print command in console when identical to previous
2023-11-30 11:10:37 +00:00
Robert Müller a1eb0ddd4c Also print command in console when identical to previous
The command currently being executed was not being printed to the console if it's identical to the previous history entry.
2023-11-29 20:42:23 +01:00
Robert Müller 1c2903b0b4 Remove unused enum literal MAX_PRINT_CB 2023-11-29 20:42:23 +01:00
Edgar 8ae5f89933
Merge pull request #7554 from 0xfaulty/russian_fix
updated russian.txt
2023-11-29 09:28:15 +00:00
Edgar 308a2bb242
Merge pull request #7558 from Robyt3/Kernel-Macro-Cleanup
Remove unused `ver` parameter of `MACRO_INTERFACE`
2023-11-29 09:20:40 +00:00
Robert Müller 5aa9003180 Remove unused ver parameter of MACRO_INTERFACE 2023-11-28 21:46:03 +01:00
Valentin Bashkirov a55a69620e updated russian.txt 2023-11-27 14:14:57 +01:00
Dennis Felsing 0213535dd8
Merge pull request #7550 from Robyt3/CI-Rustup-Remove-Default
Remove unnecessary `rustup default 1.48.0` in non-fancy Linux CI
2023-11-26 21:35:09 +00:00
Robert Müller fc8728bcb3
Merge pull request #7551 from furo321/align-vote-menu
Fix alignment of buttons in vote menu.
2023-11-26 18:51:04 +00:00
furo fd6c4ecbea Fix alignment of buttons in vote menu. 2023-11-26 19:33:42 +01:00
Robert Müller e7f4be1023 Remove unnecessary rustup default 1.48.0 in non-fancy Linux CI
The old default version causes linking errors for the tests in the non-fancy Linux CI, i.e. with Ubuntu 20.04.
2023-11-26 17:57:17 +01:00
furo eff6361c38 Add settings for info messages 2023-11-26 17:30:49 +01:00
furo 2cb948a57b Add finish info messages. 2023-11-26 17:29:40 +01:00
furo cb53c45f8c Rename killmessages to infomessages 2023-11-26 17:29:40 +01:00
Dennis Felsing c90899cc29
Merge pull request #7549 from Robyt3/Memheap-Refactoring
Refactor `CHeap`
2023-11-26 13:36:30 +00:00
Robert Müller 591c08cf34 Use static_casts instead of C style, remove unnecessary casts 2023-11-26 13:40:01 +01:00
Robert Müller 7a142df580 Move variable declarations closer to usages 2023-11-26 13:29:02 +01:00
Robert Müller ec6d7b48bf Use nullptr instead of 0x0 2023-11-26 13:20:56 +01:00
Robert Müller 41d2c80f21 Add templated CHeap::Allocate function
Add a templated `CHeap::Allocate` function to simplify memory allocation of objects using `CHeap`. The function uses perfect forwarding to construct objects with the specified arguments.
2023-11-26 13:09:23 +01:00
Robert Müller c00fb01c29
Merge pull request #7540 from archimede67/pr-chat-options
Added possibility to edit chat size and width
2023-11-26 11:43:30 +00:00
Corantin H fee9b986fb Added possibility to edit chat size and width. Refactored chat preview code. 2023-11-26 12:27:56 +01:00
Dennis Felsing 3e2f8f8a44
Merge pull request #7543 from Robyt3/Console-Interface-Cleanup
Minor refactoring of `IConsole`
2023-11-25 22:21:40 +00:00
Dennis Felsing 0601794801
Merge pull request #7547 from Robyt3/Server-Nameban-Clan
Also apply name bans to clans, trim space from clans, refactor name bans, move code to separate class `CNameBans`
2023-11-25 22:18:46 +00:00
Dennis Felsing b480a1840b
Merge pull request #7546 from Robyt3/Config-Variables-Merge
Move config variables to `config_variables.h`, remove `variables.h`
2023-11-25 22:18:07 +00:00
Robert Müller 794e6b750b Also apply name bans to clans, trim space from clans
Apply the name bans system also to player clans, meaning players joining with banned clan names are kicked and changing the clan to a banned name while ingame has no effect.

Additionally, trim UTF-8 whitespace from beginning and end of clan. This was already done for player names but not for clans.

Closes #7516.
2023-11-25 23:00:57 +01:00
Robert Müller 8156052cc1 Refactor name bans, move code to separate class CNameBans
Unify all code for name bans in new class `CNameBans` in the existing `name_ban.cpp/h` files. The previously global function `IsNameBanned` is now the member function `CNameBans::IsBanned`. The existing name ban tests are extended for the `CNameBans` class.

Move `CNameBan` constructor definition to source file to avoid including `system.h` in the header file. Use `bool` instead of `int` for `m_IsSubstring`. Reorder `CNameBan` constructor arguments and remove unnecessary default value.
2023-11-25 22:28:54 +01:00
Robert Müller 42b952bc6c Move config variables to config_variables.h, remove variables.h
The contents of `variables.h` are moved to `config_variables.h` instead of being included with the preprocessor. The file `variables.h` is removed, so all config variables can be found in a single file instead of being spread over two files without any clear structure. The original declaration order of config variables is preserved. The unnecessary header guard `GAME_VARIABLES_H` from `variables.h` is removed, as the comment `// This file can be included several times.` already serves the same purpose of silencing the header guard check.

A comment is added at the end of `config_variables.h` to mark the location where modders should ideally declare all of their own config variables to avoid merge conflicts with us in the future.

Closes #7472.
2023-11-25 16:40:55 +01:00
Robert Müller e410dd85f8 Replace IConsole::m_Cheated variable with Cheated getter
Interfaces should not have member variables, so the variable is moved to `CConsole`. Only a getter `IConsole::Cheated` is added because the cheated state of the console is never reset.
2023-11-25 11:43:42 +01:00
Robert Müller c216567431 Add IConsole::FlagMask getter function
So other interfaces/components can check which console commands are active. In particular this will be used to refactor the config manager. The respective setter function already exists.
2023-11-25 11:42:56 +01:00
Dennis Felsing ecf2f594c6
Merge pull request #7541 from By622/patch-5
Update traditional_chinese.txt
2023-11-25 09:54:32 +00:00
Dennis Felsing fdac07e685
Merge pull request #7542 from By622/patch-6
Update simplified_chinese.txt
2023-11-25 09:54:30 +00:00
By 91a875bede
Update simplified_chinese.txt 2023-11-25 16:28:39 +08:00
By 8eab64f3f1
Update traditional_chinese.txt 2023-11-25 16:26:38 +08:00
Dennis Felsing edee3d5b9f
Merge pull request #7537 from furo321/allow-unused
Hide "Allow unused" button when not using "DDNet" entities.
2023-11-24 16:15:20 +00:00
furo daa0609252 Hide "Allow unused" button when not using "DDNet" entities. 2023-11-24 16:55:36 +01:00
heinrich5991 3fff2f9fc3
Merge pull request #7535 from furo321/quote-names
Quote names with spaces when auto completing names in commands.
2023-11-24 00:06:49 +00:00
heinrich5991 cb22fbf902
Merge pull request #7536 from jtbx/scrollback-history
Show previous commands in the console's scrollback buffer
2023-11-23 23:52:17 +00:00
furo 7ca10e2645 Quote names with spaces when auto completing. 2023-11-24 00:49:41 +01:00
Jeremy 00f2c8a89f Show previous commands in the console's scrollback buffer
After you issue a command in the client console or rcon, the command
will first be printed to the console prefixed with a '>' symbol.

Cherry-pick of https://github.com/teeworlds/teeworlds/pull/3185
2023-11-24 12:30:01 +13:00
Dennis Felsing 9f20636952
Merge pull request #7532 from furo321/magic-50
Replace `50` with `SERVER_TICK_SPEED` or `TickSpeed()`
2023-11-23 22:07:37 +00:00
Robert Müller f643da7ef5
Merge pull request #7529 from furo321/killteam-fixes
More fixes to `KILLMSGTEAM`
2023-11-23 18:13:23 +00:00
heinrich5991 c50944400a
Merge pull request #7533 from furo321/correct-precision-sixup
Set correct race precision value for 0.7
2023-11-23 17:52:06 +00:00
furo 36a029c622 Set correct race precision value for 0.7 2023-11-23 18:37:02 +01:00
Robert Müller 91dce34a4b
Merge pull request #7530 from def-/pr-macos-ci-python
Fix macOS CI
2023-11-23 14:40:13 +00:00
furo 9627e7b3a8 Simplify TickSpeed getters 2023-11-23 15:33:30 +01:00
furo b9fd612ef5 Replace 50 with SERVER_TICK_SPEED or TickSpeed() 2023-11-23 14:42:30 +01:00