ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

savestate.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef ENGINES_SAVESTATE_H
00024 #define ENGINES_SAVESTATE_H
00025 
00026 #include "common/array.h"
00027 #include "common/str.h"
00028 #include "common/ptr.h"
00029 
00030 namespace Graphics {
00031 struct Surface;
00032 }
00033 
00045 class SaveStateDescriptor {
00046 private:
00047     enum SaveType {
00048         kSaveTypeUndetermined,
00049         kSaveTypeRegular,
00050         kSaveTypeAutosave
00051     };
00052 public:
00053     SaveStateDescriptor();
00054     SaveStateDescriptor(int s, const Common::String &d);
00055 
00059     void setSaveSlot(int slot) { _slot = slot; }
00060 
00064     int getSaveSlot() const { return _slot; }
00065 
00069     void setDescription(const Common::String &desc) { _description = desc; }
00070 
00074     const Common::String &getDescription() const { return _description; }
00075 
00081     void setDeletableFlag(bool state) { _isDeletable = state; }
00082 
00086     bool getDeletableFlag() const { return _isDeletable; }
00087 
00091     void setWriteProtectedFlag(bool state) { _isWriteProtected = state; }
00092 
00096     bool getWriteProtectedFlag() const { return _isWriteProtected; }
00097 
00101     void setLocked(bool state) {
00102         _isLocked = state;
00103 
00104         //just in case:
00105         if (state) {
00106             setDeletableFlag(false);
00107             setWriteProtectedFlag(true);
00108         }
00109     }
00110 
00114     bool getLocked() const { return _isLocked; }
00115 
00122     const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); }
00123 
00129     void setThumbnail(Graphics::Surface *t);
00130     void setThumbnail(Common::SharedPtr<Graphics::Surface> t) { _thumbnail = t; }
00131 
00139     void setSaveDate(int year, int month, int day);
00140 
00146     const Common::String &getSaveDate() const { return _saveDate; }
00147 
00154     void setSaveTime(int hour, int min);
00155 
00161     const Common::String &getSaveTime() const { return _saveTime; }
00162 
00169     void setPlayTime(int hours, int minutes);
00170 
00176     void setPlayTime(uint32 msecs);
00177 
00184     const Common::String &getPlayTime() const { return _playTime; }
00185 
00192     uint32 getPlayTimeMSecs() const { return _playTimeMSecs; }
00193 
00197     void setAutosave(bool autosave);
00198 
00202     bool isAutosave() const;
00203 private:
00207     int _slot;
00208 
00212     Common::String _description;
00213 
00217     bool _isDeletable;
00218 
00222     bool _isWriteProtected;
00223 
00227     bool _isLocked;
00228 
00232     Common::String _saveDate;
00233 
00237     Common::String _saveTime;
00238 
00243     Common::String _playTime;
00244 
00249     uint32 _playTimeMSecs;
00250 
00254     Common::SharedPtr<Graphics::Surface> _thumbnail;
00255 
00259     SaveType _saveType;
00260 };
00261 
00263 typedef Common::Array<SaveStateDescriptor> SaveStateList;
00264 
00268 struct SaveStateDescriptorSlotComparator {
00269     bool operator()(const SaveStateDescriptor &x, const SaveStateDescriptor &y) const {
00270         return x.getSaveSlot() < y.getSaveSlot();
00271     }
00272 };
00273 
00274 #endif


Generated on Sat May 30 2020 05:00:51 for ResidualVM by doxygen 1.7.1
curved edge   curved edge