Commit graph

100 commits

Author SHA1 Message Date
Aaron Franke
cb01268562 Fix many errors found by PVS-Studio
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
2018-11-28 05:03:24 -05:00
qonnop
50fae2b1a7 Optimize interpolation algorithms
Interpolation in the form of va + (vb - va) * c is faster and prevents floating point issues for int/string
Followup to https://github.com/godotengine/godot/pull/22786
2018-10-07 15:43:51 +02:00
Rémi Verschelde
44d82b3a07
Merge pull request #22752 from aaronfranke/equals-redundant
Remove redundant "== true" and "== false" code
2018-10-07 10:58:45 +02:00
Aaron Franke
4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
qonnop
bbfc6f6985 Fixed int interpolation issue, closes #22763
When interpolating between two equal int values a and b, floating point
calculation imprecisions can result in different values depending on
the interpolation factor.
2018-10-06 15:52:42 +02:00
Rémi Verschelde
c4f14e091c Color: Fix rounding error converting from float to 8-bit
Fixes #16736.
2018-09-18 17:11:15 +02:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
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.
2018-09-12 09:52:22 +02:00
Juan Linietsky
d280b14e6e Hacked around duplication bug. I think duplicate needs to be even smarter, maybe pass two bools? (containers and/or resources) 2018-07-03 08:34:06 -03:00
Juan Linietsky
2dc738ce27 -Fixes to how hashing happened, now StringName and NodePath use default hasher, this was leading to some severe slowdown in scenarios
-Fixes to some duplication scenarios for instanced scenes
2018-07-02 15:08:35 -03:00
ShyRed
100a775260 Keep alpha when changing h, s or v on color
When modifying the h, s or v properties of a color in GDScript the alpha value needs to stay unchanged.
2018-04-22 17:00:45 +02:00
George Marques
fefee533ae
Fix names of Variant operators 2018-04-16 14:54:49 -03:00
Juan Linietsky
4ee3f3251d
Merge pull request #17382 from bojidar-bg/13971-path-array-unsaved
Duplicate Arrays and Dictionaries when instancing scene in editor
2018-04-08 09:39:03 -03:00
Bojidar Marinov
9f6c0c6eae
Duplicate Arrays and Dictionaries when instancing scene in editor
Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate

Fixes #13971
2018-03-13 17:18:08 +02:00
Bojidar Marinov
4d81e8afe6 Fix a potential bug hinted by clang 2018-03-13 17:10:28 +02:00
Poommetee Ketson
f4f92b55e1 Color:fix setting V switch S to old V value 2018-02-22 16:43:00 +07:00
luz.paz
612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
MrCdK
b2617e72e5 Fix NEQ operation between 2 different Arrays
it was returning false if it found the same content in both arrays which isn't correct, it should return true when it finds different values
2018-01-06 04:19:48 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
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.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Ferenc Arn
d28763a4c1 Rename Rect3 to AABB.
Fixes #12973.
2017-11-17 11:01:41 -05:00
Marcelo Fernandez
d3a039cb2f Fix Color.r8/g8/b8/a8 being type float instead of type int 2017-10-19 12:36:06 -03:00
Hein-Pieter van Braam
758accdcc2 Make variant_op jumptable const
Not doing this was a bit of an oversight
2017-09-25 18:29:44 +02: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
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
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
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
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
Hein-Pieter van Braam
36e8bee752 Fix accidental cast to Vector3 for Vector2 iter 2017-09-19 14:18:12 +02: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
bncastle
9d9cfc6f61 Implement +,-,/, * and negate operators for Color type. 2017-09-16 13:09:49 -04:00
Thomas Herzog
111dae950d Revert "Don't allow division by false (zero)" 2017-09-15 23:39:09 +02:00
Hein-Pieter van Braam
4f16baca43 Don't allow division by false (zero)
This fixes #10717
2017-09-15 22:02:22 +02:00
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Juan Linietsky
2a3e00c8c7 -Many fixes to VisualScript, fixed property names, etc.
-Added ability to set/get a field in GetSet, as well as assignment ops
-Added a Select node
-Fixed update bugs related to variable list and exported properties, closes #9458
2017-06-30 21:35:05 -03:00
Juan Linietsky
db3b05d289 Reworked translation system
-Label and Button reload translation on the fly
-Resources are loaded and reload depending on locale
2017-06-28 17:01:35 -03:00
Bojidar Marinov
26a51c3c0b
Reimplement for..in range() so that it always results in ints
Fixes #8278, fixup of bfef8de1bc
2017-06-22 20:41:52 +03:00
alexholly
935f730170 renamed all Rect3.pos to Rect3.position 2017-06-09 15:54:02 +02:00
alexholly
a3c90b0293 renamed all Rect2.pos to Rect2.position 2017-06-04 02:09:17 +02:00
Juan Linietsky
5b3709d309 Removal of InputEvent as built-in Variant type..
this might cause bugs I haven't found yet..
2017-05-20 17:05:38 -03:00
Rémi Verschelde
c3baf5eb3c Fix two typos from previous commit
Also cleanup comments on variant types.
2017-05-17 18:45:56 +02:00
Juan Linietsky
98a3296702 Removal of Image from Variant, converted to a Resource. 2017-05-17 07:37:45 -03:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde
5dbf1809c6 A Whole New World (clang-format edition)
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
2017-03-05 16:44:50 +01:00
Thaer Razeq
f50488a361 Various fixes detected using PVS-Studio static analyzer.
- Add FIXME tags comments to some unfixed potential bugs
- Remove some checks (always false: unsigned never < 0)
- Fix some if statements based on reviews.
- Bunch of missing `else` statements
2017-02-28 07:52:02 -06:00
Juan Linietsky
04a6d2789e Revert "Make nan==nan true for GDScript" 2017-02-14 17:05:16 -03:00
Hein-Pieter van Braam
adcc211feb Make nan==nan true for GDScript
After discussing this with Reduz this seemed like the best way to
fix #7354. This will make composite values that contain NaN in the same
places as well as the same other values compare as the same.

Additionally non-composite values now also compare equal if they are
both NaN. This breaks IEEE specifications but this is probably what most
users expect. There is a GDScript function check for NaN if the user
needs this information.

This fixes #7354 and probably also fixes #6947
2017-02-14 13:32:23 +01:00