Commit 3d32f155 authored by Gerhard Stein's avatar Gerhard Stein

TextInput added, but still needs coding

parent 9af2f004
......@@ -6,11 +6,10 @@
*/
#include "CLoadMenu.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
CLoadMenu::CLoadMenu(Uint8 dlg_theme) :
CBaseMenu(dlg_theme, CRect<float>(0.1f, 0.24f, 0.8f, 0.4f) )//,
//m_SavedGame(SavedGame)
CBaseMenu(dlg_theme, CRect<float>(0.1f, 0.24f, 0.8f, 0.4f) )
{
mpMenuDialog->setBackground( CGUIDialog::VORTICON );
......
......@@ -9,7 +9,7 @@
#define CLOADMENU_H_
#include "CBaseMenu.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
class CLoadMenu : public CBaseMenu
{
......@@ -23,7 +23,7 @@ public:
//void release();
private:
//CSavedGame &m_SavedGame;
//CSaveGameController &m_SavedGame;
};
#endif /* CLOADMENU_H_ */
......@@ -9,6 +9,7 @@
#include "common/Menu/CMenuController.h"
#include "common/Menu/CSettingsMenu.h"
#include "common/Menu/CLoadMenu.h"
#include "common/Menu/CSaveMenu.h"
#include "common/CBehaviorEngine.h"
#include "gui/CGUIButton.h"
#include "core/CGameMode.h"
......@@ -28,6 +29,10 @@ CBaseMenu( dlgTheme, CRect<float>(0.25f, 0.24f, 0.5f, 0.5f) )
new OpenMenuEvent( new CLoadMenu(dlgTheme) ),
CGUIButton::VORTICON ) );
mpMenuDialog->addControl(new CGUIButton( "Save",
new OpenMenuEvent( new CSaveMenu(dlgTheme) ),
CGUIButton::VORTICON ) );
mpMenuDialog->addControl(new CGUIButton( "Settings",
new OpenMenuEvent( new CSettingsMenu(dlgTheme) ),
CGUIButton::VORTICON ) );
......
......@@ -12,12 +12,14 @@
#include <ctime>
/*CSaveMenu::CSaveMenu(Uint8 dlg_theme, CSavedGame &SavedGame) :
CBaseMenu(dlg_theme),
CSaveMenu::CSaveMenu(Uint8 dlg_theme) :
CBaseMenu(dlg_theme, CRect<float>(0.1f, 0.24f, 0.8f, 0.4f) ),
mp_OverwriteMenu(NULL),
m_SavedGame(SavedGame),
m_overwrite(false)
{*/
{
mpMenuDialog->setBackground( CGUIDialog::VORTICON );
/*std::string text;
mp_Dialog = new CDialog(MENU_WIDTH, 22, INPUT_MODE_UP_DOWN, m_dlg_theme);
m_selection = NO_SELECTION;
......@@ -35,9 +37,9 @@ m_overwrite(false)
}
mp_Dialog->addObject(DLG_OBJ_OPTION_TEXT, 1, i, text);
}*/
/*}
}
void CSaveMenu::processSpecific()
/*void CSaveMenu::processSpecific()
{*/
/*if(!mp_OverwriteMenu)
{
......
......@@ -9,18 +9,17 @@
#define CSAVEMENU_H_
#include "CConfirmMenu.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
class CSaveMenu : public CBaseMenu
{
public:
CSaveMenu(Uint8 dlg_theme, CSavedGame &SavedGame);
CSaveMenu(Uint8 dlg_theme);
void processSpecific();
void saveSelection();
private:
CConfirmMenu *mp_OverwriteMenu;
CSavedGame &m_SavedGame;
bool m_overwrite;
};
......
......@@ -13,7 +13,7 @@
#include "common/CGameLauncher.h"
#include "common/options.h"
#include "common/Menu/CMenuController.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include "engine/CEGAGraphics.h"
#include "engine/CMessages.h"
#include "engine/CPassive.h"
......
......@@ -14,7 +14,7 @@
#include "engine/CMessages.h"
#include "sdl/sound/CSound.h"
#include "common/CBehaviorEngine.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include "SmartPointer.h"
#include "CLogFile.h"
#include "Debug.h"
......@@ -225,7 +225,7 @@ void CGameLauncherMenu::process()
{
// Now look if there are any old savegames that need to be converted
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
CSavedGame savedgames;
CSaveGameController savedgames;
savedgames.setGameDirectory(DataDirectory);
savedgames.setEpisode(Episode);
savedgames.convertAllOldFormats();
......
......@@ -11,7 +11,7 @@
#define CGAMEMODE_H_
#include "engine/CEvent.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include <string>
///////////////////////
......@@ -41,11 +41,11 @@ struct GMSwitchToPlayGameMode : CEvent {
const int m_Numplayers;
const int m_Difficulty;
const std::string m_DataDirectory;
CSavedGame m_SavedGame;
CSaveGameController m_SavedGame;
const int m_startlevel;
GMSwitchToPlayGameMode( const int Episode, const int Numplayers,
const int Difficulty, const std::string& DataDirectory, CSavedGame& SavedGame, const int startlevel = -1 ) :
const int Difficulty, const std::string& DataDirectory, CSaveGameController& SavedGame, const int startlevel = -1 ) :
m_Episode(Episode),
m_Numplayers(Numplayers),
m_Difficulty(Difficulty),
......
......@@ -56,7 +56,7 @@ void CGamePassiveMode::process()
const int Numplayers = 1;
const int Difficulty = 1;
std::string DataDirectory = mp_Passive->getGamePath();
CSavedGame SavedGame = mp_Passive->getSavedGameBlock();
CSaveGameController SavedGame = mp_Passive->getSavedGameBlock();
EventContainer.pop_Event();
......
......@@ -25,7 +25,7 @@ private:
const std::string m_DataDirectory;
const int m_Episode;
bool m_Endgame;
CSavedGame m_SavedGame;
CSaveGameController m_SavedGame;
int m_Difficulty;
};
......
......@@ -11,7 +11,7 @@
#include "graphics/effects/CColorMerge.h"
CGamePlayMode::CGamePlayMode(const int Episode, const int Numplayers,
const int Difficulty, const std::string& DataDirectory, CSavedGame& SavedGame, bool& show_finale,
const int Difficulty, const std::string& DataDirectory, CSaveGameController& SavedGame, bool& show_finale,
const int startLevel) :
m_startLevel(startLevel),
m_show_finale(show_finale),
......@@ -52,7 +52,7 @@ void CGamePlayMode::init()
m_show_finale = false; // just show it once!!
if(m_SavedGame.getCommand() == CSavedGame::LOAD)
if(m_SavedGame.getCommand() == CSaveGameController::LOAD)
ok &= mp_PlayGame->loadGameState();
else
{
......
......@@ -10,14 +10,14 @@
#include "CGameMode.h"
#include "engine/playgame/CPlayGame.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include "SmartPointer.h"
#include <string>
class CGamePlayMode : public CGameMode {
public:
CGamePlayMode( const int Episode, const int Numplayers,
const int Difficulty, const std::string& DataDirectory, CSavedGame& SavedGame, bool& show_finale,
const int Difficulty, const std::string& DataDirectory, CSaveGameController& SavedGame, bool& show_finale,
const int startLevel = -1);
void init();
......@@ -30,7 +30,7 @@ private:
Uint8 m_Numplayers;
Uint8 m_Difficulty;
std::string m_DataDirectory;
CSavedGame m_SavedGame;
CSaveGameController m_SavedGame;
SmartPointer<CPlayGame> mp_PlayGame;
};
......
......@@ -19,7 +19,7 @@
#include "common/CMap.h"
#include "common/CObject.h"
#include "gui/CGUIDialog.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include <string>
#include <vector>
......@@ -40,7 +40,7 @@ public:
char getEpisode() { return m_Episode; }
char getNumPlayers() { return m_NumPlayers; }
char getDifficulty() { return m_Difficulty; }
CSavedGame getSavedGameBlock() { return m_SavedGame; }
CSaveGameController getSavedGameBlock() { return m_SavedGame; }
std::string getGamePath() { return m_DataDirectory; }
bool getchooseGame() { return m_modeg; }
......@@ -57,6 +57,6 @@ protected:
char m_Difficulty;
bool m_modeg;
std::string m_DataDirectory;
CSavedGame m_SavedGame;
CSaveGameController m_SavedGame;
};
#endif /* CPASSIVE_H_ */
......@@ -20,7 +20,7 @@ namespace galaxy
/**
* \brief sets the menu up when it's opened (initialization)
*/
/*CMenuGalaxy::CMenuGalaxy( char menu_mode, CSavedGame &SavedGame,
/*CMenuGalaxy::CMenuGalaxy( char menu_mode, CSaveGameController &SavedGame,
bool &restartVideo ) :
CMenu( menu_mode, SavedGame, DLG_THEME_GALAXY, restartVideo),
processPtr(&CMenuGalaxy::processMainMenu),
......
......@@ -11,7 +11,7 @@
#include "graphics/CBitmap.h"
#include "graphics/CFont.h"
#include "dialog/CDialog.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
namespace galaxy
{
......@@ -19,7 +19,7 @@ namespace galaxy
class CMenuGalaxy //: public CMenu
{
public:
CMenuGalaxy( char menu_mode, CSavedGame &SavedGame,
CMenuGalaxy( char menu_mode, CSaveGameController &SavedGame,
bool &restartVideo );
void drawMenuBorder();
......
......@@ -98,7 +98,7 @@ void CPassiveGalaxy::processMenu()
{
m_restartVideo = false;
}
else if(mp_Menu->mustStartGame() || m_SavedGame.getCommand() == CSavedGame::LOAD) // Start a normal game
else if(mp_Menu->mustStartGame() || m_SavedGame.getCommand() == CSaveGameController::LOAD) // Start a normal game
{
m_NumPlayers = mp_Menu->getNumPlayers();
m_Difficulty = mp_Menu->getDifficulty();
......
......@@ -22,7 +22,7 @@ namespace galaxy
CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, Uint8& difficulty,
CSavedGame &SavedGame) :
CSaveGameController &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty ),
m_Inventory(difficulty, m_LevelName),
m_WorldMap(ExeFile, m_Inventory, m_Cheatmode),
......
......@@ -28,7 +28,7 @@ class CPlayGameGalaxy : public CPlayGame
public:
CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, Uint8& difficulty,
CSavedGame &SavedGame);
CSaveGameController &SavedGame);
bool loadGameState();
bool init();
......@@ -48,7 +48,7 @@ private:
CWorldMap m_WorldMap;
CLevelPlay m_LevelPlay;
CMenuGalaxy *mp_Menu;
CSavedGame &m_SavedGame;
CSaveGameController &m_SavedGame;
CBitmap m_BackgroundBitmap;
std::list<CMessageBoxGalaxy*> m_MessageBoxes;
stCheat m_Cheatmode;
......
......@@ -39,4 +39,4 @@ bool CPlayGame::getExitEvent() { return m_exitgame; }
char CPlayGame::getEpisode() { return m_Episode; }
char CPlayGame::getNumPlayers() { return m_NumPlayers; }
char CPlayGame::getDifficulty() { return m_Difficulty; }
CSavedGame CPlayGame::getSavedGameBlock() { return m_SavedGame; }
CSaveGameController CPlayGame::getSavedGameBlock() { return m_SavedGame; }
......@@ -14,7 +14,7 @@
#include "fileio/CExeFile.h"
#include "common/options.h"
#include "common/CBehaviorEngine.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include <string>
#include <SDL.h>
......@@ -38,7 +38,7 @@ public:
char getEpisode();
char getNumPlayers();
char getDifficulty();
CSavedGame getSavedGameBlock();
CSaveGameController getSavedGameBlock();
protected:
unsigned char m_NumPlayers;
......@@ -69,7 +69,7 @@ protected:
bool m_restartVideo;
stOption *mp_option;
CSavedGame m_SavedGame;
CSaveGameController m_SavedGame;
};
#endif /* CPLAYGAME_H_ */
......@@ -123,7 +123,7 @@ void CPassiveVort::process()
{
mp_Menu->processSpecific();
if(mp_Menu->mustStartGame() || m_SavedGame.getCommand() == CSavedGame::LOAD) // Start a normal game
if(mp_Menu->mustStartGame() || m_SavedGame.getCommand() == CSaveGameController::LOAD) // Start a normal game
{
m_NumPlayers = mp_Menu->getNumPlayers();
m_Difficulty = mp_Menu->getDifficulty();
......
......@@ -23,10 +23,9 @@
////
CPlayGameVorticon::CPlayGameVorticon( CExeFile &ExeFile, char level,
char numplayers, Uint8& difficulty,
const bool finale, CSavedGame &SavedGame) :
const bool finale, CSaveGameController &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty),
mp_ObjectAI(NULL),
m_SavedGame(SavedGame),
mp_HighScores(NULL),
mp_HUD(NULL),
mp_KeenLeftSfc(NULL)
......
......@@ -11,7 +11,7 @@
#define CPlayGameVorticon_H_
#include "graphics/CGfxEngine.h"
#include "fileio/CSavedGame.h"
#include "fileio/CSaveGameController.h"
#include "common/CPlayer.h"
#include "common/CTileProperties.h"
#include "common/CObject.h"
......@@ -46,7 +46,7 @@ public:
CPlayGameVorticon(CExeFile &ExeFile, char level,
char numplayers, Uint8& difficulty,
const bool finale, CSavedGame &SavedGame);
const bool finale, CSaveGameController &SavedGame);
void setupPlayers();
bool init();
......@@ -104,7 +104,6 @@ private:
CObjectAI *mp_ObjectAI;
CFinale *mp_Finale;
CEGABitmap *mp_gameoverbmp;
CSavedGame &m_SavedGame;
std::list<CMessageBoxVort*> m_MessageBoxes;
bool m_showKeensLeft;
std::vector<CObject*> m_Object;
......
/*
* CSavedGame.cpp
* CSaveGameController.cpp
*
* Created on: 13.08.2009
* Author: Caitlin Shaw
* Adaptation : Gerstrong
* Author : Caitlin Shaw
* Adaptations : Gerstrong
* Routines for handling save&load of savegames
*/
#include "FindFile.h"
#include "CSavedGame.h"
#include "CSaveGameController.h"
#include "common/CBehaviorEngine.h"
#include <ctime>
......@@ -18,7 +18,8 @@ char sgrle_decompressV2(FILE *fp, unsigned char *ptr, unsigned long nbytes);
void sgrle_decompressV1(FILE *fp, unsigned char *ptr, unsigned long nbytes);
// Initialization Routines
CSavedGame::CSavedGame() {
CSaveGameController::CSaveGameController()
{
m_Command = NONE;
m_offset = 0;
......@@ -34,19 +35,19 @@ CSavedGame::CSavedGame() {
setEpisode(g_pBehaviorEngine->getEpisode());
}
void CSavedGame::setGameDirectory(const std::string& game_directory)
void CSaveGameController::setGameDirectory(const std::string& game_directory)
{
m_savedir = JoinPaths("save", game_directory);
}
void CSavedGame::setEpisode(char Episode)
void CSaveGameController::setEpisode(char Episode)
{ m_Episode = Episode; }
void CSavedGame::setLevel(int Level)
void CSaveGameController::setLevel(int Level)
{ m_Level = Level; }
// Retrieves the data size of the next block
Uint32 CSavedGame::getDataSize(std::ifstream &StateFile) {
Uint32 CSaveGameController::getDataSize(std::ifstream &StateFile) {
Uint32 size=0;
for(Uint32 i=0 ; i<sizeof(Uint32) ; i++) {
size += StateFile.get() << (i*8);
......@@ -55,10 +56,10 @@ Uint32 CSavedGame::getDataSize(std::ifstream &StateFile) {
}
// Return a string that just says empty
std::string CSavedGame::getEmptyString()
std::string CSaveGameController::getEmptyString()
{ return m_emptyString; }
std::string CSavedGame::getUnnamedSlotName()
std::string CSaveGameController::getUnnamedSlotName()
{
std::string text;
time_t rawtime;
......@@ -77,7 +78,7 @@ std::string CSavedGame::getUnnamedSlotName()
}
// Read the data of size and stores it in the buffer
void CSavedGame::readData(char *buffer, Uint32 size, std::ifstream &StateFile) {
void CSaveGameController::readData(char *buffer, Uint32 size, std::ifstream &StateFile) {
for(Uint32 i=0 ; i<size ; i++) {
buffer[i] = StateFile.get();
}
......@@ -100,7 +101,7 @@ struct StateFileListFiller {
// This method returns the the list of files we can use for the menu
// It will filter by episode and sort the list by number of slot
// It also takes care of the slotname resolution
std::vector<std::string> CSavedGame::getSlotList()
std::vector<std::string> CSaveGameController::getSlotList()
{
std::vector<std::string> filelist;
std::string buf;
......@@ -132,7 +133,7 @@ std::vector<std::string> CSavedGame::getSlotList()
/* --- Functions for older savegames START --- */
bool CSavedGame::IsOldSGVersion5(const std::string& fname)
bool CSaveGameController::IsOldSGVersion5(const std::string& fname)
{
const char *verify = "CKSAVE";
FILE* fp = OpenGameFile(fname, "rb");
......@@ -157,7 +158,7 @@ bool CSavedGame::IsOldSGVersion5(const std::string& fname)
return true;
}
bool CSavedGame::IsOldSGVersion4(const std::string& fname)
bool CSaveGameController::IsOldSGVersion4(const std::string& fname)
{
FILE* fp = OpenGameFile(fname, "rb");
if (!fp) return false;
......@@ -172,7 +173,7 @@ bool CSavedGame::IsOldSGVersion4(const std::string& fname)
/**
* This to find the proper old save game version
*/
int CSavedGame::getOldSGVersion(const std::string& fname)
int CSaveGameController::getOldSGVersion(const std::string& fname)
{
if(IsOldSGVersion5(fname))
return 5;
......@@ -183,7 +184,7 @@ int CSavedGame::getOldSGVersion(const std::string& fname)
}
// This function converts savegame all files from old versions of CG to the new format
void CSavedGame::convertAllOldFormats()
void CSaveGameController::convertAllOldFormats()
{
for(size_t slot=0 ; slot<=9 ; slot++ )
convertOldFormat(slot);
......@@ -192,7 +193,7 @@ void CSavedGame::convertAllOldFormats()
/**
* This function loads the savegame of the 5th version
*/
bool CSavedGame::loadSaveGameVersion5(const std::string &fname, OldSaveGameFormatV5& old)
bool CSaveGameController::loadSaveGameVersion5(const std::string &fname, OldSaveGameFormatV5& old)
{
FILE *fp;
unsigned char episode, level, lives, numplayers;
......@@ -247,7 +248,7 @@ bool CSavedGame::loadSaveGameVersion5(const std::string &fname, OldSaveGameForma
return true;
}
bool CSavedGame::loadSaveGameVersion4(const std::string &fname, OldSaveGameFormatV4& old)
bool CSaveGameController::loadSaveGameVersion4(const std::string &fname, OldSaveGameFormatV4& old)
{
FILE *fp;
//unsigned char episode, level, lives;
......@@ -288,7 +289,7 @@ bool CSavedGame::loadSaveGameVersion4(const std::string &fname, OldSaveGameForma
}
// Converts one old savegame file to the new format...
bool CSavedGame::convertOldFormat(size_t slot)
bool CSaveGameController::convertOldFormat(size_t slot)
{
// TODO: Old CG 0.3.0.4 Code Handle with care
std::string fname;
......@@ -328,7 +329,7 @@ bool CSavedGame::convertOldFormat(size_t slot)
//
// Now let's save it into a new format
//
/// Save the Game in the CSavedGame object
/// Save the Game in the CSaveGameController object
// store the episode, level and difficulty
encodeData(old.LevelControl.episode);
encodeData(old.LevelControl.curlevel);
......@@ -390,7 +391,7 @@ bool CSavedGame::convertOldFormat(size_t slot)
//
// Now let's save it into a new format
//
/// Save the Game in the CSavedGame object
/// Save the Game in the CSaveGameController object
// store the episode, level and difficulty
encodeData(old.LevelControl.episode);
encodeData(old.LevelControl.curlevel);
......@@ -455,7 +456,7 @@ bool CSavedGame::convertOldFormat(size_t slot)
// this is seperated out of game_load for modularity because menumanager.c
// also uses it, in it's save-game "preview" menu on the load game screen
void CSavedGame::readOldHeader(FILE *fp, byte *episode, byte *level, byte *lives, byte *num_players)
void CSaveGameController::readOldHeader(FILE *fp, byte *episode, byte *level, byte *lives, byte *num_players)
{
fseek(fp, SG_HEADERSIZE, SEEK_SET); // skip past the CKSAVE%c
*episode = fgetc(fp);
......@@ -467,7 +468,7 @@ void CSavedGame::readOldHeader(FILE *fp, byte *episode, byte *level, byte *lives
/* --- Functions for older savegames END --- */
// From judging the filename it tells you at what position this slot was saved!
Uint32 CSavedGame::getSlotNumber(const std::string &filename)
Uint32 CSaveGameController::getSlotNumber(const std::string &filename)
{
int pos = filename.find("cksave") + strlen("cksave");
std::string buf = filename.substr(pos);
......@@ -477,7 +478,7 @@ Uint32 CSavedGame::getSlotNumber(const std::string &filename)
}
// This method returns the name of the slot
std::string CSavedGame::getSlotName(const std::string &filename)
std::string CSaveGameController::getSlotName(const std::string &filename)
{
char version;
std::ifstream StateFile;
......@@ -511,7 +512,7 @@ std::string CSavedGame::getSlotName(const std::string &filename)
* \param SaveSlot Slot where to check for the file
* \return true if it exists, else false
*/
bool CSavedGame::Fileexists( int SaveSlot )
bool CSaveGameController::Fileexists( int SaveSlot )
{
std::string filename = m_savedir + "/cksave"+itoa(SaveSlot)+".ck"+itoa(m_Episode);
return IsFileAvailable(filename);
......@@ -519,7 +520,7 @@ bool CSavedGame::Fileexists( int SaveSlot )
// This method is called by the menu. It assures that the
// PlayGame instance will call save() and get the right data.
bool CSavedGame::prepareSaveGame( int SaveSlot, const std::string &Name)
bool CSaveGameController::prepareSaveGame( int SaveSlot, const std::string &Name)
{
m_statefilename = m_savedir + "/cksave"+itoa(SaveSlot)+".ck"+itoa(m_Episode);
m_statename = Name;
......@@ -534,7 +535,7 @@ bool CSavedGame::prepareSaveGame( int SaveSlot, const std::string &Name)
// This method is called by the menu. It assures that the
// PlayGame instance will call load() and get the right data.
bool CSavedGame::prepareLoadGame(int SaveSlot)
bool CSaveGameController::prepareLoadGame(int SaveSlot)
{
const std::string savefile = "cksave" + itoa(SaveSlot) + ".ck"+itoa(m_Episode);
m_statefilename = JoinPaths(m_savedir, savefile);
......@@ -546,7 +547,7 @@ bool CSavedGame::prepareLoadGame(int SaveSlot)
return true;
}
bool CSavedGame::load()
bool CSaveGameController::load()
{
Uint32 size;
std::ifstream StateFile;
......@@ -583,7 +584,7 @@ bool CSavedGame::load()
}
// This function checks if the file we want to read or save already exists
bool CSavedGame::alreadyExits()
bool CSaveGameController::alreadyExits()
{
std::ifstream StateFile;
std::string fullpath = GetFullFileName(m_statefilename);
......@@ -600,7 +601,7 @@ bool CSavedGame::alreadyExits()
// This function writes all the data from the CPlayGame and CMenu Instances to a file,
// closes it and flushes the data block.
bool CSavedGame::save()
bool CSaveGameController::save()
{
std::ofstream StateFile;
std::string fullpath = GetFullFileName(m_statefilename);
......@@ -657,7 +658,7 @@ bool CSavedGame::save()
}
// Adds data of size to the main data block
void CSavedGame::addData(byte *data, Uint32 size) {
void CSaveGameController::addData(byte *data, Uint32 size) {
for(Uint32 i=0 ; i<sizeof(Uint32) ; i++ )
{
Uint32 datasize;
......@@ -670,7 +671,7 @@ void CSavedGame::addData(byte *data, Uint32 size) {
}
// Read data of size from the main data block
void CSavedGame::readDataBlock(byte *data) {
void CSaveGameController::readDataBlock(byte *data) {
Uint32 datasize=0;
memcpy(&datasize, &m_datablock[m_offset], sizeof(Uint32));
m_offset += sizeof(Uint32);
......
/*
* CSavedGame.h
* CSaveGameController.h
*
* Created on: 13.08.2009
* Author: gerstrong
......@@ -18,6 +18,7 @@
#include "StringUtils.h"
#include "fileio/TypeDefinitions.h"
#include "CSingleton.h"
#include "Oldsavegamestructs.h"
......@@ -30,14 +31,18 @@
const int MENU_WIDTH = 40;
const int TEXT_WIDTH = 40-4;
class CSavedGame {
#define gpSaveGameController CSaveGameController::Get()
class CSaveGameController : public CSingleton<CSaveGameController>
{
public:
enum SavedGameCommands{
enum SavedGameCommands
{
NONE, SAVE, LOAD
};
// Initialization
CSavedGame();
CSaveGameController();
// Setters
void setGameDirectory(const std::string& game_directory);
......
/*
* CSavedGameCoder.h
* CSaveGameControllerCoder.h
*
* Created on: 24.11.2009
* Author: gerstrong
......@@ -19,7 +19,7 @@
// This functions are used for enconding/decoding a variable to the game data format.
// It makes everything platform independent
template <class S>
void CSavedGame::encodeData(S structure)
void CSaveGameController::encodeData(S structure)
{
size_t size = sizeof(S);
byte sizebuf[sizeof(size_t)];
......@@ -35,7 +35,7 @@ void CSavedGame::encodeData(S structure)
}
template <class S>
void CSavedGame::decodeData(S &structure)
void CSaveGameController::decodeData(S &structure)
{
size_t det_size = 0;
size_t req_size = sizeof(S);
......
/*
* CGUIInputText.cpp
*
* Created on: 25.03.2012
* Author: gerstrong
*/
#include "CGUIInputText.h"
#include "graphics/CGfxEngine.h"
#include "sdl/input/CInput.h"
#include "sdl/input/InputEvents.h"
#include "sdl/CVideoDriver.h"
#include "common/CBehaviorEngine.h"
#include "core/CGameMode.h"
#include "sdl/CTimer.h"
CGUIInputText::CGUIInputText( const std::string& text,
const SmartPointer<CEvent> ev,
const Style style )
{
// TODO Auto-generated constructor stub
}
void CGUIInputText::sendEvent(const InputCommands command)
{
if(command == IC_STATUS)
{
g_pBehaviorEngine->m_EventList.add(mEvent);