Line data Source code
1 0 : /* 2 : 3 : PlayerEntityLoadSave.h 4 : 5 : Created for the Oolite-Linux project (but is portable) 6 : 7 : LoadSave has been separated out into a separate category because 8 : PlayerEntity.m has gotten far too big and is in danger of becoming 9 : the whole general mish mash. 10 : 11 : Oolite 12 : Copyright (C) 2004-2013 Giles C Williams and contributors 13 : 14 : This program is free software; you can redistribute it and/or 15 : modify it under the terms of the GNU General Public License 16 : as published by the Free Software Foundation; either version 2 17 : of the License, or (at your option) any later version. 18 : 19 : This program is distributed in the hope that it will be useful, 20 : but WITHOUT ANY WARRANTY; without even the implied warranty of 21 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 : GNU General Public License for more details. 23 : 24 : You should have received a copy of the GNU General Public License 25 : along with this program; if not, write to the Free Software 26 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 27 : MA 02110-1301, USA. 28 : 29 : */ 30 : 31 : #import "PlayerEntity.h" 32 : #import "GuiDisplayGen.h" 33 : #import "MyOpenGLView.h" 34 : #import "Universe.h" 35 : 36 0 : #define EXITROW 1 37 0 : #define LABELROW 2 38 0 : #define BACKROW 3 39 0 : #define STARTROW 4 40 0 : #define ENDROW 17 41 0 : #define MOREROW 17 42 0 : #define NUMROWS 13 43 0 : #define COLUMNS 2 44 0 : #define INPUTROW 21 45 0 : #define CDRDESCROW 19 46 0 : #define SAVE_OVERWRITE_WARN_ROW 5 47 0 : #define SAVE_OVERWRITE_YES_ROW 8 48 0 : #define SAVE_OVERWRITE_NO_ROW 9 49 : 50 : 51 : // Set to 1 to use custom load/save dialogs in windowed mode on Macs in debug builds. No effect on other platforms. 52 0 : #define USE_CUSTOM_LOAD_SAVE_ON_MAC_DEBUG 0 53 : 54 : // OOLITE_USE_APPKIT_LOAD_SAVE is true if we ever want AppKit dialogs. 55 0 : #define OOLITE_USE_APPKIT_LOAD_SAVE (OOLITE_MAC_OS_X && !USE_CUSTOM_LOAD_SAVE_ON_MAC_DEBUG) 56 : 57 : // Mac 64-bit builds: never use custom load/save dialogs. 58 0 : #define OO_USE_APPKIT_LOAD_SAVE_ALWAYS (OOLITE_USE_APPKIT_LOAD_SAVE && OOLITE_64_BIT) 59 : 60 : // OO_USE_CUSTOM_LOAD_SAVE is true if we will ever want custom dialogs. 61 0 : #define OO_USE_CUSTOM_LOAD_SAVE (!OO_USE_APPKIT_LOAD_SAVE_ALWAYS) 62 : 63 : 64 : @interface PlayerEntity (LoadSave) 65 : 66 0 : - (BOOL) loadPlayer; // Returns NO on immediate failure, i.e. when using an OS X modal open panel which is cancelled. 67 0 : - (void) savePlayer; 68 0 : - (void) quicksavePlayer; 69 0 : - (void) autosavePlayer; 70 : 71 0 : - (void) setGuiToScenarioScreen:(int)page; 72 0 : - (void) addScenarioModel:(NSString *)shipKey; 73 0 : - (void) showScenarioDetails; 74 0 : - (BOOL) startScenario; 75 : 76 : 77 : #if OO_USE_CUSTOM_LOAD_SAVE 78 : 79 : // Interface for PlayerEntityControls 80 0 : - (NSString *) commanderSelector; 81 0 : - (void) saveCommanderInputHandler; 82 0 : - (void) overwriteCommanderInputHandler; 83 : 84 : #endif 85 : 86 0 : - (BOOL) loadPlayerFromFile:(NSString *)fileToOpen asNew:(BOOL)asNew; 87 : 88 : @end 89 : 90 : 91 0 : OOCreditsQuantity OODeciCreditsFromDouble(double doubleDeciCredits); 92 : 93 : /* Object is either a floating-point NSNumber or something that can be duck- 94 : typed to an integer using OOUnsignedLongLongFromObject(). 95 : */ 96 0 : OOCreditsQuantity OODeciCreditsFromObject(id object);