Commit graph

18453 commits

Author SHA1 Message Date
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
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
Dennis Felsing cfced55534 Fix macOS CI
Seen in https://github.com/ddnet/ddnet/actions/runs/6969106161/job/18964960431

Error: No such keg: /usr/local/Cellar/python@3.10
2023-11-23 13:20:41 +01:00
furo 04c5c6a5d6 More fixes to KILLMSGTEAM 2023-11-23 11:57:35 +01:00
Dennis Felsing 6fc27bea8c
Merge pull request #7528 from furo321/statboard-killmsgteam
Count deaths in statboard from `KILLMSGTEAM`
2023-11-23 07:26:56 +00:00
furo ad41069c20 Count deaths in statboard from KILLMSGTEAM 2023-11-23 07:54:02 +01:00
Dennis Felsing 75628335e3
Merge pull request #7527 from Robyt3/Config-ResetGameSettings-Fixes
Fix string and color game settings not being reset correctly
2023-11-22 23:06:44 +00:00
Robert Müller 61c201c37c Fix string game settings not being reset correctly
Due to swapped `str_copy` arguments, the old value for string game variables was being overridden by the current value instead of the other way around in `CConsole::ResetGameSettings`.

There are currently no string game settings affected by this.
2023-11-22 23:16:57 +01:00
Robert Müller d331bcb496 Fix color game settings not being reset correctly
Handling color settings the same as int settings in `CConsole::ResetGameSettings` is not correct, as this causes the color variable data to be cast to int variable data.

There are currently no color game settings affected by this.
2023-11-22 23:12:56 +01:00
heinrich5991 7f9371ccfd
Merge pull request #7525 from Robyt3/Server-Debug-Dummies-ServerInfo
Ensure debug dummies are not included in server info
2023-11-22 18:39:00 +00:00
Robert Müller 48bfecc0d3 Ensure debug dummies are not included in server info
Also fix normal clients being disconnected/controlled like debug dummies.

Closes #7523.
2023-11-22 19:23:38 +01:00
Dennis Felsing 403c1a5377
Merge pull request #7526 from Learath2/pr_reckon
Revert the mess-chain #7247. Apply #7171
2023-11-22 18:20:50 +00:00
Learath b9f786c14f Revert the mess-chain #7247. Apply #7171
Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
2023-11-22 18:34:42 +01:00
heinrich5991 f95b0f163f
Merge pull request #7520 from Robyt3/Packer-Improvements
Minor improvements to `CPacker` and `CUnpacker`
2023-11-22 16:44:30 +00:00
heinrich5991 8b0fccc6a3
Merge pull request #7522 from furo321/gitignore
Add `demo_extract_chat` to .gitignore.
2023-11-22 01:16:42 +00:00
furo ef8a87a359 Add demo_extract_chat to .gitignore. 2023-11-22 00:54:54 +01:00
Dennis Felsing 7c0c7051b8
Merge pull request #7519 from Robyt3/Server-Debug-Dummies-Dynamic
Dynamically connect/disconnect debug dummies, cleanup
2023-11-21 22:41:46 +00:00
Robert Müller ab4e737a57 Fix misaligned int loads in CUnpacker::GetUncompressedInt
Use `mem_copy` instead of dereferencing potentially misaligned address as `int`.
2023-11-21 21:57:06 +01:00
Robert Müller 51e3c37c03 Use mem_copy instead of for-loop in CPacker::AddRaw
Using `memcpy` is faster, assuming the compiler doesn't already transform the loop to `memcpy` automatically.
2023-11-21 21:49:29 +01:00
Robert Müller 0d8a0d3b1d Dynamically connect/disconnect debug dummies, cleanup
Call expected server callback functions to simulate clients dynamically connecting and disconnecting when changing the `dbg_dummies` variable. This makes the debug dummies more useful for debugging. Previously, the debug dummies were considered invalid clients, whereas they are now considered to be ingame, so they should behave mostly like real clients being connected to the server. The debug dummies also have correct client names now, e.g. "Debug dummy 42".

The game server code is cleaned up by moving all special handling for debug dummies to the engine server function `CServer::UpdateDebugDummies`.

The left/right direction inputs for debug dummies are now properly added to the client input array, so their input handling should be consistent with normal clients, which fixes some inconsistent prediction with debug dummies.
2023-11-21 19:59:20 +01:00
Dennis Felsing 35f071b021
Merge pull request #7513 from Robyt3/ImageLoader-Greyscale-Fix
Handle all color channel counts in image loader, refactoring
2023-11-20 21:55:00 +00:00
heinrich5991 83b199b8e2
Merge pull request #7517 from Robyt3/Style-ConstChar
Use `const char *` instead of `char const *` consistently
2023-11-20 21:53:13 +00:00
Robert Müller 29a32b7acc Use const char * instead of char const * consistently
Both are equivalent. Seems to already be used consistently for all other types.
2023-11-20 22:26:19 +01:00
Robert Müller bcae7da6b4 Handle all color channel counts in image loader
Greyscale images with alpha channel (i.e. channel count = 2) were incorrectly handled as RGBA images, causing the client to crash when loading such images. Now the images can successfully be loaded with the image loader, but the client still only supports loading RGB and RGBA images like before.
2023-11-20 21:58:29 +01:00
Robert Müller f0a17435e6 Ensure freed image buffer is not propagated
The image data is freed when the image format is unsupported, but `CImageInfo::m_pData` would still point to the freed memory, so double-frees were possible.
2023-11-20 21:58:29 +01:00