FS#32 - Combine common parts of FiosGet...

Attached to Project: OpenTTD
Opened by Emil Djupfeldt (egladil) - Tuesday, 20 December 2005, 15:02 GMT
Type Patch
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch takes the common parts of FiosGetSavegameList and FiosGetScenarioList, and replace them with FiosGetFileList which uses a callback to determine which files to add to the list. This removes the duplicated code, and also makes it easier to add new file formats to list. (Like the tutorials im working on.)
It needs testing on win32 and os2, since I don't have access to any of those.

Summary of changes:
* Moved arch independet fios functions to new file fios.c
* Added FiosGetFileList to os2.c, unix.c and win32.c
* Removed FiosGetSavegameList and FiosGetScenarioList from os2.c, unix.c and win32.c
* Created new FiosGetSavegameList and FiosGetScenarioList in fios.c
* Updated makefile and vc projects.
   fios.diff (24.3 KiB)
This task depends upon

Closed by  Darkvater (Darkvater)
Monday, 07 August 2006, 09:20 GMT
Reason for closing:  Implemented
Additional comments about closing:  Thank you egladil. I took parts of your patch and that of TrueLight, combined them, added some more and added it to SVN.
Comment by Emil Djupfeldt (egladil) - Tuesday, 20 December 2005, 16:13 GMT
Updated diff according to the comments peter1138 had. (No functional changes, just added doxygen comments.)
Comment by DaleStan (DaleStan) - Wednesday, 21 December 2005, 20:49 GMT
Update diff to work in Win32 (VS 2003)

* Include fios.h in win32.c
* Moved MSVC strcasecmp definition from win32.c to StdAfx.h
* Removed an unreferenced local in win32.c
Comment by Emil Djupfeldt (egladil) - Friday, 30 December 2005, 19:52 GMT
I updated the diff to use "typedef FiosItem *(FiosGetFileListCallback)(char *file, const char *filename, int mode);" for the callback function, instead of explicity specifying the type in all FiosGetFileList() functions.