OpenXcom Forum

Contributions => Programming => Topic started by: grrussel on May 27, 2013, 01:59:13 am

Title: Sort saved game list by game date and time
Post by: grrussel on May 27, 2013, 01:59:13 am
Patch is attached.
Title: Re: Sort saved game list by game date and time
Post by: Warboy1982 on May 27, 2013, 04:44:39 am
nice, nice, how about sorting by the (potential) turn counter as well?
Title: Re: Sort saved game list by game date and time
Post by: grrussel on May 29, 2013, 12:03:49 am
Would need some means of saying a) this save is a battle save and b) it has N turns elapsed. Don't see a trivial bit of code to do that, on a quick look round in the code. Pointers?
Title: Re: Sort saved game list by game date and time
Post by: Volutar on May 29, 2013, 07:48:51 am
in order to gather that info from saves, for instance, 100 of them (which can be in user folder) program will need to load each save file, and extract particular values. i don't see how it can be feasible without huge delay and lots of harddrive work.
Title: Re: Sort saved game list by game date and time
Post by: moriarty on May 29, 2013, 10:37:22 am
maybe a small "info string" could be added to the savefile name, and ignored for in-game display purposes? I'd guess it only needs to be a few characters to convey the information we need for sorting.
Title: Re: Sort saved game list by game date and time
Post by: Volutar on May 29, 2013, 11:16:32 am
savefile name? No. Names could be any. And easily could renamed. And what will it do in this case?
Title: Re: Sort saved game list by game date and time
Post by: grrussel on May 29, 2013, 10:11:48 pm
The existing system opens each save game file in any case, to get the game time - the UI then translates the game time into a localised date / time for display to the user. Sorting by time adds no noticeable overhead. It seems to be sufficiently fast at present, I have 56 save game files present in the same folder.

So, I doubt checking a) if battlescape and b) what turn in the battle it is, would add any more overhead. Its more how to determine the values for a and b.
Title: Re: Sort saved game list by game date and time
Post by: SupSuper on May 29, 2013, 11:57:19 pm
The existing system opens each save game file in any case, to get the game time - the UI then translates the game time into a localised date / time for display to the user. Sorting by time adds no noticeable overhead. It seems to be sufficiently fast at present, I have 56 save game files present in the same folder.

So, I doubt checking a) if battlescape and b) what turn in the battle it is, would add any more overhead. Its more how to determine the values for a and b.

The reason the current system works is because the date is stored in a YAML subdocument separate from the rest of the data (you have to parse the whole document to access any field in it), so it only has to parse that to list the saves. Parsing all the savegame data for the listing would be extremely cumbersome.

So checking a) and b) is actually trivial (it's just one var with the turn), but to use them in the listing you would have to save that data in the subdocument. And you'd get the inevitable "but I wanna see both the date and the turn" and run out of space.
Title: Re: Sort saved game list by game date and time
Post by: grrussel on May 30, 2013, 12:06:48 am
Cool. Well, if looking deeper into save games would make the process too slow, then I guess the patch can applied as is ;-)
Title: Re: Sort saved game list by game date and time
Post by: Ishmaeel on November 15, 2013, 12:13:55 am
Newb necromancer reporting for duty.  ;D :-[

Will this (save files sorted by date) make it into 1.0?
Title: Re: Sort saved game list by game date and time
Post by: SupSuper on November 15, 2013, 12:32:42 am
Yes.
Title: Re: Sort saved game list by game date and time
Post by: Ishmaeel on November 15, 2013, 12:49:11 am
Awsum.