This commit is contained in:
jl777
2019-02-16 10:19:22 -11:00
parent 4f6cdb4b15
commit 8b6fe6bec7
2 changed files with 12 additions and 9 deletions

View File

@@ -165,21 +165,24 @@ save_file(struct rogue_state *rs,FILE *savef,int32_t guiflag)
memset(histo,0,sizeof(histo)); memset(histo,0,sizeof(histo));
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
fprintf(stderr,"%02x",((uint8_t *)&rs->P)[i]); //fprintf(stderr,"%02x",((uint8_t *)&rs->P)[i]);
histo[((uint8_t *)&rs->P)[i]]++; histo[((uint8_t *)&rs->P)[i]]++;
rs->playerdata[i] = ((uint8_t *)&rs->P)[i]; rs->playerdata[i] = ((uint8_t *)&rs->P)[i];
} }
rs->playersize = n; rs->playersize = n;
fprintf(stderr," packsize.%d n.%d\n",rs->P.packsize,n); //fprintf(stderr," packsize.%d n.%d\n",rs->P.packsize,n);
if ( (fp= fopen(rogue_packfname(rs,fname),"wb")) != 0 ) if ( (fp= fopen(rogue_packfname(rs,fname),"wb")) != 0 )
{ {
fwrite(&rs->P,1,n,fp); fwrite(&rs->P,1,n,fp);
fclose(fp); fclose(fp);
} }
for (i=nonz=0; i<0x100; i++) if ( 0 )
if ( histo[i] != 0 ) {
fprintf(stderr,"(%d %d) ",i,histo[i]), nonz++; for (i=nonz=0; i<0x100; i++)
fprintf(stderr,"nonz.%d\n",nonz); if ( histo[i] != 0 )
fprintf(stderr,"(%d %d) ",i,histo[i]), nonz++;
fprintf(stderr,"nonz.%d\n",nonz);
}
fflush(savef); fflush(savef);
fclose(savef); fclose(savef);
if ( guiflag != 0 ) if ( guiflag != 0 )

View File

@@ -1434,7 +1434,7 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o)
item = &rs->P.roguepack[rs->P.packsize]; item = &rs->P.roguepack[rs->P.packsize];
if ( pstats.s_hpt <= 0 ) if ( pstats.s_hpt <= 0 )
{ {
fprintf(stderr,"KILLED\n"); //fprintf(stderr,"KILLED\n");
rs->P.gold = -1; rs->P.gold = -1;
rs->P.hitpoints = -1; rs->P.hitpoints = -1;
rs->P.strength = -1; rs->P.strength = -1;
@@ -1452,9 +1452,9 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o)
rs->P.level = pstats.s_lvl; rs->P.level = pstats.s_lvl;
rs->P.experience = pstats.s_exp; rs->P.experience = pstats.s_exp;
rs->P.dungeonlevel = level; rs->P.dungeonlevel = level;
fprintf(stderr,"%ld gold.%d hp.%d strength.%d level.%d exp.%d %d\n",ftell(savef),purse,max_hp,max_stats.s_str,pstats.s_lvl,pstats.s_exp,level); //fprintf(stderr,"%ld gold.%d hp.%d strength.%d level.%d exp.%d %d\n",ftell(savef),purse,max_hp,max_stats.s_str,pstats.s_lvl,pstats.s_exp,level);
} }
fprintf(stderr,"object (%s) x.%d y.%d type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_pos.x,o->_o._o_pos.y,o->_o._o_type,o->_o._o_packch,o->_o._o_packch); //fprintf(stderr,"object (%s) x.%d y.%d type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_pos.x,o->_o._o_pos.y,o->_o._o_type,o->_o._o_packch,o->_o._o_packch);
if ( rs->P.packsize < MAXPACK && o->o_type != AMULET ) if ( rs->P.packsize < MAXPACK && o->o_type != AMULET )
{ {
packsave(item,o->_o._o_type,o->_o._o_launch,o->_o._o_damage,sizeof(o->_o._o_damage),o->_o._o_hurldmg,sizeof(o->_o._o_hurldmg),o->_o._o_count,o->_o._o_which,o->_o._o_hplus,o->_o._o_dplus,o->_o._o_arm,o->_o._o_flags,o->_o._o_group); packsave(item,o->_o._o_type,o->_o._o_launch,o->_o._o_damage,sizeof(o->_o._o_damage),o->_o._o_hurldmg,sizeof(o->_o._o_hurldmg),o->_o._o_count,o->_o._o_which,o->_o._o_hplus,o->_o._o_dplus,o->_o._o_arm,o->_o._o_flags,o->_o._o_group);