1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-24 21:37:18 +00:00

Merge pull request #223 from jruderman/ub_gravity

Fix UB in draw_gravity_particles
This commit is contained in:
Zeno Rogue 2021-07-12 09:46:56 +02:00 committed by GitHub
commit e3cf526bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2510,9 +2510,9 @@ void celldrawer::add_map_effects() {
} }
void celldrawer::draw_gravity_particles() { void celldrawer::draw_gravity_particles() {
int u = (int)(size_t)(c); unsigned int u = (unsigned int)(size_t)(c);
u = ((u * 137) + (u % 1000) * 51) % 1000; u = ((u * 137) + (u % 1000) * 51) % 1000;
int tt = ticks + u; fractick(ticks, 900); int tt = ticks + u;
ld r0 = (tt % 900) / 1100.; ld r0 = (tt % 900) / 1100.;
ld r1 = (tt % 900 + 200) / 1100.; ld r1 = (tt % 900 + 200) / 1100.;