Commit graph

3335 commits

Author SHA1 Message Date
heinrich5991 15c6ad2fe7 Forbid votes while being muted
Fixes the problem of people abusing the vote reason for spamming.

Fixes #3926.
2021-06-22 22:45:30 +02:00
effyn 286c99805f
Fix typo 2021-06-17 02:41:45 -07:00
Zwelf 4d14bcea0b Fix inconsistent handling of death tile between front and game layer 2021-06-05 16:38:53 +02:00
bors[bot] e5e2e46da2
Merge #3837
3837: Use "occupado" spawn spots when nothing else is left r=heinrich5991 a=def-

Better than not spawning at all

<!-- 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-05-28 17:21:50 +00:00
Learath2 7e95911714 Fix alignment for CVoteOptionServer 2021-05-27 19:35:20 +02:00
bors[bot] 47d63317aa
Merge #3826
3826: Respect TuneZone for characters r=def- a=TsFreddie

*I might be totally insane for doing this.
*The effect is only truly noticeable if you have high ping AND dropping packets.*

*clang-tidy's warning doesn't seems to relate to anything I've changed*


Now characters will try to respect TuneZones when ~~evolving and~~ predicting (like projectiles do). Since it is really important to keep TuningList as accurate as possible, I made a TuningList update logic so we try our best to update tunings only for the correct TuneZone (instead of constantly shoving current tuning into TuningList)

And each CCharacterCore now has its own Tunings to avoid any characters influencing GameWorld's tuning. Some server code has to be updated accordingly. I checked the code path, didn't notice anything that would make our server behave differently.

And I guess I should tag @trml myself this 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 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 (as far as I could tell)
- [ ] 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: Freddie Wang <tsfreddiewang@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
2021-05-23 08:16:57 +00:00
Zwelf fa79ffa1a1 Simplify entities destruction 2021-05-22 20:02:00 +02:00
def 72f3b774b8 Use "occupado" spawn spots when nothing else is left
Better than not spawning at all
2021-05-20 21:39:04 +02:00
def 304d9f36ec Fix UB with super (fixes #3830) 2021-05-17 11:41:15 +02:00
Freddie Wang 500ba7609f Respect tunezone for characters 2021-05-13 00:57:50 +08:00
def 6a348c8f60 Add sv_swap
Because swap is broken and the current way of disabling is horrible.
2021-05-11 17:05:17 +02:00
Freddie Wang 796035a358 Remove dangling declaration 2021-05-09 15:14:16 +08:00
bors[bot] 3becd45ea6
Merge #3792
3792: Add hammer_hit_fire_delay tune r=heinrich5991 a=def-

as requested by J$ON for new map with Genex

the current hammer_fire_delay is only used when no other tee has been
hit. In order not to change any existing behaviour I have added a new
tune for the case of hitting, instead of making the existing one control
both.

<!-- 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>
2021-05-01 14:43:45 +00:00
def f6de0ef267 Add hammer_hit_fire_delay tune
as requested by J$ON for new map with Genex

the current hammer_fire_delay is only used when no other tee has been
hit. In order not to change any existing behaviour I have added a new
tune for the case of hitting, instead of making the existing one control
both.
2021-05-01 16:36:12 +02:00
Freddie Wang 20dbd20769 Avoid spawn effect being clipped 2021-04-30 15:37:20 +08:00
def 47b167c697 Fix crash on test servers (fixes #3789) 2021-04-23 16:44:19 +02:00
Kyle Bradley b4a5956f72 Kept hook when needed 2021-04-10 17:29:20 +02:00
Kyle Bradley cad6b82cd9 Removed unintended format changes 2021-04-08 16:39:17 +02:00
Kyle Bradley 13fae16817 Reset hook of all players in a team whenever swap occurs.
Standardized hook resets
2021-04-08 16:36:43 +02:00
heinrich5991 c29874daf1 Fix team rank updating not working
With the MySQL C API, we need to distinguish between SQL statements that
return result sets and those that do not, UPDATE is one of those that
don't produce a result set.

Fixes #3725.
2021-04-07 17:19:53 +02:00
def 9a56b229ca sv_swap_timeout <= 2021-04-07 16:16:50 +02:00
def afe16b7e53 Please wait %d seconds 2021-03-24 19:16:00 +01:00
bors[bot] 027e1d8b14
Merge #3654
3654: Added swap functionality to server client: r=def- a=houseme-kyle

Added a new chat command /swap based on the discussion in the associated issue: 
https://github.com/ddnet/ddnet/issues/1103

Swaps the character's position with another tee using the existing Save/Load functionality. 

Restrictions:
- Has to be in a team similar to the save/load feature

Possible additions:
- Time penalty

**Disclaimer**
This is my first contribution to the project. I tried my best to apply the correct coding standards and understand the purpose of each class/method. Please do provide feedback if used incorrectly. 

![Initiate Swap](https://user-images.githubusercontent.com/25198124/109426245-46ff0a80-79f5-11eb-935a-2b228a72695e.JPG)
![Pre-Acceptance](https://user-images.githubusercontent.com/25198124/109426249-4bc3be80-79f5-11eb-986a-eea9c6b84334.JPG)
![Post-Swap](https://user-images.githubusercontent.com/25198124/109426251-4e261880-79f5-11eb-80a3-772e23a23013.JPG)

## 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)


Co-authored-by: Kyle Bradley <kyle@house.me>
Co-authored-by: houseme-kyle <kyle@houseme.co.za>
Co-authored-by: def <dennis@felsin9.de>
2021-03-21 09:04:21 +00:00
houseme-kyle 6ecd326b4c
Scenario of (invalid) or (connection) names breaking /swap
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-03-21 10:58:50 +02:00
Kyle Bradley 35991ea973 Fixed names 2021-03-20 18:33:34 +02:00
Kyle Bradley decaeb8934 PR feedback:
- Changed names of variables
- Changed config descriptions
- Fix for perma timeout
2021-03-20 18:08:54 +02:00
Learath2 a3dd47d7e8 Actually check all tees. Fixes #3697 2021-03-20 15:45:11 +01:00
Kyle Bradley 6c9cbee41c Merge branch 'feature-swap' of https://github.com/houseme-kyle/ddnet into feature-swap 2021-03-17 21:23:52 +02:00
Kyle Bradley a68b28fc14 Further tests and edge cases dealt with 2021-03-17 21:23:41 +02:00
def 61b3a7c554 Fix clang-format
By using clang-format-10 from AUR clang-format-static package
2021-03-17 20:19:35 +01:00
Kyle Bradley 2d4834ffcf Edge case for player state when changing team 2021-03-17 20:51:52 +02:00
houseme-kyle e11345807f
Merge pull request #5 from ddnet/master
Merge
2021-03-17 19:07:18 +02:00
Kyle Bradley 1a35e3be12 Removed comments and added variable reset 2021-03-17 00:48:24 +02:00
Kyle Bradley 73aea2426b Style fixes 2021-03-17 00:33:48 +02:00
Kyle Bradley 4afe62a596 Updated to include penalty, cooldown and timeout 2021-03-17 00:31:16 +02:00
Kyle Bradley 0b6da7ece1 Applied community feedback.
- Always show global /top5
2021-03-15 15:38:53 +02:00
Kyle Bradley 6ed2b2277d Added break on primary message while still processing subsequent 2021-03-11 09:20:26 +02:00
heinrich5991 f694dd68e9 Don't bypass the anti-spam system
Quick-fix for
https://github.com/ddnet/ddnet/pull/3669#issuecomment-794805243.

Probably breaks that feature a bit.
2021-03-10 21:50:56 +01:00
bors[bot] 46864c0e08
Merge #3683 #3684
3683: More colors from components in console r=heinrich5991 a=Jupeyy


![screenshot_2021-03-08_01-18-23](https://user-images.githubusercontent.com/6654924/110260454-9d97b600-7fac-11eb-9437-e5b31c9146ab.png)

dunno how to trigger that echo chat, but rest looks fine i think

## 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 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)


3684: Increase max ban duration from 1 month to 1 year r=heinrich5991 a=def-

to show ban message more accurately when player gets globally banned

<!-- 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: Jupeyy <jupjopjap@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
2021-03-09 21:41:23 +00:00
Kyle Bradley c79f874c54 Removd unusual characters and added a base dash to mirror previous implementation 2021-03-09 18:41:48 +02:00
Kyle Bradley 0a183673c5 Hide local when there are duplicates 2021-03-09 18:27:25 +02:00
Kyle Bradley b1e200df88 Formatted player.cpp using ClangFormat 2021-03-08 15:56:20 +02:00
Kyle Bradley 8957005f48 Kept rank spam protection 2021-03-08 15:33:26 +02:00
Kyle Bradley ecf70319fc Fixed formatting issues 2021-03-08 14:53:35 +02:00
Jupeyy 853e00ed15 More colors from chat in console 2021-03-08 01:20:28 +01:00
= 380664aae4 PR feedback 2021-03-08 00:41:48 +02:00
= f6ddfe830d Added PR feedback:
- Server name included in output
- Better output for unranked local
2021-03-08 00:39:11 +02:00
Kyle Bradley f950f27424 Formatting fixes 2021-03-03 16:50:43 +02:00
Kyle Bradley 50966f04e1 Updates config variables 2021-03-03 16:49:11 +02:00
Kyle Bradley ef1b30661e Add local rank and top 5 2021-03-03 15:23:18 +02:00
Kyle Bradley d276005697 Fixed missing variable 2021-03-02 21:42:53 +02:00
Kyle Bradley 2c11fedfb0 - Added name to message
- Fixed format issue
2021-03-02 16:35:29 +02:00
bors[bot] 8e4e4940d2
Merge #3664
3664: Add initial delay to talking in chat r=heinrich5991 a=Learath2

<!-- What is the motivation for the changes of this pull request -->
This adds a delay before one can chat. It should help mods in situations where people are spamming chat
## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] 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: Learath2 <learath2@gmail.com>
2021-03-01 20:10:14 +00:00
Learath2 f1af68dff9 Add initial delay to talking in chat 2021-03-01 20:37:07 +01:00
Learath2 5f50d1dc57 Add a way to block people from chatting on vpns 2021-03-01 19:54:59 +01:00
heinrich5991 9f41b5d910 Fix /mapinfo displaying a time when not having finished
The C API doesn't return 0.0f for NULL values, check for them
explicitly.

Fixes #3653.
2021-03-01 00:37:38 +01:00
Kyle Bradley 44bd43f38b Fixed for formatting check 2021-03-01 00:47:22 +02:00
Kyle Bradley 894885eef0 Removed space 2021-03-01 00:40:59 +02:00
Kyle Bradley cf7fb72dbf - Added timeout penalty
- Applied PR feedback
2021-03-01 00:37:49 +02:00
Kyle Bradley 94dbae981f Added swap functionality to server client:
- New chat command
- Swaps character's position with other tee using existing Save/Load methods.
2021-02-28 18:35:35 +02:00
heinrich5991 dd964316cb Fix duplicate teamranks getting inserted
There was a logic error that caused the loop to never execute.
2021-02-27 22:35:44 +01:00
heinrich5991 61b46746d7 Fix /times query by reordering fields
Pull request #3630 started showing the countries where ranks are from,
but created a mismatch between the two queries, one selected

Time, Ago, Stamp

the other

Time, Ago, Stamp, Name, Server

but both tried accessing the server. Add Server to the former query and
swap Name and Server in the second query to fix the problem.

Fixes #3643.
2021-02-26 23:44:26 +01:00
heinrich5991 35dca7e17d Forgot to actually send Sv_RecordLegacy to old clients 2021-02-24 23:40:11 +01:00
heinrich5991 44437eed39 Fix return values for loading saves
Introduced by an incorrect rebase.
2021-02-24 20:43:07 +01:00
heinrich5991 83da81e8c3 Use ExecuteUpdate for SQL INSERT statements
Fixes
```
save score failed: (fetch:stmt:2014): Commands out of sync; you can't run this command now
```
2021-02-24 20:42:47 +01:00
bors[bot] 2fb1c723c9
Merge #3568
3568: Get rid of the MySQL C++ connector as a dependency and disable C++ exceptions r=Learath2 a=heinrich5991

We now use the C API directly. This has the advantage of using one
obscure dependency less, as the C++ connector also used the C API.

Also remove exceptions from database code.

The equivalent code with return codes is a human-assisted mechanical
translation of the old code, no attempts to improve correctness were
made.

This allows us to enable the -fno-exceptions flag.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] 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
- [ ] 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-02-24 16:43:16 +00:00
heinrich5991 9568d1055a Remove exceptions from database code
The equivalent code with return codes is a human-assisted mechanical
translation of the old code, no attempts to improve correctness were
made.

This allows us to enable the -fno-exceptions flag.
2021-02-24 17:39:48 +01:00
heinrich5991 794d768ccb Bump version for the new protocol to DDNet 15.4
This fixes interoperability with DDNet 15.3 which did in the end not
support the new messages.
2021-02-24 17:09:39 +01:00
Alexander Akulich 6b49bf1388 Make spectators stay specs on map changed
Based on PRs to the upstream:
https://github.com/teeworlds/teeworlds/pull/2065
https://github.com/teeworlds/teeworlds/pull/2066

Co-authored-by: Jordy Ruiz <jordy.ruiz@univ-lille.fr>
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-02-23 19:36:52 +03:00
Alexander Akulich 2790270abf Adopt upstream refactoring: Mark several functions as 'const' 2021-02-23 18:26:16 +03:00
Alexander Akulich dfc75806c6 CGameContext::SendVoteStatus: Hide the trick for 64 clients
as an implementation detail. This way the caller is synced with the upstream
and does not care about 64 players.
2021-02-23 18:26:16 +03:00
Alexander Akulich 688f11ef34 Move DDRace-specific player initialization code to the Controller 2021-02-23 18:26:16 +03:00
Alexander Akulich b0c0fb316c Get rid of gamemode.h with confusing definitions
We also have GAME_NAME macro in game/version.h and the macros
from gamemode are not used anywhere else.
2021-02-23 18:26:16 +03:00
Alexander Akulich a6bdda60ed GameController: Add OnPlayerConnect() like in the upstream 2021-02-23 18:26:16 +03:00
Alexander Akulich a9bc6190eb CGameControllerDDRace: Add Score() getter 2021-02-23 18:26:16 +03:00
Alexander Akulich ef6282d2e0 Replace remaining int64_t by int64 for the sake of consistency
The codebase uses int64 since commit f4344dc420.
2021-02-23 18:26:16 +03:00
bors[bot] daf13cb85a
Merge #3630
3630: /times: Show country rank is from 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-02-20 22:09:30 +00:00
def 660d23adac /times: Show country rank is from 2021-02-20 23:07:02 +01:00
bors[bot] 71477de816
Merge #3581
3581: Improve performance of /top5points query, remove negative /top5points since it makes no sense anyway r=heinrich5991 a=def-

<!-- 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>
2021-02-20 16:36:20 +00:00
bors[bot] 1ac07fe797
Merge #3626
3626: Rename save/load to conform to the code style r=def- a=Zwelf

Small cleanup

## 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>
2021-02-16 22:47:32 +00:00
Zwelf 9daf1274a4 Rename save/load to conform to the code style 2021-02-16 18:15:50 +01:00
Zwelf c59c41bd3f Inform player while loading when save exists, but they don't belong to the team 2021-02-16 17:54:13 +01:00
fokkonaut c79bb91b16 Fix crash on autoban unsupported client 2021-02-11 12:51:56 +01:00
def c28d949f0c Improve performane of /top5points query
Thanks to Learath2

Also remove negative /top5points since it makes no sense anyway
2021-02-02 00:15:56 +01:00
def 6f2c82c0d4 SUBSTRACT -> SUBTRACT 2021-02-01 14:55:26 +01:00
heinrich5991 18bb0ed92c Fix /pause not working
Caused by a logic error in a comparison, comparing a client ID with a
DDNet version.

Fixes #3578.
2021-02-01 00:58:09 +01:00
bors[bot] 2b5723cdef
Merge #3492 #3559 #3561 #3565
3492: Support F-Client and replace non-extended extension messages r=Learath2 a=heinrich5991

This continues what #3439 started, and also replaces non-extended messages that are DDRace extensions with extended messages. The DDNet server still sends the old message to old clients and the DDNet client still understands the old messages.

Supersedes #3439.

## 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
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


3559: Don't highlight us if we have no name (alternative fix for #3554) r=heinrich5991 a=def-

<!-- 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
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


3561: Fix input message position in teehistorian files r=heinrich5991 a=Zwelf

Previously the message was recorded when incoming. But the time when the input should apply wasn't recorded. Now inputs are recorded right before they get applied in the game world.

And record exact tick where load/save result is returned.

## 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
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


3565: Add Arabic language translation by .Yukki r=heinrich5991 a=def-

![screenshot-20210131@093216](https://user-images.githubusercontent.com/2335377/106378755-747d7780-63a7-11eb-9553-6a1898907441.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 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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: Zwelf <zwelf@strct.cc>
2021-01-31 14:37:48 +00:00
Zwelf 80df59ba5a Clarify teehistorian code 2021-01-28 23:42:01 +01:00
Zwelf 04e8ce56a9 Record exact tick where load/save result is returned 2021-01-28 22:50:15 +01:00
Zwelf cd407a08a8 Fix teehistorian PLAYER_INPUT message position
Previously the message was recorded when incoming. But the time when the input
should apply wasn't recorded.
Now inputs are recorded right before they get applied in the game world.
2021-01-28 22:50:00 +01:00
heinrich5991 43998ce41a Replace projectile hack with a new extended snapshot object
Still send the old hack to old clients, still accept the old hack from
old servers. This is so F-Client can support DDNet servers without such
hacks.
2021-01-26 20:58:42 +01:00
def f2cf038248 Revert "rescue on freeze/dfreeze"
This reverts commit 28cf3b31ba.
2021-01-26 14:44:01 +01:00
bors[bot] aa43e329b6
Merge #3538
3538: Improve error messages when you can't join team r=heinrich5991 a=def-

<!-- 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
- [ ] 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-25 11:35:39 +00:00
bors[bot] f5280919f1
Merge #3541
3541: rank/teamrank: Display how much better you are r=def- a=def-

![screenshot-20210123@231642](https://user-images.githubusercontent.com/2335377/105615509-8c666180-5dd1-11eb-94b4-a3f5d9131383.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
- [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>
Co-authored-by: Zwelf <zwelf@strct.cc>
2021-01-24 17:34:07 +00:00
Zwelf 953ea87929 Use sql PERCENTAGE_RANK() window function 2021-01-24 16:41:43 +01:00
bors[bot] ab897f21f1
Merge #3539
3539: Inform player about possibility to keep the hook when loading r=def- a=Zwelf

Message is displayed when saving with an active hook

## 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
- [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: Zwelf <zwelf@strct.cc>
2021-01-24 14:50:43 +00:00
bors[bot] 319c382167
Merge #3343
3343: rescue on freeze/dfreeze (supersedes #3335) r=heinrich5991 a=def-

Fixed all the merges and clang-format (hopefully)

## 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: Vlad <gerdoexx@gmail.com>
2021-01-24 00:07:31 +00:00
def b28cdc933a rank/teamrank: Display how much better you are 2021-01-23 23:19:45 +01:00
Zwelf a3702e8314 Inform player about possibility to keep the hook when loading
Message is displayed when saving with an active hook
2021-01-23 16:49:50 +01:00
bors[bot] a176990649
Merge #3537
3537: Fix condition for eye emote (fixes #3536) r=Learath2 a=def-

<!-- 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
- [ ] 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-23 14:53:00 +00:00
def d39a17933d Improve error messages when you can't join team 2021-01-23 15:52:57 +01:00
def 4eeb14d2f4 Fix condition for eye emote (fixes #3536) 2021-01-23 12:04:14 +01:00
bors[bot] 14e70506e1
Merge #3535
3535: Fix a possible race in load code  r=def- a=heinrich5991

Previously, a save could possibly be loaded twice given enough latency
discrepancy between servers. The server only verified that it deleted
*some* save with the given password, not *the* save it is trying to
load. This is fixed by also checking the SaveID column that is random
and globally unique (except for the old NULLs). Since users can't create
new saves with NULL SaveID, these pose no problem.

Also change the default UUID for saves without save ID to something
nonzero, so we can't accidentally hit it due to a bug.

## 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
- [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: heinrich5991 <heinrich5991@gmail.com>
2021-01-23 10:14:32 +00:00
heinrich5991 7b0b1c4162 Fix a possible race in load code
Previously, a save could possibly be loaded twice given enough latency
discrepancy between servers. The server only verified that it deleted
*some* save with the given password, not *the* save it is trying to
load. This is fixed by also checking the SaveID column that is random
and globally unique (except for the old NULLs). Since users can't create
new saves with NULL SaveID, these pose no problem.

Also change the default UUID for saves without save ID to something
nonzero, so we can't accidentally hit it due to a bug.
2021-01-23 01:21:20 +01:00
heinrich5991 3539f2b183 Allow ParseUuid to report errors and add tests 2021-01-23 01:21:20 +01:00
bors[bot] 93acedf00e
Merge #3523
3523: Handle switch number 0 r=heinrich5991 a=def-

Thanks to ReD 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
- [x] Considered possible null pointers and out of bounds array indexing
- [ ] 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: def <dennis@felsin9.de>
2021-01-22 17:31:35 +00:00
bors[bot] 77a9f41268
Merge #3530
3530: Improve ClShowDistance a bit r=heinrich5991 a=def-

<!-- 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>
2021-01-22 17:16:37 +00:00
def 23c145d760 Improve ClShowDistance a bit 2021-01-21 17:07:07 +01:00
bors[bot] 5d927f35b6
Merge #3502
3502: Some (mostly backported) refactor r=Learath2 a=Kaffeine

Port some cleanup and refactoring from the upstream and add some custom refactoring.

Changes overview:
- Backported angle() and direction() functions (upstream commit 7735557aa5)
- Backported vector math cleanup (remove some pointless templates, refactor other functions; upstream commit bdaabc10bc)
- `ddracechat.h` (used by both client and server) moved to a shared dir next to `ddracecommands.h`
- Backport `IGameController::DoActivityCheck()`
- Backport `IGameController::DoTeamChange()`
- Backport `IGameController::OnPlayerDisconnect()`
- Refactor Emote-related code (decouple the code and hide the details in CPlayer class)
- Fix: restore default emote on the emote override ended over.
- CCharacter::HandleTiles(): Move a part of DDRace-specific code to the DDRace GameController
- Add `IGameController::GetMaskForPlayerWorldEvent()` to port classes away from direct `CGameControllerDDRace/CGameTeams` usage.

Result overview:
- CPlayer does not depend on CGameControllerDDRace nor CGameTeams anymore
- CCharacter does not depend on CGameControllerDDRace anymore

I'm not sure that `GetMaskForPlayerWorldEvent()` is a good name for that. The idea of the method is to abstract the users of `CreateExplosion`, `CreatePlayerSpawn`, `CreateDeath`, `CreateSound`, and other world events from thinking about the player team.

I checked that the client and server work (didn't do deep testing though).

## Checklist

- [x] Tested the change ingame
- Provided screenshots if it is a visual change (no visual changes)
- Tested in combination with possibly related configuration options (no related options)
- [ ] Written a unit test if it works standalone, system.c especially
- [x] 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: Alexander Akulich <akulichalexander@gmail.com>
Co-authored-by: BeaR <cinaera@web.de>
2021-01-21 10:56:38 +00:00
Zwelf 4375bc1ac6 Don't depend on table locking for savegame load/save synchronization 2021-01-20 21:42:44 +01:00
def cd8e67df66 Handle switch number 0
Thanks to ReD for report
2021-01-20 20:00:25 +01:00
Alexander Akulich c28bd693d3 CPlayer: Port to GetMaskForPlayerWorldEvent
The CPlayer class does not depend on CGameTeams anymore.
2021-01-19 22:36:23 +03:00
Alexander Akulich d2744d595a GameController: Introduce GetMaskForPlayerWorldEvent() 2021-01-19 22:36:23 +03:00
Alexander Akulich d536743dda DDRace GameController: Set Teams to CCharacter on Spawned
Since this commit, CCharacter does not directly depend on
CGameControllerDDRace anymore.
2021-01-19 22:36:22 +03:00
Alexander Akulich 33dc79d190 Character: Make the GameController set the Teleports info
CCharacter::HandleTiles() doesn't depend on the CGameControllerDDRace anymore.
2021-01-19 22:36:03 +03:00
Alexander Akulich d5dbd94c66 CCharacter: Move Team-related tiles handling to the DDRace Controller 2021-01-16 03:20:58 +03:00
Alexander Akulich f7dfd8c9b9 CCharacter: Move start/finish tiles handling to the DDRace Controller 2021-01-16 03:20:58 +03:00
Alexander Akulich acfb541db9 DDrace GameController: Add GetPlayerTeam() 2021-01-16 03:20:58 +03:00
Alexander Akulich a14607f818 Introduce GameController::HandleCharacterTiles() 2021-01-16 03:20:58 +03:00
Alexander Akulich d924d9bf68 CCharacter: Extract ResetPickups() 2021-01-16 03:20:58 +03:00
Alexander Akulich 729262b896 GameController: Move the DDRace-specific code to the subclass
This leads to some small code duplication but let us remove the ugly casts.
2021-01-16 03:20:58 +03:00
Alexander Akulich 39938b6b2f Adjust the CGameControllerDDRace header file
- Reorder the methods as they're in the source file
- Move the member variables to the end (to later apply a special access-control)
- Mark Tick() override (we use C++11 and this is our own code)
2021-01-16 03:20:58 +03:00
Alexander Akulich cba66d96f2 CPlayer: Remove unused GameControllerDDRace include 2021-01-16 03:20:58 +03:00
Alexander Akulich 2191996254 CPlayer: Make the emote-related members private 2021-01-16 03:20:58 +03:00
Alexander Akulich 281186468f CPlayer: Correctly restore the default emote on override emote expired
We used to set EMOTE_NORMAL even on 'special' days ('events' config option).
2021-01-16 03:20:58 +03:00
Alexander Akulich f0e34c9c36 Move DefaultEmote logic into CPlayer 2021-01-16 03:20:58 +03:00
Alexander Akulich 4004fc093c CPlayer: Add missing reset for m_LastEyeEmote 2021-01-16 03:20:58 +03:00
Alexander Akulich 5a9af45f9a CPlayer: Rename EyeEmote to EyeEmoteEnabled (to be clear) 2021-01-16 03:20:58 +03:00
Alexander Akulich 2286771349 ConEyeEmote: Don't count the command if arguments not valid 2021-01-16 03:20:58 +03:00
Alexander Akulich 9197075654 Refactor the SetEmote code to remove custom CCharacter methods 2021-01-16 03:20:58 +03:00
Alexander Akulich b36a4fd8c3 Process CPlayer::m_DefEmoteReset in CPlayer 2021-01-16 03:20:58 +03:00
Alexander Akulich ecce5631ed Move Halloween emoticon to CPlayer and send it once per client
GameServer()->SendEmoticon() sends CNetMsg_Sv_Emoticon packet to everyone.

Calling SendEmoticon() from Character::Snap(ClientID) triggers as many
messages to everyone as there are active players.

Move the SendEmoticon() because it is not the Character (a world entity object)
responsibility to celebrate a day. Actually it is not CPlayer responsibility
either but CPlayer is the class where we deciding to celebrate (checking the
date) so at least let's keep the coupled stuff together.
2021-01-16 03:20:58 +03:00
Alexander Akulich 457f91ca8d CCharacter: Add GetLastAction() 2021-01-16 03:20:58 +03:00
Alexander Akulich 19234987c9 Backport IGameController::OnPlayerDisconnect() from the upstream
Upstream commit 5e4caa9b9c
2021-01-16 03:20:58 +03:00
Alexander Akulich 7512ad285b Backport IGameController::DoTeamChange from the upstream
Upstream commit 5e4caa9b9c
2021-01-16 03:20:58 +03:00
Alexander Akulich c4405c4811 GameController: Backport reorder from upstream
Upstream commit 5e4caa9b9c
2021-01-16 03:20:57 +03:00
Alexander Akulich e34f268bed Make CSaveTee and CPlayer not friends anymore 2021-01-16 03:20:57 +03:00
Alexander Akulich ffe3f110eb GameController: Extract DoActivityCheck()
Apply refactoring from the upstream.
2021-01-16 03:20:57 +03:00
Alexander Akulich 242aa63178 ddracechat.h is used by the client, so move it to src/game
where ddracecommands.h already is.
2021-01-16 03:20:57 +03:00
Alexander Akulich dfd60e6668 CGameContext: Remove ugly CGameControllerDDRace::m_Teams.Reset()
We called CGameControllerDDRace constructor on the previous line.
The CGameControllerDDRace invokes CGameTeams constructor which calls
Reset() on his own.

There is no chance how this can change anything.
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
def 39d06c5e85 Display median time instead of average (fixes #3399) 2021-01-12 14:24:38 +01:00
heinrich5991 9784726683 Replace remaining non-extended extension messages
Add backward compatibility stuff, but this allows newer clients to only
care for new messages.
2021-01-12 01:48:10 +01:00
heinrich5991 0d916e2ef6 Remove F-Client-specific messages
The PLAYERFLAG_AIM can now be set directly on DDNet servers via the 0.7
bridge and will be sent to clients identifying themselves as DDNet
clients.

Add a new extended message that mirror the old `Sv_TeamsState`.
2021-01-12 01:38:23 +01:00
fokkonaut 9940a806fa Support for F-Client 2021-01-12 01:38:23 +01:00
def cbda5b720a Make netclipping of entities and events respect shown distance (fixes #3420) 2021-01-11 23:11:28 +01:00
Zwelf 87d422df5a Remove unused onChangeTeamState 2021-01-11 14:29:01 +01:00
bors[bot] c8b4ce9c92
Merge #3465
3465: Reset practice after team saved and got killed r=Zwelf a=def-

As reported by Polector on Discord

<!-- 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-11 13:09:18 +00:00
def 4520ea3bb7 Reset practice after team saved and got killed
As reported by Polector on Discord
2021-01-11 00:23:36 +01:00
bors[bot] 6f4fb1a926
Merge #3468
3468: Improve grammar when locking team (fixes #3467) 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 16:46:08 +00:00
Alexander Akulich c2f276cee1 Port CConfig API from the upstream (0.7.5)
The old (g_Config) API is kept to not break the stuff.

See commits:
    de5859b371
    78076761eb
2021-01-10 17:10:19 +03:00
Alexander Akulich 77b2b22dd2 Entity: Restrict the access to some (now) private members
Follow upstream commit e86a486688
2021-01-10 14:25:12 +03:00
Alexander Akulich b0db610a47 Entities: Get rid of direct m_ID access 2021-01-10 14:25:12 +03:00
Alexander Akulich 035a50dd0b Entities: Get rid of direct m_ProximityRadius access 2021-01-10 14:25:12 +03:00
Alexander Akulich b865306b56 Entity: Add API changes from the upstream
The upstream restricted access to the class member.
Keep the some protected API as public and some private API as protected
for now to avoid massive changes in a hundreds places (related to m_Pos).

See upstream commit e86a486688.
2021-01-10 14:25:12 +03:00
Alexander Akulich 476c2c60d7 Cleanup includes
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Alexander Akulich f16937b361 gamecontext.h: Remove unused player.h include
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Alexander Akulich 164cb9907a player.h: Remove unused character.h include
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Alexander Akulich 8ee8351b68 Move WEAPON enum from character.h to player.h
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Alexander Akulich dc5b9340d5 Extract allocation macros to alloc.h (mimic the upstream)
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Alexander Akulich 80539245c8 GameContext: Extract SendMotd() and SendSettings() methods
Partial cherry-pick from upstream d8d259a166
2021-01-10 00:47:06 +03:00
hhh26459 ef2dd39cf5
typo in gamecontext.cpp
specators...
2021-01-06 18:16:30 +01:00
def 5c4fc9471a Fix server crash with too many items (fixes #3477) 2021-01-05 19:09:29 +01:00
def 134b644d40 Improve grammar when locking team (fixes #3467) 2021-01-01 23:40:34 +01:00
Zwelf 72455ed32d Fix use of uninitialized variable during /load of old saves 2020-12-28 18:02:43 +01:00
def 5a23bc1ab1 Fix veto 2020-12-28 12:01:35 +01:00
def 18ccb39384 Add (un)endless_hook command
As requested by Kicker
2020-12-26 23:09:38 +01:00
def e981d1b477 Fix veto vote, simplified logic
Also allow IPs to change their vote when multiple players are connected,
with 1 player it always worked.

Reported by Lenah on Discord
2020-12-23 10:51:51 +01:00
bors[bot] e708f3a1b1
Merge #3405
3405: Keep veto right after joining dummy with lower ID (fixes #3404) 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>
2020-12-22 11:15:46 +00:00
bors[bot] 8a15bc15d5
Merge #3417 #3419 #3432
3417: Notify about vote when authed r=heinrich5991 a=def-

<!-- 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
- [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)


3419: Only assign aOldName when we need it 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)


3432: Fix localization of version/game type/ping in server details r=heinrich5991 a=def-

<!-- 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>
2020-12-22 10:55:34 +00:00
bors[bot] 8d4e1a8b1a
Merge #3425
3425: Remove redundant check for pPlayer->m_IsReady r=Jupeyy 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>
2020-12-19 11:12:43 +00:00
def bdfb8bb06e Fix dragger being shown (fixes #3414)
Still doesn't seem to work with different team and /showothers 1, but
maybe that has always been the case
2020-12-19 11:30:56 +01:00
def 7eb26c62d1 Remove redundant check for pPlayer->m_IsReady 2020-12-19 10:20:18 +01:00
def 4d3d9d7049 Only assign aOldName when we need it 2020-12-18 23:18:55 +01:00
def ea70c347a3 Keep veto right after joining dummy with lower ID (fixes #3404) 2020-12-13 17:58:24 +01:00
Zwelf 037bac8f13 Add /top5team s?i command to show all team ranks of a player 2020-12-10 13:44:11 +01:00
Zwelf b256250b7b Synchronize database thread via atomic_bool instead of use_count from shared pointer 2020-12-08 18:11:00 +01:00
Dennis Felsing 516c1cc599
Merge pull request #3382 from Zwelf/pr-fix-race-condition
Fix storing load/save result in main thread without incrementing usage count
2020-12-04 11:48:14 +01:00
Zwelf e15a91911e Fix storing load/save result in main thread without incrementing usage count
Resulting to race condition, since the main thread always thought that the
load/save thread already completed. Passing the shared_ptr by reference to
prevent a similar future bug to happen.

Fixes #3380
2020-12-04 11:09:21 +01:00
def b63d20a6e0 Check for m_pCharacter before accessing it (fixes #3372) 2020-12-02 11:37:55 +01:00
bors[bot] 0848df797a
Merge #3315
3315: Remove annoying "added option" logging r=heinrich5991 a=def-

Fills our logs all the time

<!-- 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>
2020-11-30 15:46:25 +00:00
def b32e421dff Remove annoying "added option" logging
Fills our logs all the time
2020-11-30 08:08:37 +01:00
bors[bot] 6eb56ffb13
Merge #3341
3341: Check finish of team after player joins spectators r=heinrich5991 a=def-

Reported by Jupeyy

<!-- 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: def <dennis@felsin9.de>
2020-11-28 20:18:37 +00:00
def 9d66c2530b Check finish of team after player joins spectators
Reported by Jupeyy
2020-11-28 20:59:51 +01:00
bors[bot] b8fca40851
Merge #3340
3340: Fix vec_base constructors & remove useless operator r=heinrich5991 a=Jupeyy

Interestingly besides it found unused variables, this also found some "logic" errors, where vectors were used in `if`.

## 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>
2020-11-28 17:06:25 +00:00
bors[bot] 80a65c6326
Merge #3358
3358: Fix prediction with global collision off tiles and tunings (fix #2510) r=def- a=trml

Tested it now, and it seems that only the hook and collision off tiles were affected by this.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] 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: trml <trml@users.noreply.github.com>
2020-11-25 22:59:17 +00:00
trml 7bfd708405 Set ddnetchar flags when collision is disabled with server tunings 2020-11-25 23:38:29 +01:00
Headshot 9b460750fa
fix typo "authroized" 2020-11-24 21:50:10 -04:00
Vlad 28cf3b31ba rescue on freeze/dfreeze 2020-11-21 10:52:43 +01:00
Jupeyy f83d528f5d Fix vector constructor impl & remove useless operator 2020-11-20 12:14:33 +01:00
bors[bot] 797116fbfe
Merge #3316
3316: Disable ninja jetpack when player has telegun r=heinrich5991 a=def-

Required for map Taceht because of weapon tele interaction with jetpack

As requested by Cøke

## 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>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2020-11-19 13:06:24 +00:00
Dennis Felsing 227405b645
Update src/game/server/entities/character.cpp
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-11-19 10:20:13 +01:00
bors[bot] b138c4038c
Merge #3304 #3310
3304: Improve list box behaviour, make it more consistent r=heinrich5991 a=def-

Make keys work after searching in vote menu
Unify some duplicated 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
- [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)


3310: Found some more times with mins, use hours for consistency r=heinrich5991 a=def-

## 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: def <dennis@felsin9.de>
2020-11-18 23:43:22 +00:00
def c0b48ad89f Disable ninja jetpack when player has telegun
Required for map Taceht because of weapon tele interaction with jetpack

As requested by Cøke
2020-11-16 20:28:17 +01:00
def c3f6d89cac Fix random map vote reason to set stars
Caused by the hotfix for solo cheat

As reported by maggi323
2020-11-16 17:32:48 +01:00
def cfd3f84106 Found some more times with mins, use hours for consistency 2020-11-14 00:22:21 +01:00
Jupeyy 4d9f4da3ec Fix dragger logic 2020-11-11 05:41:42 +01:00
Jupeyy 6db4323daf Fix spawnpoints calculation 2020-11-08 03:42:35 +01:00
bors[bot] 556f64775e
Merge #3242
3242: Enable most clang-tidy bugprone-*, misc-*, performance-* checks r=Jupeyy a=def-

Fixes #3134

## 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>
2020-11-07 20:15:30 +00:00
bors[bot] 85c4384045
Merge #3245
3245: Don't access m_aaSpawnPoints out of bounds r=heinrich5991 a=def-

As discovered by ASAN:

```
/home/teeworlds/src/master/src/game/server/gamecontroller.cpp:142:3: runtime error: index 65 out of bounds for type 'vec2 [64]'
    #0 0x5de082 in IGameController::OnEntity(int, vector2_base<float>, int, int, int) /home/teeworlds/src/master/src/game/server/gamecontroller.cpp:142:3
    #1 0x5c9f43 in CGameContext::OnInit() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:3291:20
    #2 0x4ae3aa in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2473:20
    #3 0x4c265d in main /home/teeworlds/src/master/src/engine/server/server.cpp:3551:21
    #4 0x7f400fedc09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #5 0x451509 in _start (/home/teeworlds/servers/DDNet-Server-ubsan+0x451509)
```

## 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>
2020-11-07 18:32:42 +00:00
bors[bot] a59f8495f4
Merge #3247
3247: Initialize pointer in dragger r=Jupeyy a=def-

How did this not blow up all day long for years?!
    
Found by UBSAN:

    /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29: runtime error: member call on address 0x0000013319b8 which does not point to an object of type 'CCharacter'
    0x0000013319b8: note: object has invalid vptr
     00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  invalid vptr
        #0 0x5501de in CDragger::Move() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29
        #1 0x5522c2 in CDragger::Tick() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:153:3
        #2 0x5eb11e in CGameWorld::Tick() /home/teeworlds/src/master/src/game/server/gameworld.cpp:261:11
        #3 0x58d660 in CGameContext::OnTick() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:751:10
        #4 0x4afefe in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2558:19
        #5 0x4c26fd in main /home/teeworlds/src/master/src/engine/server/server.cpp:3551:21
        #6 0x7f2c8cc9309a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
        #7 0x451509 in _start (/home/teeworlds/servers/DDNet-Server-ubsan+0x451509)


## 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>
2020-11-06 23:06:27 +00:00
def 7a9a67c5d7 Enable most clang-tidy misc-* checks 2020-11-05 12:03:14 +01:00
def 312b9d3bd8 Enable clang-tidy performance-* checks 2020-11-05 11:34:20 +01:00
def b0f9dc2139 Update credits 2020-11-05 09:53:03 +01:00
def 2c3000ba81 Minor code cleanup in dragger.cpp 2020-11-05 07:53:04 +01:00
def 5b5d4404a6 Don't access m_aaSpawnPoints out of bounds
As discovered by ASAN:

/home/teeworlds/src/master/src/game/server/gamecontroller.cpp:142:3: runtime error: index 65 out of bounds for type 'vec2 [64]'
    #0 0x5de082 in IGameController::OnEntity(int, vector2_base<float>, int, int, int) /home/teeworlds/src/master/src/game/server/gamecontroller.cpp:142:3
    #1 0x5c9f43 in CGameContext::OnInit() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:3291:20
    #2 0x4ae3aa in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2473:20
    #3 0x4c265d in main /home/teeworlds/src/master/src/engine/server/server.cpp:3551:21
    #4 0x7f400fedc09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #5 0x451509 in _start (/home/teeworlds/servers/DDNet-Server-ubsan+0x451509)
2020-11-04 23:16:04 +01:00
def 5a9d93f160 Initialize pointer in dragger
How did this not blow up all day long for years?!

Found by UBSAN:

/home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29: runtime error: member call on address 0x0000013319b8 which does not point to an object of type 'CCharacter'
0x0000013319b8: note: object has invalid vptr
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
    #0 0x5501de in CDragger::Move() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29
    #1 0x5522c2 in CDragger::Tick() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:153:3
    #2 0x5eb11e in CGameWorld::Tick() /home/teeworlds/src/master/src/game/server/gameworld.cpp:261:11
    #3 0x58d660 in CGameContext::OnTick() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:751:10
    #4 0x4afefe in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2558:19
    #5 0x4c26fd in main /home/teeworlds/src/master/src/engine/server/server.cpp:3551:21
    #6 0x7f2c8cc9309a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #7 0x451509 in _start (/home/teeworlds/servers/DDNet-Server-ubsan+0x451509)
2020-11-04 23:06:45 +01:00
bors[bot] dcfdd05911
Merge #3237
3237: Create fallback wordlist in sourcecode (fixes #3206) r=Learath2 a=def-

<!-- 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
- [ ] 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: def <dennis@felsin9.de>
2020-11-03 23:45:20 +00:00
def 06b534c07d Create fallback wordlist in sourcecode (fixes #3206) 2020-11-03 17:01:16 +01:00
bors[bot] 9b64b9ba1d
Merge #3222
3222: Kick-voting someone from team doesn't kill locked team (fixes #3207) r=heinrich5991 a=def-

<!-- 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
- [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: def <dennis@felsin9.de>
2020-11-03 11:59:34 +00:00
def 2c98f2b76b Kick-voting someone from team doesn't kill locked team (fixes #3207) 2020-11-03 08:37:56 +01:00
def 63c093c065 Get rid of remaining strcpy calls 2020-11-02 22:40:41 +01:00
def 165857a5a8 Fix variable names manually 2020-11-02 22:40:40 +01:00
def b1f0fd8969 Enable modernize-loop-convert clang-tidy check
and run clang-format afterwards

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2020-11-02 22:40:24 +01:00
def dad91eb763 Enable readability-qualified-auto clang-tidy check
https://clang.llvm.org/extra/clang-tidy/checks/readability-qualified-auto.html
2020-11-02 22:40:02 +01:00
def bb7ff2a482 Revert "Show halloween skins only on Halloween"
People are clearly unhappy with this event, so let's revert it. On
servers I've set events 0 already.

This reverts commit ae90bdf3f9.
2020-10-31 09:51:06 +01:00
Zwelf 6eb95c6b96 Fix random_map and random_unfinished_map on SQLite server 2020-10-28 22:36:54 +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
bors[bot] 499cbb254d
Merge #3128
3128: Add add_map_votes command for easier local map testing r=heinrich5991 a=def-

No need to tell new players how to manually add a vote or load a map from rcon

Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2020-10-26 11:52:39 +00:00
Dennis Felsing 9b810017e1 str_truncate instead of str_copy 2020-10-26 12:49:19 +01:00
Dennis Felsing bb2f446802 Escape map in change_map 2020-10-26 11:28:04 +01:00
Dennis Felsing 23c005144b consistent formatting for dbg_msg
no capital letters, no spaces
2020-10-26 10:04:03 +01:00
bors[bot] 3bdded3c4f
Merge #3122 #3137
3122: Fix arithmentic problems r=def- a=Jupeyy

The first three commits are safe

The ones i'll add later will be inside the gamecore, so might alter behaviour.

I'll see which ones are critical, but takes me some time

i fixed most in #3081

3137: Add gfx debug r=def- a=Jupeyy

If someone wants to try, you have to execute the client with a config that contains dbg_gfx 1
If opengl debug is supported it will show "Enabled OpenGL debug mode" in the console

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-20 16:19:55 +00:00
bors[bot] 2709afb007
Merge #3095
3095: Disallow player name changes when the player is muted r=def- a=heinrich5991



Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-10-20 15:56:16 +00:00
def 655bbd2cb6 Clamp /emote duration
/home/teeworlds/src/master/src/game/server/ddracechat.cpp:1108:65: runtime error: signed integer overflow: 99999999 * 50 cannot be represented in type 'int'
2020-10-20 16:46:25 +02:00
Zwelf 81131c7831 Fix grammar mistake 2020-10-19 15:23:48 +02:00
Zwelf 6d11c34d63 Load game UUID on /load
Fixes #2522 and #3144
2020-10-19 15:21:23 +02:00
def bd14545b47 Show times with hours in SQL (fixes #3140) 2020-10-18 23:47:13 +02:00
def 67178b0ea0 Use str_time/str_time_float everywhere 2020-10-18 23:47:09 +02:00
def 3d94f9c7af Finish chat msg: Add comment 2020-10-18 17:57:27 +02:00
ChillerDragon c81eb50b50 Fix halloween logic 2020-10-18 10:26:52 +02:00
bors[bot] 91773cd991
Merge #3116
3116: Show halloween skins only on Halloween r=heinrich5991 a=def-

Making use of the skin downloader.

Skin choice is based on your name, only active on October 31 and November 1 with events 1 in settings

Co-authored-by: def <dennis@felsin9.de>
2020-10-18 00:33:47 +00:00
def 81bc68d9d0 Add add_map_votes command for easier local map testing
No need to tell new players how to manually add a vote or load a map
from rcon
2020-10-18 00:06:43 +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
Jupeyy fa8b8b9324 More Target cleanup 2020-10-17 19:58:07 +02:00
Jupeyy 6426e341f3 Fix NaNs created by bad initialization 2020-10-17 18:17:13 +02:00
Learath2 ba7b95f7ad Revert #3066
This reverts commits:
	a2b3f45f8b
	26a07c804f
2020-10-17 17:32:52 +02:00
def 08045f6bd9 Only assign skin when non-Halloween skin has been chosen 2020-10-17 16:58:47 +02:00
def ae90bdf3f9 Show halloween skins only on Halloween
Making use of the skin downloader.

Skin choice is based on your name, only active on October 31 and November 1 with events 1 in settings
2020-10-17 12:10:56 +02:00
heinrich5991 6ff53358d3 Remove code for CRC in most places, except where needed for net compat
This should path the way to remove it altogether in the future.
2020-10-14 17:08:58 +02:00
heinrich5991 246d2ac3d6 Allow IServer users to check when client's names change
Use that available interface to process name change spam protection more
cleanly.
2020-10-14 16:42:35 +02:00
def 0867424749 Fix clang-analyzer-security.insecureAPI.strcpy
/media/ddnet/src/engine/server/sql_string_helpers.cpp:74:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
2020-10-14 15:45:47 +02:00
def 98d4baabed Fix clang-analyzer-core.NonNullParamChecker
/media/ddnet/src/game/server/entities/projectile.cpp:201:37: warning: Forming reference to null pointer [clang-analyzer-core.NonNullParamChecker]
                                        Found = GetNearestAirPosPlayer(pTargetChr->m_Pos, &PossiblePos);
                                                                       ^
2020-10-14 15:45:47 +02:00
def a4f13ed4a8 Fix clang-analyzer-optin.portability.UnixAPI
and mark some false positives

/media/ddnet/src/engine/client/backend_sdl.cpp:329:30: warning: Call to 'malloc' has an allocation size of 0 bytes [clang-analyzer-optin.portability.UnixAPI]
2020-10-14 15:45:43 +02:00
heinrich5991 5b4c64005f Disallow player name changes when the player is muted 2020-10-14 01:19:41 +02:00
heinrich5991 a2b3f45f8b Reintroduce CMDFLAG_TEST
Add some more helpful messages for executing test/game commands.
2020-10-11 16:27:28 +02:00
Andrii 26a07c804f Disallow game-related commands unless testing is enabled 2020-10-11 16:02:10 +02:00
def 04b840f542 Consider as not-afk on emoticon, chat, vote,
call vote, spectator mode, info change
2020-10-07 23:24:50 +02:00
bors[bot] 4a30ef1e9a
Merge #3020
3020: Fix all Multiplication type alerts by CodeQL r=heinrich5991 a=def-

> Multiplication result converted to larger type

> A multiplication result that is converted to a larger type can be a
> sign that the result can overflow the type converted from.

Example: https://github.com/ddnet/ddnet/security/code-scanning/17?query=ref%3Arefs%2Fheads%2Fmaster

Co-authored-by: def <dennis@felsin9.de>
2020-10-07 00:56:19 +00:00
bors[bot] 4706b0f5be
Merge #3005
3005: Use rest instead of string in some commands r=heinrich5991 a=def-

where it makes sense, means you don't need to quote strings for those

Co-authored-by: def <dennis@felsin9.de>
2020-10-06 15:06:45 +00:00
def 62dc12aacb Fix all Multiplication type alerts by CodeQL
> Multiplication result converted to larger type

> A multiplication result that is converted to a larger type can be a
> sign that the result can overflow the type converted from.

Example: https://github.com/ddnet/ddnet/security/code-scanning/17?query=ref%3Arefs%2Fheads%2Fmaster
2020-10-05 19:03:54 +02:00
def 5b06f54d06 censorlist without case 2020-10-05 10:55:32 +02:00
def 5ec702ad2f Use rest instead of string in some commands
where it makes sense, means you don't need to quote strings for those
2020-10-04 17:52:05 +02:00
def 04f2fc5d41 Censor string multiple times 2020-10-04 17:49:19 +02:00
Pure luck 9a89b6fc68 fix for a SixUp vote creator id which wasn't set 2020-09-30 18:01:50 +03:00
def 2deb8aa380 Fix Windows compilation 2020-09-27 11:05:54 +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
bors[bot] 8b399ba1be
Merge #2861
2861: Implement censoring words on server r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
2020-09-25 23:07:15 +00:00
bors[bot] c6ade7eeeb
Merge #2917
2917: Create ALLOW_X_SKINS game info flag r=heinrich5991 a=def-

To allow server to set any x_ prefixed skin and client won't filter it
out. As requested by Pure_luck for his mod to show players as tanks,
walls, etc. Won't be enabled on DDNet-Servers, thus such skins can be
added where a server modification wants to fine-control what skins are
allowed and can enforce such skins.

Co-authored-by: def <dennis@felsin9.de>
2020-09-25 21:22:38 +00:00
Pure luck 3cd0f30d55 laser_damage bugfix styling 2020-09-25 17:41:17 +03:00
Pure luck e7d830a01e bugfix: laser_damage was removed from tunes of 0.7 protocol 2020-09-25 17:25:59 +03:00
def 9f9ccaccf7 Create ALLOW_X_SKINS game info flag
To allow server to set any x_ prefixed skin and client won't filter it
out. As requested by Pure_luck for his mod to show players as tanks,
walls, etc. Won't be enabled on DDNet-Servers, thus such skins can be
added where a server modification wants to fine-control what skins are
allowed and can enforce such skins.
2020-09-24 19:05:30 +02:00
nobody-mb 78040b31e5
automatically kick k-client (#2912) 2020-09-23 16:52:50 +02:00
bors[bot] fddb8b34c0
Merge #2898 #2901 #2908
2898: Inform players that they are in team already r=heinrich5991 a=def-



2901: Remove failed downloaded files immediately r=heinrich5991 a=def-

Especially skins were only deleted after they were requested again

2908: Don't log skin downloading progress r=heinrich5991 a=def-

since it's not really interesting for most players, as long as things work fine

Co-authored-by: def <dennis@felsin9.de>
2020-09-22 14:57:20 +00:00
def ae4dc1032e Inform players that they are in team already 2020-09-22 16:45:46 +02:00
def 3a3d3bcb99 Fix UpdatePlayerMaps 2020-09-21 15:32:16 +02:00
def cfd32c357b Fix clang-format 2020-09-21 15:32:16 +02:00
def 35fc180559 Finish /showothers 2 implementation on server 2020-09-21 15:32:16 +02:00
12pm aa18dc1d88 remove for more info 2020-09-19 13:40:19 +02:00
12pm f3bef4919f mention rules 2020-09-19 13:28:30 +02:00
def f11679afb2 Implement censoring words on server 2020-09-18 19:18:08 +02:00
bors[bot] edb4462f8a
Merge #2814 #2818
2814: Remove saving to other servers r=Learath2 a=def-

sv_sql_valid_servernames is no longer required

2818: Load fonts from memory (fixes #2810) r=Learath2 a=def-

Missing: Freeing the memory again. But not so important since we keep
the same fonts until end of process anyway in our case.

@QingGo Could you give this a try from the Github build artifacts? If not, I can provide you a nightly build.

Co-authored-by: def <dennis@felsin9.de>
2020-09-15 17:16:21 +00:00
def a67a8e36aa clang-format: fix style 2020-09-14 16:00:51 +02:00
Vlad be90f3f48b Replaced tile names. 2020-09-13 23:00:49 +03:00
def 0f8d682f81 Remove saving to other servers
sv_sql_valid_servernames is no longer required
2020-09-13 21:49:44 +02:00
Andrii a2b149a114 remove sv_team_lock command 2020-09-13 00:46:49 +03:00
heinrich5991 35228fb997 Always accept the local server name for saves 2020-09-11 06:10:53 +02:00
Zwelf 3a986fbe52 Fix SQL query style using clang-format 2020-09-10 20:24:34 +02:00
Zwelf 88dc1c1a9c Add print functionality to SQLite 2020-09-10 20:16:42 +02:00
Zwelf 46b0ff354e Align InsertIgnore with other SQL query related functions 2020-09-10 20:16:42 +02:00
def 9bbd7f6259 Improve performance of /points
No need to do the rank() calculation at all

by heinrich5991
2020-09-07 23:11:24 +02:00
def a2b5d639a0 Fix duplicate teamranks (fixes #2405)
by ordering names in binary collation, consistent with C++ std::sort

Required since the official DDNet DB uses utf8mb4_general_ci default collation
2020-09-07 12:12:55 +02:00
def d492d6d270 Fix duplicate teamranks (fixes #2405)
by ordering names in binary collation, consistent with C++ std::sort

Required since the official DDNet DB uses utf8mb4_general_ci default collation
2020-09-07 12:10:23 +02:00
def f89766034c Don't lock SQL writes for teamrace
The slow query logs are full of this:

  # Time: 200906 21:03:43
  # User@Host: teeworlds[teeworlds] @ ger6.ddnet.tw [89.163.212.120]
  # Thread_id: 101540  Schema: teeworlds  QC_hit: No
  # Query_time: 11.012166  Lock_time: 0.000000  Rows_sent: 0  Rows_examined: 0
  # Rows_affected: 0  Bytes_sent: 67
  SET timestamp=1599419023;
  LOCK TABLES record_teamrace WRITE, record_teamrace AS r WRITE;

Do we really need these lock? See also
https://dev.mysql.com/doc/refman/5.7/en/table-locking.html

> InnoDB tables use row-level locking so that multiple sessions and
> applications can read from and write to the same table simultaneously,
> without making each other wait or producing inconsistent results. For
> this storage engine, avoid using the LOCK TABLES statement, because it
> does not offer any extra protection, but instead reduces concurrency.
2020-09-07 00:34:01 +02:00
def c3f9dc7c9f INSERT OR IGNORE on sqlite 2020-09-04 16:12:12 +02:00
def e613f7df7f Allow loading from any server
Since we are switching to a single write sql server for sake of
simplicity
2020-09-03 22:56:22 +02:00
def 0ba18cd891 Inform client about failure to join because of invalid utf8 2020-09-03 20:34:05 +02:00
def 253c8e00b2 Clarify kill and /kill 2020-09-01 15:35:17 +02:00
Dennis Felsing 958d75abf1
Merge pull request #2663 from def-/pr-duplicate-db
Ignore duplicate records when inserting (fixes #2636)
2020-08-29 15:02:46 +02:00
heinrich5991 31cfa9250d Fix server port in teehistorian
Official servers weren't affected because they didn't use the default of
`sv_port 0`.
2020-08-29 14:14:37 +02:00
def 63f6ecd19d Ignore duplicate records when inserting (fixes #2636) 2020-08-29 08:26:03 +02:00
Learath fbb498588c Missed a vote case 2020-08-27 19:48:19 +03:00
trml c98a1f0a59 Only send pain sound in freeze if fire was released 2020-08-25 22:45:23 +02:00
Zwelf 52af88826c Allow switching weak/strong with saving and loading 2020-08-13 16:19:07 +02:00
Zwelf f3619c27ee Remove incorrect check when inserting team ranks
Can be reliable reproduced by finishing in this sequence:

1. A, B
2. A, C
3. B, C <- triggers error

Fixes #2568
2020-08-13 09:58:56 +02:00
Zwelf a866c3e9b7 Fix team rank not updating after SQLite update 2020-08-12 10:57:43 +02:00
Arda Demir fabc194081 Flag afk when player timed-out 2020-08-10 21:59:31 +03:00
Dennis Felsing 77d61973fa
Merge pull request #2545 from def-/pr-version-14.3
Version 14.3
2020-08-10 17:50:29 +02:00
def 4ceb4ddb9f Version 14.3 2020-08-10 17:50:05 +02:00
bors[bot] b06bea7c04
Merge #2465
2465: Sqlite3 support and prepared statements r=heinrich5991 a=Zwelf

This PR changes the abstraction layer of the score backend to thin abstractions over the MySQL and SQLite3 library. It executes all Queries in one worker thread making it easier to use the ddnet thread pool. This doesn't change much, because each the mysql-connection was locked with `m_SqlLock` beforehand, serializing writes and reads respectively.

Behavior change (even though I tried to minimize them):

* `sv_use_sql` is used to determine if mysql server should be added
* `sv_sql_failure_file` is replaced by `sv_sqlite_file`
* `sv_sqlite_file` is either used as a backup server when `sv_use_sql` is enabled or as the primary read+write server when `sv_use_sql` is disabled
* `/load` now escapes the like-string

Since I am not good at designing config file commands, I would appreciate feedback on this part.

WIP:
* [x] rewrite SQL statements to work in both MySQL and SQLite (preferable just ANSI-SQL)
  * [x] create tables (`COLLATE BINARY` and encoding info)
  * [x] store rank (UPSERT for points)
  * [x] load birthday (different function in sqlite for time handling)
  * [x] `/mapinfo` (`convert(? using utf8mb4) COLLATE utf8mb4_general_ci`)
  * [x] `/map` (`convert(? using utf8mb4) COLLATE utf8mb4_general_ci`)
  * [x] store teamrank (`GROUP_CONCAT`)
  * [x] `/teamrank` (`GROUP_CONCAT`)
  * [x] ~`/top5team` (`GROUP_CONCAT`)~ doesn't contain GROUP_CONCAT
  * [x] `/times` (`UNIX_TIMESTAMP`)
  * [x] `/load` without any arguments (`UNIX_TIMESTAMP`)
* [x] all commits compiling, making future bisect easier
* [x] write a sqlite_to_mysql script
* [x] write an old_file_server to sqlite script
* [x] gracefully shutdown DbPool

Co-authored-by: Zwelf <zwelf@strct.cc>
2020-08-09 23:30:08 +00:00
Zwelf 5893913922 Clean up includes in sql backend 2020-08-09 17:54:25 +02:00
Zwelf 5b53a05a40 Rename LoadString to FromString to fix windows build 2020-08-09 17:14:11 +02:00
def 20e8bfd12a Try to fix Windows build 2020-08-09 17:14:11 +02:00
Learath 039139b836 Fix more sixup vote issues 2020-08-04 20:14:37 +03:00
Zwelf d71bf5cef1 Use DB write server for /load 2020-08-03 12:58:52 +02:00
Zwelf 3e1324dd0a Add uuid parsing 2020-08-03 12:58:52 +02:00
Zwelf c6b1b08355 Database specific collate utf8 nocase
making and work
2020-08-03 12:58:52 +02:00
Zwelf d16bb5cc08 Make timestamps compatible with SQLite
works for `/mapinfo`, `/load`, `/save`, `/times`
2020-08-03 12:58:52 +02:00
Zwelf 41b5ee9dd8 Make /teamrank compatible with SQLite 2020-08-03 12:58:52 +02:00
Zwelf aee73b99dc Rewrite insert teamrank making code reuse easier 2020-08-03 12:58:52 +02:00
Zwelf c8d710926f Fix missing last line 2020-08-03 12:58:52 +02:00
Zwelf 044edbe42b Make storing teamrank compatible with SQLite 2020-08-03 12:58:52 +02:00
Zwelf a6df9be98e Make getting birthday compatible with SQLite 2020-08-03 12:58:52 +02:00
Zwelf eb4d77f071 Make inserting ranks compatible with SQLite 2020-08-03 12:58:52 +02:00
Zwelf 89ee5944b4 Add missing include 2020-08-03 12:58:52 +02:00
Zwelf 2eb3d23ef4 Rewrite score using the new interface
delete file_score for now as it will be replaced by a sqlite backend
2020-08-03 12:58:52 +02:00
Fireball 7e610f9944 Fix sixup players not making sounds when hooking others
This also fixes some less noticeable edgecases with ground jump sound: for example, when spectating a tee who is in a solo part.
2020-07-18 19:13:56 +01:00
bors[bot] 37a906d972
Merge #2501
2501: Show "Free View" for Sixup r=fokkonaut a=Learath2

@fokkonaut is this enough?

bors delegate=fokkonaut

Co-authored-by: Learath <learath2@gmail.com>
2020-07-13 09:50:48 +00:00
Learath 85a2268b2a Show "Free View" for Sixup 2020-07-13 11:35:03 +03:00
bors[bot] 38ea723d94
Merge #2433 #2505 #2506
2433: Fix votes for sixup r=heinrich5991 a=Learath2

I think this looks sane but I haven't tested it at all for idk how to even test this locally/alone

2505: Fix legacy 64 player serverinfo, don't send duplicate packets (fixes #2495) r=heinrich5991 a=def-

For legacy we sent the first packet once correctly, then the 2nd and 3rd
packet without the marker and token at the start, so they never worked.

For new 64 player serverinfo we sent all packets correctly but the 1st
packet twice.

Introduced in #1955.

2506: Prevent whisper spam from 0.7 (fixes #2504) r=heinrich5991 a=def-



Co-authored-by: Learath <learath2@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
2020-07-12 22:58:23 +00:00
def 74197fc027 Prevent whisper spam from 0.7 (fixes #2504) 2020-07-13 00:28:47 +02:00
Learath dd010364ed Fix double messages 2020-07-12 10:34:36 +03:00
bors[bot] c4d5c8dfa2
Merge #2478 #2480
2478: Use (u)int64 from system.h instead of (u)int64_t from cstdint r=heinrich5991 a=def-

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);
      |                                                                                          ^~~~~~~

2480: Send zoom status for dummy too r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
2020-07-09 18:31:32 +00: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
def 5e7a45a49b Set smaller default area for what distance to show
as suggested by fokkonaut
2020-07-08 23:16:30 +02:00
bors[bot] 8a3743fa90
Merge #2474 #2476
2474: Remove IP skins r=heinrich5991 a=def-



2476: Use x instead of y in show distance (fixes #2475) r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
2020-07-08 20:39:01 +00:00
Dennis Felsing 05ed51cf86
Update src/game/server/gamecontext.cpp
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-07-08 22:02:36 +02:00
Dennis Felsing 71bd706f2a
Update src/game/server/gamecontext.cpp
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-07-08 22:02:31 +02:00
def 2a35121c84 Use x instead of y in show distance (fixes #2475) 2020-07-08 15:57:00 +02:00
def 66c7bf8851 Tell why DNSBL isn't allowing to vote (fixes #2466) 2020-07-07 23:12:55 +02:00
Learath fb09f8a6c6 "Translate" the vote message 2020-07-07 13:16:53 +03:00
Learath 95d363b42c Fix votes for sixup 2020-07-07 13:14:07 +03:00
Zwelf d0975f9c4b Fix storing finish on solo server with practice mode enabled 2020-07-02 22:49:30 +02:00
bors[bot] 7266bcad78
Merge #2444
2444: Fix erroneous "unable to find all characters" message r=heinrich5991 a=Zwelf

Fixes #2443 

Co-authored-by: Zwelf <zwelf@strct.cc>
2020-07-02 15:07:55 +00:00
Zwelf 17bb4522fc Fix erroneous "unable to find all characters" message 2020-07-02 16:34:36 +02:00
Zwelf ab9cdc294d Reset all input after rescuing 2020-07-02 16:24:23 +02:00
Zwelf 538de72c94 Don't load movement and pause state when rescuing 2020-07-02 14:06:18 +02:00
Zwelf 4388579d48 Fix reenabling practice mode after kill on solo server 2020-07-02 11:13:07 +02:00
Learath f9bf6cf354 Spam protection on /rank 2020-07-01 23:53:25 +03:00
bors[bot] 6da2f117cf
Merge #2425
2425: Fix doors not resetting on restart on solo server r=heinrich5991 a=Zwelf



Co-authored-by: Zwelf <zwelf@strct.cc>
2020-07-01 16:10:34 +00:00
bors[bot] 98779776e5
Merge #2424
2424:  Keep hook when loading  r=heinrich5991 a=Zwelf

Solves issue discussed in #2374. Also keeps direction and jump, which is evaluated when player is in /pause. Fire could be deleted, as it does not affect game play in any way.

Co-authored-by: Zwelf <zwelf@strct.cc>
2020-07-01 16:01:25 +00:00
Zwelf bff8e90319 Fix loading team sets teamstate to TEAMSTATE_OPEN 2020-07-01 09:03:16 +02:00
Zwelf 9e43f8d483 Add CCharacter::m_ReloadTimer to save 2020-06-30 23:49:40 +02:00
def 1cb9454ab8 Rename showothers2 -> showothers
and the old showothers to legacy
2020-06-30 21:38:51 +02:00
def c3521572ea Add showothers2@netmsg.ddnet.tw
to support cl_show_others 2 properly
2020-06-30 21:38:14 +02:00
Zwelf 6f9dd48401 Fix doors not resetting on restart on solo server 2020-06-30 20:42:01 +02:00
Zwelf b99bbccd24 Revert "Revert "Fix /save on solo server""
This reverts commit 59a7e1f187.
2020-06-30 20:22:17 +02:00
def 3de5b3a12f Revert "Revert "Explain why the randomly generated save code is used""
This reverts commit 4476ec39f9.
2020-06-30 20:18:58 +02:00
def 4476ec39f9 Revert "Explain why the randomly generated save code is used"
This reverts commit 0d887e8b37.
2020-06-30 20:15:50 +02:00