fios.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef FIOS_H
00013 #define FIOS_H
00014
00015 #include "gfx_type.h"
00016 #include "company_base.h"
00017 #include "newgrf_config.h"
00018
00019
00020 typedef SmallMap<uint, CompanyProperties *> CompanyPropertiesMap;
00021
00025 struct LoadCheckData {
00026 bool checkable;
00027 StringID error;
00028 char *error_data;
00029
00030 uint32 map_size_x, map_size_y;
00031 Date current_date;
00032
00033 GameSettings settings;
00034
00035 CompanyPropertiesMap companies;
00036
00037 GRFConfig *grfconfig;
00038 GRFListCompatibility grf_compatibility;
00039
00040 LoadCheckData() : error_data(NULL), grfconfig(NULL)
00041 {
00042 this->Clear();
00043 }
00044
00048 ~LoadCheckData()
00049 {
00050 this->Clear();
00051 }
00052
00057 bool HasErrors()
00058 {
00059 return this->checkable && this->error != INVALID_STRING_ID;
00060 }
00061
00066 bool HasNewGrfs()
00067 {
00068 return this->checkable && this->error == INVALID_STRING_ID && this->grfconfig != NULL;
00069 }
00070
00071 void Clear();
00072 };
00073
00074 extern LoadCheckData _load_check_data;
00075
00076
00077 enum FileSlots {
00084 CONFIG_SLOT = 0,
00086 SOUND_SLOT = 1,
00088 FIRST_GRF_SLOT = 2,
00090 LAST_GRF_SLOT = 63,
00092 MAX_FILE_SLOTS = 64
00093 };
00094
00095 enum SaveLoadDialogMode {
00096 SLD_LOAD_GAME,
00097 SLD_LOAD_SCENARIO,
00098 SLD_SAVE_GAME,
00099 SLD_SAVE_SCENARIO,
00100 SLD_LOAD_HEIGHTMAP,
00101 };
00102
00103
00104 enum FileType {
00105 FT_NONE,
00106 FT_SAVEGAME,
00107 FT_SCENARIO,
00108 FT_HEIGHTMAP,
00109 };
00110
00111 enum FiosType {
00112 FIOS_TYPE_DRIVE,
00113 FIOS_TYPE_PARENT,
00114 FIOS_TYPE_DIR,
00115 FIOS_TYPE_FILE,
00116 FIOS_TYPE_OLDFILE,
00117 FIOS_TYPE_SCENARIO,
00118 FIOS_TYPE_OLD_SCENARIO,
00119 FIOS_TYPE_DIRECT,
00120 FIOS_TYPE_PNG,
00121 FIOS_TYPE_BMP,
00122 FIOS_TYPE_INVALID = 255,
00123 };
00124
00125
00126 struct FiosItem {
00127 FiosType type;
00128 uint64 mtime;
00129 char title[64];
00130 char name[MAX_PATH];
00131 };
00132
00133
00134 struct SmallFiosItem {
00135 int mode;
00136 FileType filetype;
00137 char name[MAX_PATH];
00138 char title[255];
00139 };
00140
00141 enum SortingBits {
00142 SORT_ASCENDING = 0,
00143 SORT_DESCENDING = 1,
00144 SORT_BY_DATE = 0,
00145 SORT_BY_NAME = 2
00146 };
00147 DECLARE_ENUM_AS_BIT_SET(SortingBits)
00148
00149
00150 extern SmallVector<FiosItem, 32> _fios_items;
00151 extern SmallFiosItem _file_to_saveload;
00152 extern SaveLoadDialogMode _saveload_mode;
00153 extern SortingBits _savegame_sort_order;
00154
00155
00156 void ShowSaveLoadDialog(SaveLoadDialogMode mode);
00157
00158
00159 void FiosGetSavegameList(SaveLoadDialogMode mode);
00160
00161 void FiosGetScenarioList(SaveLoadDialogMode mode);
00162
00163 void FiosGetHeightmapList(SaveLoadDialogMode mode);
00164
00165 void FiosFreeSavegameList();
00166
00167 const char *FiosBrowseTo(const FiosItem *item);
00168
00169 StringID FiosGetDescText(const char **path, uint64 *total_free);
00170
00171 bool FiosDelete(const char *name);
00172
00173 void FiosMakeSavegameName(char *buf, const char *name, size_t size);
00174
00175 FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last);
00176
00177 int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b);
00178
00179
00180 extern const TextColour _fios_colours[];
00181
00182 void BuildFileList();
00183 void SetFiosType(const byte fiostype);
00184
00185 #endif