This commit is contained in:
Simon 2021-01-03 22:18:31 +00:00
commit 429ad68966
3 changed files with 22 additions and 5 deletions

View File

@ -1227,6 +1227,21 @@ idStr idSessionLocal::GetAutoSaveName( const char *mapName ) const {
return va( "^3AutoSave:^0 %s", mapName );
}
/*
===============
idSessionLocal::GetAutoSaveName
===============
*/
idStr idSessionLocal::GetSaveMapName( const char *mapName ) const {
const idDecl *mapDecl = declManager->FindType( DECL_MAPDEF, mapName, false );
const idDeclEntityDef *mapDef = static_cast<const idDeclEntityDef *>( mapDecl );
if ( mapDef ) {
mapName = common->GetLanguageDict()->GetString( mapDef->dict.GetString( "name", mapName ) );
}
// Fixme: Localization
return mapName;
}
/*
===============
idSessionLocal::MoveToNewMap

View File

@ -161,6 +161,7 @@ public:
void ScrubSaveGameFileName( idStr &saveFileName ) const;
idStr GetAutoSaveName( const char *mapName ) const;
idStr GetSaveMapName( const char *mapName ) const;
bool LoadGame(const char *saveName);
// DG: added saveFileName so we can set a sensible filename for autosaves (see comment in MoveToNewMap())

View File

@ -337,10 +337,11 @@ const char *TimeStampToFilename( ) {
idStr out;
// english gets "month/day/year hour:min" + "am" or "pm"
out = "Save: ";
out += va( "%d", time->tm_year + 1900 );
out += va( "%02d", time->tm_mon + 1 );
out += va( "%02d", time->tm_mday );
//out = "Save: ";
out = "-";
//out += va( "%d", time->tm_year + 1900 );
//out += va( "%02d", time->tm_mon + 1 );
//out += va( "%02d", time->tm_mday );
out += va( "%02d", time->tm_hour );
out += va( "%02d", time->tm_min );
out += va( "%02d", time->tm_sec );
@ -367,7 +368,7 @@ bool idSessionLocal::HandleSaveGameMenuCommand( idCmdArgs &args, int &icmd ) {
}
if ( !idStr::Icmp( cmd, "createNewName" ) ) {
guiActive->SetStateString( "saveGameName", TimeStampToFilename() );
guiActive->SetStateString( "saveGameName", "Save: " + GetSaveMapName( mapSpawnData.serverInfo.GetString("si_map")) + TimeStampToFilename() );
guiActive->StateChanged( com_frameTime );
return true;
}