Activate replay

This commit is contained in:
jl777
2019-03-26 06:36:47 -11:00
parent 42b2c36f72
commit bd855221df
2 changed files with 3 additions and 3 deletions

View File

@@ -886,10 +886,10 @@ gamesevent *games_keystrokesload(int32_t *numkeysp,uint64_t seed,int32_t counter
{ {
char fname[1024]; gamesevent *keystrokes = 0; FILE *fp; long fsize; int32_t num = 0; char fname[1024]; gamesevent *keystrokes = 0; FILE *fp; long fsize; int32_t num = 0;
*numkeysp = 0; *numkeysp = 0;
while ( 1 ) if ( 1 )
{ {
gamesfname(fname,seed,counter); gamesfname(fname,seed,counter);
printf("check (%s)\n",fname); //printf("check (%s)\n",fname);
if ( (fp= fopen(fname,"rb")) == 0 ) if ( (fp= fopen(fname,"rb")) == 0 )
break; break;
if ( (fsize= get_filesize(fp)) <= 0 ) if ( (fsize= get_filesize(fp)) <= 0 )
@@ -939,6 +939,7 @@ int32_t games_replay(uint64_t seed,int32_t sleeptime)
if ( seed == 0 ) if ( seed == 0 )
seed = 777; seed = 777;
keystrokes = games_keystrokesload(&num,seed,counter); keystrokes = games_keystrokesload(&num,seed,counter);
fprintf(stderr,"keystrokes.%p num.%d\n",keystrokes,num);
if ( num > 0 ) if ( num > 0 )
{ {
sprintf(fname,"%s.%llu.player",GAMENAME,(long long)seed); sprintf(fname,"%s.%llu.player",GAMENAME,(long long)seed);

View File

@@ -102,7 +102,6 @@ gamesevent games_readevent(struct games_state *rs)
int32_t games_replay2(uint8_t *newdata,uint64_t seed,gamesevent *keystrokes,int32_t num,struct games_player *player,int32_t sleepmillis) int32_t games_replay2(uint8_t *newdata,uint64_t seed,gamesevent *keystrokes,int32_t num,struct games_player *player,int32_t sleepmillis)
{ {
struct games_state *rs; FILE *fp; int32_t i,n; void *ptr; struct games_state *rs; FILE *fp; int32_t i,n; void *ptr;
return(0);
rs = (struct games_state *)calloc(1,sizeof(*rs)); rs = (struct games_state *)calloc(1,sizeof(*rs));
rs->seed = rs->origseed = seed; rs->seed = rs->origseed = seed;
rs->keystrokes = keystrokes; rs->keystrokes = keystrokes;