save and restore games and prefs

This commit is contained in:
ehouse 2005-01-18 15:03:31 +00:00
parent f9f24ccddb
commit 7b475c067c

View file

@ -28,6 +28,13 @@
#include "game.h" #include "game.h"
#include "memstream.h" #include "memstream.h"
#include "symdraw.h" #include "symdraw.h"
#include "symgmmgr.h"
typedef enum {
EGamesLoc
,EDictsLoc
,EPrefsLoc
} TDriveReason;
/*! /*!
@class CXWordsAppView @class CXWordsAppView
@ -79,7 +86,6 @@ class CXWordsAppView : public CCoeControl
private: private:
/*! /*!
@function ConstructL @function ConstructL
@ -98,11 +104,12 @@ class CXWordsAppView : public CCoeControl
/* Added by eeh */ /* Added by eeh */
public: public:
int HandleCommand( TInt aCommand ); int HandleCommand( TInt aCommand );
void Exiting();
TBool HandleKeyEvent( const TKeyEvent& aKeyEvent ); TBool HandleKeyEvent( const TKeyEvent& aKeyEvent );
private: private:
/* open game from prefs or start a new one. */ /* open game from prefs or start a new one. */
void InitGameL(); void MakeOrLoadGameL();
void DeleteGame(); void DeleteGame();
void SetUpUtil(); void SetUpUtil();
void PositionBoard(); void PositionBoard();
@ -111,10 +118,19 @@ class CXWordsAppView : public CCoeControl
TBool AskFromResId( TInt aResource ); TBool AskFromResId( TInt aResource );
TBool FindAllDicts(); TBool FindAllDicts();
void UserErrorFromID( TInt aResource ); void UserErrorFromID( TInt aResource );
TBool ReadCurrentGame() { return EFalse; } /* later.... */ TBool LoadPrefs();
TBool AskSaveGame() { return EFalse; } TBool AskSaveGame() { return ETrue; }
void SaveCurrentGame() {} void SaveCurrentGame() {}
void NotImpl(); void NotImpl();
void GetXwordsRWDir( TFileName* aPathRef, TDriveReason aWhy );
void InitPrefs();
void WritePrefs();
void SaveCurGame();
void LoadOneGameL( TGameName* aGameName );
void StoreOneGameL( TGameName* aGameName );
TBool DoSavedGames();
TBool DoNewGame();
static void sym_util_requestTime( XW_UtilCtxt* uc ); static void sym_util_requestTime( XW_UtilCtxt* uc );
@ -122,7 +138,7 @@ class CXWordsAppView : public CCoeControl
static XP_U32 sym_util_getCurSeconds( XW_UtilCtxt* uc ); static XP_U32 sym_util_getCurSeconds( XW_UtilCtxt* uc );
static void sym_util_notifyGameOverL( XW_UtilCtxt* uc ); static void sym_util_notifyGameOverL( XW_UtilCtxt* uc );
static void sym_util_userError( XW_UtilCtxt* uc, UtilErrID id ); static void sym_util_userError( XW_UtilCtxt* uc, UtilErrID id );
static DictionaryCtxt* sym_util_makeEmptyDict( XW_UtilCtxt* uc );
static TInt TimerCallback( TAny* aThis ); static TInt TimerCallback( TAny* aThis );
@ -131,14 +147,15 @@ class CXWordsAppView : public CCoeControl
XW_UtilCtxt iUtil; XW_UtilCtxt iUtil;
XWGame iGame; XWGame iGame;
DrawCtx* iDraw; DrawCtx* iDraw;
XP_Bool iBoardPosInval; TGameName iCurGameName;
VTableMgr* iVtMgr; VTableMgr* iVtMgr;
TTime iStartTime; TTime iStartTime;
TInt iTimerRunCount; TInt iTimerRunCount;
CIdle* iRequestTimer; CIdle* iRequestTimer;
CXWGamesMgr* iGamesMgr;
CDesC16ArrayFlat* iDictList; /* to pass into the dialog */ CDesC16ArrayFlat* iDictList; /* to pass into the dialog */
MPSLOT MPSLOT