Commit graph

1416 commits

Author SHA1 Message Date
Ruslan Mustakov
1a2311e350 Extract logging logic
Previously logging logic was scattered over OS class implementations
with plenty of duplication. Major changes in this commit:

 - Extracted logging logic into a separate Logger hierarchy. It allows
   easy configuration of logging mechanism depending on compile-time or
   run-time configuration.

 - Implemented RotatedFileLogger which is usually used with StdLogger,
   providing persistency of logs. It is often important to be able to
   obtain logs of the game even in production to be able to understand
   what happened prior to some problem. On mobile there previously was
   no way to obtain the logs aside from having the device connected to
   your machine.

 - flush() is not performed in release mode for every logged line. It
   is only performed for errors.
2017-09-25 16:19:21 +07:00
Hein-Pieter van Braam
a124651280 Merge pull request #11549 from hpvb/fix-11543
Fix Dictionary set_named
2017-09-24 20:22:53 +02:00
Marcelo Fernandez
57d438eb7a Fix Variant::get_named return when p_index is invalid 2017-09-24 14:50:51 -03:00
Hein-Pieter van Braam
4d14d61bbc Fix Dictionary set_named
Reduz optimized field indexing in 3c85703 but the changes didn't apply
to dictionary so this code remained untouched. However, the logic for
validity checking was changed but not updated for the dictionary case.
2017-09-24 19:44:49 +02:00
Rémi Verschelde
ebaf2d89e9 Merge pull request #11473 from hpvb/fix-11466
Implement operator != on Pool*Array types
2017-09-24 15:59:59 +02:00
Elliott Sales de Andrade
a408388623 Enable building against system zstd. 2017-09-23 23:46:47 -04:00
Juan Linietsky
3c857033df Massive optimization to Variant::set_named/get_named. Should give a nice boost to GDScript. 2017-09-23 21:05:35 -03:00
Hein-Pieter van Braam
7b492e6a23 Implement operator != on Pool*Array types
These types previously had equality checks but not inequality checks.
Add these too.

This fixes #11466
2017-09-22 14:40:42 +02:00
Rémi Verschelde
be60689812 Merge pull request #11461 from hpvb/add-likely-macros
Implement Linux-style likely()/unlikely() macros
2017-09-22 09:15:45 +02:00
Ross Hadden
1a97d6455d Fixed a bunch of typos, including an error code. 2017-09-21 23:58:29 -04:00
Hein-Pieter van Braam
22358babda Implement Linux-style likely()/unlikely() macros
This implement branch prediction macros likely() and unlikely() like in
Linux. When using these macros please ensure that when you use them the
condition in the branch really is very, very likely or unlikely. Think
90+% of the time. Primarily useful for error checking. (And I implement
these macros for all our error checking macros now)

See this article for more information:
https://kernelnewbies.org/FAQ/LikelyUnlikely

There are more places where these macros may make sense in renderer and
physics engine. Placing them will come in another commit down the line.
2017-09-21 18:28:28 +02:00
Juan Linietsky
423ca9bcaf Fix import order, so scenes are imported after textures.
Also fix bugs when meshes are always generated.
2017-09-20 21:04:20 -03:00
Juan Linietsky
71e4fae3a1 Merge pull request #11437 from hpvb/allow-compare-to-null
Allow equality checks between null and arbitrary types
2017-09-20 17:49:18 -03:00
Hein-Pieter van Braam
6565cf3360 Allow equality checks between null and arbitrary types
Uninitialzed values in GDScript are of type NIL so not allowing null
comparisons did end up breaking some code.

This commit reenables NULL equality checks for all types. We're going to
have to figure out how to make this fast for the compiler later.
2017-09-20 22:14:38 +02:00
Rémi Verschelde
e3617cb187 Merge pull request #11409 from MarufSarker/PR-core-math-is_nan
Verbose and Platform-specific implementation for is_nan
2017-09-20 14:29:01 +02:00
letheed
5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
ABU MD. MARUF SARKER
7744bb153f verbose and platform specific implementation for is_nan 2017-09-20 08:20:08 +06:00
Rémi Verschelde
593511b2b8 Merge pull request #10748 from Cradmon/fixCoreSet
Refactor core/set.h
2017-09-19 23:47:39 +02:00
Rémi Verschelde
27fb329c82 Merge pull request #11208 from kitsune/hex-color-shortcuts
Adds 3 and 4 digit html shortcuts to Color
2017-09-19 23:33:25 +02:00
Rémi Verschelde
d58b0a5c9a Merge pull request #11388 from hpvb/fix-missing-return-fail
Be type-strict checking on equality checks
2017-09-19 19:03:25 +02:00
Hein-Pieter van Braam
833c3917b2 Allow booleanization of all types
We now allow booleanization of all types. This means that empty versions
of all types now evaluate to false. So a Vector2(0,0), Dictionary(),
etc.

This allows you to write GDScript like:
if not Dictionary():
  print("Empty dict")

Booleanization can now also no longer fail. There is no more valid flag,
this changes Variant and GDNative API.
2017-09-19 18:55:31 +02:00
Rémi Verschelde
67aa409f59 Merge pull request #11405 from karroffel/new-hashmap
added OAHashMap type
2017-09-19 16:57:58 +02:00
Karroffel
add040d381 added OAHashMap type 2017-09-19 16:48:53 +02:00
Hein-Pieter van Braam
85641c545b Be type-strict checking on equality checks
After a short discussion with @reduz and @karroffel we decided to make
all non number/number comparisons return type errors on comparisons.

Now bool == bool is allowed but Vector2 == Vector3 is a type error and
no longer 'not equal'. The same has been done for the != operators.

In addition I forgot to add some failures to some Object operators
meaning that there was a potential for a crasher.
2017-09-19 16:00:19 +02:00
Rémi Verschelde
33e1716f13 Merge pull request #11402 from hpvb/remove-gdscript-checks-on-release
Various GDScript performance tweaks
2017-09-19 15:48:14 +02:00
Hein-Pieter van Braam
d05965963d Don't call Variant::reference() unnecessarily
operator= does not need to call reference() if the new value is of the
same type as the old. This saves us zeroing the Variant, This speeds
up reuse of a Variant in a loop by roughly 50%.
2017-09-19 15:27:57 +02:00
Rémi Verschelde
ba4439c491 Merge pull request #11386 from kosz78/fix-msvc-compile-errors
Fix MSVC compilation errors
2017-09-19 14:58:19 +02:00
Hein-Pieter van Braam
36e8bee752 Fix accidental cast to Vector3 for Vector2 iter 2017-09-19 14:18:12 +02:00
Indah Sylvia
13b630eb0c Fixed Typo: 'Seperate' to 'Separate' 2017-09-19 15:51:00 +07:00
Konstantin Zaitsev
c386a02654 Fix MSVC compilation errors 2017-09-19 10:33:07 +07:00
Hein-Pieter van Braam
137f8a58a8 Move Variant::evaluate() switch to computed goto
In an effort to make GDScript a little faster replace the double
switch() with a computed goto on compilers that set __GNUC__. For
compilers that don't support computed goto it will fall back to regular
switch/case statements.

In addition disable using boolean values in a mathematical context. Now
boolean values can only be compared with other booleans. Booleans will
also no longer be coerced to integers.

This PR replaces #11308 and fixes #11291
2017-09-17 22:49:23 +02:00
Marcelo Fernandez
3528b1e571 Fix x11 exported executables not getting the +x flag 2017-09-17 14:40:58 -03:00
Thomas Herzog
41715c1e8f Merge pull request #11294 from karroffel/json-object
added JSON singleton
2017-09-17 16:31:27 +02:00
Rémi Verschelde
a1b4e4c607 Merge pull request #11272 from Rubonnek/move-to-initializer-list
Moved class_name and return_val to initializer list
2017-09-17 12:52:46 +02:00
Rémi Verschelde
2db9973ad4 Merge pull request #11176 from bncastle/master
Implement +,-,/, * and negate operators for Color type
2017-09-17 12:43:21 +02:00
Rémi Verschelde
6dd8dd935e Merge pull request #11343 from BastiaanOlij/fix_basename
Fixed naming of pck file
2017-09-17 12:03:39 +02:00
Bastiaan Olij
913e5cabbd Fixed naming of pck file 2017-09-17 11:59:56 +10:00
Poommetee Ketson
a9229d37c8 Merge pull request #11223 from GodotExplorer/pr-undoredo
Expose more methods for UndoRedo
2017-09-17 08:48:38 +07:00
bncastle
9d9cfc6f61 Implement +,-,/, * and negate operators for Color type. 2017-09-16 13:09:49 -04:00
Ignacio Etcheverry
f1f8fd1b68 Adds _OS::PowerState enum 2017-09-16 12:28:23 +02:00
karroffel
308d20aba5 added JSON singleton
There was no way to access JSON functionality in scripting languages
apart from GDScript because the JSON class wasn't exposed to ClassDB.
2017-09-15 15:40:27 +02:00
Thomas Herzog
7dffed485b Merge pull request #11230 from maxim-sheronov/fix_enum_bindings
Fix enums bindings
2017-09-15 08:43:35 +02:00
Wilson E. Alvarez
0f4643a4f6 Moved class_name and return_val to initializer list 2017-09-14 12:54:37 -04:00
Ruslan Mustakov
f08bc0df7c Construct Variants from Reference properly in GDNative
Previously godot_variant_new_object constructed Variant without
accounting for the fact that the Object can be a Reference, so refcount
was not increased and References were destructed prematurely.

Also, Reference::init_ref did not propagate refcount increment to the
script instance, which led to desync of refcount info on the script
side and Godot side.
2017-09-14 19:40:36 +07:00
Rémi Verschelde
ae4cd72e62 Drop unused EventQueue class
Thanks to @Marqin for the notice.
2017-09-13 20:56:23 +02:00
Maxim Sheronov
0fffa45158 Fix enums bindings
Add missed bindings for enums
Move some enums to class to have correct output of api.json
2017-09-13 20:57:07 +03:00
Marcelo Fernandez
83fe937362 Added a crash handler to dump the backtrace on Windows, Linux and OS X 2017-09-13 10:07:23 -03:00
Rémi Verschelde
42504ef0d4 Merge pull request #11062 from BastiaanOlij/osx_datapack
Fixed loading package from resource folder, exporting textures to bun…
2017-09-13 11:11:01 +02:00
Rémi Verschelde
e73e00d369 Style: Apply clang-format to @reduz's changes
[ci skip]
2017-09-13 09:13:34 +02:00
Geequlim
ae18b1f83f Expose more methods for UndoRedo 2017-09-13 12:18:51 +08:00