Commit graph

2840 commits

Author SHA1 Message Date
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