summaryrefslogtreecommitdiffstats
path: root/core/array.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-10/+20
| | | | | 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/+4
| | | | | | | | | | | | | | | | | | | | | | | 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-44/+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.
* Fix array slicing.Marcel Admiraal2020-05-021-41/+31
|
* Add proper type to most public API uses of ArrayJuan Linietsky2020-04-211-4/+29
|
* Add ability to bind typed arrays to script APIJuan Linietsky2020-04-211-2/+63
| | | | | | | Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells Note: Will do a mass replace on later PRs of whathever I can find, but probably need a tool to grep through doc. Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
* Replace NULL with nullptrlupoDharkael2020-04-021-2/+2
|
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-2/+2
| | | | objects and made them default.
* 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.
* Don't try to slice empty arraysTomasz Chabora2019-09-241-0/+3
|
* Add array slice methodCameron Reikes2019-09-141-0/+57
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily2019-08-171-8/+2
| | | | | | | | | 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?)
* Remove unnecessary code and add some error explanationsqarmin2019-07-011-6/+12
|
* Don't crash on printing nested typesHein-Pieter van Braam-Stewart2019-04-201-0/+4
| | | | | | | | | | When adding an Array or Dictionary to itself operator String() got in an infinite loop. This commit adds a stack to operator String() (Through the use of a new 'stringify method'). This stack keeps track of all unique Arrays and Dictionaries it has seen. When a duplicate is found only a static string is printed '[...]' or '{...}'. This mirror Python's behavior in a similar case.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Revert "Added a check in sort_custom thats test wether the given method exists."Rémi Verschelde2018-10-091-1/+0
| | | | | | | This reverts commit 6415454581c3ba0025da6b9bae42e060fa4e1508. That patch was correct but Object::has_method is not a reliable way to check if we can use the given method, as it doesn't support inner classes (#22838).
* Added a check in sort_custom thats test wether the given method exists.DualMatrix2018-10-041-0/+1
| | | | Added a check in sort_custom thats test wether the given method exists.
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-4/+4
| | | | | | 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.
* Added max() and min() functions to array to return greater or lesser element ↵Juan Linietsky2018-08-231-0/+47
| | | | (or null if data is not of compatible type or empty array). Closes #15697
* Fix SortArray crashing with bad comparison functionspoke10242018-08-041-1/+1
|
* Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Duplicate Arrays and Dictionaries when instancing scene in editorBojidar Marinov2018-03-131-4/+4
| | | | | | Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate Fixes #13971
* Add shuffle() method to Arraypoke10242018-01-101-0/+14
|
* 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!
* Made Vector::ptrw explicit for writing, compiler was sometimes using the ↵Juan Linietsky2017-11-251-1/+1
| | | | | | wrong function, leading to unnecesary copy on writes and reduced performance.
* Add bsearch and bsearch_custom to Arraypoke10242017-11-211-0/+43
|
* Array::sort, sort_custom and invert now return reference to Array to allow ↵Marius Guggenmos2017-10-091-4/+7
| | | | chaining of operations
* Fixed a bunch of typos, including an error code.Ross Hadden2017-09-211-2/+2
|
* -Fixed changes to default input actions not working, closes #10502Juan Linietsky2017-09-061-0/+11
| | | | -Added Array.duplicate() method, needed to fix above
* Use HTTPS URL for Godot's website in the headersRémi Verschelde2017-08-271-1/+1
|
* Add "Godot Engine contributors" copyright lineRémi Verschelde2017-04-081-0/+1
|
* A Whole New World (clang-format edition)Rémi Verschelde2017-03-051-67/+52
| | | | | | | | | | | | | | | | | | | | | | | | I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
* Style: Cleanups, added headers, renamed filesRémi Verschelde2017-01-161-0/+1
| | | | | | | | | Made sure files in core/ and tools/ have a proper Godot license header when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h} to rect3.{cpp,h} and class_db.{cpp,h} respectively. Also added a proper header to core/io/base64.{c,h} after clarifying the licensing with the original author (public domain).
* Both Array and Dictionary are always in shared mode (removed copy on write).Juan Linietsky2017-01-111-19/+3
|
* Welcome in 2017, dear changelog reader!Rémi Verschelde2017-01-011-1/+1
| | | | | | | | That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games!
* Add Array.front() and Array.back()Kazuo2562016-11-181-0/+10
|
* (Array) pop_front, pop_back return valuesRăzvan Cosmin Rădulescu2016-09-111-5/+15
| | | | | | | | | | pop_front, pop_back now return values instead of `void`. Things I didn't know how to properly implement: 1. pop_front & pop_back shows in the help menu Object as return value. I know this is incorrect but if not Object than what? Cause it can't be void. It needs to be a generic type that includes all the Array types
* Array has(var value) functionPawel Kowal2016-07-071-0/+4
|
* Add 'rfind' function to ArrayGeorge Marques2016-06-101-3/+17
|
* Add 'from' argument to Array.find()George Marques2016-06-101-2/+2
|
* Added Array.find_last() and Array.count()J08nY2016-06-031-0/+31
|
* Update copyright to 2016 in headersGeorge Marques2016-01-011-1/+1
|
* add pop_back/pop_front/push_back/push_front to array, to make it according ↵Juan Linietsky2015-12-121-0/+18
| | | | to doc, fixes #3040
* Updated copyright year in all headersJuan Linietsky2015-04-181-1/+1
|
* GODOT IS OPEN SOURCEJuan Linietsky2014-02-091-0/+241