OpenTTD
fios.h
Go to the documentation of this file.
1 /* $Id: fios.h 26489 2014-04-23 21:23:21Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef FIOS_H
13 #define FIOS_H
14 
15 #include "gfx_type.h"
16 #include "company_base.h"
17 #include "newgrf_config.h"
19 
20 
22 
26 struct LoadCheckData {
27  bool checkable;
29  char *error_data;
30 
31  uint32 map_size_x, map_size_y;
32  Date current_date;
33 
34  GameSettings settings;
35 
37 
40 
43 
44  LoadCheckData() : error_data(NULL), grfconfig(NULL),
46  {
47  this->Clear();
48  }
49 
54  {
55  this->Clear();
56  }
57 
62  bool HasErrors()
63  {
64  return this->checkable && this->error != INVALID_STRING_ID;
65  }
66 
71  bool HasNewGrfs()
72  {
73  return this->checkable && this->error == INVALID_STRING_ID && this->grfconfig != NULL;
74  }
75 
76  void Clear();
77 };
78 
80 
81 
82 enum FileSlots {
98 };
99 
108 };
109 
111 enum FileType {
116 };
117 
118 enum FiosType {
119  FIOS_TYPE_DRIVE,
120  FIOS_TYPE_PARENT,
121  FIOS_TYPE_DIR,
122  FIOS_TYPE_FILE,
123  FIOS_TYPE_OLDFILE,
124  FIOS_TYPE_SCENARIO,
125  FIOS_TYPE_OLD_SCENARIO,
126  FIOS_TYPE_DIRECT,
127  FIOS_TYPE_PNG,
128  FIOS_TYPE_BMP,
129  FIOS_TYPE_INVALID = 255,
130 };
131 
133 struct FiosItem {
134  FiosType type;
135  uint64 mtime;
136  char title[64];
137  char name[MAX_PATH];
138 };
139 
142  int mode;
144  char name[MAX_PATH];
145  char title[255];
146 };
147 
148 enum SortingBits {
149  SORT_ASCENDING = 0,
150  SORT_DESCENDING = 1,
151  SORT_BY_DATE = 0,
152  SORT_BY_NAME = 2
153 };
154 DECLARE_ENUM_AS_BIT_SET(SortingBits)
155 
156 /* Variables to display file lists */
157 extern SmallVector<FiosItem, 32> _fios_items;
158 extern SmallFiosItem _file_to_saveload;
159 extern SaveLoadDialogMode _saveload_mode;
160 extern SortingBits _savegame_sort_order;
161 
163 
167 
168 void FiosFreeSavegameList();
169 const char *FiosBrowseTo(const FiosItem *item);
170 
171 StringID FiosGetDescText(const char **path, uint64 *total_free);
172 bool FiosDelete(const char *name);
173 void FiosMakeHeightmapName(char *buf, const char *name, const char *last);
174 void FiosMakeSavegameName(char *buf, const char *name, const char *last);
175 
176 FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last);
177 
178 int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b);
179 
180 extern const TextColour _fios_colours[];
181 
182 void BuildFileList();
183 void SetFiosType(const byte fiostype);
184 
185 #endif /* FIOS_H */