mirror of
https://github.com/glest/glest-source.git
synced 2025-09-07 06:20:41 +02:00
"save game" in ingame menu( I don't know how a quick "load last saved game" ould work from ingame menu :-/ )
This commit is contained in:
@@ -107,6 +107,8 @@ Game::Game() : ProgramState(NULL) {
|
|||||||
exitGamePopupMenuIndex = -1;
|
exitGamePopupMenuIndex = -1;
|
||||||
joinTeamPopupMenuIndex = -1;
|
joinTeamPopupMenuIndex = -1;
|
||||||
pauseGamePopupMenuIndex = -1;
|
pauseGamePopupMenuIndex = -1;
|
||||||
|
saveGamePopupMenuIndex = -1;
|
||||||
|
loadGamePopupMenuIndex = -1;
|
||||||
keyboardSetupPopupMenuIndex = -1;
|
keyboardSetupPopupMenuIndex = -1;
|
||||||
masterserverMode = false;
|
masterserverMode = false;
|
||||||
currentUIState=NULL;
|
currentUIState=NULL;
|
||||||
@@ -152,6 +154,8 @@ void Game::resetMembers() {
|
|||||||
exitGamePopupMenuIndex = -1;
|
exitGamePopupMenuIndex = -1;
|
||||||
joinTeamPopupMenuIndex = -1;
|
joinTeamPopupMenuIndex = -1;
|
||||||
pauseGamePopupMenuIndex = -1;
|
pauseGamePopupMenuIndex = -1;
|
||||||
|
saveGamePopupMenuIndex = -1;
|
||||||
|
loadGamePopupMenuIndex = -1;
|
||||||
keyboardSetupPopupMenuIndex = -1;
|
keyboardSetupPopupMenuIndex = -1;
|
||||||
currentUIState = NULL;
|
currentUIState = NULL;
|
||||||
|
|
||||||
@@ -1119,11 +1123,18 @@ void Game::setupPopupMenus(bool checkClientAdminOverrideOnly) {
|
|||||||
joinTeamPopupMenuIndex = menuItems.size()-1;
|
joinTeamPopupMenuIndex = menuItems.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allowAdminMenuItems == true) {
|
if(allowAdminMenuItems == true){
|
||||||
menuItems.push_back(lang.get("PauseResumeGame"));
|
menuItems.push_back(lang.get("PauseResumeGame"));
|
||||||
pauseGamePopupMenuIndex = menuItems.size()-1;
|
pauseGamePopupMenuIndex= menuItems.size() - 1;
|
||||||
}
|
|
||||||
|
|
||||||
|
if(gameSettings.isNetworkGame() == false){
|
||||||
|
menuItems.push_back(lang.get("SaveGame"));
|
||||||
|
saveGamePopupMenuIndex= menuItems.size() - 1;
|
||||||
|
|
||||||
|
// menuItems.push_back(lang.get("LoadGame"));
|
||||||
|
// loadGamePopupMenuIndex= menuItems.size() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
menuItems.push_back(lang.get("Keyboardsetup"));
|
menuItems.push_back(lang.get("Keyboardsetup"));
|
||||||
keyboardSetupPopupMenuIndex = menuItems.size()-1;
|
keyboardSetupPopupMenuIndex = menuItems.size()-1;
|
||||||
menuItems.push_back(lang.get("Cancel"));
|
menuItems.push_back(lang.get("Cancel"));
|
||||||
@@ -1883,6 +1894,9 @@ void Game::mouseDownLeft(int x, int y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(result.first == saveGamePopupMenuIndex){
|
||||||
|
saveGame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(popupMenuSwitchTeams.mouseClick(x, y)) {
|
else if(popupMenuSwitchTeams.mouseClick(x, y)) {
|
||||||
//popupMenuSwitchTeams
|
//popupMenuSwitchTeams
|
||||||
@@ -2590,14 +2604,7 @@ void Game::keyDown(SDL_KeyboardEvent key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isKeyPressed(configKeys.getSDLKey("SaveGame"),key) == true) {
|
if(isKeyPressed(configKeys.getSDLKey("SaveGame"),key) == true) {
|
||||||
string file = this->saveGame(GameConstants::saveGameFilePattern);
|
saveGame();
|
||||||
char szBuf[8096]="";
|
|
||||||
sprintf(szBuf,lang.get("GameSaved","",true).c_str(),file.c_str());
|
|
||||||
console.addLine(szBuf);
|
|
||||||
|
|
||||||
Config &config= Config::getInstance();
|
|
||||||
config.setString("LastSavedGame",file);
|
|
||||||
config.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3584,6 +3591,18 @@ void Game::addNetworkCommandToReplayList(NetworkCommand* networkCommand, int wor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::saveGame(){
|
||||||
|
string file = this->saveGame(GameConstants::saveGameFilePattern);
|
||||||
|
char szBuf[8096]="";
|
||||||
|
Lang &lang= Lang::getInstance();
|
||||||
|
sprintf(szBuf,lang.get("GameSaved","",true).c_str(),file.c_str());
|
||||||
|
console.addLine(szBuf);
|
||||||
|
|
||||||
|
Config &config= Config::getInstance();
|
||||||
|
config.setString("LastSavedGame",file);
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
string Game::saveGame(string name) {
|
string Game::saveGame(string name) {
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
// auto name file if using saved file pattern string
|
// auto name file if using saved file pattern string
|
||||||
|
@@ -138,6 +138,8 @@ private:
|
|||||||
int exitGamePopupMenuIndex;
|
int exitGamePopupMenuIndex;
|
||||||
int joinTeamPopupMenuIndex;
|
int joinTeamPopupMenuIndex;
|
||||||
int pauseGamePopupMenuIndex;
|
int pauseGamePopupMenuIndex;
|
||||||
|
int saveGamePopupMenuIndex;
|
||||||
|
int loadGamePopupMenuIndex;
|
||||||
int keyboardSetupPopupMenuIndex;
|
int keyboardSetupPopupMenuIndex;
|
||||||
GLuint statelist3dMenu;
|
GLuint statelist3dMenu;
|
||||||
ProgramState *currentUIState;
|
ProgramState *currentUIState;
|
||||||
@@ -182,6 +184,7 @@ public:
|
|||||||
|
|
||||||
bool getPaused();
|
bool getPaused();
|
||||||
void setPaused(bool value, bool forceAllowPauseStateChange=false);
|
void setPaused(bool value, bool forceAllowPauseStateChange=false);
|
||||||
|
void saveGame();
|
||||||
const int getTotalRenderFps() const {return totalRenderFps;}
|
const int getTotalRenderFps() const {return totalRenderFps;}
|
||||||
|
|
||||||
void toggleTeamColorMarker();
|
void toggleTeamColorMarker();
|
||||||
|
Reference in New Issue
Block a user