Commit graph

16812 commits

Author SHA1 Message Date
bors[bot] 010652c102
Merge #6404
6404: Use text and quad containers for MOTD rendering, fix MOTD height calculation r=def- a=Robyt3

Optimize MOTD rendering by caching the round rect and 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. Closes #6346.

Screenshots:

- Tutorial, ingame:
   - Before: 
![Tutorial ingame old](https://user-images.githubusercontent.com/23437060/224178255-5bac285f-0d0b-45ba-880a-10329c0075d1.png)
   - After:
![Tutorial ingame new](https://user-images.githubusercontent.com/23437060/224178246-d9348037-cc91-4456-893f-5041040575ff.png)
- Multeasymap, ingame:
   - Before: 
![Multeasymap ingame old](https://user-images.githubusercontent.com/23437060/224178443-f4aad8fb-f9a3-4cbc-a12b-ff0cc166b2e8.png)
   - After:
![Multeasymap ingame new](https://user-images.githubusercontent.com/23437060/224178458-d155ecf4-dfc4-496f-a2a5-ef5422d2cf4f.png)
- Test server, ingame:
   - Before: 
![Testing ingame new](https://user-images.githubusercontent.com/23437060/224178543-0cd794fa-ad89-453b-b255-2fcef0fd4cb0.png)
   - After: 
![Testing ingame old](https://user-images.githubusercontent.com/23437060/224178532-52d00a96-4d4d-4fc1-a9c1-94c7717f6f7b.png)
- Long, ingame:
   - Before: 
![Long ingame old](https://user-images.githubusercontent.com/23437060/224177971-5066aa03-b017-4a34-ab02-ba8b07968791.png)
   - After:
![Long ingame new](https://user-images.githubusercontent.com/23437060/224177991-52c6d391-9524-4013-b332-9a511a2cba75.png)
- Long, menu:
   - Before: 
![Long menu old](https://user-images.githubusercontent.com/23437060/224178139-6fb7b785-5b1f-4b22-acdb-514022c89181.png)
   - After:
![Long menu new](https://user-images.githubusercontent.com/23437060/224178137-d351fe22-8bc9-42e0-af5a-d414e551e4c9.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-03-09 23:39:49 +00: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
bors[bot] 4f8ff9c115
Merge #6402
6402: Remove fatal space from vim syntax r=Chairn a=ChillerDragon

<!-- 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: ChillerDragon <ChillerDragon@gmail.com>
2023-03-09 19:14:55 +00:00
bors[bot] 21fa527ed9
Merge #6401
6401: Document vim and neovim syntax install r=Chairn a=ChillerDragon

![image](https://user-images.githubusercontent.com/20344300/224081467-22f48428-4ac0-4a7f-935c-da163f98f55c.png)

Co-authored-by: ChillerDragon <ChillerDragon@gmail.com>
2023-03-09 18:54:33 +00:00
ChillerDragon 2e25167524 Remove fatal space from vim syntax 2023-03-09 17:23:16 +01:00
ChillerDragon ea25fd94e3 Document vim and neovim syntax install 2023-03-09 17:00:30 +01:00
bors[bot] bdaaeae48b
Merge #6400
6400: vim syntax support comments (closed #6399) r=edg-l a=ChillerDragon

<!-- 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: ChillerDragon <ChillerDragon@gmail.com>
2023-03-09 15:58:08 +00:00
ChillerDragon a38a5df573 vim syntax support comments (closed #6399)
Co-authored-by: Edgar Luque <git@edgarluque.com>
2023-03-09 16:55:52 +01:00
bors[bot] f78f188dff
Merge #6397
6397: Use `mem_copy` instead of `memcpy` for websockets r=def- a=Robyt3

Replace all remaining usages of `memcpy`.

## 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-09 12:53:11 +00: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
bors[bot] 398bc0d5dd
Merge #6395
6395: Replace leftover `memcpy` with `mem_copy` r=def- a=n0toose

Fixes the following error on Haiku:

```
~/ddnet/build> ninja
[5/8] Building CXX object CMakeFiles/m...a.dir/src/tools/map_replace_area.cpp.o
FAILED: CMakeFiles/map_replace_area.dir/src/tools/map_replace_area.cpp.o
/bin/c++ -DCONF_INFORM_UPDATE -DCONF_OPENSSL -DCONF_VIDEORECORDER -DGAME_RELEASE_VERSION=\"16.8\" -DGLEW_STATIC -I/boot/home/ddnet/build/src -I/boot/home/ddnet/src -I/boot/home/ddnet/src/ru>
/boot/home/ddnet/src/tools/map_replace_area.cpp: In function 'void SetExtendedArea(MapObject&)':
/boot/home/ddnet/src/tools/map_replace_area.cpp:502:33: error: 'memcpy' was not declared in this scope
  502 |                                 memcpy(Ob.m_aaExtendedArea[i], aInspectedArea, sizeof(float[2]));
      |                                 ^~~~~~
/boot/home/ddnet/src/tools/map_replace_area.cpp:7:1: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    6 | #include <game/mapitems.h>
  +++ |+#include <cstring>
    7 |
/boot/home/ddnet/src/tools/map_replace_area.cpp: In function 'bool GetVisibleArea(const float (*)[2], const MapObject&, float (*)[2])':
/boot/home/ddnet/src/tools/map_replace_area.cpp:523:9: error: 'memcpy' was not declared in this scope
  523 |         memcpy(aaInspectedArea, aaGameArea, sizeof(float[2][2]));
      |         ^~~~~~
/boot/home/ddnet/src/tools/map_replace_area.cpp:523:9: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
/boot/home/ddnet/src/tools/map_replace_area.cpp: In function 'void GetGameAreaDistance(const float (*)[2][2], const MapObject*, const float (*)[2], float*)':
/boot/home/ddnet/src/tools/map_replace_area.cpp:597:9: error: 'memcpy' was not declared in this scope
  597 |         memcpy(aaaVisibleAreas[0], aaVisibleArea[0], sizeof(float[2][2]));
      |         ^~~~~~
/boot/home/ddnet/src/tools/map_replace_area.cpp:597:9: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
/boot/home/ddnet/src/tools/map_replace_area.cpp: In function 'bool GetLineIntersection(const float*, const float*, float*)':
/boot/home/ddnet/src/tools/map_replace_area.cpp:639:17: error: 'memcpy' was not declared in this scope
  639 |                 memcpy(aIntersection, aBorders, sizeof(float[2]));
      |                 ^~~~~~
/boot/home/ddnet/src/tools/map_replace_area.cpp:639:17: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
[6/8] Building CXX object CMakeFiles/g....dir/src/game/generated/checksum.cpp.o
ninja: build stopped: subcommand failed.
~/ddnet/build>
```

#### Regarding the Haiku port

After a two year hiatus (I temporarily stopped working on the Haiku port after being done with 80% of the work, as I was waiting for a Haiku-specific Mesa patch to land so that I could run it), I tried testing whether the port would work in a Haiku VM.

I was a bit afraid that it wouldn't work because of Rust being added as a dependency, but apparently, Haiku can support that just fine using OpenGL. Some additional stability/input-related patches may be required.

![image](https://user-images.githubusercontent.com/30193966/223889249-5ac8568f-23e4-418f-beae-7496e6afdbbb.png)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [x] 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: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
2023-03-09 10:54:07 +00: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] 08176ab95b
Merge #6396
6396: Pick client icon file based on client name r=def- a=ChillerDragon

convenience for downstream projects that renamed the client

<!-- 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: ChillerDragon <ChillerDragon@gmail.com>
2023-03-09 09:59:37 +00:00
ChillerDragon c801df311c Pick icon files based on executable name
convenience for downstream projects that renamed the client or server

Co-authored-by: Paul <paul.turkovskiy@gmail.com>
2023-03-09 10:44:52 +01:00
bors[bot] 2222a1df57
Merge #6393
6393: Ignore .gdb_history r=def- a=ChillerDragon

The file is created when running gdb with ``set history save on``

<!-- 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: ChillerDragon <ChillerDragon@gmail.com>
2023-03-08 14:59:23 +00:00
ChillerDragon 3dd24355d2 Ignore .gdb_history
The file is created when running gdb with ``set history save on``
2023-03-08 14:18:58 +01:00
bors[bot] 28f9d0def0
Merge #6389
6389: CMake: Add targets to allow (previously available) build by exec name r=heinrich5991 a=Kaffeine

Seems to be needed only for MinGW/Unix Makefiles generator.

Note: ninja (and probably some other build systems) does not allow us to add extra `DDNet` target because it already builds a file with that name. At the same time, CMake alias targets are not propagated to Makefile.

Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
2023-03-08 11:42:59 +00: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
bors[bot] 797b153702
Merge #6391
6391: Revert editor changes to popup menus, so popup menus are shown also when GUI is hidden r=def- a=Robyt3

Closes #6385.

## 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 22:14:16 +00: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
Alexander Akulich cb0192dd56 CMake: Add targets to allow (previously available) build by exec name
Seems to be needed only for MinGW/Unix Makefiles generator.
2023-03-07 22:26:28 +03:00
bors[bot] b9486ac0af
Merge #6384
6384: Close editor popups and prevent popups from opening when GUI hidden r=def- a=Robyt3

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.

## 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-06 23:47:26 +00: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
bors[bot] 775b35c30e
Merge #6381
6381: Flush `NETMSG_PING` and `NETMSG_PING_REPLY` r=def- a=Robyt3

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.

Cherry-picked from teeworlds/teeworlds#3194.

## 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: ChillerDragon <chillerdragon@gmail.com>
2023-03-05 16:34:09 +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
bors[bot] fdc425b5f5
Merge #6377
6377: Fix invalid json (partially fixes #6366) r=edg-l 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-05 14:53:33 +00: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
bors[bot] 4cd2c2964f
Merge #6376
6376: Fix opening file in editor with enter not working after searching, disable editor file browser hotkeys while another popup is open 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-03 22:45:29 +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
bors[bot] 4fa433960b
Merge #6374
6374: Fix server logfile error message r=def- a=ChillerDragon

before:
```
$ ./DDNet-Server 'logfile "invalid/path.txt"' | grep failed
2023-03-02 09:43:37 I client: failed to open 'invalid/path.txt' for logging
```

after:
```
$ ./DDNet-Server 'logfile "invalid/path.txt"' | grep failed
2023-03-02 09:43:55 I server: failed to open 'invalid/path.txt' for logging
```

🤯 

Co-authored-by: ChillerDragon <chillerdragon@gmail.com>
2023-03-02 09:01:00 +00: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
bors[bot] c9c19eb980
Merge #6373
6373: Fix warning in CI when cloning twmap from GitLab r=def- a=Robyt3

`warning: redirecting to https://gitlab.com/Patiga/twmap.git/`

## 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:13:57 +00:00
Robert Müller 69e95fbb5b Fix warning in CI when cloning twmap from GitLab
`warning: redirecting to https://gitlab.com/Patiga/twmap.git/`
2023-03-01 21:10:34 +01: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 cf4da09ce9 Check in CI that no C standard headers are used
Add `scripts/check_standard_headers.sh` to check that no C standard header is included in our code. The script prints an error message for every C header used as well as the corresponding C++ header that should be used instead.

The script is added to the style checking CI.
2023-03-01 19:26:51 +01:00