Commit graph

135 commits

Author SHA1 Message Date
jupeyy 259629db9f Map optimizer 2020-11-21 12:10:20 +01:00
Jupeyy c989cd67f9 Check skin/sprite images for correctness 2020-11-18 07:59:15 +01:00
def 7a9a67c5d7 Enable most clang-tidy misc-* checks 2020-11-05 12:03:14 +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
Dennis Felsing 333218e8c2
Merge pull request #3200 from Patiga/pr-remove-duplicate-function
Use IntsToStr function from gamecore.h
2020-10-27 13:18:59 +01:00
Patiga 1253215018 Fix style 2020-10-27 12:35:55 +01:00
Patiga cce91746da Use IntsToStr function from gamecore.h 2020-10-27 12:15:11 +01:00
bors[bot] a050370055
Merge #3197
3197: 0.7 map converter - Stop embedding rgb images r=heinrich5991 a=Patiga

DDNet doesn't CMapItemTypeImage version 2, meaning it doesn't have
support yet for having rgb images in maps. Currently, trying that would result in
invalid map files.

## 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
- [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: Patiga <dev@patiga.eu>
2020-10-27 09:44:16 +00:00
Patiga 090b0942fb Stop embedding rgb images
DDNet doesn't CMapItemTypeImage version 2, meaning it doesn't have
support yet for having rgb images in maps. Currently, trying that would result in
invalid map files.
2020-10-26 17:08:52 +01:00
Dennis Felsing e55eecc88b Fix map_convert_07
Broken in 5c1b8cd221 (diff-17a71d0838a3f107d2baf573a0885c3b7727266b432a13836525737e83a81a58)

Thanks to Jupstar for noticing
2020-10-26 15:11:54 +01:00
def 87b06d307f Fix clang-analyzer-core.UndefinedBinaryOperatorResult
/media/ddnet/src/game/client/animstate.cpp:54:27: warning: The left operand of '*' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
        pSeq->m_X += pAdded->m_X * Amount;
                                 ^
2020-10-14 15:45:47 +02:00
def 5c1b8cd221 Fix clang-analyzer-deadcode.DeadStores
/media/ddnet/src/game/client/components/statboard.cpp:288:3: warning: Value stored to 'tw' is never read [clang-analyzer-deadcode.DeadStores]
2020-10-14 15:45:47 +02:00
def 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
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 b0a3de60b2 Handle PNG read errors (fixes #2959)
and print a more telling error message

I'll check all our existing maps for failures now:

$ find . -iname '*.map' | while read i; do echo $i; map_extract $i > /dev/null; find . -iname '*.png' | while read j; do dilate $j; rm -- $j; done; done

For skins Soreu and the skin DB team is already taking care.
2020-09-30 18:23:52 +02:00
def 3be8a592e5 Run clang-format
Purely automatic change. In case of conflict with this change, apply the
other change and rerun the formatting to restore it:

$ python scripts/fix_style.py
2020-09-26 21:50:15 +02:00
def 0bac9f0de8 Manual preparation for cleaner clang-format
Also include what you use explicitly
2020-09-26 21:41:01 +02:00
Jupeyy 0ec7f1e1dc Fix dilate threshold & automatically apply dilate on embedded textures in the editor 2020-09-21 19:17:38 +02:00
Jupeyy a1eb5dc114 Max images(for editor, clamp for client and warning for mapconvert) (fixes #2148) 2020-09-19 21:22:21 +02:00
def f9ec8c5696 map_convert_07: Check for width/height 0
as suggested by Jupeyy
2020-09-14 18:03:23 +02:00
Andrii bea30a879d
Apply suggestions from code review
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-09-13 00:40:22 +03:00
Andrii 3835395591 allow to use config_retrieve on whole directory 2020-09-12 23:48:01 +03:00
bors[bot] 51483c2ff1
Merge #2789 #2797
2789: Refresh server browser immediately when updated ddnet info arrived r=heinrich5991 a=def-

At the moment it only happens the next time you press refresh.

Before we had it so that it always reloaded once the ddnet info arrived,
causing a quick flickering and lots of packets having to be resent every
time someone pressed refresh, even if nothing changed.

The new approach combines the advantages of both without the
disadvantages. An even nicer way would be to compare the json objects,
so that news and version updates don't matter, but our json library
doesn't seem to support that.

2797: dilate: Don't crash if file doesn't exist r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
2020-09-10 22:24:06 +00:00
def 80b7ceb3d7 dilate: Don't crash if file doesn't exist 2020-09-10 23:25:33 +02:00
def c839dc96d9 Remove tools we don't need anymore
Following Jupeyys new renderer
2020-09-10 23:15:28 +02:00
def 5d239bce80 Also check for divisibility by 16 of height (fixes #2687) 2020-08-31 14:01:34 +02:00
def 53c43536d5 map_convert_07: Support drag'n'drop 2020-08-16 23:21:00 +02:00
bors[bot] de328c1360
Merge #2301
2301: map_convert_07: Check image width for divisibility by 16 r=heinrich5991 a=def-

As noticed on Sunny Land.

> [5:31 PM] redix: in theory it should be enough if width and height are divisible by 16

Now running this over our maps and fixing them manually.

Co-authored-by: def <dennis@felsin9.de>
2020-06-23 23:30:34 +00:00
def ca094df46b map_extract: Only access map info if it exists
Noticed on map Paranormal
2020-06-21 00:57:14 +02:00
def 66917c4b24 map_convert_07: Check image dimensions for divisibility by 16 2020-06-20 23:32:08 +02:00
Learath 9a4b1f3615 Fix fake_server 2020-06-19 20:28:55 +03:00
def b0406e335b Remove debugging help 2019-12-29 13:35:19 +01:00
def 6da92b4b9c Fix map_convert_07 tool 2019-12-29 12:43:41 +01:00
def 8639c902ae map_convert_07: use regular paths 2019-12-08 23:14:56 +01:00
def 28aabc5b91 Add map_convert_07 tool
Fixes https://github.com/ddnet/ddnet7/issues/20
2019-12-08 22:44:25 +01:00
def faa3cc195d UTF8 nocase compare & use for chat TAB completion
- As suggested by Arseniy Zarche
- Also updated confusables to Unicode 12
2019-01-09 08:31:03 +01:00
def 76c32b2b1f fix tools 2018-12-17 22:23:50 +01:00
def 6846a6ecad Fixes and stress improvements 2018-12-17 20:05:50 +01:00
Dennis Felsing e585b1f2b8 Fix tools compilation 2018-12-17 14:46:17 +01:00
def 5d8d900643 Revert recvmmsg 2018-07-29 22:49:34 +02:00
heinrich5991 5c4e819e44 Use str_startswith, str_endswith instead of ad-hoc implementations 2018-07-26 14:18:23 +02:00
Dennis Felsing d5dc951747 fix 2018-07-25 16:24:12 +02:00
heinrich5991 ca8fcc823c Use more secure hash function for map downloads
SHA256 was chosen because it is reasonably standard, the file names
don't explode in length (this rules out SHA512) and it is supported by
basically all versions of OpenSSL (this rules out SHA512/256 and SHA3).

The protocol is changed in a backward compatible way: The supporting
server sends the SHA256 corresponding to the map in the `MAP_DETAILS`
message prior to sending the `MAP_CHANGE` message. The client saves the
SHA256 obtained from the `MAP_DETAILS` message until the next
`MAP_CHANGE` message.

For servers not supporting this protocol, the client falls back to
simply opening maps like in the previous scheme.

Remove the `map_version` tool, it is not being used and would have been
a little bit effort to update.

Use the OpenSSL implementation of SHA256 if it is supported, otherwise
fall back to a public domain one.

Fix #1127.
2018-06-24 17:04:50 +02:00
heinrich5991 f8277267a0 Remove mem_alloc and mem_free, use standard C functions instead
Replace `mem_free` by `free`, and `mem_alloc` by `malloc` or `calloc`
(the latter one being used to allocate a zeroed array of elements,
sometimes, this makes a call to `mem_zero` superfluous).

This results in having to remove `mem_stats` which previously recorded
the number of allocations and their size that the Teeworlds code did
directly.

Remove OOM handling in `src/game/client/components/binds.cpp`.

Remove needless copying in the CSV code in
`src/game/client/components/statboard.cpp`.
2018-04-09 11:56:39 +02:00
bors[bot] c0fa444f3a Merge #1034
1034: Try to find external GLEW, pnglite and Wavpack  r=Learath2 a=heinrich5991

Allow for newer versions of Wavpack, fixes #1023.

Fixes #1016.
2018-02-13 02:02:07 +00:00
heinrich5991 94818ec1f0 Try to find external GLEW, pnglite and Wavpack
Allow for newer versions of Wavpack, fixes #1023.

Fixes #1016.
2018-02-12 23:29:45 +01:00
yangfl 1620fc9b0f Fix typo 2018-02-07 16:10:40 +08:00
Dennis Felsing eb2634ab0a Merge pull request #852 from heinrich5991/pr_ddnet_fix_extractname
Add testing; fix, rename and test the `CEditor::ExtractName` function
2017-08-30 22:09:17 +02:00
heinrich5991 22be1be389 Fix and rename the CEditor::ExtractName function
Fixes #846.
2017-08-30 13:59:42 +02:00