Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.
This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.
It is explained in this article: https://www.viva64.com/en/b/0226/
The change in #10524 subtly changes the behavior of set_motion_scale()
and set_motion_offset() if the ParallaxLayer does not have a parent
node. Previously it would still set the corresponding property, but
after this change the property change would be discarded.
I'm not entirely sure if this actually matters as there doesn't appear
to be any code that picks up this change if the ParallaxLayer gets
re-parented later, but it's better to not change behavior regardless.
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
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!
Replaces the iterative approach currently used by an equivalent direct computation.
Also fixes infinite looping that happens when the mirroring value is negative.
Replaces the iterative approach currently used by the standard fmod() function.
Also fixes infinite looping that happens when the mirroring value is negative.