Add fallback when seeding random

This commit is contained in:
redfast00 2022-01-19 21:33:41 +01:00
parent f190e00d93
commit be4fa5d2e5
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -166,7 +166,9 @@ bool loopPuzzle(obus_can::message* message, void (*callback_game_start)(uint8_t
callback_state(message->gamestatus.time_left, message->gamestatus.strikes, message->gamestatus.max_strikes, message->gamestatus.puzzle_modules_left);
break;
case OBUS_MSGTYPE_C_INFOSTART:
randomSeed(message->infostart.seed);
// randomSeed has no effect when called with 0 as seed, so we use
// a fallback value that is unlikely to collide with other frequently used seeds
randomSeed(message->infostart.seed ? message->infostart.seed : 0xFFFFFFFF);
break;
default:
break;