OpenXcom  1.0
Open-source clone of the original X-Com
SaveConverter.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 <string>
21 #include <vector>
22 #include <map>
23 #include <utility>
24 
25 namespace OpenXcom
26 {
27 
32 {
33  int id;
34  std::string name, date, time;
35  bool tactical;
36  SaveOriginal() : tactical(false)
37  {
38  }
39 };
40 
41 class SavedGame;
42 class Mod;
43 class Language;
44 class Target;
45 class Soldier;
46 class AlienMission;
47 class RuleConverter;
48 
54 {
55 private:
56  std::string _saveName, _savePath;
57  SavedGame *_save;
58  Mod *_mod;
59  RuleConverter *_rules;
60  int _year, _funds;
61  std::vector<Target*> _targets;
62  std::vector<int> _targetDat;
63  std::vector<Soldier*> _soldiers;
64  std::vector<std::string> _aliens;
65  std::map<std::pair<int, int>, AlienMission*> _missions;
66 
68  char *binaryBuffer(const std::string &filename, std::vector<char> &buffer) const;
70  template <typename T> void graphVector(std::vector<T> &vector, int month, bool year);
71 
73  void loadDatXcom();
75  void loadDatAlien();
77  void loadDatDiplom();
79  void loadDatLease();
81  void loadDatLIGlob();
83  void loadDatUIGlob();
85  void loadDatIGlob();
87  void loadDatZonal();
89  void loadDatActs();
91  void loadDatMissions();
93  void loadDatLoc();
95  void loadDatBase();
97  void loadDatAStore();
99  void loadDatCraft();
101  void loadDatSoldier();
103  void loadDatTransfer();
105  void loadDatResearch();
107  void loadDatUp();
109  void loadDatProject();
111  void loadDatBProd();
113  void loadDatXBases();
114 public:
115  static const int NUM_SAVES = 10;
116 
118  SaveConverter(int save, Mod *mod);
120  ~SaveConverter();
122  static void getList(Language *lang, SaveOriginal info[NUM_SAVES]);
125 };
126 
127 }
~SaveConverter()
Cleans up the converter.
Definition: SaveConverter.cpp:108
SaveConverter(int save, Mod *mod)
Creates a converter for the specified save.
Definition: SaveConverter.cpp:94
Represents an ongoing alien mission.
Definition: AlienMission.h:46
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:99
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
Container for savegame info displayed on listings.
Definition: SaveConverter.h:31
Represents game-specific contents needed for save convertion and ID matching.
Definition: RuleConverter.h:33
SavedGame * loadOriginal()
Loads an original X-COM save.
Definition: SaveConverter.cpp:163
Contains strings used throughout the game for localization.
Definition: Language.h:39
Represents a soldier hired by the player.
Definition: Soldier.h:48
Handles conversion operations for original X-COM savegames.
Definition: SaveConverter.h:53
static void getList(Language *lang, SaveOriginal info[NUM_SAVES])
Gets list of saves in the user directory.
Definition: SaveConverter.cpp:117
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:35
Definition: BaseInfoState.cpp:40