OpenXcom  1.0
Open-source clone of the original X-Com
Options.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <SDL.h>
21 #include <string>
22 #include <vector>
23 #include "OptionInfo.h"
24 #include "ModInfo.h"
25 
26 namespace OpenXcom
27 {
28 
30 enum ScrollType { SCROLL_NONE, SCROLL_TRIGGER, SCROLL_AUTO };
32 enum KeyboardType { KEYBOARD_OFF, KEYBOARD_ON, KEYBOARD_VIRTUAL };
34 enum SaveSort { SORT_NAME_ASC, SORT_NAME_DESC, SORT_DATE_ASC, SORT_DATE_DESC };
36 enum MusicFormat { MUSIC_AUTO, MUSIC_FLAC, MUSIC_OGG, MUSIC_MP3, MUSIC_MOD, MUSIC_WAV, MUSIC_ADLIB, MUSIC_GM, MUSIC_MIDI };
38 enum SoundFormat { SOUND_AUTO, SOUND_14, SOUND_10 };
40 enum VideoFormat { VIDEO_FMV, VIDEO_SLIDE };
42 enum PathPreview {
43  PATH_NONE = 0x00, // 0000 (must always be zero)
44  PATH_ARROWS = 0x01, // 0001
45  PATH_TU_COST = 0x02, // 0010
46  PATH_FULL = 0x03 // 0011 (must always be all values combined)
47 };
48 
49 enum ScaleType
50 {
51  SCALE_ORIGINAL,
52  SCALE_15X,
53  SCALE_2X,
54  SCALE_SCREEN_DIV_3,
55  SCALE_SCREEN_DIV_2,
56  SCALE_SCREEN
57 };
62 namespace Options
63 {
64 #define OPT extern
65 #include "Options.inc.h"
66 #undef OPT
67 
69  void create();
71  void resetDefault();
73  bool init(int argc, char *argv[]);
75  bool load(const std::string &filename = "options");
77  bool save(const std::string &filename = "options");
79  std::string getDataFolder();
81  void setDataFolder(const std::string &folder);
83  const std::vector<std::string> &getDataList();
85  std::string getUserFolder();
87  std::string getConfigFolder();
89  std::string getMasterUserFolder();
91  const std::vector<OptionInfo> &getOptionInfo();
93  void setFolders();
95  void userSplitMasters();
97  void updateOptions();
99  void backupDisplay();
101  void switchDisplay();
103  std::string getActiveMaster();
105  void updateReservedSpace();
107  void mapResources();
109  const std::map<std::string, ModInfo> &getModInfos();
111  void updateMods();
113  std::vector<const ModInfo*> getActiveMods();
114 }
115 
116 }
void userSplitMasters()
Splits the game&#39;s User folder by master mod, creating a subfolder for each one and moving the appprop...
Definition: Options.cpp:859
void updateOptions()
Updates the game&#39;s options with those in the configuration file, if it exists yet, and any supplied on the command line.
Definition: Options.cpp:910
void updateMods()
Refreshes the mods and filemaps.
Definition: Options.cpp:553
std::vector< const ModInfo * > getActiveMods()
Returns a list of currently active mods.
Definition: Options.cpp:1152
void switchDisplay()
Switches old/new display options for temporarily testing a new display setup.
Definition: Options.cpp:1196
void mapResources()
Maps resources in active mods to the virtual file system.
Definition: Options.cpp:770
std::string getActiveMaster()
Gets the currently active master mod.
Definition: Options.cpp:672
const std::vector< std::string > & getDataList()
Returns the game&#39;s list of possible Data folders.
Definition: Options.cpp:1101
void setDataFolder(const std::string &folder)
Changes the game&#39;s current Data folder where resources and X-Com files are loaded from...
Definition: Options.cpp:1092
void create()
Sets up the options by creating their OptionInfo metadata.
Definition: Options.cpp:60
std::string getUserFolder()
Returns the game&#39;s User folder where saves are stored in.
Definition: Options.cpp:1111
bool init(int argc, char *argv[])
Handles the initialization of setting up default options and finding and loading any existing ones...
Definition: Options.cpp:504
std::string getConfigFolder()
Returns the game&#39;s Config folder where settings are stored in.
Definition: Options.cpp:1122
const std::map< std::string, ModInfo > & getModInfos()
Gets the map of mod ids to mod infos.
Definition: Options.cpp:439
std::string getDataFolder()
Returns the game&#39;s current Data folder where resources and X-Com files are loaded from...
Definition: Options.cpp:1082
void updateReservedSpace()
Updates the reservedSpace for master mods if necessary.
Definition: Options.cpp:719
void resetDefault()
Resets the options back to their defaults.
Definition: Options.cpp:333
const std::vector< OptionInfo > & getOptionInfo()
Returns the game&#39;s list of all available option information.
Definition: Options.cpp:1141
void setFolders()
Sets up the game&#39;s Data folder where the data files are loaded from and the User folder and Config fo...
Definition: Options.cpp:803
bool save(const std::string &filename)
Saves options to a YAML file.
Definition: Options.cpp:1031
bool load(const std::string &filename)
Loads options from a YAML file.
Definition: Options.cpp:944
Definition: BaseInfoState.cpp:40
std::string getMasterUserFolder()
Returns the game&#39;s User folder for the currently loaded master mod.
Definition: Options.cpp:1132
void backupDisplay()
Saves display settings temporarily to be able to revert to old ones.
Definition: Options.cpp:1173