OpenTTD
fileio_type.h
Go to the documentation of this file.
1 /* $Id: fileio_type.h 27653 2016-09-04 16:06:50Z alberth $ */
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 FILEIO_TYPE_H
13 #define FILEIO_TYPE_H
14 
15 #include "core/enum_type.hpp"
16 
23 
24  FT_INVALID = 7,
25  FT_NUMBITS = 3,
26  FT_MASK = (1 << FT_NUMBITS) - 1,
27 };
28 
31  /* Save game and scenario files. */
34 
35  /* Heightmap files. */
38 
39  /* fios 'files' */
44 
45  DFT_INVALID = 255,
46 };
47 
53 
55 };
56 
62 #define MAKE_FIOS_TYPE(abstract, detailed) ((abstract) | ((detailed) << FT_NUMBITS))
63 
69 enum FiosType {
70  FIOS_TYPE_DRIVE = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DRIVE),
71  FIOS_TYPE_PARENT = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_PARENT),
72  FIOS_TYPE_DIR = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DIR),
73  FIOS_TYPE_DIRECT = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DIRECT),
74 
75  FIOS_TYPE_FILE = MAKE_FIOS_TYPE(FT_SAVEGAME, DFT_GAME_FILE),
76  FIOS_TYPE_OLDFILE = MAKE_FIOS_TYPE(FT_SAVEGAME, DFT_OLD_GAME_FILE),
77  FIOS_TYPE_SCENARIO = MAKE_FIOS_TYPE(FT_SCENARIO, DFT_GAME_FILE),
78  FIOS_TYPE_OLD_SCENARIO = MAKE_FIOS_TYPE(FT_SCENARIO, DFT_OLD_GAME_FILE),
81 
82  FIOS_TYPE_INVALID = MAKE_FIOS_TYPE(FT_INVALID, DFT_INVALID),
83 };
84 
85 #undef MAKE_FIOS_TYPE
86 
93 {
94  return static_cast<AbstractFileType>(fios_type & FT_MASK);
95 }
96 
103 {
104  return static_cast<DetailedFileType>(fios_type >> FT_NUMBITS);
105 }
106 
128 };
129 
134  SP_FIRST_DIR,
135  SP_WORKING_DIR = SP_FIRST_DIR,
136 #if defined(WITH_XDG_BASEDIR) && defined(WITH_PERSONAL_DIR)
137  SP_PERSONAL_DIR_XDG,
138 #endif
145  NUM_SEARCHPATHS
146 };
147 
149 
150 #endif /* FILEIO_TYPE_H */