Commit graph

14723 commits

Author SHA1 Message Date
heinrich5991 5603d284bf Parse Date and Last-Modified HTTP headers 2024-03-14 12:31:41 +01:00
heinrich5991 2d17097c91 Use log_* instead of Console()->Log() in HTTP serverbrowser 2024-03-14 11:19:32 +01:00
ChillerDragon 4da4ca5bdd Make tele getters const 2024-03-14 08:50:35 +08:00
ChillerDragon 552d466197 Move tele vector init from gamecontroller to collision 2024-03-14 08:46:22 +08:00
Robert Müller ae9a8fe3d4 Support overlapping scroll regions, always allow mouse scrolling
Support scrolling all scroll regions with the mouse wheel also while popup menus are open. Support overlapping scroll regions by always scrolling the top-most hovered scroll region on mouse wheel events.

The hot scroll region is now tracked separated by `CUi`, as tracking the IDs of all UI elements which are contained in scroll regions is not feasible. The separate active state for scroll regions is therefore unnecessary.

It's still necessary to disable `CListBox`es when popup menus are open, to ensure that only one list box consumes the key events.

Closes #8087. Supersedes #8090.
2024-03-12 22:15:20 +01:00
Robert Müller f291362d88 Revert name of enum literal Ui back to UI
This `enum` literal was accidentally included in the renaming of the `UI` function to `Ui`.
2024-03-12 21:49:00 +01:00
heinrich5991 8108cb04fd Inform HTTP map download of the map size 2024-03-11 17:50:51 +01:00
heinrich5991 dd5ddf07a4 Disconnect when we get map change with invalid parameters
This is the only sane thing we can do, the server will have changed its
map and we can't pretend to still be on the old one.
2024-03-11 17:50:12 +01:00
Dennis Felsing 3489131d78
Merge pull request #8085 from dobrykafe/pr-timecp
Improve `/timecp` chat command
2024-03-11 07:34:54 +00:00
Dennis Felsing 621b201acf
Merge pull request #8086 from furo321/browser-login-filter
Add a `No login required` filter
2024-03-11 07:33:21 +00:00
furo 40f641b0a6 Add a No login required filter 2024-03-11 02:09:16 +01:00
dobrykafe 35c45cf869 improve /timecp chat command 2024-03-11 00:36:07 +01:00
furo 1cee65a980 Document usage of ~ for /tpxy in help text. 2024-03-10 21:44:40 +01:00
heinrich5991 3805ffba86
Merge pull request #8073 from Robyt3/Gamecore-Str-Validation
Add validation for `StrToInts` and `IntsToStr`
2024-03-10 13:48:08 +00:00
Robert Müller 02f60421f9 Add validation for StrToInts and IntsToStr
Add strict validation for `StrToInts` function. Because this function should only be used with trusted internal strings, assertions are added to ensure that the string is not truncated. Some buffer sizes are adjusted accordingly, so truncation cannot happen.

Add less strict validation for `IntsToStr` function. An additional argument specifying the size of the output buffer is added to assert that the size of the output buffer is sufficient. However, because this function is used to decode data sent by the server and read from maps and ghosts, invalid input data should never result in crashes or invalid UTF-8 strings. The function will now unpack an empty string and return `false`, if the string contains invalid UTF-8.

The inline definition of the functions is not wanted, because it requires adding a `system.h` include in `gamecore.h`. Therefore the tools now have to depend on game-shared, which previously only worked because the functions were inline.

Tests are added to ensure the function still behaves the same as before for valid inputs and correctly handles invalid inputs.
2024-03-10 12:49:56 +01:00
Robert Müller bff5247746 Ensure commands executed via Econ are valid UTF-8
`CNetConsole` will now ignore received lines containing invalid UTF-8 codepoints. Previously, it was possible to crash the server on Windows with Econ commands like `exec <invalid UTF-8>`.
2024-03-10 11:23:42 +01:00
Robert Müller b67263107d Use uint8_t * consistently for raw image data
Previously, usage of `void *`, `unsigned char *` and `uint8_t *` was mixed in various places for pointers to raw image data and the pointers ended up being cast to `uint8_t *` at some point anyway. Now only `uint8_t *` is used consistently, which improves type safety and readability. Casts to `uint8_t *` are now only necessary when using `malloc` or when reading data from a map.
2024-03-09 13:31:53 +01:00
Robert Müller 3073934df1 Show completion options for bind key names in console
Show completion options for key names for all bind commands (`bind`, `binds`, `bind_reset`) in the local console.

At the moment this only works for completing the first key name but not for composite binds that use `+`, which would work differently than other console argument completion.

Unnamed keys (starting with `&`) are not shown as completion options.

Refactor console argument completion to reduce duplicate code.
2024-03-08 21:54:22 +01:00
heinrich5991 1afdf47362
Merge pull request #8072 from furo321/practice-helptext
List all practice commands when enabling `/practice`
2024-03-07 00:14:36 +00:00
furo 209df982f8 List all practice commands when enabling /practice 2024-03-07 00:57:21 +01:00
archimede67 de956c8db9
Merge pull request #8071 from dobrykafe/pr-popup-image-height
Editor: Make embedded image popup bigger at all times
2024-03-06 22:47:38 +00:00
dobrykafe 0b03bc7a16 make embedded image popup bigger at all times 2024-03-06 23:27:50 +01:00
Robert Müller 3656c95eca Ensure commands executed via FIFO are valid UTF-8 2024-03-06 22:01:10 +01:00
Dennis Felsing b6689bc012
Merge pull request #8068 from heinrich5991/pr_ddnet_job_atomics
Fix race conditions in job state handling
2024-03-05 21:57:11 +00:00
heinrich5991 e7717f2265 Fix race conditions in job state handling
We want to change the state of the job from `STATE_QUEUED` to
`STATE_RUNNING`, but not from `STATE_ABORTED`. Previously, the code
usedd `exchange` to change the state and compared non-atomically
afterwards. This led to `STATE_ABORTED` being replaced by
`STATE_RUNNING` in a race. With `compare_exchange_strong`, this can no
longer happen.

Fixes #8044.
2024-03-05 20:55:44 +01:00
Robert Müller 9323e18616 Fix HTTP client shutdown and deadlock on request error
Fix HTTP client effectively shutting down by entering the `ERROR` state when a request cannot be added. Now only the invalid request is aborted immediately. The `ERROR` state is now only entered when a curl function fails in a way where recovery is not possible.

Fix occasional deadlock when HTTP client is shutting down after entering the `ERROR` state, by also immediately aborting new requests when the HTTP client is already in the `ERROR` state.

Remove unused `CHttp::EState::STOPPING`.
2024-03-05 19:48:45 +01:00
Dennis Felsing f3de37d9d4
Merge pull request #8019 from heinrich5991/pr_ddnet_rename_variables
Rename all variables for strict camel-casing of abbreviations
2024-03-05 16:06:58 +00:00
heinrich5991 44bf0134f0
Merge pull request #8065 from dobrykafe/pr-solo-practice-bug
Fix practice mode not resetting after disconnect on solo servers
2024-03-05 15:20:34 +00:00
heinrich5991 17402cc43f Rename all variables for strict camel-casing of abbreviations
This is the strict version, ID → Id, UI → Ui, except DDNet which stays
DDNet.

This would fix #7750.

Done using a naive rename script (for bash, use `shopt -s globstar`):

```fish
sed -i \
	-e 's/\([a-z]_\?\)ID/\1Id/g' \
	-e 's/\([^ ]\)\<UI\>/\1Ui/g' \
	-e 's/UI()/Ui()/g' \
	-e 's/\<CUI\>/CUi/g' \
	-e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \
	-e 's/\<ID\>\([^ ").]\)/Id\1/g' \
	-e 's/\<ID\([0-9]\)/Id\1/g' \
	-e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \
	-e 's/int ID/int Id/g' \
	-e 's/\([a-z]_\?\)GPU/\1Gpu/g' \
	-e 's/\([a-z]_\?\)IP/\1Ip/g' \
	-e 's/\([a-z]_\?\)CID/\1Cid/g' \
	-e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \
	-e 's/MySql/Mysql/g' \
	-e 's/\([a-xz]_\?\)SQL/\1Sql/g' \
	-e 's/DPMode/DpMode/g' \
	-e 's/TTWGraphics/TTwGraphics/g' \
	\
	-e 's/Ipointer/IPointer/g' \
	-e 's/\.vendorId/.vendorID/g' \
	-e 's/\.windowId/.windowID/g' \
	-e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \
	-e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \
	-e 's/SDL_JoystickId/SDL_JoystickID/g' \
	-e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \
	-e 's/AVCodecId/AVCodecID/g' \
	src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py
git checkout -- src/engine/external
```

I like this option because it presents clear rules.

Still needs fixups because of the naive replacement, I'd do this if we
want this merged.
2024-03-05 15:44:09 +01:00
dobrykafe d94d020c25 fix practice mode not resetting after disconnect on solo servers 2024-03-05 14:08:30 +01:00
heinrich5991 c15733eda3
Merge pull request #8063 from heinrich5991/pr_ddnet_register_error
Show error from masterserver in console
2024-03-04 23:08:25 +00:00
heinrich5991 12409e545c Show error from masterserver in console
Allows people to see why masterserver registering failed.
2024-03-04 21:58:30 +01:00
Robert Müller dd94da67fb Hide tune_zone command in local console
Prevent the `tune_zone` command from being shown and used in the local console, which could cause issues with prediction, by only registering it as a game setting but not as a client command. The command callback is still correctly called when map settings are loaded in the `CGameClient::LoadMapSettings` function.
2024-03-04 21:26:47 +01:00
Robert Müller bfa5bc2b3c Remove remaining hard-coded server commands from client-side
Followup for #7919.
2024-03-04 21:26:41 +01:00
heinrich5991 e851c78e47 Don't show the git revision twice in server log
Previously:
```
2024-03-03 12:17:40 I git-revision: 885ae7ecae
2024-03-03 12:17:40 I server: version 18.0.3 on linux amd64
2024-03-03 12:17:40 I server: git revision hash: 885ae7ecae
```
2024-03-04 16:50:45 +01:00
Dennis Felsing 70eca3869a
Merge pull request #8051 from dobrykafe/pr-serverbrowser-friends-sort
Add sorting by number of friends to the server browser
2024-03-04 07:27:48 +00:00
Robert Müller 6b3e16ea82 Fix client crash due to truncated skin name 2024-03-03 18:18:49 +01:00
dobrykafe 13f324ccf4 add sort by number of friends to server browser 2024-03-03 02:01:28 +01:00
Dennis Felsing c0e4a4c3f2
Merge pull request #8002 from dobrykafe/pr-change-info-countdown
Show countdown message in player/tee settings for `sv_info_change_delay`
2024-03-02 13:02:06 +00:00
Dennis Felsing 968d08c716
Merge pull request #8026 from Robyt3/Base-Threading-Error-Handling
Add assertions to all thread and semaphore functions
2024-03-02 13:00:58 +00:00
Dennis Felsing 5d070ec5c3
Merge pull request #8043 from Robyt3/Editor-Envelope-Point-Color-Fix
Fix editor crash when right-clicking bezier control points
2024-03-02 12:50:42 +00:00
Robert Müller 350acae56b
Merge pull request #8041 from Jupeyy/pr_small_alloc_fix_vk
Search __most__ fitting allocation, not _first_ fitting
2024-03-02 12:36:48 +00:00
Robert Müller 6895cdc343 Fix editor crash when right-clicking bezier control points
The color selection should only be shown for normal envelope points but not for bezier control points, because it always changes the previously selected normal envelope point. This caused the client to crash when right-clicking a bezier control point when no normal envelope point was previously selected.

Closes #8020.
2024-03-02 13:16:26 +01:00
Jupeyy ec39742017 Search __most__ fitting allocation, not _first_ fitting 2024-03-02 13:12:58 +01:00
Robert Müller 209a367ab2 Fix editor color picker when Vulkan image blitting used
When image blitting is supported by the Vulkan backend, the color picker was reading incorrect pixel values, because the offset positions for the blitting region are the positions of the top-left and bottom-right corners, but instead the top-left offset and size (width, height) were passed as arguments.

Closes #8040.
2024-03-02 12:32:11 +01:00
Robert Müller 52da715858 Minor refactoring of CClient::SetState
- Rename parameter `s` to `State`.
- Only print debug message if new state is different from old state.
- Reduce indentation.
2024-03-01 18:58:41 +01:00
Robert Müller dd09834f32 Always build switch entities layers
Only building the switch entities layer when the current map has a switch layer (#8011) also does not work, because the entities textures are cached for each type and not reloaded unless the entities are changed manually. First joining a server with a map that does not have a switch layer will cause the textures for the type of that server to be built without the switch entities layer, so the switch entities texture will be missing when joining a server of that type with a map that does have a switch layer.

Instead, the switch entities layer textures are always built now, so the cached entities textures are can be used on all maps of the respective server type. This is expected to slightly increase the total memory usage after joining multiple servers of different types. As before, tiles which are unused are masked unless `m_DontMaskEntities` is set.
2024-02-29 21:45:53 +01:00
bencie 26cc7dde2f Refactor 2024-02-29 18:37:39 +01:00
bencie 2868b3cdf6 Let users pick background entities map without file extensions 2024-02-29 18:13:50 +01:00
Robert Müller be9411b262
Merge pull request #8031 from dobrykafe/pr-emotional-tees
fix incorrect usage of `SvEmotionalTees`
2024-02-29 16:06:43 +00:00
dobrykafe d2b2071bda fix incorrect usage of SvEmotionalTees 2024-02-29 16:47:58 +01:00
dobrykafe 720572ddda make chat command arguments case-insensitive when possible 2024-02-29 01:17:11 +01:00
heinrich5991 9620a9d3d9
Merge pull request #8029 from Robyt3/Menus-RenderPopupFullscreen-Function
Extract `CMenus::RenderPopupFullscreen` function
2024-02-28 22:39:29 +00:00
Robert Müller 6080cffcbb Extract CMenus::RenderPopupFullscreen function
Improve readability of the `CMenus::Render` function by extracting the code for rendering the fullscreen popups into a separate function.
2024-02-28 22:53:51 +01:00
Robert Müller 8d774fa48c Define Windows header macros only once in CMakeLists.txt
Instead of defining the macro `WIN32_LEAN_AND_MEAN` and sometimes also the macro `_WIN32_WINNT` in each file that directly or indirectly includes `<windows.h>`, only define these macros once consistently in `CMakeLists.txt`.

Also define `NTDDI_VERSION`, which is the new macro to specify the minimum Windows version starting with Windows Vista. This macro needs to be defined in addition to old `_WIN32_WINNT` macro, according to the documentation.

See https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers
2024-02-28 21:40:28 +01:00
Robert Müller 4ceb376969 Add assertions to all thread and semaphore functions
Assert on failures in all `thread_*` and `sphore_*` functions on all operating systems instead of only printing log messages on Unix, as these functions are only expected to fail when used with incorrect arguments or in some cases when a dead-lock is detected.

On macOS, `sphore_wait` was not correctly calling `sem_wait` in a loop to repeat the wait operation if it is interrupted by a signal.

On Windows, the AIO tests were failing with the additional assertions. The maximum count that semaphores on Windows could be incremented to was previously, arbitrarily limited to 10000, which was causing the `ReleaseSemaphore` call to fail as the AIO semaphore is signaled 65536 times (for each write operation) in multiple of the AIO tests.
2024-02-27 22:14:56 +01:00
Robert Müller ecfc18d129 Minor refactoring of bezier curve evaluation
- Remove `ValidateFCurve` function because it's small and only used once.
- Remove unnecessary checks in `SolveBezier`, as all of these conditions are already checked before the function is called.
- Remove unnecessary double negation of `InTang` to improve readability.
- Use `double` literals for `double` comparisons instead of `float` literals.
- Fix comments.
2024-02-26 20:43:35 +01:00
Robert Müller 47a8156ca8 Fix inaccurate evaluation of bezier curve envelopes
There is no need to divide the times by 1000 when evaluating bezier curves, as all times are relative and the division adds significant inaccuracy, to the point where evaluation of bezier curves goes completely wrong in some cases.

Closes #8005.
2024-02-26 20:43:21 +01:00
Robert Müller cc1d43e5a0 Fix division by zero when envelope point times overlap
Effectively skip envelope points whose start time is equal to the start time of the next envelope point.
2024-02-26 20:43:12 +01:00
Robert Müller 5aab9969ce Fix first envelope line segment not being rendered in editor
Rendering was started with the second line segment after one time step has already passed.
2024-02-26 20:42:58 +01:00
Robert Müller 7c4d51f111
Merge pull request #8016 from dobrykafe/pr-save-replay-improve
Improvements regarding `save_replay`
2024-02-26 18:39:20 +00:00
dobrykafe 91349e4cae add error handling for CDemoEdit job 2024-02-26 18:44:11 +01:00
dobrykafe 268b79cb61 handle invalid filename for save_replay 2024-02-26 18:43:51 +01:00
Robert Müller 2258cbca57
Merge pull request #8007 from heinrich5991/pr_ddnet_vital_ping
Respond to pings sent as vital messages with vital pongs
2024-02-26 12:22:46 +00:00
Robert Müller 6cdfa35727 Allow background jobs to be aborted, refactoring
Add `IJob::Abortable(bool)` function which jobs can call to specify whether they can be aborted. Jobs are not abortable per default. Abortable jobs may have their state set to `IJob::STATE_ABORTED` at any point if the job was aborted. The job state should be checked periodically in the `IJob::Run` function and the job should terminate at the earliest, safe opportunity when aborted. Scheduled jobs which are not abortable are guaranteed to fully complete before the job pool is shut down. However, if the job pool is already shutting down, no additional jobs will be enqueue anymore and abortable jobs will immediately be aborted.

In particular, the sound loading, community icon loading, master chooser and host lookup jobs are specified as being abortable. Conversely, the jobs saving replay demos, editor maps and screenshots are expected to finish before the client is shut down.

When the client is quitting/restarting, it will now disconnect from the current server first, before saving the config, to ensure that any actions that happen on disconnect (demo recorders being stopped etc.) happen first. The shutdown message is rendered before disconnecting and waiting for background jobs to finish.

The HTTP client is now initialized later during server launch, after the network initialization. Error handling is added and the server stops if the HTTP client could not be initialized, same as the client.

The `RunBlocking` functions are removed, as they are not used anymore after curl-multi was added.

The function `IJob::Status` is renamed to `State` and `IJob::STATE_PENDING` is renamed to `STATE_QUEUED` for consistency with naming of the HTTP client.

The member variables of the engine interface are encapsulated and the `jobs.h` include is removed from `engine.h`, which removes transitive includes of `system.h`.

Documentation for all job and job pool API is added.
2024-02-25 17:03:45 +01:00
Jupeyy 6bfd565a7c
Merge pull request #7995 from edg-l/some_updates
update ci actions, update rust edition to 2021 since our MSRV covers it
2024-02-25 15:11:54 +00:00
Edgar 0e0ebe9aea
update ci actions, update rust edition to 2021 since our MSRV covers it 2024-02-25 15:55:10 +01:00
archimede67 95e51db753
Merge pull request #8014 from furo321/case-insenstive-command-chat
Make chat commands completion case-insenstive
2024-02-24 18:30:43 +00:00
furo f3a277c365 Make chat commands completion case-insenstive 2024-02-24 18:11:26 +01:00
Dennis Felsing 59a734ce3f
Merge pull request #8010 from Robyt3/Map-Envelope-Render-Refactoring
Improve envelope evaluation and validation
2024-02-23 23:07:22 +00:00
Robert Müller 835001058b Always build switch entities layer when map has switch layer
Instead of only building the switch entities when the server uses the DDNet/DDrace type. Fix switch entities not being shown anymore on servers which do not mask entities. Regression from #7979.
2024-02-23 21:37:46 +01:00
Robert Müller ab3c6c4353 Improve envelope evaluation and validation
Call `EnvelopeEval` functions directly instead of passing them and their arguments to `CRenderTools::RenderTilemap` and `CRenderTools::RenderTileRectangle`.

Only evaluate color envelopes for tiles layers once instead of separately for the opaque and transparent passes.

Only evaluate relevant number of envelope channels instead of always evaluating all channels.

Avoid unnecessary calculations by only evaluating position envelopes for quads which are not fully transparent.

Fully ignore layer color and envelope color for entities layers, as these cannot be specified in the editor and should not be changeable.

Remove duplicate and insufficient checks for invalid envelope index before calling `EnvelopeEval`. Instead, set the correct default for all channels before calling `EnvelopeEval` and only change the result on success. Now, white color will consistently be assumed for invalid color envelopes, zero positions and rotations for invalid position envelopes, and full volume for invalid sound envelopes.

Validate number of envelope channels to prevent crashes. When loading maps containing envelopes with invalid number of channels (not equal to 1, 3 or 4), the number of channels of these envelopes is reset to 4 and an error message is displayed, so the mapper can examine all channels' data and transfer it to another envelope if necessary. Closes #7985.
2024-02-23 19:24:34 +01:00
Robert Müller 040d7673c6 Remove dead code 2024-02-23 18:21:18 +01:00
Robert Müller 73c3636f3b Add color4_base::Multiply function 2024-02-23 18:21:17 +01:00
Robert Müller 7d7a45663f Improve layout of General settings page, refactoring
Use consistent margins for all settings pages and titles (except the Appearance settings, which will be covered in the future).

Fix checkbox UI element ID variable `s_LowerRefreshRate` not being `static`.

Improve readability of layout code.
2024-02-22 22:14:54 +01:00
heinrich5991 e69ea46982 Respond to pings sent as vital messages with vital pongs
Matching the requester allows "reliable" and "unreliable" pings.
"Reliable" pings suffer from re-sends, thus might not accurately reflect
the latency, "unreliable" pings might not arrive at all.
2024-02-22 11:18:12 +01:00
Robert Müller e50f8cfaa0 Fix client crash if cl_race_ghost_save_best 1 deletes last ghost
If the own ghost is the last element in the vector and deleted due to using the `cl_race_ghost_save_best 1` setting then the following accesses with index `Own` were out-of-bounds. Closes #8003.
2024-02-21 23:38:43 +01:00
Dennis Felsing 99ee3f4fb9
Merge pull request #8004 from furo321/teamcolors-fixes
Small fixes to `cl_chat_teamcolors`
2024-02-21 11:29:34 +00:00
furo da02be4a9f Remove cl_chat_teamcolors check from info messages. 2024-02-21 12:03:42 +01:00
furo ba3a6b4262 Enable cl_chat_teamcolors by default 2024-02-21 12:02:51 +01:00
dobrykafe 40329b7d2e show countdown in player/tee settings for sv_info_change_delay 2024-02-20 21:41:20 +01:00
heinrich5991 87f3740a61
Merge pull request #8001 from Robyt3/Http-Android-Fix
Fix incorrect variable used in Android-specific code
2024-02-20 20:29:14 +00:00
Robert Müller aa7a614c36 Fix incorrect variable used in Android-specific code
The function `curl_easy_setopt` expects a `CURL *`, but `pHandle` is a `void *`.
2024-02-20 21:11:26 +01:00
Robert Müller 386b00f18d Add has_finishes attribute to community info
Add mandatory Boolean attribute `has_finishes` to every community info, which specifies whether finishes can be shown for the community, regardless of whether any finishes are currently available for the player.

The community info must be adjusted when/before merging this, by adding the attribute `has_finishes` to every community object, with the value `true` for DDNet and `false` for all other communities.

Closes #7957.
2024-02-20 20:34:21 +01:00
Dennis Felsing 99c982e3e0
Merge pull request #7998 from Robyt3/Client-Skin-Loading-Refactoring
Validate skin names when loading, refactor skin loading
2024-02-19 22:56:58 +00:00
heinrich5991 9a95f3b1fd Add return value docs to DoEditBox* 2024-02-19 22:51:55 +01:00
Robert Müller 8adfb2f2ec Fix unlikely cases of skin blood color being wrong
The check before calling `normalize` incorrectly excludes skins containing zero in any color component instead of excluding only skins with zero in all components. The check can be removed entirely, because it is already checked inside the `normalize` function whether the length of the `vec3` is zero, in which case a zero `vec3` will be returned.

For very large skins which use large color values in at least one component, the `int` used for calculating the blood color could overflow.
2024-02-19 22:09:59 +01:00
Robert Müller 4eb0ffd701 Validate skin names when loading, refactor loading
Prevent skins with invalid names from being loaded/downloaded.

Improve log messages when skins cannot be loaded.

Remove obsolete check for duplicate skins, as the storage handles duplicate files already.
2024-02-19 22:09:59 +01:00
Robert Müller 9a24cf4e10 Ensure placeholder skin always exists and has valid metrics
Instead of adding the placeholder skin to the list of skins only when no skins have been loaded, always create the placeholder skin and use it only when no other skin is available.

Use reasonable values for skin metrics of placeholder skin to improve its rendering.
2024-02-19 22:09:59 +01:00
heinrich5991 bf0f699b42 ClientEmptyClientSlotEmpty
Makes it clearer to me, didn't know what an empty client is supposed to
be.

CC #7968
2024-02-19 21:36:21 +01:00
bencie 2240380b0e Unfreeze on rcon undeep 2024-02-19 17:45:30 +01:00
archimede67 4760ff71c7
Merge pull request #7991 from Robyt3/Client-Loading-Indicators
Render loading message/indicator for vote options and rcon commands
2024-02-18 19:03:23 +00:00
archimede67 8a98e70172
Merge pull request #7992 from furo321/no-cmdlist-rcon
Don't tell user about `/cmdlist` in rcon when using an unknown command.
2024-02-18 18:15:02 +00:00
furo 19796cdce4 Don't tell user about /cmdlist in rcon when using an unknown command. 2024-02-18 18:42:22 +01:00
Robert Müller ce81f7b45f Render loading message/indicator when receiving rcon commands
Render a progress spinner and message in the remote console while receiving rcon commands.
2024-02-18 18:15:33 +01:00
Robert Müller 1d0bb0dfcf Render loading message/indicator when receiving vote options
Render a progress spinner and message on the "Change settings" tab while receiving vote options.
2024-02-18 18:11:58 +01:00
Edgar e041c0a870
Merge pull request #7977 from dobrykafe/pr-expire-invites
Expire team invites on player disconnect
2024-02-18 15:24:01 +00:00
Edgar ea0827b5bd
Merge pull request #7987 from dobrykafe/pr-showfps-render
Don't show fps during demo render
2024-02-18 15:23:16 +00:00
Edgar f7b3cc7179
Merge pull request #7988 from Robyt3/Editor-Button-Refactoring
Refactor editor button functions: replace/remove `DoButton_File`, `DoButton_ButtonDec/Inc` and `DoButton_Menu`
2024-02-18 15:22:08 +00:00
Robert Müller ca56aa0b4a Replace DoButton_Menu with DoButton_Ex
This adds highlighting color when hovering the main menu buttons (File, Tools, Settings), which was previously missing for these buttons. This also reduced duplicate code.

Extract font size for menu buttons into constant `MENU` in new namespace `EditorFontSizes`.
2024-02-18 15:56:19 +01:00
Robert Müller 0da1743143 Avoid while loop for calculating console Y offset 2024-02-18 13:14:02 +01:00
Robert Müller bb650b85c4 Minor refactoring of console rendering variables
Remove temporary variables. Mark variables as `const` when possible. Avoid duplicate calculations. Use `bool` instead of `int`.
2024-02-18 13:12:20 +01:00
Robert Müller af99f5ba57 Replace DoButton_ButtonDec/Inc with DoButton_FontIcon/Ex
Use `DoButton_FontIcon` with `FONT_ICON_MINUS`/`FONT_ICON_PLUS` consistently instead of using `DoButton_ButtonDec/Inc` with text labels `+`/`-`.

For yes/no buttons, use `DoButton_Ex` and specify the button corners explicitly instead of using `DoButton_ButtonDec/Inc`.
2024-02-18 12:32:51 +01:00
Robert Müller 929765e95e Remove unused DoButton_File 2024-02-18 12:32:46 +01:00
dobrykafe 3ad0e233ee dont show fps during demo render 2024-02-18 04:01:40 +01:00
Robert Müller aded3f70a2 Fix editor UI locking up when dragging groups/layers quickly
Reset dragging operation when the dragged button has been unset and reset dragged button when operation has been reset, to prevent the editor from being stuck in either of two inconsistent states. This could be reproduced easily by clicking very quickly while moving the mouse up and down over the groups/layers list.

Do not call `CheckActiveItem` on a UI element (the dragged button) which might not be in view, as this prevents the UI from detecting the invalid active item, when groups/layers are dragged very far and quickly outside the scrollregion.

Closes #6855.
2024-02-17 13:14:13 +01:00
Robert Müller 886b417ed4
Merge pull request #7983 from archimede67/editor-fix-quads-2
Editor: fix quad snapping when grid is enabled
2024-02-17 09:42:59 +00:00
Robert Müller a720bb0c29
Merge pull request #7976 from ChillerDragon/pr_ed_hover_tiles_vector
[vector] Move select layer to editor component
2024-02-17 09:34:28 +00:00
Corantin H 87155d4a82 Fix logic for preferring grid over quad snapping 2024-02-17 10:16:09 +01:00
ChillerDragon 9134e31800 Move select layer to editor component
closed #7943
closed #7612
2024-02-17 12:06:04 +08:00
Robert Müller c729ccad32 Abort new HTTP requests immediately when shutting down CHttp
Immediately cancel new HTTP requests instead of enqueuing them when already shutting down `CHttp`. Otherwise, `CChooseMaster` may wait forever for HTTP requests to be completed while the client is shutting down, if `CHttp` was shutdown while `CChooseMaster` is not waiting for an existing HTTP request.

Not directly caused by #7962, but it made it more likely to happen.

Closes #7980.
2024-02-16 17:33:50 +01:00
archimede67 aae674897a
Merge pull request #7975 from ChillerDragon/pr_ed_wasd_speed
[editor] Increase WASD pan speed when holding down shift
2024-02-16 12:50:10 +00:00
Robert Müller fdf427db15 Fix entities textures not being built for non-DDNet/DDRace types
The combined entities texture for all layers except the switch layer was only built when the gametype has a front, speedup, tele or tune layer, which is only the case for servers declaring DDNet or DDRace type in their gameinfo. Now this entities layer is always built, as the game layer is always present.
2024-02-15 21:51:53 +01:00
dobrykafe 5dc8fe81e3 expire team invites on player disconnect 2024-02-15 21:37:51 +01:00
Robert Müller ab3445967d Fix assertion due to double-free of transparent texture
The transparent texture is reused for multiple entity layers and should never be unloaded.
2024-02-15 20:49:55 +01:00
Robert Müller 0a776b9062 Cleanup select layer UI element handling
Expose UI element ID for the main map editor as member variable so the select layer by tile funtionality can correctly be enabled when the map editor is the hot item.
2024-02-14 22:03:25 +01:00
ChillerDragon 7ec182b498 Increase editor pan speed when holding down shift 2024-02-14 08:43:21 +08:00
Dennis Felsing 5cb37c2e4a
Merge pull request #7974 from Robyt3/Menus-Tabs-Tooltips
Add tooltips for all icon-based menu and browser tabs
2024-02-13 23:51:30 +00:00
Robert Müller 639a5879a6 Add tooltips for all icon-based menu and browser tabs 2024-02-13 22:26:28 +01:00
Robert Müller 6c27894a63
Merge pull request #7973 from ChillerDragon/pr_ed_igfx
Remove indirect Graphics() access in BrushSelecting()
2024-02-13 21:03:17 +00:00
ChillerDragon 2f2b8f32fa Remove indirect Graphics() access in BrushSelecting() 2024-02-13 16:01:18 +08:00
Robert Müller 73011529cd Document all shell, OS, secure random and related functions
Add/update doxygen comments for all `shell_*`, `os_*`, `secure_*`, `cmdline_*`, `windows_*` and related functions.

Move `open_link` and `open_file` declarations to shell group, to the same relative position as their function definitions.
2024-02-12 23:05:21 +01:00
bencie 997fe8fa3b Add /solo and /deep as practice commands 2024-02-12 17:17:55 +01:00
Dennis Felsing c85be52409
Merge pull request #7968 from Robyt3/Server-Mod-Message-Fix
Make it less likely that antibot message is sent from random tees
2024-02-11 21:58:01 +00:00
Robert Müller be98c17738 Make it less likely that antibot message is sent from random tees
Instead of sending the message from the first client which is not ingame, choose the first client which is fully empty, to make it less likely that the message is sent from a currently connecting client.
2024-02-11 22:12:15 +01:00
Robert Müller f0e71219a9 Add placeholder country/type for servers without community
Add a country "none" with tee flag (code `-1`) and a type "None" for all servers without community.

Previously, the country and type for these servers was unset and their handling special-cased, so any non-empty country/type filter would exclude servers without country/type information. Now individual countries/types can be excluded without also excluding all servers without community.

Closes #7961.
2024-02-11 17:55:53 +01:00
Robert Müller e4e4227709 Fix filter excluding all items when right-clicking the only entry
It was possible to create a community/country/type filter excluding all entries when the list only contains one entry and right-click is used to deselect it.
2024-02-11 17:41:15 +01:00
Dennis Felsing 6d3bd36877
Merge pull request #7964 from ChillerDragon/pr_doc_ui_doeditbox
Document `DoEditBox()`
2024-02-11 14:47:47 +00:00
Robert Müller 8e2195ce16
Merge pull request #7963 from bencie/flag-search
Add flag search
2024-02-11 14:43:47 +00:00
bencie b5960f3fc3 Track filtered flags directly instead of their indices 2024-02-11 15:16:40 +01:00
ChillerDragon 74a9c39650 Document DoEditBox() 2024-02-11 17:47:02 +08:00
bencie 206a36a02a Add searchbar to flags tab in settings 2024-02-11 04:05:35 +01:00
Robert Müller 9d1ebe726c Quit client faster by aborting HTTP requests earlier
Shutdown `CHttp`, i.e. abort all HTTP requests, as early as possible when quitting/restarting the client, after the config has been saved but before shutting down the gameclient. Previously, this was delayed until the engine shutdown, so the requests would often finish entirely instead of being aborted by the callback.

Previously, HTTP requests being aborted due to `CHttp` shutting down were considered `EHttpState::ERROR`, which sometimes causes deadlocks during engine shutdown or destruction of `CHttp`. The state is now set to `ABORTED` by passing `CURLE_ABORTED_BY_CALLBACK` to `OnCompletionInternal`. The otherwise unused handling of internal errors is removed.
2024-02-10 22:38:42 +01:00
Robert Müller b2041f5703 Fix assertion due to incorrect HTTP request state
Previously, it was assumed `ResultJson` would return `nullptr` for HTTP requests which have been aborted or failed with an error, which would trigger the newly added assertion error "Request not done".
2024-02-10 22:38:10 +01:00
Robert Müller 399ba63a2c Fix incorrect check for aborted server list GET request result
The HEAD request result has already been checked above.
2024-02-10 22:37:54 +01:00
Corantin H 93120b83cf Call FlagModified only when property can affect automapper (fixes #7959)
Handle more cases for undoing auto automap
2024-02-10 12:15:28 +01:00
Dennis Felsing a7bbcf00a6
Merge pull request #7956 from archimede67/editor-fix-quads
Editor: fix several quads related issues
2024-02-09 23:13:30 +00:00
Robert Müller fe5b9d2dc9 Encapsulate CInfoMessages members 2024-02-09 21:35:35 +01:00
Robert Müller dda86b4624 Refactor info message creation
Add `CInfoMessages::CreateInfoMsg` function to create fully initialized info messages, to reduce duplicate code when creating info messages.
2024-02-09 21:35:14 +01:00
Robert Müller 4be56bb87d Refactor info message rendering
Improve readability of flag rendering code.

Add `ROW_HEIGHT` and `FONT_SIZE` constants.
2024-02-09 21:35:07 +01:00
Robert Müller 9295993190 Remove redundant text width calculation
Directly use the bounding box which has already been calculated for the text containers, instead of calculating the text width again for every info message text.
2024-02-09 21:34:45 +01:00
Robert Müller ebe60738d9 Refactor CInfoMessages::AddInfoMsg usage
Reduce duplicate code by moving screen remapping and validation of the info message into the `AddInfoMsg` function.

Check for valid kill message before creating text containers, so they are not created and deleted unnecessarily.

Assign info message type directly instead of passing it as a separate parameter.
2024-02-09 21:33:47 +01:00
Robert Müller 109b6bfb8e Refactor info message text container creation
Combine `CreateNamesIfNotCreated` and `CreateFinishTextContainersIfNotCreated` functions to `CreateTextContainersIfNotCreated` function to reduce duplicate code on usage.

Extract duplicate code for determining name color in info messages as lambda function.
2024-02-09 21:33:27 +01:00
Robert Müller 1683304acd Ensure skin info of finish messages is valid 2024-02-09 21:33:14 +01:00
Robert Müller 289b7b08c7 Ensure finish info messages are initialized
Closes #7913.
2024-02-09 21:33:04 +01:00
Robert Müller cb0af02eae Extract CTeeRenderInfo::Valid function 2024-02-09 21:32:56 +01:00
Robert Müller 4cb0bb2744 Split CInfoMessages::OnMessage into separate functions
Improve readability by splitting long `OnMessage` function into separate functions for each individual message.
2024-02-09 21:32:48 +01:00
Robert Müller e350ceeb16 Extract SSkinTextures::Unload function 2024-02-09 21:32:44 +01:00
Corantin H f9ba9d819b Add more const qualifiers to editor methods 2024-02-09 21:13:28 +01:00
Robert Müller fbc4181809
Merge pull request #7937 from Peakies/switch_screen_pr
fix switch screen and blackscreen on opengl + window borderless
2024-02-09 19:47:42 +00:00