fios.h

Go to the documentation of this file.
00001 /* $Id: fios.h 15608 2009-03-04 01:09:48Z rubidium $ */
00002 
00005 #ifndef FIOS_H
00006 #define FIOS_H
00007 
00008 #include "strings_type.h"
00009 #include "core/smallvec_type.hpp"
00010 
00011 enum {
00018   CONFIG_SLOT    =  0,
00020   SOUND_SLOT     =  1,
00022   FIRST_GRF_SLOT =  2,
00024   LAST_GRF_SLOT  = 63,
00026   MAX_FILE_SLOTS = 64
00027 };
00028 
00029 enum SaveLoadDialogMode{
00030   SLD_LOAD_GAME,
00031   SLD_LOAD_SCENARIO,
00032   SLD_SAVE_GAME,
00033   SLD_SAVE_SCENARIO,
00034   SLD_LOAD_HEIGHTMAP,
00035   SLD_NEW_GAME,
00036 };
00037 
00038 /* The different types of files been handled by the system */
00039 enum FileType {
00040   FT_NONE,      
00041   FT_SAVEGAME,  
00042   FT_SCENARIO,  
00043   FT_HEIGHTMAP, 
00044 };
00045 
00046 enum FiosType {
00047   FIOS_TYPE_DRIVE,
00048   FIOS_TYPE_PARENT,
00049   FIOS_TYPE_DIR,
00050   FIOS_TYPE_FILE,
00051   FIOS_TYPE_OLDFILE,
00052   FIOS_TYPE_SCENARIO,
00053   FIOS_TYPE_OLD_SCENARIO,
00054   FIOS_TYPE_DIRECT,
00055   FIOS_TYPE_PNG,
00056   FIOS_TYPE_BMP,
00057   FIOS_TYPE_INVALID = 255,
00058 };
00059 
00060 /* Deals with finding savegames */
00061 struct FiosItem {
00062   FiosType type;
00063   uint64 mtime;
00064   char title[64];
00065   char name[MAX_PATH];
00066 };
00067 
00068 /* Deals with the type of the savegame, independent of extension */
00069 struct SmallFiosItem {
00070   int mode;             
00071   FileType filetype;    
00072   char name[MAX_PATH];  
00073   char title[255];      
00074 };
00075 
00076 enum {
00077   SORT_ASCENDING  = 0,
00078   SORT_DESCENDING = 1,
00079   SORT_BY_DATE    = 0,
00080   SORT_BY_NAME    = 2
00081 };
00082 
00083 /* Variables to display file lists */
00084 extern SmallVector<FiosItem, 32> _fios_items; 
00085 extern SmallFiosItem _file_to_saveload;
00086 extern SaveLoadDialogMode _saveload_mode;   
00087 extern byte _savegame_sort_order;
00088 
00089 /* Launch save/load dialog */
00090 void ShowSaveLoadDialog(SaveLoadDialogMode mode);
00091 
00092 /* Get a list of savegames */
00093 void FiosGetSavegameList(SaveLoadDialogMode mode);
00094 /* Get a list of scenarios */
00095 void FiosGetScenarioList(SaveLoadDialogMode mode);
00096 /* Get a list of Heightmaps */
00097 void FiosGetHeightmapList(SaveLoadDialogMode mode);
00098 /* Free the list of savegames */
00099 void FiosFreeSavegameList();
00100 /* Browse to. Returns a filename w/path if we reached a file. */
00101 const char *FiosBrowseTo(const FiosItem *item);
00102 /* Return path, free space and stringID */
00103 StringID FiosGetDescText(const char **path, uint64 *total_free);
00104 /* Delete a name */
00105 bool FiosDelete(const char *name);
00106 /* Make a filename from a name */
00107 void FiosMakeSavegameName(char *buf, const char *name, size_t size);
00108 /* Determines type of savegame (or tells it is not a savegame) */
00109 FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last);
00110 
00111 int CDECL compare_FiosItems(const void *a, const void *b);
00112 
00113 #endif /* FIOS_H */

Generated on Mon Dec 14 20:59:58 2009 for OpenTTD by  doxygen 1.5.6