Commit graph

9 commits

Author SHA1 Message Date
Professor Hastig
ab8711b57a removed several bad casts to 'long'.
The 'long' type should generally be avoided because its size differs on Windows and Linux/Mac so it is almost guaranteed to cause undefined behavior
2023-10-04 16:47:43 +02:00
Sally Coolatta
15521e5181 Fix a very rare crash with complex Polyobjects
If all of the worst stars align when compiling Polyobject BSP and splitting a seg into two sets:
- The very first seg in the current set fails all of the metrics for determining which side of a split it is on, and doesn't know which side it should go to. Since there are 0 are in front, it goes to front by default.
- Every other seg in the same set don't fail their metrics, and they all decide they are meant to go to the front side.
- Oops! Now there's nothing in the back side!
I've fixed this by collecting all of the undecided segs in a split, and setting the new side after the other segs. Doing it in the normal loop means there's a non-zero chance the crash prevention will fail depending on how the segs are in memory.

This can technically happen with even the most simplistic Polyobjects, but it becomes more common the more complex it is (add tons of lines, move and rotate it at the same time, so on). Quite an annoying crash since it doesn't always replicate consistently.
2023-09-15 00:13:22 +02:00
Christoph Oelckers
47b76180d6 - fixed several warnings emitted by Clang. 2023-03-26 08:48:54 +02:00
Christoph Oelckers
595975fcc7 - did a test compile as C++20 and fixed all warnings that got emitted. 2022-07-15 09:17:50 +02:00
Christoph Oelckers
07a181090b - missed some MAX's. 2021-10-30 10:45:58 +02:00
Christoph Oelckers
1d0aed219e - replaced MIN/MAX in all non-common code. 2021-10-30 10:16:52 +02:00
Christoph Oelckers
58d8ce1a4f - cleanup of m_fixed.h.
With fixed point math barely being used anywhere with the vast majority of calls in the software voxel drawer it makes sense to reduce the function interface to the minimum possible and move the shift value into the function call as an argument.
2020-11-22 10:25:04 +01:00
Christoph Oelckers
b0ecb02d6b - move SuperFastHash to its own set of files, instead of having this tied to the console.
- replace swapvalues with std::swap globally.
- added some additions to utility code from Raze, mainly to reduce file content differences.
- reduced some unused utilities
2020-04-11 14:00:10 +02:00
Christoph Oelckers
7241072b16 - moved most utility code to a subdirectory.
Again no code changes.
2019-01-31 20:33:52 +01:00