Commit graph

798 commits

Author SHA1 Message Date
Robert Müller aeb8790649 Remove base/tl/base.h 2022-05-15 20:36:16 +02:00
Robert Müller 535fbd28fa Replace usages of tl_assert with dbg_assert 2022-05-15 19:25:18 +02:00
bors[bot] e346e3e186
Merge #5072
5072: Updated unicode script generation (fixes https://github.com/ddnet/ddnet/issues/5017) r=def- a=Chairn

I also updated the version to 15.0.0. However, confusables are still from version 14 as https://www.unicode.org/Public/security/15.0.0/ is empty.

CC `@heinrich5991` 

## 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 if it works standalone, system.c especially
- [ ] 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>
2022-05-15 11:17:15 +00:00
heinrich5991 b9e255a7a1 Mark dbg_break as [[noreturn]] 2022-05-13 09:04:39 +02:00
heinrich5991 52d0dc8b5b Add functions to encode/decode base64 2022-05-13 09:00:48 +02:00
Chairn 2cb4a4d8f5 Changed file names to match classic source.c include header.h 2022-05-07 00:54:29 +02:00
Robert Müller 22562094bd Remove base/tl/string.h 2022-05-07 00:17:29 +02:00
Chairn 5925181acc Updated unicode script generation 2022-05-06 20:31:24 +02:00
heinrich5991 b20f16059d Add logging macros log_{error,warn,info,debug,trace}
This makes it almost as short to log as with `dbg_msg` (one to two more
characters), and much shorter than
`Console()->Print(IConsole::OUTPUT_LEVEL_{STANDARD,ADDINFO,DEBUG})`.
2022-04-29 15:32:42 +02:00
heinrich5991 fa4bcd5ec0 Unify logging infrastructure between IConsole and dbg_msg
This makes the "black console window" less important on Windows (or
anywhere else, for that matter), lets you see logs from other threads in
the f1 console, and removes the distinction between `IConsole::Print`
and `dbg_msg`.
2022-04-29 15:21:26 +02:00
Edgar 2fca2872b4
Merge branch 'master' into pr/system/documentation 2022-04-29 10:26:45 +02:00
bors[bot] 98bf721587
Merge #4726 #4727 #4728 #4880 #5022
4726: Display super with "super" string in scoreboard (fixes #4724) r=heinrich5991 a=def-

instead of showing the number 64

Alternative to https://github.com/ddnet/ddnet/pull/4725

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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)


4727: Increase MAX_IDS to 32k (fixes #4723) r=heinrich5991 a=def-

Not sure I like it, otherwise we have to edit Game City.

Maybe we should fail this in map editor already instead of allowing to
create a map which requires > MAX_IDS

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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)


4728: Implement shields that remove specific weapon (fixes #4572) r=heinrich5991 a=def-

Thanks to Cellegen for graphics.

Functionality works, still a bit buggy sprite display (see screenshot), maybe someone can
quickly spot what I'm doing wrong

<img width="898" alt="Screenshot 2022-02-18 at 00 50 14" src="https://user-images.githubusercontent.com/2335377/154591108-d89cb475-daaf-4a6a-9748-17160a1e71a2.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 if it works standalone, system.c especially
- [ ] 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)


4880: Add mysql to github workflow in ubuntu 20.04 r=heinrich5991 a=def-

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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)


5022: Use std::clamp r=heinrich5991 a=def-

Not sure if we want to, there are some easy functions like this we could
take from stdlib now

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2022-04-29 00:30:17 +00:00
Dennis Felsing 6a7c7ff4cc Use std::gcd 2022-04-28 17:01:53 +02:00
Dennis Felsing 67286a4971 Remove unused sign() (C++11 has signbit) 2022-04-28 17:01:51 +02:00
Dennis Felsing af0fcf8773 Use std::clamp
Not sure if we want to, there are some easy functions like this we could
take from stdlib now
2022-04-28 17:01:30 +02:00
Dennis Felsing 50e9e4c8c4 Use XDG_DATA_HOME 2022-04-25 09:50:46 +02:00
def 790c1cc0aa Switch new players to DDNet config dir, support Teeworlds as fallback
This way new players will get DDNet directory, old ones can switch
directory if they want, or keep using the old one.

If we ever enforce a switch in a future version, this will make it
easier since older DDNet versions will also support the DDNet directory
already.
2022-04-25 09:50:45 +02:00
heinrich5991 103b663662 Rename ActCur, some "actual" → "current"
Seems like it got introduced by means of the false friend "actual" ≠
"aktuell" = "current".
2022-04-23 00:42:37 +02:00
Robert Müller c14889e18a Code format: use multiple lines for function 2022-04-10 15:41:22 +02:00
Robert Müller 05bc25610b Fix undefined behavior in fixed point number conversion 2022-04-10 15:38:45 +02:00
Chairn 691b0435db Change tolower array name to not conflict with tolower std function 2022-04-03 01:12:27 +02:00
Chairn ae1e3c079d clang-format 2022-04-03 01:12:27 +02:00
Chairn 21e64cbdcb Added external linkage instead of static const 2022-04-03 01:12:27 +02:00
def e4bec352d9 Remove unused bubble sort (finally) 2022-04-02 18:30:03 +02:00
Dennis Felsing 843acf6a5a Use std::size instead of sizeof(a) / sizeof(a[0]) 2022-03-30 18:55:04 +02:00
bors[bot] ea852d8f1c
Merge #4852
4852: Fixed some useless double promotion r=def- a=Chairn

Double promotion occurs quite often when an operator is an hidden double, like constants written without the 'f' at the end. We might get a tiny micro improvement. Unfortunately, we can't do anything for all the double promotion occurring in printf like functions as it is the default for both C and C++.

Only this line might change physics:
4d47fcda09 (diff-d76009083687ba43c59dc7bb2c7357457c999c2eb9d913967d598e913c6fd01fR406)

## 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 if it works standalone, system.c especially
- [ ] 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: Chairn <chairn.nq@hotmail.fr>
2022-03-25 18:29:02 +00:00
Jupeyy bb1ed45c3d Emscripten support 2022-03-25 12:42:18 +01:00
Chairn 6086893fa6 Renamed all shadowing/shadowed variables 2022-03-24 17:59:49 +01:00
Chairn d4aac67929 Fixed some useless double promotion 2022-03-23 18:22:08 +01:00
Dennis Felsing 6600bc622b Fix some Windows build warnings 2022-03-21 16:34:47 +01:00
bors[bot] f49afca3dc
Merge #4818
4818: Add str_startswith_nocase and str_endswith_nocase r=def- a=ChillerDragon

Gets rid of the more complex str_comp_nocase_num usage

## 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 if it works standalone, system.c especially
- [ ] 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: ChillerDragon <ChillerDragon@gmail.com>
2022-03-20 10:27:18 +00:00
heinrich5991 897ba5854a Use system.h style for system.h 2022-03-13 19:45:01 +01:00
ChillerDragon 99b0eb2819 Add str_startswith_nocase and str_endswith_nocase 2022-03-13 11:42:45 +01:00
Jupeyy 25ceea6f5f Write log to disk on assert 2022-03-12 13:48:29 +01:00
Robert Müller 74f87ee604 Remove unnecessary trailing semicolons after method declarations 2022-03-08 20:01:26 +01:00
heinrich5991 1a35595bce Unify buffer handling in UDP sockets across operating systems
Previously, only Linux used an internal buffer (for optimized
receiving). Now all OSs use an internal buffer so that the call to
`net_udp_recv` behaves the same on all platforms.
2022-03-05 14:11:03 +01:00
heinrich5991 a8664a0100 Hide the recvmmsg as an implementation detail 2022-03-04 19:33:06 +01:00
heinrich5991 471bb441a1 Move NETSOCKET behind a pointer so it can grow 2022-03-04 19:33:06 +01:00
Edgar a7c25964f4
progress 2022-03-04 12:02:18 +01:00
def fd44f4523a Support NO_COLOR environment variable 2022-02-27 09:30:51 +01:00
bors[bot] a8e8619af7
Merge #4759
4759: Add module offset r=def- a=Jupeyy

Get module offset, so we can at least recover the DDNet.exe paths:
`Error occurred on Wednesday, February 23, 2022 at 20:34:57. (with offset 00007FF7C4A00000)`
(Address - Offset) + (Image-Base)
(ImageBase  = winedump -f DDNet.exe (image base: usually 0x140000000)

Tested on windows 64-bit

08ab91c489

ez download from github actions:
https://github.com/Jupeyy/drmingw/actions/runs/1889238377

## 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 if it works standalone, system.c especially
- [ ] 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>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-02-24 10:59:52 +00:00
Jupeyy 8bed1c7267 Add module offset 2022-02-24 10:45:58 +01:00
bors[bot] a5b3bd9fa0
Merge #4733
4733: Fix MinGW warnings (fixes #4731) r=Jupeyy a=def-

`@Jupeyy` `@Robyt3` `@Zwelf` 

## 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 if it works standalone, system.c especially
- [ ] 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>
2022-02-19 08:51:54 +00:00
Dennis Felsing aaec807963 Disable invalid cast warning in set_exception_handler_log_file 2022-02-18 12:55:13 +01:00
Dennis Felsing ded32c4334 Fix MinGW warnings (fixes #4731) 2022-02-18 12:54:19 +01:00
Edgar 7fbcaa6d36
start document system.h with doxygen 2022-02-18 11:35:46 +01:00
Jupeyy 4330ff83cf Add exception handling for Windows 2022-02-18 11:35:06 +01:00
Dennis Felsing dbfc62d2c0 Add modernize-deprecated-headers 2022-02-15 00:22:52 +01:00
Dennis Felsing 68e4eb21d5 Add modernize-use-bool-literals 2022-02-15 00:12:52 +01:00
ChillerDrgon 064ba50230 Add secure_random_uninit 2022-02-14 12:06:31 +01:00
Robert Müller 082e26d5ba Reduce system API calls when listing directory contents 2022-02-04 16:30:12 +01:00
heinrich5991 4d90119f25 Don't flush all files, some improvements to io_sync
- Empty buffers using `io_flush` before calling the OS function for
  syncing the file to disk.
- Fix error return of `io_sync` on Windows.
- Don't indiscriminately flush all files on close.
- Add a test that `io_sync` can return without error.
2022-02-01 02:33:18 +01:00
def 31f3c841ed Lower chance of losing written files by syncing them to disk on close
I'm wondering if this helps. Overhead exists, but is not that much (on
my system): 333 ms for initialization instead of 311 ms

If we only want to do this for files written to, then we need to keep
track of how the file was opened.
2022-02-01 02:32:53 +01:00
heinrich5991 7a6f5a8af4 Add a function for getting a handle to the current executable file 2022-01-31 21:31:26 +01:00
heinrich5991 67508adff1 Add function to get the OS version 2022-01-31 03:15:19 +01:00
bors[bot] 155a922d47
Merge #4628 #4639
4628: Disable or fix some spammy new clang-tidy 13 warnings r=heinrich5991 a=def-

```
src/engine/client/backend/opengles/opengles_sl_program.cpp:10:11: warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]
          ^

src/engine/graphics.h:330:67: warning: 2 adjacent parameters of 'CFreeformItem' of similar type ('float') are easily swapped by mistake [bugprone-easily-swappable-parameters]
                CFreeformItem(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) :
                                                                                ^~~~~~~~~~~~~~~~~~

src/game/editor/layer_tiles.cpp:1802:14: warning: result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
                        mem_zero(&m_pSwitchTile[y * m_Width], o * sizeof(CSwitchTile));
                                  ^

src/game/server/entities/plasma.cpp💯152: warning: operator has equivalent nested operands [misc-redundant-expression]
        if(SnapPlayer && SnapPlayer->GetTeam() != TEAM_SPECTATORS && !SnapPlayer->IsPaused() && SnapChar && SnapChar && SnapChar->Team() != m_ResponsibleTeam && SnapPlayer->m_ShowOthers != 1)
                                                                                                ~~~~~~~~    ~~~~~~~~                                          ^

src/game/editor/editor.cpp:4295:38: warning: The right operand of '>' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                        if(m_FilePreviewImageInfo.m_Width > Preview.w)
                                                          ^ ~~~~~~~~~
```
<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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)


4639: Fix SendStartWarning() to only warn every 3 seconds r=heinrich5991 a=def-

Thanks for Skeith for report

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-01-26 13:17:54 +00:00
Dennis Felsing 7903b40066 Quiet clang-tidy on macOS 2022-01-23 19:04:01 +01:00
Dennis Felsing c79320ed71 Improve macos performance
by declaring all threads as QoS class interactive
2022-01-23 18:23:09 +01:00
def 3f7befdd8b Add some further readability checks, mostly redundancy
/media/ddnet/src/engine/server/databases/sqlite.cpp:232:55: warning: the address of ‘char* sqlite3_expanded_sql(sqlite3_stmt*)’ will never be NULL [-Waddress]
  232 |         if(m_pStmt != nullptr && sqlite3_expanded_sql != nullptr)
      |                                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
2022-01-22 17:22:01 +01:00
def bc78ba57b9 Enable readability-inconsistent-declaration-parameter-name 2022-01-22 14:12:59 +01:00
Robert Müller 2f17fa9b39 close find handle in fs_file_time on windows 2022-01-18 22:42:08 +01:00
Zwelf dcabb07707 Fix uninitialized count variable and naming convention 2022-01-09 22:51:55 +01:00
Robert Müller 0726703937 fix undefined behavior in byte packing functions, add tests 2021-12-31 13:18:41 +01:00
bors[bot] 768a007eed
Merge #4429 #4517
4429: Pr sql fail fast r=heinrich5991 a=Zwelf

Remaining changes for #4424. Improving sql write times during shutdown and slow mysql responses/timeouts. I still want to test this change, especially for the last commit. Might have time for testing this evening. Thoughts and feedback on this patchset welcome.

## Checklist

- [ ] Tested the change ingame
   - [x] in mysql mod
   - [ ] in sqlite3 mode
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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)


4517: Rename EXPLODING BULLET to BULLET r=heinrich5991 a=def-

As suggested by Yuzu

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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: Zwelf <zwelf@strct.cc>
Co-authored-by: def <dennis@felsin9.de>
2021-12-27 23:11:09 +00:00
Zwelf d8258fcda9 Add semaphore getvalue functionality 2021-12-25 10:53:26 +01:00
def 440baa17be Support building universal binaries with discord
For now only x86-64 is supported by discord sdk, arm64 we ship without
discord sdk. So players can choose if they want more performance without
discord integration, or less performance with discord integration.
2021-12-20 16:07:00 +01:00
heinrich5991 58533cddef Fix string functions not to truncate in the middle of a UTF-8 character
This makes `str_utf8_copy` obsolete.
2021-12-20 02:34:02 +01:00
heinrich5991 27f18824d6 Fix str_utf8_forward to use the same logic as str_utf8_decode 2021-12-20 02:17:10 +01:00
heinrich5991 ae9944550c Add a function to fix UTF-8 truncation at the end of a string
This can be used after truncating at byte boundaries.
2021-12-20 02:05:07 +01:00
def ffc532a302 Add open_file, works on macOS, safer 2021-12-19 23:22:04 +01:00
bors[bot] 79e5703e21
Merge #3638
3638: Revert "Let's not crash the client and server on dbg_assert" r=def- a=heinrich5991

This reverts commit a6e144e.

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-12-19 18:45:38 +00:00
heinrich5991 49c861372a Add a flag to skip a UTF-8 BOM when opening files for reading
https://en.wikipedia.org/w/index.php?title=Byte_order_mark&oldid=1059783325#UTF-8

This allows to read text files created by Windows users transparently,
even if they contain a UTF-8 BOM.
2021-12-17 22:07:01 +01:00
Robert Müller f20443b694 fix command line arguments with unicode on windows
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-12-06 19:48:25 +01:00
Robert Müller 06a1d28a7f remove redundant *count >= max_count check 2021-11-28 11:00:49 +01:00
Robert Müller 7578386538 add empty lines to method documentation 2021-11-25 20:01:29 +01:00
Robert Müller 2ada540988 update str_utf8_stats documentation 2021-11-25 19:54:50 +01:00
Robert Müller 0253b6e25c refactor str_utf8_stats 2021-11-25 19:54:32 +01:00
Robert Müller 84ecbdb9d0 add str_utf8_stats to base system 2021-11-24 23:24:46 +01:00
Robert Müller e37ff4db65 remove unused fs_getmtime in favor of fs_file_time 2021-11-21 11:14:18 +01:00
Robert Müller 4bb5dbc84a do fs_is_dir smarter 2021-11-21 11:14:11 +01:00
Robert Müller b96fc7479e use str_format, improve code format 2021-11-21 10:41:57 +01:00
Robert Müller e1df7669f0 fix incorrect/inconsistent buffer sizes 2021-11-21 10:34:11 +01:00
Robert Müller c9dfbb6f45 fix unicode winsock error messages 2021-11-20 16:37:03 +01:00
Robert Müller 00606d1e2a fix open_link with unicode on windows 2021-11-20 13:36:05 +01:00
Robert Müller 30c65dedad add UNICODE defines on windows, misc. unicode fixes 2021-11-20 12:39:52 +01:00
bors[bot] cdfc521132
Merge #4340 #4350
4340: Add functions for packing/unpacking int/unsigned using char arrays r=heinrich5991 a=Robyt3

Add `uint_to_bytes_be` and `bytes_be_to_uint` functions from upstream and use them where applicable to reduce duplicate code.

## 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 if it works standalone, system.c especially
- [ ] 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)


4350: Fix map_extract r=heinrich5991 a=def-

Reported by cheeser0613

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] 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 <robert.mueller@uni-siegen.de>
Co-authored-by: def <dennis@felsin9.de>
2021-11-15 19:33:45 +00:00
Robert Müller c4e2dc5c5f make opening files for reading on windows case insensitive 2021-11-13 23:16:20 +01:00
Robert Müller 12699aa3e4 add functions for packing/unpacking int/unsigned using char arrays 2021-11-09 22:19:32 +01:00
def 724fbffaf0 Use uint64_t for network stats (fixes #4309)
Doesn't overflow so quickly, if it overflows has deterministic behavior
at least.
2021-11-06 23:32:54 +01:00
Robert Müller 385481462e fix fs_chdir with unicode on windows 2021-11-04 21:35:46 +01:00
Robert Müller 83d8e2bf7f fix fs_getcwd with unicode on windows 2021-11-04 21:22:17 +01:00
Robert Müller 3df3feb024 fix fs_makedir and fs_storage_path with unicode on windows 2021-11-04 21:20:36 +01:00
Jupeyy 66947b70b7 Fix detect.h 2021-10-16 21:16:47 +02:00
Edgar 8810531065
remove missused volatile 2021-10-15 12:15:39 +02:00
Jupeyy ce9a962030 Rename VERSION to VERSION.txt 2021-10-06 16:13:36 +02:00
bors[bot] b2efcb8ba4
Merge #4196
4196: Fix fs_removedir and fs_remove with unicode on windows r=Jupeyy a=Robyt3

Fixes `fs_removedir` and `fs_remove` to work with unicode names on Windows.

## 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 if it works standalone, system.c especially
- [ ] 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 <robert.mueller@uni-siegen.de>
2021-10-04 19:08:42 +00:00
Robert Müller 2791f1e127 fix fs_removedir and fs_remove with unicode on windows 2021-10-04 20:11:50 +02:00
def 8270266bcf Try to fix unicode race demos (fixes #4192)
by making fs_rename work on Windows with Unicode chars
2021-10-04 17:50:12 +02:00
Jupeyy 7f5ca0ffe1 Small graphic refactoring 2021-09-14 00:21:17 +02:00
Panagiotis Vasilopoulos cc49273cb4
Fixed typo
TO BE SQUASHED LATER
2021-09-13 20:12:21 +02:00
Panagiotis Vasilopoulos 3b1c074842
Further fixes for Haiku
- Haiku is Unix-like, but it still doesn't use libnotify.
- Haiku comes with its own sets of definitions for certain long variables.
  There's still a problem revolving around the variables, but I removed a
  duplicate, conflicting definition on the Haiku platform.
- Changed some definition-related logic in detect.h, because the gcc compiler
  in Haiku (version 8.3.0) complained about duplicate definitions. I chose to
  use 'unknown' rather than an empty string on one occasion.
- Changed size of m_aLastSoundPlayed[CHAT_NUM] in
  `src/game/client/components/chat.cpp` due to an undocumented/undiscovered bug
  in Haiku.
2021-09-13 15:29:32 +02:00
heinrich5991 406bb85873 Fix dbg_* comments to reflect reality
They also work in release mode.
2021-09-13 12:58:18 +02:00
heinrich5991 deb4917563 Revert "Let's not crash the client and server on dbg_assert"
This reverts commit a6e144ea72.
2021-09-13 12:57:53 +02:00
bors[bot] 121173b5d6
Merge #4111
4111: Fix filesystem/IO with unicode filenames on windows r=def- a=Robyt3

It was previously not possible to load a map or really any file with a filename containing unicode, e.g. german umlauts.

Now all filenames are converted from multibyte to widechar on windows, and the correct functions and structs (with the `W` suffix) are used consistently.

Some changes are made to synchronize ddnet's implementation with upstream (once https://github.com/teeworlds/teeworlds/pull/2936 has been merged there):
- The unused and not working `IOFLAG_RANDOM` is removed (on upstream ddnet's `IOFLAG_APPEND` is added instead).
- The `fs_listdir_info` function is renamed to `fs_listdir_fileinfo` and now using the parameter object `CFsFileInfo` that contains the filename, modified date and creation date, making it easier to add more properties in the future. `FS_LISTDIR_INFO_CALLBACK` is renamed to `FS_LISTDIR_CALLBACK_FILEINFO`.

## 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 if it works standalone, system.c especially
- [ ] 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 <robert.mueller@uni-siegen.de>
2021-08-30 09:02:24 +00:00
BloodWod b9d660dd95 Add colors for dbg_msg console 2021-08-28 04:42:42 +05:00
Jupeyy b216b6744a Add Android build scripts 2021-08-24 12:18:20 +02:00
Robert Müller 2171373e3c fix code format 2021-08-23 15:29:31 +02:00
Robert Müller c89cdc6806 add fs_file_time 2021-08-23 13:29:33 +02:00
Robert Müller 355466e0bf fix fs_is_dir with unicode on windows 2021-08-23 12:57:31 +02:00
Robert Müller f6954c8001 fix io_open with unicode on windows 2021-08-23 12:56:23 +02:00
Robert Müller 4a375242c5 fix fs_listdir and fs_listdir_fileinfo with unicode on windows 2021-08-23 12:49:15 +02:00
Robert Müller 75662b6c1a remove unused and not implemented IOFLAG_RANDOM, add assert 2021-08-23 12:30:12 +02:00
Jupeyy c7580b374c Remove Windows XP code 2021-08-23 12:05:01 +02:00
Alexander Akulich ed8955e60f math: Rename frandom() to random_float() to match with random_int()
(cherry picked from commit 5e4c7b66c5)
2021-08-03 14:29:52 +02:00
heinrich5991 1f68e11445 Mark the inverted exclamation mark as confusable with i
They look pretty much the same in our font, but for some reason, the
inverted exclamation mark doesn't have confusables.
2021-07-27 02:43:04 +02:00
heinrich5991 707e13ff7a Update confusables_data.h to Unicode 13.0.0 2021-07-27 02:41:55 +02:00
Vlad 01822cada8
EOF x2 2021-07-26 01:30:01 +03:00
Vlad e78ba96f3b
EOF 2021-07-26 01:23:10 +03:00
Vlad 28c34bd101
Stop accepting invalid ipv4's 2021-07-26 01:13:05 +03:00
Jupeyy 69aa97fe9e Remove (void) parameter of functions 2021-06-24 17:19:17 +02:00
Jupeyy a663799188 uint64 -> uint64_t, int64 -> int64_t 2021-06-24 17:19:17 +02:00
Jupeyy 3e1d4ad0b3 Use chrono 2021-06-24 17:19:17 +02:00
Jupeyy 9dfea5511a Use cpp 2021-06-24 17:19:17 +02:00
ChillerDragon 8a4f4fc6c9 Use str_length 2021-06-05 16:46:01 +02:00
heinrich5991 fb27b83d79 Add function to remove directories
Add tests. Unify behavior of `fs_remove` across operating systems to
only remove files, not directories. Previously on Linux, it would also
delete directories.
2021-05-14 01:00:41 +02:00
heinrich5991 782c826381 Add secure_rand_below function
It works by masking the numbers and the using rejection sampling to
ensure a uniform generation.
2021-05-12 17:02:02 +02:00
Jupeyy f99f062d0a Only sort friends, if you got any 2021-05-06 14:45:34 +02:00
bors[bot] 97ab2c6c01
Merge #3798
3798: Add GLES support r=def- a=Jupeyy

I know i *****ed up, that i didnt move the files in a different commit, but when i noticed it was already too late.
Its mostly disabling stuff that GLES doesn't support. Global LOD bias or glOrtho for examlpe.

~***Strong note***:
This will move ALL linux implementation to GLES instead of GL, since GLES is supported by X11 and wayland, we probably want some testing for this.
This also means, that the default for Linux gets GLES 3.0 which is equivalent to OpenGL 3.3, not OpenGL 3.0!!!~

~If you wonder "why":
Gles just works differently to OGL, it knows about all functions that exists, and e.g. doesn't require GLEW at all, but that also means, that GLES does NOT work while we use OGL, because GLEW would kill GLES.~
GLEW in EGL mode works fine with wayland, just requires X11 to use EGL too(SDL_VIDEO_X11_FORCE_EGL)

_Additionally, for GLES only, only 3.0 and 1.0 context are supported._(doesn't matter anymore for linux)

probably fixes:
~not_really_fixes  #3797~
fixes #2885

And would also allow android support, if i ever get these build scripts upto date, or smby is interested into fixing them for me :D

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-06 09:50:26 +00:00
heinrich5991 b2a54dc7f8 Compress IPv6 string representations according to RFC5952
https://tools.ietf.org/html/rfc5952#section-4

Also add some tests.
2021-05-05 18:22:52 +02:00
Jupeyy b8f96ce500 Allow GLES3 coexists with OpenGL on Linux 2021-05-02 04:39:02 +02:00
Jupeyy ecc5a7af81 Make GLES3 only makros 2021-05-01 21:21:09 +02:00
Jupeyy c0d6ce6d25 Add GLES support 2021-05-01 01:39:37 +02:00
bors[bot] 6572f9e4fe
Merge #3779
3779: Copied Teeworld patches for the Haiku operating system r=def- a=panos

I initiated a port of ddnet and received a lot of help from the IRC in order to do so as seen in #2986. Unfortunately, my efforts went stale after one point. Fortunately, however, @threedeyes released a [set of patches for Teeworlds](2ea72967cd/games-action/teeworlds/patches/teeworlds-0.7.5.patchset). I decided to take down my repository with my own work and attempt to port Gerasim's work, which includes code for setting the directories that ddnet should use the same way one would do so in a Mac OS X-system in `src/base/system.c`, which was precisely the part where I got stuck in on my first attempt.

The changes have not been tested thoroughly yet and were the result of methodic copying and pasting.

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

## Checklist

- [ ] Tested the change ingame
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [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: Panagiotis Vasilopoulos <hello@alwayslivid.com>
2021-04-17 18:15:34 +00:00
Panagiotis Vasilopoulos 6c02076c05 Copied Teeworld patches for the Haiku operating system
Co-authored-by: Gerasim Troeglazov <3dEyes@gmail.com>
2021-04-17 20:10:56 +02:00
heinrich5991 8d6b62d8f8 Fix parsing an IPv6 address without port
The port in the NETADDR struct was left uninitialized.

Add some tests to ensure behavior.

CC #3774 #3775
2021-04-17 16:05:39 +02:00
def 1d636a4b43 Detect hangul choseong filler character as whitespace (fixes #3752) 2021-04-01 18:32:04 +02:00
def a4bb2f8764 Switch back to using a stable sort
so that for example demos stay sorted the same way when sorting by demo
markers and removing a demo, otherwise they get totally reordered every
time.

as reported by Shyzo
2021-03-15 23:36:25 +01:00
def c92f818a3c Don't leak memory on Windows in logger
Thanks to 拓真 on Discord for report
2021-02-28 23:22:18 +01:00
Vlad a780dd691d Memory leak in system.c
> Here I get a memory leak
> https://github.com/ddnet/ddnet/blob/master/src/base/system.c#L167

Thanks to @kurosio
2021-02-28 23:22:15 +01:00
Alexander Akulich 2790270abf Adopt upstream refactoring: Mark several functions as 'const' 2021-02-23 18:26:16 +03:00
def e985632fae OSX -> macOS
Changing the filenames of the releases will be a bit more annoying, so
not sure we want to do that
2021-02-12 13:41:41 +01:00
bors[bot] 0b2c457c37
Merge #3526
3526: Run server in background on Windows (fixes #3525) r=Learath2 a=def-

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow

> Displays a window in its most recent size and position. This value is
> similar to SW_SHOWNORMAL, except that the window is not activated.

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

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [x] Written a unit test if it works standalone, system.c especially
- [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: def <dennis@felsin9.de>
2021-01-21 11:05:35 +00:00
def 8edb561f4e Run server in background on Windows (fixes #3525)
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow

> Displays the window as a minimized window. This value is similar to
> SW_SHOWMINIMIZED, except the window is not activated.
2021-01-21 10:01:11 +01:00
Alexander Akulich 5d0bb4cf3c Backport vector functions cleanup from the upstream
Keep closest_point_on_line() as-is.

(commit 6b69f94dc8)
2021-01-16 03:20:57 +03:00
BeaR 9f0b0af862 Add angle<->direction conversion functions to vector math (Cleanup)
Keep angle() (ex. GetAngle()) as-is.

(cherry picked from commit 7735557aa5)
2021-01-16 03:20:57 +03:00
bors[bot] 40a36c2dfc
Merge #3377 #3487
3377: Add Thread Safety Analysis r=heinrich5991 a=def-

https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

## 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 if it works standalone, system.c especially
- [ ] 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)


3487: Fix centisecs rounding in str_time_float r=heinrich5991 a=def-

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-01-10 15:00:19 +00:00
def b5440d7d5a Implement network statistics for recvmmsg 2021-01-09 11:48:05 +01:00
def 7fa331a5e9 Fix centisecs rounding in str_time_float 2021-01-08 11:22:21 +01:00
def 59f1c2cbe6 Add New Year season theme by mind and use for 2 days
Map reduces my FPS from 60 to 45, mind can't optimize it further.

I'd release this as 15.2.5 in 1-2 days ideally with no other new changes in.
2020-12-28 17:45:04 +01:00
def e592afc98c Add Thread Safety Analysis
and annotate some code: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
2020-12-23 18:13:21 +01:00
Edgar 105b049497
Rename lock and semaphore classes to match current naming 2020-11-29 18:12:58 +01:00
Jupeyy f83d528f5d Fix vector constructor impl & remove useless operator 2020-11-20 12:14:33 +01:00
def d99f1b9340 Allow utf8 ban reasons (fixes #3329) 2020-11-18 14:42:12 +01:00
def 7e0cbb5b09 Fix sizeof differently 2020-11-07 19:57:25 +01:00
def bf8ae71b7d Fix and NOLINT bugprone-sizeof-expression 2020-11-05 08:25:34 +01:00
def 1877943ceb Fix bugprone-signed-char-misuse with tolower 2020-11-05 08:25:27 +01:00
bors[bot] a03df3a4d1
Merge #3141
3141: More hours (fixes #3140) r=heinrich5991 a=def-

Will also look into #3140 and fix here.

Co-authored-by: def <dennis@felsin9.de>
2020-10-26 12:00:13 +00:00
Dennis Felsing 23c005144b consistent formatting for dbg_msg
no capital letters, no spaces
2020-10-26 10:04:03 +01:00
def 4f44472e59 Add non-space blanks: Hangul Filler characters
Taken from https://en.wikipedia.org/wiki/Whitespace_character#Non-space_blanks

Had to Hangul Jungseong Filler to that Wiki article as it was missing.
2020-10-25 10:17:56 +01:00
def 8dfcd67fe6 Add str_time/str_time_float
Handles centisecs < 0

Uses int64, otherwise we're limited to ~260 days
2020-10-18 23:44:47 +02:00
Jupeyy 3aef2ebfe0 Make closest_point_on_line safer
Does not change behaviour, all NaNs resulted in false checks
2020-10-17 20:22:13 +02:00
def 87b06d307f Fix clang-analyzer-core.UndefinedBinaryOperatorResult
/media/ddnet/src/game/client/animstate.cpp:54:27: warning: The left operand of '*' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
        pSeq->m_X += pAdded->m_X * Amount;
                                 ^
2020-10-14 15:45:47 +02:00
def 5c1b8cd221 Fix clang-analyzer-deadcode.DeadStores
/media/ddnet/src/game/client/components/statboard.cpp:288:3: warning: Value stored to 'tw' is never read [clang-analyzer-deadcode.DeadStores]
2020-10-14 15:45:47 +02:00
def 469888e156 array: Don't allocate size 0
/media/ddnet/src/game/editor/auto_map.h:30:9: warning: Use of zero-allocated memory [clang-analyzer-cplusplus.NewDelete]
        struct CIndexRule
               ^
2020-10-14 14:54:33 +02:00
def 476ac6951f Fix memory leak in lock_create
/media/ddnet/src/base/system.c:805:3: warning: Potential leak of memory pointed to by 'lock' [clang-analyzer-unix.Malloc]
2020-10-14 14:54:33 +02:00
Jupeyy 9e8cbfea5d Optimize uuid lookup 2020-10-11 08:39:29 +02:00
Jupeyy 52911e4302 Use std::sort instead of bubble_sort 2020-10-08 08:00:01 +02:00
def 3be8a592e5 Run clang-format
Purely automatic change. In case of conflict with this change, apply the
other change and rerun the formatting to restore it:

$ python scripts/fix_style.py
2020-09-26 21:50:15 +02:00
def 0bac9f0de8 Manual preparation for cleaner clang-format
Also include what you use explicitly
2020-09-26 21:41:01 +02:00
Jupeyy 8235df7752 Add menu background map 2020-09-23 23:38:28 +02:00
Learath bbdcb7035d Style 2020-09-22 15:47:21 +03:00
Learath 586043fc64 Use fixed point conversion consistently 2020-09-22 15:29:16 +03:00
清歌 7ab35dc55e fix localhost lookup problem when ws enable 2020-09-18 23:02:25 +08:00
清歌 059a2a0a35 fix websockets behavior in net_socket_read_wait 2020-09-18 21:28:17 +08:00
def 9717d032ff Don't call atexit in forked process 2020-09-17 22:19:13 +02:00
QingGo b64a0ef4c6 make client able to connect ws server with ws:// 2020-09-13 09:59:10 +08:00
def 277040fc7c shell_execute: handle some failures 2020-09-11 09:47:19 +02:00
def f7b37eaf6a clang-format fixes 2020-09-10 20:16:09 +02:00
def 0f051def21 Fix cbSize for Windows 2020-09-10 20:13:01 +02:00
def 90f3199d98 Implement opening server on Windows (reading autoexec_server.log not working yet) 2020-09-10 20:13:01 +02:00
def 2cdc7d0faf Adapt 0.7 start menu
- Working Local Server button (needs fixing for Windows)
- Highlight buttons if server is running, new news is out and editor has
  unsaved changes
2020-09-10 20:13:01 +02:00
bors[bot] cbc272fd5d
Merge #2758 #2769 #2772
2758: Remove the rudimentary fuzzing since no one uses it anyway r=heinrich5991 a=def-



2769: Update front.png by Soreu r=heinrich5991 a=def-



2772: Dont predict camera position on spectator changed r=heinrich5991 a=BannZay

No reason to predict camera position in case when we just changed spectator.
But tbh I have not found a big reason to predict it at all.

Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: Andrii <bannzay3@gmail.com>
2020-09-06 23:25:16 +00:00
bors[bot] e3cfb23f28
Merge #2742 #2745
2742: Add str_utf8_copy that trim broken utf8 sequence at the end. r=heinrich5991 a=TsFreddie

Currently this replaces `str_copy` text input and clipboard paste in chat. Many places may need the same treatments, like steam names.

![image](https://user-images.githubusercontent.com/3797859/92263741-08b8e080-eed5-11ea-84a5-b7f070ded260.png)

Test string:
abcd今天是个好日子心想的事儿都能成今天是个好日子打开了家门咱迎春风今天是个好日子心想的事儿都能成今天是个好日子打开了家门咱迎春风今天是个好日子心想的事儿都能成今天是个好日子打

2745: Update mapres by mind r=heinrich5991 a=def-

Adapted from 0.7 for new renderer. Not sure if this makes sense :D

Co-authored-by: TsFreddie <tsfreddiewang@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
2020-09-06 23:12:04 +00:00
TsFreddie 6b053936c7 str_utf8_copy using str_utf8_truncate 2020-09-06 20:58:26 +01:00
TsFreddie badc49cac7 Revert "Revert & use "str_utf8_truncate" instead"
This reverts commit b045a3d6ee.
2020-09-06 20:54:57 +01:00
Jupeyy aed4293040 Prevent NULL pointer in mem_copy (fixes #2753) 2020-09-06 18:32:56 +02:00
def b7da058b76 Remove the rudimentary fuzzing since no one uses it anyway 2020-09-05 23:50:31 +02:00
TsFreddie b045a3d6ee Revert & use "str_utf8_truncate" instead 2020-09-05 00:51:39 +01:00
TsFreddie a3a363f665 C90 2020-09-04 17:48:18 +01:00
TsFreddie 92d08d07de add str_utf8_copy 2020-09-04 17:34:27 +01:00
def 7781c8826e Forbid some more whitespace and whitespace-like characters
Made sure everything from
https://en.wikipedia.org/wiki/Whitespace_character#Unicode is included
2020-08-26 16:43:47 +02:00
heinrich5991 3c6f05887f Add SteamAPI + stub 2020-08-25 13:03:20 +02:00
yeojingkang de6ea67663 Update math.h 2020-08-20 05:02:33 +08:00
yeojingkang 6e9c370eca Added constexpr to math functions 2020-08-20 04:47:09 +08:00
def 539c20a200 Add support for PLATFORM_SUFFIX define
So that we can set it like this:

  CXXFLAGS='-DPLATFORM_SUFFIX="steam"' CPPFLAGS='-DPLATFORM_SUFFIX="steam"' make
2020-08-19 13:41:06 +02:00
def 467778fc56 Satisfy old C standard
system.c:2325:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
  for(int cursor = 0, pos = 0; pos <= truncation_len && cursor < dst_size && size != cursor; cursor = str_utf8_forward(src, cursor), pos++)
2020-08-10 18:11:51 +02:00
Zwelf 81e5bb924c Move sync_barrier to only used place
to remove `#include <windows.h>` from header file preventing compiling on windows
2020-08-09 18:17:42 +02:00
def e2fde4d730 Fix utf8 handling in str_truncate (fixes #2533)
and rename to str_utf8_truncate since it's only used for utf8 strings
2020-08-02 18:32:42 +02:00
def f4344dc420 Use (u)int64 from system.h instead of (u)int64_t from cstdint
src/game/client/prediction/gameworld.h:62:90: error: ‘int64_t’ has not been declared
   62 |  void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
      |                                                                                          ^~~~~~~
2020-07-09 13:55:28 +02:00
3edcxzaq1 f30fe2b4b5 fix indentation 2020-06-29 23:07:57 +02:00
3edcxzaq1 1be3b7ead5 Suppress open_link output 2020-06-29 21:34:07 +02:00
heinrich5991 741c3a705e Revert "Fix str_format on mingw"
This reverts commit a9f6d3716c.
2020-06-29 13:48:51 +02:00
def a9f6d3716c Fix str_format on mingw
src/game/server/ddracecommands.cpp:743:39: warning: unknown conversion type character ‘l’ in format [-Wformat=]
  743 |  str_format(aBuf, sizeof(aBuf), "%s-%lld-%s.save", pSelf->Server()->GetMapName(), time_get(), pSelf->Server()->GetAuthName(pResult->m_ClientID));

See https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/
2020-06-22 14:47:40 +02:00
def 70b8bf9497 Open links in background (fixes #2292)
Only tested on Linux
2020-06-20 14:59:36 +02:00
bors[bot] 4edac3143a
Merge #2281
2281: Add Learn button which opens the ddnet wiki in the browser. r=heinrich5991 a=edg-l

![image](https://user-images.githubusercontent.com/15859336/85147350-05f00d00-b24f-11ea-8b6c-f79dbf605747.png)

## **I didn't test it on windows or mac.**

Co-authored-by: Edgar <git@edgarluque.com>
2020-06-20 12:00:45 +00:00
Edgar 07f0239e01
Add Learn button which opens the ddnet wiki in the browser. 2020-06-20 13:56:02 +02:00
Learath 75e96aa5d3 Get rid of more magic constants, adapt to 0.7 2020-06-19 21:48:48 +03:00
Learath d200ef0bb0 Remove ugly hack 2020-06-19 21:42:19 +03:00
Learath 9e2434c65d Better skin colors. Better game message translation 2020-06-19 20:28:55 +03:00
def a951845083 Surprise: void x(); accepts any parameter in C!
Prevents accidentally passing parameters that would then be ignored.

C++ is more reasonable, so nothing to do there.
2020-04-12 20:06:38 +02:00
def 4c00e4533c Fix type of os_is_winxp_or_lower function (fixes #2135) 2020-04-12 10:23:08 +02:00
Learath ce8987cd43 Missing include 2020-02-27 16:56:40 +03:00
Learath f679fbfbc5 Allow editing multiple tile layer props 2020-02-27 16:53:12 +03:00
def 598ec52892 Fix GCC 9.2.0 compilation
src/game/server/ddracechat.cpp:623:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
2020-02-05 08:22:04 +01:00
heinrich5991 8c4569991d Fix indentation and formatting of str_clean_whitespaces
(cherry picked from commit b9c4086382)
2020-01-19 22:38:08 +01:00
KillaBilla 75d076b3bc changed str_clean_whitespace implementation to pkoerner's one
(cherry picked from commit a9cc1e8de2)
2020-01-19 22:37:57 +01:00
KillaBilla ba1abac52f remove leading and trailing space from server name and forbit the use of multiple spaces
(cherry picked from commit a9cc1e8de2)
2020-01-19 22:28:19 +01:00
Dennis Felsing ba3b436139 Fix Websockets warning 2019-12-30 10:12:16 +01:00
Dennis Felsing a27358806c Revert "Support shotgun_speed 0"
This reverts commit 9d39ca888f.
2019-12-09 14:59:10 +01:00
bors[bot] c31f6303cf
Merge #1977
1977: Support shotgun_speed 0 r=Learath2 a=def-

for mapping stationary bullets

As requested by Im 'corneum.

Co-authored-by: def <dennis@felsin9.de>
2019-12-04 16:48:06 +00:00
Dennis Felsing 37ef24225e Clean up color handling a bit
- SetAlpha should be called WithAlpha and only works for RGBA
- Fix type correctness of color_scale and introduce color_invert
- Nicer hook coll color handling in RenderPlayer
- Use CRTP to have type safe WithAlpha, otherwise this would compile:
  ColorHSLA = WithAlpha(ColorRGBA(1.0f, 1.0f, 1.0f));
2019-12-03 11:32:55 +01:00
def 9d39ca888f Support shotgun_speed 0
for mapping stationary bullets
2019-11-27 18:29:39 +01:00
Learath 37d9e4fa26 Add a saner way to select angles. Close #1916 2019-09-20 23:57:35 +03:00
heinrich5991 c8198cc853 Annotate str_timestamp_format with format arguments 2019-07-14 15:42:16 +02:00
Learath2 1993989067 Fix toggle not working with colors 2019-07-02 14:54:06 +02:00
heinrich5991 b90dd43118 Fix -Wdeprecated-copy from GCC9 2019-06-26 11:53:39 +02:00
Learath db5c17ce71 Avoid implementation-defined behaviour 2019-05-15 18:11:22 +02:00
def e1c9033300 Render news without STL functions (fixes #1693) 2019-05-09 21:54:56 +02:00
Learath b86c457c91 Remember whether a color is lit or not 2019-05-01 23:35:29 +03:00
Learath 5d0a1c8d0a Unlighten colors when sending to server 2019-05-01 22:49:52 +03:00
Learath 05b3df0afa Add the default constructors 2019-04-27 02:07:11 +03:00
Learath 979d58f830 Use colors in CTextRender 2019-04-27 01:34:20 +03:00
Learath 15058330fa Don't inherit from vector, more cleanup 2019-04-27 00:47:34 +03:00
Learath be26789872 Remove unused function 2019-04-26 22:57:40 +03:00
Learath 93d14a1eca Inconvenience for windows 2019-04-26 22:36:49 +03:00
Learath 1b668916f2 Fix the test, fix small bug 2019-04-26 21:01:41 +03:00
Learath 69d78c21b4 Lighten tee colors 2019-04-26 16:38:16 +03:00
Learath 54afd2c5af No iostream 2019-04-26 15:09:12 +03:00
Learath 65a17599e1 Add ColorHSVA, phase out more vec3's 2019-04-26 15:06:32 +03:00
Learath 987b9f69de Only lighten if too dark 2019-04-25 23:29:31 +03:00
Learath 93265dbb9c Please MSVC 2019-04-25 21:09:32 +03:00
Learath f53f09339a Default constructor 2019-04-25 19:59:04 +03:00
Learath e637064a68 Don't store HSL separately 2019-04-25 19:49:27 +03:00
Learath 95a3a69e08 Start phasing out vectors for colors 2019-04-25 18:21:35 +03:00
Learath 0f781df1dd Try handling colors in console 2019-04-25 14:48:53 +03:00
Learath 5e5def314f Add tests 2019-04-24 23:53:38 +03:00
Learath cc36af73be Cleanup colors 2019-04-24 23:53:26 +03:00
trml 0b3f3b03b5 Rewrite of prediction code, with additional prediction 2019-04-21 16:12:20 +02:00
Dennis Felsing 00c87c121a str_num_copy -> str_truncate, as in Vanilla 0.7 2019-04-18 10:25:01 +02:00
Learath 843dc29a88 Names can include quotes :/ 2019-04-16 02:39:22 +02:00