Commit graph

12714 commits

Author SHA1 Message Date
Robert Müller 99ef97a0f8 Use variadic arguments for ShowFileDialogError formatting
Reduces duplicate code when calling the function.

Also increase the size of the message popup message, as it was not large enough for all paths.
2023-03-19 11:48:39 +01:00
Robert Müller d0fe1087db Add str_format_v with va_list argument
So the string formatting can be reused in other places. Passing variadic arguments directly to another function is not possible.

The function must have a different name, as overloading `str_format` would cause the wrong function to be called when passing the `va_list`. The same naming with suffix `_v` is used for the logging functions.
2023-03-19 11:48:39 +01:00
VoxelDoesCode 929675be68 Make team kills condensed in killfeed
Clang + Formatting test before merge
2023-03-18 23:27:59 -04:00
bors[bot] 22b7e5eaf4
Merge #6438
6438: Fix incorrect tee blood color being shown in settings r=def- a=Robyt3

When the tee color lighting is set to 0, the blood color was shown as black instead of the actual tee blood color. The blood color used ingame is already correct and now matches the color shown in the settings.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-18 22:14:29 +00:00
Robert Müller c5f2727a3f Fix inconsistent slow mouse in editor
The mouse slow flag must be reset at the beginning of the render function in the editor instead of at the beginning of the update function, as it otherwise only works very inconsistently.
2023-03-18 22:26:43 +01:00
Robert Müller 484df7fc79 Support holding shift for slow mouse with color pickers
When picking a color with a color picker also support holding shift to move the mouse slowly (at 5% normal speed) like for scrollbars.
2023-03-18 22:24:46 +01:00
Robert Müller a9ef757475 Add random_float functions with min and max arguments
Add `random_float(float min, float max)` to generate a random `float` between `min` and `max`.

Add `random_float(float max)` to generate a random `float` between `0.0f` and `max`.
2023-03-18 12:09:37 +01:00
Robert Müller 0cf5dd7ad3 Add random_direction function
Replace existing `RandomDir` with this function. This function was biased towards the corners, as it first generates a random `vec2` with `x` and `y` in `[-0.5f;0.5f]` and then normalizes it, which doesn't result in a uniform distribution of directions. Now the random direction is generated by taking a random angle and then converting it to a direction which is per definition already normalized.
2023-03-18 12:09:37 +01:00
Robert Müller ea6e267d98 Add random_angle function
To generate a random angle in the range `[0.0f;2.0f * pi[`. This ensures that the random angle cannot be `2.0f * pi`, which would be identical to the angle `0.0f` and therefore cause the random angle to be less uniformly selected.

Note that this first casts `RAND_MAX` to a `float` and then uses `std::nextafter` to get the next larger `float`. Using `RAND_MAX + 1` would cause an integer overflow on systems where `RAND_MAX == INT_MAX` (e.g. Ubuntu and macOS).
2023-03-18 12:07:52 +01:00
Robert Müller d2bd863c79 Fix incorrect tee blood color being shown in settings
When the tee color lighting is set to 0, the blood color was shown as black instead of the actual tee blood color. The blood color used ingame is already correct and now matches the color shown in the settings.
2023-03-18 11:09:49 +01:00
marmare314 7f0c0523fd fix formatting 2023-03-18 08:19:52 +01:00
marmare314 0cbc725235 fix formatting and include array 2023-03-18 08:07:25 +01:00
marmare314 8e2869e280 add tooltips 2023-03-18 07:53:18 +01:00
marmare314 9537656e57 use array again and consider checkpoints 2023-03-17 19:25:50 +01:00
marmare314 0ce70f863b add proof mode for menu backgrounds closes #3009 2023-03-17 18:37:55 +01:00
Robert Müller 3ab0fa7653 Fix editor preview image not being updated after searching
The preview image was not being updated after the search term is changed. Changing the search term causes the selected image to be changed, so the preview image also needs to be updated.
2023-03-17 12:58:25 +01:00
Robert Müller 9b8d8e4965 Don't reload editor preview image every frame if it's invalid
If the preview image in the "Add image" dialog could not be loaded it was retried every frame, which causes a debug message to be printed each time.

Now a tristate variable is used to ensure that the image is not reloaded after is previously failed to load.
2023-03-17 12:58:25 +01:00
Robert Müller 0c67d033ea Show popups in editor when loading/saving file fails
Show error message in a popup at the current mouse position when a file operation fails. Also works when pressing Ctrl+S to save.

When replacing images/sounds also first check if an image/sound with that name already exists.

When replacing sounds also first check whether the replacement sound could be loaded and don't replace existing sound with invalid sound on failure.

Replace existing error message for "Create folder" dialog with the new mechanism.

Closes #6430.
2023-03-17 12:58:24 +01:00
bors[bot] 5e2e1e25e3
Merge #6433
6433: add show directory button in filedialog closes #6422 r=Robyt3 a=Marmare314

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-03-17 11:30:35 +00:00
marmare314 b477173b8a add show directory button in filedialog 2023-03-17 12:17:31 +01:00
marmare314 fe221dab23 implement draggable layers 2023-03-17 11:28:08 +01:00
marmare314 1ccd357f53 check for success when decoding audio 2023-03-17 10:39:17 +01:00
marmare314 115cd4c4a3 fix bug when loading invalid opus file 2023-03-17 09:12:15 +01:00
bors[bot] cc612a7e18
Merge #6423
6423: Always enable editor panning and zooming when GUI is hidden r=heinrich5991 a=Robyt3

The `UI()->MouseInside(&View)` check does work when the mouse is all the way at the right or bottom side. Changing the `MouseInside` functions introduces other problems due to UI element and mouse positions being floating point numbers and not corresponding to exact pixels.

As a workaround to enable unlimited editor panning in all direction when the GUI is hidden the check is omitted, as the map editor encompasses the entire view and so the check is not necessary in this case.

Closes #4553.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-16 20:51:17 +00:00
bors[bot] 5241c4ce5f
Merge #6425
6425: Don't add duplicate consecutive commands to console history r=heinrich5991 a=Robyt3

Don't add entered command to console history, if the last console history entry is identical to this command. For example, entering the commands `1`, `2`, `3`, `3`, `2`, `1` adds 5 entries to the history, i.e. only one entry for the command `3`.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-16 20:29:33 +00:00
Robert Müller 66ad9536fe Extend CScrollRegion to support scrolling when mouse at edge
Add `ScrollRelative` function to initiate relative scrolling programmatically, to realise scroll regions that scroll when the mouse is being dragged at the edge.

Add `DoEdgeScrolling` to encapsulate all the necessary edge scrolling logic based on the position of the mouse. The edge scrolling starts at a fixed distance from the edges. The scrolling speed is dependent on the distance of the mouse from this border.
2023-03-16 13:07:04 +01:00
Robert Müller d08f784a97 Don't add duplicate consecutive commands to console history
Don't add entered command to console history, if the last console history entry is identical to this command. For example, entering the commands `1`, `2`, `3`, `3`, `2`, `1` adds 5 entries to the history, i.e. only one entry for the command `3`.
2023-03-14 23:33:06 +01:00
Robert Müller 3808a23bc7 Always enable editor panning and zooming when GUI is hidden
The `UI()->MouseInside(&View)` check does work when the mouse is all the way at the right or bottom side. Changing the `MouseInside` functions introduces other problems due to UI element and mouse positions being floating point numbers and not corresponding to exact pixels.

As a workaround to enable unlimited editor panning in all direction when the GUI is hidden the check is omitted, as the map editor encompasses the entire view and so the check is not necessary in this case.

Closes #4553.
2023-03-14 22:19:40 +01:00
bors[bot] 762f1a1262
Merge #6421
6421: ignore tiles that dont use ids in ContainsElementWithId r=Robyt3 a=Marmare314

See #5908. As far as I can tell this function is only used in the popup, so this should not break anything.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-03-14 20:02:14 +00:00
bors[bot] 5f7f30d009
Merge #6419
6419: add sorting by name and time modified to filedialog r=Robyt3 a=Marmare314

As suggested in #4508 it would be nice to have at least some basic sorting ability in the filedialog. This PR implements at least the two most important sorting criteria: filename and time modified. Also the time modified is now displayed.
At the moment the characters ▲ and ▼ are used to indicate the sorting direction. Maybe there is a nicer way to display this.
![file_dialog_1](https://user-images.githubusercontent.com/49279081/224561567-d3335ca0-d9c9-4d44-ab97-31ce177d287e.png)
![dialog_2](https://user-images.githubusercontent.com/49279081/224561570-4182ba16-bfe0-42d7-b2ee-0f49895fec85.png)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-03-14 18:55:19 +00:00
marmare314 71c8aad8d4 ignore tiles that dont use ids in ContainsElementWithId 2023-03-14 18:39:12 +01:00
marmare314 223813e519 reset timemodified sort 2023-03-14 17:17:24 +01:00
Robert Müller 1e74e06908 Fix slash removal when multiple slashes are pasted in editor
When pasting text containing multiple consecutive (back)slashes in the editor save dialog not all slashes where removed. For example with the text `/a//bb/\/ccc////dddd//\//`.
2023-03-14 13:32:06 +01:00
marmare314 fb5cb3e131 fix formatting 2023-03-12 19:57:46 +01:00
marmare314 c338eca199 ignore time for links and root folder 2023-03-12 19:41:58 +01:00
marmare314 e2449ac3b8 use str_timestamp_ex and fix codestyle 2023-03-12 18:54:57 +01:00
marmare314 9540d27a10 fix formatting issues and clean up indicator selection 2023-03-12 18:39:11 +01:00
marmare314 f012716af6 add sorting by name and time modified to filedialog 2023-03-12 18:10:22 +01:00
bors[bot] 20ae11567f
Merge #6416
6416: use ValueSelector for envelope selection #3598 r=def- a=Marmare314

Allow choosing envelopes by typing its ID.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-03-12 15:29:12 +00:00
marmare314 05204bbcb8 use ValueSelector for envelope selection closes #3598 2023-03-12 15:58:38 +01:00
Robert Müller 1b1fc8de3e Save screenshot in separate thread to avoid lags
Encoding the image as PNG and saving it to a file comprises the majority of the time when taking a screenshot.

To avoid the client freezing while a screenshot is being saved, this task is moved to a separate background thread.
2023-03-11 13:19:57 +01:00
bors[bot] 2323359ea5
Merge #6409
6409: Refactor server process launching from client r=def- a=Robyt3



## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-10 23:20:28 +00:00
bors[bot] f5970645e8
Merge #6406
6406: Fix deprecation warning in ffmpeg 6 (fixes #6398) r=Robyt3 a=def-

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-03-10 19:59:05 +00:00
Robert Müller 3996ee01a7 Close process handle on Windows after process is killed
Prevent leak of process handle. Keep the handle open if the process could not be killed, so killing can be attempted again.
2023-03-10 18:02:39 +01:00
Robert Müller 128d3e4758 Handle return value of kill_process
Only clear process handle if the process was actually killed.
2023-03-10 17:59:36 +01:00
Robert Müller a0c61a1b60 Add INVALID_PROCESS to represent invalid PROCESS value 2023-03-10 17:39:24 +01:00
Robert Müller 4834cfdac9 Rename CServerProcess::Process to CServerProcess::m_Process 2023-03-10 17:38:04 +01:00
Robert Müller 8d225fd3e7 Remove unused CServerProcess members 2023-03-10 17:36:33 +01:00
Robert Müller 4a94ab340f Fix some potentially undefined editor member variables
See #6407.
2023-03-10 17:18:24 +01:00
Dennis Felsing 3428968702 Fix deprecation warning in ffmpeg 6 (fixes #6398) 2023-03-10 14:38:37 +01:00
Robert Müller e07d9ae724 Use std::size(g_Config.m_SvMotd) instead of magic number 900
The size of the `sv_motd` config variable is also `900`.
2023-03-10 00:32:51 +01:00
Robert Müller de99fecaa0 Use text container for ingame server info MOTD
Optimize MOTD rendering in ingame menu by caching the text.

Use the correct text height based on the aligned font size instead of the original font size, to fix the discrepancy between the scrollable height and the text height.
2023-03-09 23:48:31 +01:00
Robert Müller c286f32b17 Use text and quad containers for ingame MOTD, refactor variables
Optimize MOTD rendering by caching the round rect and the text.

Align font and rect sizes so exactly 24 lines of text fit in the MOTD rect with margins on all sizes.
2023-03-09 23:04:19 +01:00
Robert Müller a02738bd2e Mark CMotd::IsActive as const 2023-03-09 23:04:19 +01:00
Robert Müller 53635deb35 Encapsulate CMotd::m_aServerMotd with getter 2023-03-09 23:04:18 +01:00
Robert Müller f7d7592cb7 Add CTextCursor::Height() to calculate actual height of cursor 2023-03-09 23:04:18 +01:00
Robert Müller a0f1b4118d Use round_to_int in text render
For positive numbers, which the text positions always are, the result of `(int)(x + 0.5f)` is identical to `round_to_int(x)`.
2023-03-09 23:04:18 +01:00
Robert Müller 92615617b2 Use mem_copy instead of memcpy for websockets
Replace all remaining usages of `memcpy`.
2023-03-09 13:16:49 +01:00
Panagiotis "Ivory" Vasilopoulos 776eabcc78 Replace leftover memcpy with mem_copy
This change was made as I was doing some tests for the Haiku port.
2023-03-09 11:50:15 +01:00
bors[bot] 0fd284a6f3
Merge #6392
6392: Add missing default value for custom parallax zoom property r=def- a=Robyt3

The "Custom Zoom" property was not initialized when creating a new layer group, leading to the property editor not working correctly and an undefined value being saved to the map file.

![property-editor](https://user-images.githubusercontent.com/23437060/223575784-81ce5eeb-992e-4084-985b-183b4389090c.png)

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-07 23:22:28 +00:00
Robert Müller 96ccfbb4c2 Add missing default value for custom parallax zoom property
The "Custom Zoom" property was not initialized when creating a new layer group, leading to the property editor not working correctly and an undefined value being saved to the map file.
2023-03-08 00:15:15 +01:00
Robert Müller da08533adf Revert "When GUI inactive, unlock mouse and don't render popup menus"
This reverts commit 0e476dfd70.
2023-03-07 22:51:56 +01:00
Robert Müller d69084ca0d Revert "Close editor popups and prevent popups from opening when GUI hidden"
This reverts commit 5c4d5fb571.
2023-03-07 22:43:35 +01:00
Robert Müller 5c4d5fb571 Close editor popups and prevent popups from opening when GUI hidden
Prevent editor popups (quad point, quad pivot, sound source) from being opened while the editor GUI is hidden. The opened popups would not be visible, which results in multiple identical popups being opened at the same time. This cannot happen while the GUI is shown, as the already opened popup takes focus so no second identical popup can be opened at the same time.

Additionally, all opened popups are now closed when the GUI is hidden. Otherwise this results in crashes, as the already opened popups reference the current layer and quad selection, which can change or become invalidated while the GUI is hidden.

Closes #6383.
2023-03-07 00:31:31 +01:00
bors[bot] 5107b38d04
Merge #6324 #6345
6324: Optimize client ids map update r=def- a=0xfaulty

I have launched support for 128 players in testing mode on my server, it's means it's time for another step in this direction here. Perhaps not all changes will be clear, I am ready to answer/discuss them as usual. Let me know if I forgot or didn't take anything into account.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6345: Set constant and uniform names for the server and client CMake targets r=def- a=Kaffeine

This MR set the server and client CMake target names to `game-server` and `game-client` which are uniform with other targets such as `engine-gfx`, `engine-shared`, and `game-shared`.

Set uniform names for the targets to:
1. Avoid long rebuilds on the target _executable_ name changed
2. Provide the same name for different executables and/or different setup (use-cases are `cmake --build . --target game-server` and various CMake target lookups in IDEs)

Those changes are necessary but not enough to allow CI for custom app name on all platforms.

Personally this 'll allow me switch to between DDNet and Infclass branches faster and without breaking the targets configuration (e.g. with that patchset I can have `game-client` as an active target in both branches), and also reduces the conflicts in `CMakeLists.txt`.
Easier to switch between the forks => easier to contribute.

Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
Co-authored-by: Valentin Bashkirov <v.bashkirov@dev.tassta.com>
Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
2023-03-05 16:53:37 +00:00
ChillerDragon 97ac4e791e Flush NETMSG_PING and NETMSG_PING_REPLY
The client measures the time difference between
ping send and ping reply receive.
Without MSGFLAG_FLUSH the server keeps the chunk
until the next flush which makes the ping dependend
on when the next flush happens.
2023-03-05 17:29:14 +01:00
Dennis Felsing 0ff19c617a Fix color in json (fixes remaining #6366 hopefully) 2023-03-05 15:43:15 +01:00
Dennis Felsing 38933d319f Fix invalid json (partially fixes #6366) 2023-03-05 15:43:15 +01:00
Dennis Felsing d6f617debd Version 16.8 2023-03-05 15:41:26 +01:00
bors[bot] a14f32cf47
Merge #6369
6369: Fix Move also requesting the current canvas size, which should report… r=Robyt3 a=Jupeyy

… a resize event

fixes #6368

For some reason KDE seems to set the current window'd size of the window (even if i use fullscreen)  for the window when its minimized. And ::Move re-requests the canvas size.

This resulted in the incorrect viewport.

Funnily enough for me under KDE this also means that the check for GotResized, to only notify the components when the canvas actually resized is now useless.

`@Robyt3` can you check if Windows is not doing this behavior? Else the previous patch is useless for the crash bug :D
On the other hand, this *could* have been part of the text container bug, tho I cannot imagine yet why

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2023-03-05 11:53:12 +00:00
Robert Müller 75d371743e Disable editor file browser hotkeys while another popup is open
Prevent enter, escape, up/down and F5 keys from manipulating the editor file browser while a popup menu (map details, new folder) is open.
2023-03-03 22:28:56 +01:00
Robert Müller dc2601f335 Fix opening file in editor with enter not working after searching
The filename of the selected file is tracked separately and was not updated when the search term in the Open File dialog is changed.
2023-03-03 22:28:08 +01:00
ChillerDragon 20853793ee Fix server logfile error message 2023-03-02 09:44:27 +01:00
bors[bot] 0f5d4d8bec
Merge #6372
6372: Check in CI that no C standard headers are used, replace all usages of C standard headers with C++ headers, replace usages of C math functions r=def- a=Robyt3

Closes #6334.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-03-01 22:34:26 +00:00
Robert Müller db4ec4a12d Replace usages of C math functions
Replacing the C standard headers with the C++ standard headers causes various `error: call to 'floor' promotes float to double [performance-type-promotion-in-math-fn,-warnings-as-errors]`, which are fixed by using the C++ std math functions or our own math functions instead of the C math functions.

- Use `absolute` instead of `abs` and `fabs`.
- Use `std::floor` instead of `floor` and `floorf`.
- Use `std::ceil` instead of `ceil`, `ceilf` and `round_ceil`.
- Use `std::round` instead of `round` and `roundf`.
- Use `std::sin` instead of `sin` and `sinf`.
- Use `std::asin` instead of `asin` and `asinf`.
- Use `std::cos` instead of `cos` and `cosf`.
- Use `std::acos` instead of `acos` and `acosf`.
- Use `std::tan` instead of `tan` and `tanf`.
- Use `std::atan` instead of `atan` and `atanf`.
- Use `std::pow` instead of `pow` and `powf`.
- Use `std::log` instead of `log` and `logf`.
- Use `std::log2` instead of `log2` and `log2f`.
- Use `std::log10` instead of `log10` and `log10f`.
- Use `std::pow` instead of `pow` and `powf`.
- Use `std::sqrt` instead of `sqrt` and `sqrtf`.
- Use `std::fmod` instead of `fmod` and `fmodf`.
- Use `direction(Angle)` instead of `vec2(std::cos(Angle), std::sin(Angle))`.
- Use `length(vec2(x, y))` instead of `std::sqrt(x * x + y * y)`.
- Remove unused `NormalizeAngular` and `AngularDistance` functions.
2023-03-01 19:26:53 +01:00
Robert Müller a76fb9b99a Replace all usages of C standard headers with C++ headers 2023-03-01 19:26:51 +01:00
Robert Müller 24fd7e626d Fix client crash when cl_chat_old config is used
The graphics are not initialised when `RebuildChat` is called by `ConchainChatOld`, which causes the client to crash if `cl_chat_old` is present in the user's config or used as a command line argument.
2023-02-28 21:43:21 +01:00
Valentin Bashkirov 287d36c4d1 fixed comments 2023-02-28 13:06:50 +01:00
Jupeyy c7362ba6c4 Fix Move and SetWindowScreen also requesting the current canvas size, which should report a resize event 2023-02-26 13:56:37 +01:00
bors[bot] e992089d02
Merge #6364
6364: Fix incorrect text wrapping in ingame server info r=def- a=Robyt3

The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already.

This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`).

For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.

Before:

![screenshot_2023-02-26_11-46-26](https://user-images.githubusercontent.com/23437060/221405841-30c0a57a-d7ce-44c5-8c2e-958d67c801a4.png)

After:

![screenshot_2023-02-26_11-41-24](https://user-images.githubusercontent.com/23437060/221405844-faf9095f-07d9-4dde-bfd5-9e44197d1fce.png)


## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-26 11:52:18 +00:00
Robert Müller d1a9f0a76a Fix erratic smooth scrolling when scroll time is changed
Remember the maximum animation time when initiating a smooth scroll, so the smooth scrolling does not change erratically when `ui_smooth_scroll_time` is changed while smooth scrolling is in progress.
2023-02-26 12:12:08 +01:00
Robert Müller ffa4801220 Fix incorrect text wrapping in ingame server info
The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already.

This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`).

For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.
2023-02-26 11:43:55 +01:00
Jupeyy 9530077588 Only call onresize events if actual size changed
clearify difference between resize and window property change for resolution list
2023-02-25 16:02:38 +01:00
Dennis Felsing fa3675d328 Improve warning text in backend_sdl 2023-02-25 10:40:36 +01:00
Robert Müller aace33fc3c Support 4 and 8 digit RGBA color values in console
In addition to values in `$RGB` and `$RRGGBB` format, also support the `$RGBA` and `$RRGGBBAA` formats for color variables.
2023-02-24 20:32:44 +01:00
Robert Müller cd15b93517 Remove unnecessary temporary variables 2023-02-24 18:11:16 +01:00
Robert Müller f5221caf50 Mark ColorRGBA/ColorHSLA functions as const 2023-02-24 18:10:32 +01:00
bors[bot] 931ea6d828
Merge #6351
6351: Fix client crash when echoing client message to chat, use em dash for client messages in chat like on upstream r=def- a=Robyt3

![client-message](https://user-images.githubusercontent.com/23437060/220452193-1ce5cc5b-b79b-4632-a675-5ca70c37e7f0.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-24 08:25:43 +00:00
Robert Müller a1821986fa Align color picker buttons on right side
Align the color picker selection and reset buttons on the right side instead of the left side dependent on the label width.

Closes #6237.

The `UseCheckBox` argument is removed and instead `pCheckBoxValue != nullptr` is used.
2023-02-23 22:32:04 +01:00
Robert Müller 541115022a Fix client crash when echoing client message to chat
The client crashes when printing a client message to the chat from a config file or from the command line, as the graphics have not been initialized at that point.

Closes #6350.
2023-02-23 21:49:56 +01:00
Robert Müller 284f3326a7 Use em dash for client messages in chat like on upstream 2023-02-23 21:49:56 +01:00
bors[bot] ebe605ab2e
Merge #6355
6355: Mark absolute #includes as absolute r=def- a=heinrich5991

Also verify that absolute imports are done using `#include <>` in CI.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2023-02-23 15:26:02 +00:00
heinrich5991 1a2c82c0b1 Mark absolute #includes as absolute 2023-02-23 10:53:16 +01:00
Robert Müller 3cd294372a Fix text rendering over maximum line width with newline
When a word is rendered over the maximum line width it should be moved to the next line.

However, this was not working correctly if the word ends with a newline instead of a space, because then the text x-advance including this word did not exceed the maximum width, as the newline caused the x-advance to be reset before it can be used.

This is fixed by replacing the unused flag `TEXTFLAG_ALLOW_NEWLINE` with the flag `TEXTFLAG_DISALLOW_NEWLINE`, which causes newline characters to be replaced with space characters. This flag is then used when calculating whether the next word fits in the current line.

Closes #4541.
2023-02-21 23:38:41 +01:00
Robert Müller 61bf48c1ed Add chat message constants from upstream, remove redundant comments
Add `CLIENT_MSG = -2` and `SERVER_MSG = -1` constants from upstream.

Remove comments for self-documenting code.
2023-02-21 20:46:17 +01:00
Robert Müller 8286105804 Use RecreateTextContainer, reorder parameters
The `RecreateTextContainer` function calls `DeleteTextContainer` and then `CreateTextContainer`.

The arguments of `RecreateTextContainer` and `RecreateTextContainerSoft` are reordered so all functions take the text container as their first argument.
2023-02-20 23:39:43 +01:00
bors[bot] 0f37591af7
Merge #6340
6340: Various refactoring of text render r=def- a=Robyt3



## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-20 22:19:58 +00:00
Robert Müller f386eff45c Remove unused argument of Text/TextWidth/TextLineCount
The `void *pFontSetV` argument is unused and all invocations except one were already passing `0`, `0x0` or `nullptr` for this argument.
2023-02-20 20:06:17 +01:00
Robert Müller 4284f78bb7 Various refactoring and cleanup of text render
- Use `nullptr` instead of `NULL` and `0`.
- Consistently use `unsigned` for render flags instead of mixing `int` and `unsigned`.
- Use `constexpr` instead of `#define` for constants.
- Use prefix `S` for struct instead of `C`.
- Use `\0` instead of `0` for characters.
- Mark various methods as `const` when possible.
- Mark variables and pointer parameters as `const` when possible.
- Remove `const` from pointer parameters where constness was later removed by casting to `void *` anyway.
- Use `size_t` directly for loop variables and parameters which are being cast to `size_t` later anyway.
- Move variable declarations closer to usages.
- Fix variable names.
- Add/remove empty lines to improve readability.
- Use loops to reduce duplicate code.
- Use `bool` instead of `int`.
- Replace nested `if`s with single `if` using `&&` to reduce indentation and improve readability.
- Remove unnecessary temporary variables.
- Reorder includes.
2023-02-20 20:06:17 +01:00
Robert Müller 12e8f19421 Add comments explaining UUID generation 2023-02-20 20:05:26 +01:00
bors[bot] d347bfcbe9
Merge #6339
6339: Update menus_browser.cpp r=def- a=Sedonya

The first change concerning S-DDRace

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Sedonya_ <danilshalaginov829@gmail.com>
2023-02-20 10:42:12 +00:00
Robert Müller ec7f5560a3 Fix possible integer overflows using mem_* functions 2023-02-19 13:45:48 +01:00
Robert Müller 18cfbb53f9 Use size_t for mem_* function size parameters 2023-02-19 12:48:54 +01:00
Robert Müller d4809fa9a8 Change mem_has_null return type to bool 2023-02-19 12:48:54 +01:00
Robert Müller cb6de6a384 Group and order mem_* function implementations 2023-02-19 12:48:53 +01:00
Alexander Akulich bb5f0f8894 Cleanup unused or not defined functions 2023-02-18 20:05:52 +03:00
Robert Müller d09393e379 Add reset command to server
Move `reset` command from client to console, so it's also available on the server.
2023-02-18 16:35:12 +01:00
Robert Müller 3173aeec6a Simplify io_write_newline error handling
Instead of returning the number of bytes written, which are platform specific, return `true` on success and `false` on failure, so no platform specific code is required when checking the result.
2023-02-18 14:13:55 +01:00
Sedonya_ c0b39628aa Update menus_browser.cpp 2023-02-17 00:48:31 +05:00
bors[bot] 95a65f5695
Merge #6338
6338: Reset graphics container indices after deletion r=Jupeyy a=Robyt3

Reduce duplicate code and improve correctness by passing indices of quad, buffer and text containers by reference and always setting them to `-1` after they are deleted.

Also check if index is `-1` before trying to delete it to reduce duplicate code when calling the methods.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-16 10:24:41 +00:00
bors[bot] 9941bda313
Merge #6333
6333: Add `CFGFLAG_SAVE` flag to save prediction margin (fixes #6332) r=def- a=Chairn

I guess when you have a bad connection, it stays the same during several days, so it makes sense to save prediction margin

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Chairn <chairn.nq@hotmail.fr>
2023-02-15 20:36:29 +00:00
Robert Müller 3280f1824f Reset graphics container indices after deletion
Reduce duplicate code and improve correctness by passing indices of quad, buffer and text containers by reference and always setting them to `-1` after they are deleted.

Also check if index is `-1` before trying to delete it to reduce duplicate code when calling the methods.
2023-02-15 21:05:15 +01:00
bors[bot] 3fcabec30b
Merge #6328
6328: Remove `bytes_be_to_int` and `int_to_bytes_be`, static assert size of `int` and `unsigned`, refactoring r=heinrich5991 a=Robyt3

Supersedes #6263.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-14 22:11:05 +00:00
ChillerDragon 4772428256 Add 0.7 system message constants 2023-02-14 11:40:55 +01:00
Chairn 3f050f5e6a Add CFGFLAG_SAVE flag to save prediction margin (fixes #6332) 2023-02-13 21:24:10 +01:00
Robert Müller ef2aa13c73 Update documentation of bytes_be_to_uint and uint_to_bytes_be 2023-02-11 13:59:08 +01:00
Robert Müller be6862e997 Use sizeof(int32_t) instead of 4 2023-02-11 13:59:08 +01:00
Alexander Akulich 3a9e4ee067 Extract SnapPickup() to CGameContext helpers 2023-02-10 23:12:26 +03:00
Alexander Akulich 2ad5c020e0 Add a simpler IServer::SnapNewItem() API based on some more generated data 2023-02-10 23:12:24 +03:00
Alexander Akulich cc43d402d3 Extract SnapLaserObject() from entities to CGameContext helpers 2023-02-10 23:07:07 +03:00
Alexander Akulich f5d7174c36 GameContext: Use SERVER_DEMO_CLIENT instead of a magic number 2023-02-10 23:04:01 +03:00
Alexander Akulich 971e1b0093 server/pickup: Use enum values and struct size instead of magic numbers 2023-02-10 23:04:01 +03:00
bors[bot] 911bd0e69a
Merge #6282
6282: Add a refresh button to the editor file browser r=heinrich5991 a=Robyt3

![screenshot_2023-01-13_22-51-07](https://user-images.githubusercontent.com/23437060/212426385-f8c03e58-8e5d-4c47-9f19-865946c5be9c.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-02-04 11:16:09 +00:00
Robert Müller 624f7df217 Fix memory leak of editor preview image texture and data
The texture of the previous preview image was not unloaded before loading the texture of the new image.

The PNG data was never freed either. It's not necessary to keep this data loaded after loading the texture.
2023-02-04 11:28:13 +01:00
Robert Müller 64081ad3e4 Add static assert to ensure correct size of int and unsigned
We assume in various places, especially when using `bytes_be_to_uint` and `uint_to_bytes_be`, that `int` and `unsigned` are 4 bytes in size.
2023-02-04 01:24:03 +01:00
Robert Müller 218e6f7985 Remove bytes_be_to_int and int_to_bytes_be
Use `bytes_be_to_uint` and `uint_to_bytes_be` instead.

As casting between `int` and `unsigned` preserves the bit representation of the value, it's not necessary to apply additional tricks to convert between `char` arrays and `int`.
2023-02-04 01:24:03 +01:00
Robert Müller 0a32e58367 Add error message when saving screenshot fails 2023-02-02 21:50:32 +01:00
Valentin Bashkirov 934546e9c5 skip pMap filling on new versions 2023-02-02 12:12:48 +01:00
Robert Müller bd5c39f528 Fix wrong system name being used for logging client git revision 2023-02-01 23:54:43 +01:00
Valentin Bashkirov 63fe1e29d2 rewrote pMap filling 2023-02-01 22:37:17 +01:00
bors[bot] 9bd43795c8
Merge #6293
6293: rewrite int64_t to bitset for clients mask r=Robyt3 a=0xfaulty

Alternative version for PR [#6292](https://github.com/ddnet/ddnet/pull/6292) with bitset used.
I did the naming as I would like, but I can change it if there is a more suitable one, typedef is just for shortening, can be removed.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Valentin Bashkirov <v.bashkirov@dev.tassta.com>
Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
2023-01-31 17:06:49 +00:00
Valentin Bashkirov 056ae4091d removed bitmask.h 2023-01-31 10:07:25 +01:00
Valentin Bashkirov 1bb7b5b44a use length_squared 2023-01-31 00:46:39 +01:00
bors[bot] e0315f528e
Merge #6313
6313: Use `str_copy` instead of `str_format`, minor fixes and refactoring r=Chairn a=Robyt3



## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-28 16:17:47 +00:00
Robert Müller 52aa8ac22a Use str_copy instead of str_format
Using `str_format` without format arguments is equivalent to `str_copy`, but using the latter is more efficient and readable.

As `str_format` also returns the result `str_utf8_fix_truncation`, i.e. the potentially truncated string length, the return value is also added to `str_copy` so existing invocations don't need to be adjusted.
2023-01-28 16:37:33 +01:00
Robert Müller 34ef28c6b6 Fix empty chat message being sent when using moderate
When activating `moderate` on a server that already has another active moderator, `aBuf` contained undefined values and the empty or undefined message was sent to the clients.

Clients ignore empty chat messages and don't display or log them, but the empty message can be seen in the server console.

Now no buffer is used anymore, so no empty message can be sent.
2023-01-28 16:36:03 +01:00
Robert Müller 31bcc59a86 Print database connection error that was previously unused
The string copied into `aError` was previously unused because the function immediately returns.

Now the error is logged to the console.
2023-01-28 16:35:32 +01:00
Robert Müller 854dc47cf7 Replace unnecessary char buffers with pointers 2023-01-28 16:35:29 +01:00
bors[bot] 936ff4a444
Merge #5913
5913: Only use pthread_attr_set_qos_class_np if it's available r=heinrich5991 a=def-

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-01-27 22:21:23 +00:00
Robert Müller 25216bfddb Increase relative joystick movement based on input update time
For relative mouse movement in SDL, the `SDL_GetRelativeMouseState` function always returns distance that the mouse moved since the last call of this function.

For joysticks, we only have access to the current axis values and no accumulated values.
This made the relative joystick movement speed decrease a lot when the client's refresh rate is low.
This is now counteracted by measuring the average time between calls of `IInput::Update` and multiplying the joystick movement by this number.

Closes #6296.
2023-01-26 23:37:52 +01:00
Robert Müller 35c863b4d2 Disable relative joystick when console is open or window not focused
It shouldn't be possible to move the joystick when the console is open or when the window is not focused.
2023-01-26 23:35:55 +01:00
Robert Müller f25ffd9669 Remove unused IInput::VideoRestartNeeded
The variable is never set to `true` so the function always returns `false` and any code depend on this variable was never executed.
2023-01-26 23:35:00 +01:00
Robert Müller c2e8f6738a Use bool instead of int for m_InputGrabbed 2023-01-26 23:35:00 +01:00
Robert Müller 25872820d7 Fix division by zero when joystick deadzone is at maximum
By preventing the actual deadzone value from reaching `1.0f`.
2023-01-26 23:34:54 +01:00
Valentin Bashkirov d61fcbaba2 optimize map update 2023-01-26 20:21:42 +01:00
Dennis Felsing ccc6cd59de Only use pthread_attr_set_qos_class_np if it's available
Noticed in nixOS that DDNet package is marked as broken on Darwin for this reason:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/games/ddnet/default.nix
2023-01-26 15:42:46 +01:00
Valentin Bashkirov 79f72a5d55 move typedef to protocol.h 2023-01-26 11:56:48 +01:00
Robert Müller 9054eb15aa Add buttons to move envelopes left and right, use unicode icons
Closes #4129.
2023-01-25 20:05:06 +01:00
Robert Müller b997fe97bc Decrease buffer size 2023-01-25 20:05:06 +01:00
Robert Müller 385fa4d36c Slightly decrease width of name editbox if total width is low 2023-01-25 20:05:06 +01:00
Robert Müller 2514f1d521 Align the editbox labels in the envelope editor with the editboxes 2023-01-25 20:05:06 +01:00
Robert Müller 27790be784 Reserve same space for all envelope channel buttons
Keep all the UI elements in the envelope editor at the same position, independent from the number of channels of the selected envelope.

Previously the UI elements changed their position due to different numbers of channels of the different envelope types. Now the space for the maximum number of channels is always reserved and the UI elements don't move around.
2023-01-25 20:05:06 +01:00
Robert Müller 7ce143bd9e Add CEnvPoint::MAX_CHANNELS constant 2023-01-25 20:05:05 +01:00
Robert Müller 3c42b224f5 Add margin to point value/time editboxes for low screen width
The labels for the editboxes are not shown when the screen width is low, but the spacing should still be applied to the editboxes in that case.
2023-01-25 20:05:05 +01:00
Robert Müller d6d8739031 Remove unnecessary temporary CUIRect 2023-01-25 20:05:05 +01:00
Robert Müller c62cc979cb Remove dead commented code 2023-01-25 20:05:05 +01:00
Robert Müller c9d8fedcee Use IGraphics::CORNER_NONE instead of 0 2023-01-25 20:05:05 +01:00
Robert Müller 3b4d2910ef Rename envelope Synchronized checkbox to Sync.
To gain more width of other controls.
2023-01-25 20:05:04 +01:00
Robert Müller 5b61691f25 Pass nullptr to CUIRect functions when result is unused 2023-01-25 20:05:04 +01:00
Robert Müller c86ef06c5c Add tooltip support for editboxes in editor
Add tooltips for envelope name, point value and point time.
2023-01-25 20:05:04 +01:00
Zwelf 010d545fac Fix Crash in CSafeTeam::Safe/Load
Fixes #6304

`pEnt` is freed after removing, so must not be used in the next loop
iteration.
2023-01-25 18:47:03 +01:00
Valentin Bashkirov 1cd9eac7ae rewrite int64_t to CClientMask 2023-01-24 09:27:29 +01:00
bors[bot] b8e7160555
Merge #6299
6299: Show error message when downloaded map cannot be saved r=def- a=Robyt3

Check if deleting the old map file or renaming the temporary downloaded map fails. If so, show an error message which indicates that the user should delete the map file manually.

Sometimes downloaded map files seem to end up with wrong permissions, ownership or with read-only flag set, which makes the client unable to delete them.

![screenshot_2023-01-22_17-19-12](https://user-images.githubusercontent.com/23437060/213927019-ff49cb72-f60a-4c1a-b48b-d34e40d1420e.png)

Closes #5825.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-23 11:41:51 +00:00
bors[bot] 54e56b0048
Merge #6302
6302: Use OpenGL 3.3 on macOS by default r=Jupeyy a=def-

Otherwise falls back to OpenGL 1.5, since 3.0 is not supported

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-01-23 11:15:46 +00:00
Dennis Felsing ec30fc7043 Use OpenGL 3.3 on macOS by default
Otherwise falls back to OpenGL 1.5, since 3.0 is not supported
2023-01-23 12:06:04 +01:00
Dennis Felsing 1af3c2274a More minimal clang-tidy 15 run
Alternative to #6294

The only remaining problems are:
/home/deen/git/ddnet/src/engine/client/backend/glsl_shader_compiler.cpp:22:26: warning: unnecessary temporary object created while calling emplace_back [modernize-use-emplace]
        m_vDefines.emplace_back(SGLSLCompilerDefine(DefineName, DefineValue));
                                ^~~~~~~~~~~~~~~~~~~~                       ~
2023-01-23 11:20:05 +01:00
bors[bot] 3ffd4205ef
Merge #6295
6295: Implement FIFO on Windows using Named Pipes r=def- a=Robyt3

Reimplement the Linux FIFO file server and client controls on Windows by using Named Pipes.

The DDNet server/client acts as a named pipe server and receives messages.
Messages can be posted to the named pipe server by connecting to it as a client.
The named pipe client can for instance be controlled from the command line with PowerShell.

The PowerShell script `scripts/send_named_pipe.ps1` is added for this purpose.
For example the PowerShell command `./send_named_pipe.ps1 "testpipe" "echo a"` sends the command `echo a` to the pipe named `testpipe`.
Multiple commands can be sent at the same time by separating them with semicolons or newlines.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-22 21:40:17 +00:00
Robert Müller e29a6e2f0a Show error message when downloaded map cannot be saved
Check if deleting the old map file or renaming the temporary downloaded map fails. If so, show an error message which indicates that the user should delete the map file manually.

Sometimes downloaded map files seem to end up with wrong permissions, ownership or with read-only flag set, which makes the client unable to delete them.
2023-01-22 17:22:11 +01:00
Robert Müller f80e962888 Add IStorage::FileExists and IStorage::FolderExists
As wrappers around `fs_is_file` and `fs_is_dir`.
2023-01-22 17:22:11 +01:00
Robert Müller b67a1f5ce5 Add fs_is_file to check if a given path is file 2023-01-22 17:22:11 +01:00
Robert Müller 7e9129cb44 Use doxygen style for all fs_* functions 2023-01-22 17:14:04 +01:00
Robert Müller 29b61fc438 Refactor CEditor:::PopupLayer, remove CEditor::IsSpecialLayer
- Use `pCurrentLayer` instead of `pEditor->GetSelectedLayer(0)` everywhere.
- Remove unnecessary null-checks of `pCurrentLayer`.
- Use `CLayer::IsEntitiesLayer` instead of `CEditor::IsSpecialLayer` and remove the latter function.
- Restructure UI layout code and variables.
2023-01-22 11:58:37 +01:00
Robert Müller c7819841f8 Remove dead code, update documentation for LAYERTYPE_GAME
This layer type was never used when saving maps.
Game layers were always identified by their flags.
In any case the check in the popup handler is unnecessary, as the group property cannot be changed for game layers, so this code is never used.
2023-01-22 11:58:37 +01:00
Robert Müller 50ecfb178f Add CLayer::IsEntitiesLayer to reduce duplicate code 2023-01-22 11:58:30 +01:00
bors[bot] cd13871053
Merge #6215
6215: Don't count (connecting) players for voting r=Robyt3 a=def-

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
2023-01-21 12:41:02 +00:00
Robert Müller 7eb5966f6f Implement FIFO on Windows using Named Pipes
Reimplement the Linux FIFO file server and client controls on Windows by using Named Pipes.

The DDNet server/client acts as a named pipe server and receives messages.
Messages can be posted to the named pipe server by connecting to it as a client.
The named pipe client can for instance be controlled from the command line with PowerShell.

The PowerShell script `scripts/send_named_pipe.ps1` is added for this purpose.
For example the PowerShell command `./send_named_pipe.ps1 "testpipe" "echo a"` sends the command `echo a` to the pipe named `testpipe`.
Multiple commands can be sent at the same time by separating them with semicolons or newlines.
2023-01-21 11:13:02 +01:00
Robert Müller f7d3052170 Export windows_format_system_message utility on Windows
Declare the function in `system.h`, so we can use it in other platform-specific components.
2023-01-20 22:53:00 +01:00
Robert Müller f78fd6bda1 Minor refactoring of CFifo
- Remove unused include.
- Instead of quitting entirely, only disable the fifo component when file cannot be used.
- Return early to reduce indentation.
2023-01-20 22:52:55 +01:00
heinrich5991 e06052292e CMsgPacker doesn't know about message ID encoding
CC #6289
2023-01-20 21:09:58 +01:00
bors[bot] 4a4d6c5483
Merge #6284
6284: Ensure integer wrapping instead of preventing overflow/underflow r=heinrich5991 a=Robyt3

As the integer overflow/underflow in `UndiffItem` can happen during normal gameplay, we should in this case neither ignore the snapshot delta nor show an error message.

Instead of depending on the particular compiler doing integer wrapping, when integer overflows or underflows occur, we make it part of the design, by casting to `unsigned`, which ensures that integer wrapping is being used.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-18 22:46:52 +00:00
Dennis Felsing f3867d677f Version 16.7.2 2023-01-18 23:20:15 +01:00
bors[bot] 0ba6c1c3b6
Merge #6289
6289: Fix `sv_vanilla_antispoof` for vanilla 0.6.5 clients r=def- a=Robyt3

This fixes issues that prevented vanilla 0.6.5 clients from joining DDNet servers with `sv_vanilla_antispoof 1` (closes #2074).

The dummy map was not valid. The size of the tiles and game layers was calculated incorrectly. The last member variable included in `CMapItemLayerTilemap` version 2 should be `m_Data`. Previously only the size of the member `m_aName` was subtracted from the total size, which was resulting in an incorrect item size, as the size of the following 5 members also needs to be subtracted.

The handshake messages were packed incorrectly. The message ID and the system flag were not added to the six packers that are passed to `SendMsgs`. The lines that are removed in this function seemed to assume that the message ID was already added but not packed, which was no longer the case. Presumable at some point `CMsgPacker` was changed without adapting the vanilla antispoof feature. Now, the message ID and system flag are properly packed when initially creating the message packers.

The `dummy_map` tool is improved to also print the generated map file's hashes and data as a C style array, so the data can immediately be copied to `network_server.cpp`.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [X] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-18 21:51:46 +00:00
Robert Müller 1a9357b961 Fix sv_vanilla_antispoof for vanilla 0.6.5 clients
This fixes issues that prevented vanilla 0.6.5 clients from joining DDNet servers with `sv_vanilla_antispoof 1` (closes #2074).

The dummy map was not valid. The size of the tiles and game layers was calculated incorrectly. The last member variable included in `CMapItemLayerTilemap` version 2 should be `m_Data`. Previously only the size of the member `m_aName` was subtracted from the total size, which was resulting in an incorrect item size, as the size of the following 5 members also needs to be subtracted.

The handshake messages were packed incorrectly. The message ID and the system flag were not added to the six packers that are passed to `SendMsgs`. The lines that are removed in this function seemed to assume that the message ID was already added but not packed, which was no longer the case. Presumable at some point `CMsgPacker` was changed without adapting the vanilla antispoof feature. Now, the message ID and system flag are properly packed when initially creating the message packers.

The `dummy_map` tool is improved to also print the generated map file's hashes and data as a C style array, so the data can immediately be copied to `network_server.cpp`.
2023-01-18 20:21:12 +01:00
Robert Müller 0e59b84718 Add str_hex_cstyle to print bytes as a C style array
This function converts data to a C style array string presentation.
2023-01-18 17:29:23 +01:00
Robert Müller 64578d4954 Improve str_hex documentation 2023-01-18 00:09:23 +01:00
Robert Müller 65cb2ed7de Ensure integer wrapping instead of preventing overflow/underflow
As the integer overflow/underflow in `UndiffItem` can happen during normal gameplay, we should in this case neither ignore the snapshot delta nor show an error message.

Instead of depending on the particular compiler doing integer wrapping, when integer overflows or underflows occur, we make it part of the design, by casting to `unsigned`, which ensures that integer wrapping is being used.
2023-01-16 18:12:28 +01:00
bors[bot] 029b42458c
Merge #6288
6288: Fix layout of kick/spec vote list items r=def- a=Robyt3

The tee and label were overlapping due to a regression from #6240.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-16 15:15:15 +00:00
Robert Müller 0948a1dc4c Fix layout of kick/spec vote list items
The tee and label were overlapping due to a regression from #6240.
2023-01-16 15:37:58 +01:00
ChillerDragon f2a26aa452 Fix build with clang on debian 11
$ clang --version
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Fixes this error

```
In file included from
/home/chiller/Desktop/git/ddnet/src/base/color.h:6:
/home/chiller/Desktop/git/ddnet/src/base/vmath.h:141:38: error:
constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr inline vector2_base<float> direction(float angle)
                                     ^
/home/chiller/Desktop/git/ddnet/src/base/vmath.h:143:29: note:
non-constexpr function 'cosf' cannot be used in a constant expression
        return vector2_base<float>(cosf(angle), sinf(angle));
                                   ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:62:1: note: declared here
__MATHCALL_VEC (cos,, (_Mdouble_ __x));
^
/usr/include/math.h:266:3: note: expanded from macro '__MATHCALL_VEC'
  __MATHCALL (function, suffix, args)
  ^
/usr/include/math.h:273:3: note: expanded from macro '__MATHCALL'
  __MATHDECL (_Mdouble_,function,suffix, args)
  ^
/usr/include/math.h:275:3: note: expanded from macro '__MATHDECL'
  __MATHDECL_1(type, function,suffix, args); \
  ^
/usr/include/math.h:283:15: note: expanded from macro '__MATHDECL_1'
  extern type __MATH_PRECNAME(function,suffix) args __THROW
              ^
/usr/include/math.h:303:34: note: expanded from macro '__MATH_PRECNAME'
                                 ^
<scratch space>:34:1: note: expanded from here
cosf
^
1 error generated.
make[2]: *** [CMakeFiles/engine-shared.dir/build.make:173:
CMakeFiles/engine-shared.dir/src/engine/shared/console.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:604:
CMakeFiles/engine-shared.dir/all] Error 2
make: *** [Makefile:171: all] Error 2
```
2023-01-16 15:10:19 +01:00
bors[bot] 4c639a5965
Merge #6286
6286: Add tooltip to demo seekbar showing the currently hovered time r=Chairn a=Robyt3

When hovering the demo seekbar, show a tooltip with the time at the hovered position.

![screenshot](https://user-images.githubusercontent.com/23437060/212565749-a38951a3-1f08-43a6-b607-02f379b28c52.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-15 21:07:54 +00:00
Robert Müller d662c7e9fd Add tooltip to demo seekbar showing the currently hovered time
When hovering the demo seekbar, show a tooltip with the time at the hovered position.
2023-01-15 21:31:45 +01:00
Robert Müller 315e52fb99 Refactor demo seekbar width calculation 2023-01-15 21:31:21 +01:00
Robert Müller a127890e2d Clear editor file browser search term when entering folder
Closes #5620.
2023-01-15 20:46:10 +01:00
Robert Müller aa23873af8 Add a refresh button to the editor file browser 2023-01-13 22:54:29 +01:00
bors[bot] 4a6d6fb654
Merge #6281
6281: Support longer file/folder names in editor r=heinrich5991 a=Robyt3



## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-01-13 21:28:25 +00:00
Robert Müller 6b873cab1a Use sizeof for array sizes that should equal other array sizes 2023-01-13 22:07:21 +01:00
Robert Müller d1712f30e6 Support longer file/folder names in editor 2023-01-13 22:07:20 +01:00
Robert Müller 25b487703f Make color pickers not change selected color as much
As described in #5844, sometimes the color kept changing when activating a color picker.

By rounding the color components before packing them into an unsigned, the color only changes very little and only at most once when activating a color picker.
2023-01-13 21:40:25 +01:00
bors[bot] a9207a931f
Merge #6276
6276: Fix announcement feature, don't depend on buffer staying consistent r=Jupeyy a=def-

There is a change in behavior: The file is now only reread if the filename changed, previously it was reread every time.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-01-13 16:30:46 +00:00
Dennis Felsing 43e994a002 Fix announcement feature, don't depend on buffer staying consistent
There is a change in behavior: The file is now only reread if the
filename changed, previously it was reread every time.
2023-01-13 16:22:22 +01:00