widelands-dev team mailing list archive
Mailing list archive
Re: [Merge] lp:~widelands-dev/widelands/bug-1784122-singleplayer-viewport into lp:widelands
That bug is really fun but the streamreader isn't to blame. ;-)
The problem is that the float_32() call not only returns the value but also modifies the internal state of the stream. As a consequence, the order of assignment to x and y matters (or more precisely, the order in which the respective float_32() calls are made).
It seems as if calling it twice as constructor parameters results in the *second* call being done first, resulting in x and y being swapped after the assignment. Doing only one call as parameter and assigning the other one later on is fine. Or just assign both later on as in this branch.
Took me quite some time of trial&error until I realized that...
I am using gcc version 8.2.0 with a release build. The order of the evaluation is undefined in the standard, so it might indeed be compiler dependent.
The null-assignment is required since the default constructor is deleted.
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1784122-singleplayer-viewport.