Closed welash closed 9 years ago
Thanks. I'll copy this over to the ao-curses branch as well. I think everything is in place for a new point release of Frotz.
It looks like I inadvertently added a .gitignore in with my change. I hope that is ok.
I've been meaning to put that in the main branch, but have just been procrastinating and leaving it for the merge with ao-curses. The one you added is identical to the ao-curses one, so no worries.
This change fixes restarting in games that are stored in blorb files. It also fixes when you use the verify command on those files. Before this change, using uninvited.zblorb as an example,
The issue was that the code was using fseek(storyfile, 0, SEEK_SET) to go to the beginning of the file instead of going to the beginning of the zcode segment of the blorb file. Similarly, to find the size of the zcode, in some cases the code would do a fseek(storyfile,0, SEEK_END) and then use ftell and use the result to determine the size of the zcode.
I replaced the use of fseek and ftell with an new os dependent os_storyfile_seek() and os_storyfile_tell() which, for zcode NOT in blorb files, just do fseek and ftell, but if the code IS in a blorb file, will seek relative to the beginning and end of the zcode segment and will report the corresponding position for os_storyfile_tell().