summaryrefslogtreecommitdiffstats
path: root/core/io/packet_peer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
|
* Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Style: Add `WARNING:` as new comment admonitionThaddeus Crews2024-09-251-1/+1
|
* Promote CowData to 64 bitsJuan Linietsky2024-01-191-3/+3
| | | | Fixes a lot of bugs, please help me fill the list.
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* Simplify network GDExtension bindings using EXBIND macros.Fabio Alessandrelli2022-09-011-22/+4
| | | | | | Simplify StreamPeer, PacketPeer, MultiplayerPeer extension. Simplify and update WebRTC*Extension with newly supported types.
* Vectors: Use clear() and has().Anilforextra2022-02-021-1/+1
| | | | | | Use clear() instead of resize(0). Use has() instead of "find(p_val) != -1".
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* [Net] Enable PacketPeer native extensions.Fabio Alessandrelli2021-09-241-0/+46
|
* Add PROPERTY_USAGE_NONE and use itAaron Franke2021-06-171-1/+1
|
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Cleanup unused engine codeTomasz Chabora2020-12-091-8/+1
|
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-1/+1
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Style: Remove unnecessary semicolons from `core`Rémi Verschelde2020-05-191-2/+2
| | | | | | | | | | Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-13/+26
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-24/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-5/+0
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Replace NULL with nullptrlupoDharkael2020-04-021-2/+2
|
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-10/+10
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* Remove deprecated PacketPeer allow_object_decodingRémi Verschelde2020-02-131-17/+3
| | | | | | | | It was added for 3.2 in #27485 to preserve backwards compatibility, but we can now remove it. It is still needed in MultiplayerAPI as it's the only way to control it for the internal put_var calls.
* PacketPeer use heap buffer for var encoding.Fabio Alessandrelli2020-01-191-5/+28
| | | | | | | Used to allocate in stack (via alloca) which causes crashes when trying to encode big variables. The buffer grows as needed up to `encode_buffer_max_size` (which is 8MiB by default) and always in power of 2.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Fix buffers size calculation in PacketPeerStream.Fabio Alessandrelli2019-12-221-1/+1
| | | | | | | | | | | | | | | | | The calculation used to be wrong when exactly at a power of 2. `nearest_shift` always return the "next" power of 2 `nearest_shift(4) == 3 # 2^3 = 8`. On the other hand `next_power_of_2` returns the exact value if that value is a power of 2 (i.e. `next_power_of_2(4) == 4`). I.e. : ``` WARN_PRINT(itos(next_power_of_2(4)) + " " + itos(1 << nearest_shift(4))); // WARNING: ... : 4 8 ``` Is this by design?
* Fix some overflows and unitialized variablesRafał Mikrut2019-11-201-0/+1
|
* Added some obvious errors explanationsqarmin2019-09-251-3/+3
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily2019-08-171-2/+1
| | | | | | | | | Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
* Fix some code found by Coverity Scan and PVS Studioqarmin2019-07-231-2/+3
|
* Add object encoding param to serialization methodsFabio Alessandrelli2019-04-011-9/+9
| | | | | | | | | Network peers get_var/put_var File get_var/store_var GDScript/Mono/VisualScript bytes2var/var2bytes Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding. Break ABI compatibaility (API compatibility for GDNative).
* Use same boolean for objects encode and decode.Fabio Alessandrelli2019-03-281-2/+2
| | | | | | In a very unintuitive move encode needed false to encode an object, decode needed true to decode it. They now need the same value: `true`.
* Fix -Wsign-compare warnings.marxin2019-02-271-1/+1
| | | | | I decided to modify code in a defensive way. Ideally functions like size() or length() should return an unsigned type.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Moved member variables to initializer listWilson E. Alvarez2018-12-111-4/+3
|
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-2/+3
| | | | | | This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
* Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
* Merge pull request #15305 from poke1024/checks-peerJuan Linietsky2018-05-081-0/+2
|\ | | | | Checks on input_buffer in PacketPeerStream
| * Checks on input_buffer in PacketPeerStreamBernhard Liebl2018-01-031-0/+2
| |
* | fix set_stream_peer binding in PacketPeerPaul Joannon2018-01-121-1/+1
| |
* | Bind many more properties to scriptsBojidar Marinov2018-01-121-0/+12
| | | | | | | | | | | | | | Notable potentially breaking changes: - PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL - Some properties were renamed, and sometimes even shadowed by new ones - New getter methods (some virtual) were added
* | Add missing copyright headers and fix formattingRémi Verschelde2018-01-051-0/+1
|/ | | | | | Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
* Update copyright statements to 2018Rémi Verschelde2018-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Remove "const" from PacketPeer get_packet/get_varFabio Alessandrelli2017-12-151-5/+5
| | | | | | They are NOT constant methods, as state by the comment message, they fetch the last packet and then forget about it, actively changing the state of the object.
* Use HTTPS URL for Godot's website in the headersRémi Verschelde2017-08-271-1/+1
|
* -Properly check limits to objects sent (regarding to size), fixes #9034Juan Linietsky2017-08-181-2/+14
| | | | | -Changed the way objects are marshalled and sent to the debugger -Editing debugged objects happens in the remote inspector now
* Add closest_power_of_2 func and implement mix_rate/latency on OS XMarcelo Fernandez2017-08-171-2/+2
|
* Ability to save objects to binary formatJuan Linietsky2017-08-141-1/+15
|
* Removes type information from method bindsIgnacio Etcheverry2017-08-101-5/+5
|
* Set some reasonable limits for sending information to the debugger, closes #5848Juan Linietsky2017-08-081-11/+19
|
* Style: Apply clang-format on all filesRémi Verschelde2017-07-301-1/+1
| | | | Thus fixing some invalid changes that had still made it to the master branch.
* -Renamed GlobalConfig to ProjectSettings, makes more sense.Juan Linietsky2017-07-191-1/+1
| | | | -Added system for feature overrides, it's pretty cool :)