ScummVM API documentation
saveload.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program 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  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef PARALLACTION_SAVELOAD_H
23 #define PARALLACTION_SAVELOAD_H
24 
25 namespace Parallaction {
26 
27 struct Character;
28 
29 class SaveLoad {
30 protected:
31  Common::SaveFileManager *_saveFileMan;
32  Common::String _saveFilePrefix;
33 
34  Common::String genSaveFileName(uint slot);
35  Common::InSaveFile *getInSaveFile(uint slot);
36  Common::OutSaveFile *getOutSaveFile(uint slot);
37  int selectSaveFile(Common::String &selectedName, bool saveMode, const Common::U32String &caption, const Common::U32String &button);
38  int buildSaveFileList(Common::StringArray& l);
39  virtual void doLoadGame(uint16 slot) = 0;
40  virtual void doSaveGame(uint16 slot, const char* name) = 0;
41 
42 public:
43  SaveLoad(Common::SaveFileManager* saveFileMan, const char *prefix) : _saveFileMan(saveFileMan), _saveFilePrefix(prefix) { }
44  virtual ~SaveLoad() { }
45 
46  virtual bool loadGame();
47  virtual bool saveGame();
48 
49  virtual void getGamePartProgress(bool *complete, int size) = 0;
50  virtual void setPartComplete(const char *part) = 0;
51 
52  virtual void renameOldSavefiles() { }
53 };
54 
55 class SaveLoad_ns : public SaveLoad {
56  Parallaction_ns *_vm;
57 
58 protected:
59  void renameOldSavefiles() override;
60  void doLoadGame(uint16 slot) override;
61  void doSaveGame(uint16 slot, const char* name) override;
62 
63 public:
64  SaveLoad_ns(Parallaction_ns *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "nippon"), _vm(vm) { }
65 
66  bool saveGame() override;
67 
68  void getGamePartProgress(bool *complete, int size) override;
69  void setPartComplete(const char *part) override;
70 };
71 
72 class SaveLoad_br : public SaveLoad {
73 // Parallaction_br *_vm;
74  void doLoadGame(uint16 slot) override;
75  void doSaveGame(uint16 slot, const char* name) override;
76 
77 public:
78  SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra") { }
79 
80  void getGamePartProgress(bool *complete, int size) override;
81  void setPartComplete(const char *part) override;
82 };
83 
84 } // namespace Parallaction
85 
86 #endif
Definition: str.h:59
Definition: savefile.h:54
Definition: parallaction.h:377
Definition: stream.h:745
Definition: debug.h:8
Definition: ustr.h:57
Definition: saveload.h:55
Definition: saveload.h:72
Definition: savefile.h:142
Definition: saveload.h:29
Definition: parallaction.h:489