aboutsummaryrefslogtreecommitdiffstats
path: root/keyboard.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-25 05:28:10 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-03-25 05:28:10 +0000
commit37ae1353fb4ef6013b688b28cd82f06182ad3063 (patch)
tree7d7c3029d3b5f14d4da2997718b523e47362aea9 /keyboard.c
parent1128ad360b5cccb1b82de092505e5ca1c4dbed8d (diff)
downloadgrv-37ae1353fb4ef6013b688b28cd82f06182ad3063.tar.gz
grv-37ae1353fb4ef6013b688b28cd82f06182ad3063.tar.xz
grv-37ae1353fb4ef6013b688b28cd82f06182ad3063.zip
Add support for high score tables, including the ability to generate
a (hopefully) unique ID for each game that we can use to match identical records.
Diffstat (limited to 'keyboard.c')
-rw-r--r--keyboard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/keyboard.c b/keyboard.c
index 06d57b9..69f4732 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -26,6 +26,12 @@ static int queuedkeys = 0;
*/
void push_key(SDL_KeyboardEvent *ke)
{
+ /* Hack to add some nondeterminism into the gameid's */
+ if ( !gp.have_id ) {
+ gp.gameid = (gp.gameid << 5 | gp.gameid >> 59)
+ + ((uint64_t)SDL_GetTicks() << 32) + genrand_int32();
+ }
+
if ( queuedkeys >= KEYQUEUELEN )
return; /* Drop it */