# fios.h

Go to the documentation of this file.

    00001 /* $Id: fios.h 17528 2009-09-13 17:39:33Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef FIOS_H
    00013 #define FIOS_H
    00014
    00015 #include "strings_type.h"
    00016 #include "core/smallvec_type.hpp"
    00017
    00018 enum {
    00025   CONFIG_SLOT    =  0,
    00027   SOUND_SLOT     =  1,
    00029   FIRST_GRF_SLOT =  2,
    00031   LAST_GRF_SLOT  = 63,
    00033   MAX_FILE_SLOTS = 64
    00034 };
    00035
    00036 enum SaveLoadDialogMode{
    00037   SLD_LOAD_GAME,
    00038   SLD_LOAD_SCENARIO,
    00039   SLD_SAVE_GAME,
    00040   SLD_SAVE_SCENARIO,
    00041   SLD_LOAD_HEIGHTMAP,
    00042   SLD_NEW_GAME,
    00043 };
    00044
    00045 /* The different types of files been handled by the system */
    00046 enum FileType {
    00047   FT_NONE,
    00048   FT_SAVEGAME,
    00049   FT_SCENARIO,
    00050   FT_HEIGHTMAP,
    00051 };
    00052
    00053 enum FiosType {
    00054   FIOS_TYPE_DRIVE,
    00055   FIOS_TYPE_PARENT,
    00056   FIOS_TYPE_DIR,
    00057   FIOS_TYPE_FILE,
    00058   FIOS_TYPE_OLDFILE,
    00059   FIOS_TYPE_SCENARIO,
    00060   FIOS_TYPE_OLD_SCENARIO,
    00061   FIOS_TYPE_DIRECT,
    00062   FIOS_TYPE_PNG,
    00063   FIOS_TYPE_BMP,
    00064   FIOS_TYPE_INVALID = 255,
    00065 };
    00066
    00067 /* Deals with finding savegames */
    00068 struct FiosItem {
    00069   FiosType type;
    00070   uint64 mtime;
    00071   char title[64];
    00072   char name[MAX_PATH];
    00073 };
    00074
    00075 /* Deals with the type of the savegame, independent of extension */
    00076 struct SmallFiosItem {
    00077   int mode;
    00078   FileType filetype;
    00079   char name[MAX_PATH];
    00080   char title[255];
    00081 };
    00082
    00083 enum {
    00084   SORT_ASCENDING  = 0,
    00085   SORT_DESCENDING = 1,
    00086   SORT_BY_DATE    = 0,
    00087   SORT_BY_NAME    = 2
    00088 };
    00089
    00090 /* Variables to display file lists */
    00091 extern SmallVector<FiosItem, 32> _fios_items;
    00092 extern SmallFiosItem _file_to_saveload;
    00093 extern SaveLoadDialogMode _saveload_mode;
    00094 extern byte _savegame_sort_order;
    00095
    00096 /* Launch save/load dialog */
    00097 void ShowSaveLoadDialog(SaveLoadDialogMode mode);
    00098
    00099 /* Get a list of savegames */
    00100 void FiosGetSavegameList(SaveLoadDialogMode mode);
    00101 /* Get a list of scenarios */
    00102 void FiosGetScenarioList(SaveLoadDialogMode mode);
    00103 /* Get a list of Heightmaps */
    00104 void FiosGetHeightmapList(SaveLoadDialogMode mode);
    00105 /* Free the list of savegames */
    00106 void FiosFreeSavegameList();
    00107 /* Browse to. Returns a filename w/path if we reached a file. */
    00108 const char *FiosBrowseTo(const FiosItem *item);
    00109 /* Return path, free space and stringID */
    00110 StringID FiosGetDescText(const char **path, uint64 *total_free);
    00111 /* Delete a name */
    00112 bool FiosDelete(const char *name);
    00113 /* Make a filename from a name */
    00114 void FiosMakeSavegameName(char *buf, const char *name, size_t size);
    00115 /* Determines type of savegame (or tells it is not a savegame) */
    00116 FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last);
    00117
    00118 int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b);
    00119
    00120 #endif /* FIOS_H */