Extract player data
This commit is contained in:
@@ -49,7 +49,11 @@ void init_player(struct rogue_state *rs)
|
|||||||
// duplicate rng usage of normal case
|
// duplicate rng usage of normal case
|
||||||
obj = new_item();
|
obj = new_item();
|
||||||
init_weapon(obj, MACE);
|
init_weapon(obj, MACE);
|
||||||
|
free(obj);
|
||||||
|
obj = new_item();
|
||||||
init_weapon(obj, BOW);
|
init_weapon(obj, BOW);
|
||||||
|
free(obj);
|
||||||
|
obj = new_item();
|
||||||
init_weapon(obj, ARROW);
|
init_weapon(obj, ARROW);
|
||||||
obj->o_count = rnd(15) + 25;
|
obj->o_count = rnd(15) + 25;
|
||||||
free(obj);
|
free(obj);
|
||||||
|
|||||||
@@ -104,7 +104,9 @@ void rogueiterate(struct rogue_state *rs)
|
|||||||
fuse(swander, 0, WANDERTIME, AFTER);
|
fuse(swander, 0, WANDERTIME, AFTER);
|
||||||
start_daemon(stomach, 0, AFTER);
|
start_daemon(stomach, 0, AFTER);
|
||||||
if ( rs->restoring != 0 )
|
if ( rs->restoring != 0 )
|
||||||
|
{
|
||||||
restore_player(rs);
|
restore_player(rs);
|
||||||
|
}
|
||||||
playit(rs);
|
playit(rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +246,7 @@ int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t nu
|
|||||||
{
|
{
|
||||||
rs->P = *player;
|
rs->P = *player;
|
||||||
rs->restoring = 1;
|
rs->restoring = 1;
|
||||||
fprintf(stderr,"restore player packsize.%d\n",rs->P.packsize);
|
fprintf(stderr,"restore player packsize.%d HP.%d\n",rs->P.packsize,rs->P.hitpoints);
|
||||||
}
|
}
|
||||||
uint32_t starttime = (uint32_t)time(NULL);
|
uint32_t starttime = (uint32_t)time(NULL);
|
||||||
rogueiterate(rs);
|
rogueiterate(rs);
|
||||||
|
|||||||
@@ -873,6 +873,13 @@ UniValue rogue_extract(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
fprintf(stderr,"error writing %s\n",fname);
|
fprintf(stderr,"error writing %s\n",fname);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
sprintf(fname,"rogue.%llu.player",(long long)seed);
|
||||||
|
if ( (fp= fopen(fname,"wb")) != 0 )
|
||||||
|
{
|
||||||
|
if ( fwrite(playerdata,1,(int32_t)playerdata.size(),fp) != playerdata.size() )
|
||||||
|
fprintf(stderr,"error writing %s\n",fname);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
num = rogue_replay2(player,seed,keystrokes,numkeys,playerdata.size()==0?0:&P,50);
|
num = rogue_replay2(player,seed,keystrokes,numkeys,playerdata.size()==0?0:&P,50);
|
||||||
if ( keystrokes != 0 )
|
if ( keystrokes != 0 )
|
||||||
free(keystrokes);
|
free(keystrokes);
|
||||||
|
|||||||
Reference in New Issue
Block a user