1 /* 2 * Holotz's Castle 3 * Copyright (C) 2004 Juan Carlos Seijo P�rez 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the Free 7 * Software Foundation; either version 2 of the License, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 59 17 * Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * Juan Carlos Seijo P�rez 20 * jacob@mainreactor.net 21 */ 22 23 /** Game data slot for save and load. 24 * @file HCLoadSaveSlot.h 25 * @author Juan Carlos Seijo P�rez 26 * @date 14/09/2004 27 * @version 0.0.1 - 14/09/2004 - Primera versi�n. 28 */ 29 30 #ifndef _HCLOADSAVESLOT_INCLUDED 31 #define _HCLOADSAVESLOT_INCLUDED 32 33 #include <JLib/Util/JTextFile.h> 34 #include <JLib/Graphics/JImage.h> 35 36 /** Game data slot for save and load. 37 */ 38 class HCLoadSaveSlot 39 { 40 JString story; /**< Story name. */ 41 s32 level; /**< Level number within the story. */ 42 43 public: 44 /** Creates an empty slot, Init() must be called before. 45 */ HCLoadSaveSlot()46 HCLoadSaveSlot() : level(1) 47 {} 48 49 /** Loads this slot. 50 * @param slot Slot number to load. 51 * @return <b>true</b> if succeeded, <b>false</b> otherwise. 52 */ 53 bool Load(s32 slot); 54 55 /** Saves this slot with the given parameters. 56 * @param s Name of the story. 57 * @param levelNumber Ordinal of the level to save. 58 * @param image Image to be stored. 59 * @param f File already opened and positioned. 60 * @return 0 if succeeded, 1 if there was an I/O error, 2 if an integrity error. 61 */ 62 bool Save(s32 slot, const JString& s, s32 levelNumber); 63 64 /** Returns the story name. 65 * @return story name. 66 */ Story()67 const char * Story() {return story.Str();} 68 69 /** Returns the level number. 70 * @return level number. 71 */ Level()72 s32 Level() {return level;} 73 }; 74 75 #endif // _HCLOADSAVESLOT_INCLUDED 76