Index: src/fios_gui.cpp =================================================================== --- src/fios_gui.cpp (revision 24260) +++ src/fios_gui.cpp (working copy) @@ -66,6 +66,11 @@ this->gamelog_actions = 0; ClearGRFConfigList(&this->grfconfig); + + if(this->savefile_modification_date != NULL) { + free(savefile_modification_date); + savefile_modification_date = NULL; + } } /** Load game/scenario with optional content download */ @@ -432,6 +437,17 @@ } if (y > y_max) break; + /* Date of File */ + if(_load_check_data.savefile_modification_date != NULL) { + uint32 day = _load_check_data.savefile_modification_date->tm_mday; + uint32 month = _load_check_data.savefile_modification_date->tm_mon + 1; /* tm_mon are the month since January */ + uint32 year = _load_check_data.savefile_modification_date->tm_year + 1900; /* tm_year stores the years since 1900 */ + SetDParam(0, ConvertYMDToDate(year, month, day)); + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_FILE_DATE); + y += FONT_HEIGHT_NORMAL; + if (y > y_max) break; + } + /* Hide the company stuff for scenarios */ if (_saveload_mode != SLD_LOAD_SCENARIO && _saveload_mode != SLD_SAVE_SCENARIO) { y += FONT_HEIGHT_NORMAL; Index: src/saveload/saveload.h =================================================================== --- src/saveload/saveload.h (revision 24260) +++ src/saveload/saveload.h (working copy) @@ -15,6 +15,10 @@ #include "../fileio_type.h" #include "../strings_type.h" +#include +#include +#include + /** Save or load result codes. */ enum SaveOrLoadResult { SL_OK = 0, ///< completed successfully Index: src/saveload/saveload.cpp =================================================================== --- src/saveload/saveload.cpp (revision 24260) +++ src/saveload/saveload.cpp (working copy) @@ -2515,12 +2515,36 @@ } /** + * Load the modification date of the file and store it in _load_check_data.savefile_modification_date. + * + * @param filename The file that is being loaded. + * @return Return the result of the action. #SL_OK or #SL_ERROR + */ +SaveOrLoadResult SlLoadFileMetaInformation(const char *filename) +{ + struct stat fst; + memset(&fst, 0, sizeof(fst)); + if (stat(filename,&fst) == 0) { /* Load the file information */ + struct tm *modification_date; + modification_date = localtime(&fst.st_mtime); + /* Localtime returns a pointer to an static internal memory used for every call. Therefore we need to allocate memory and copy the date. */ + _load_check_data.savefile_modification_date = (struct tm*) malloc(sizeof(struct tm)); + memcpy(_load_check_data.savefile_modification_date, modification_date, sizeof(struct tm)); + return SL_OK; + } else { + _load_check_data.savefile_modification_date = NULL; + return SL_ERROR; + } + +} + +/** * Actually perform the loading of a "non-old" savegame. * @param reader The filter to read the savegame from. * @param load_check Whether to perform the checking ("preview") or actually load the game. * @return Return the result of the action. #SL_OK or #SL_REINIT ("unload" the game) */ -static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check) +static SaveOrLoadResult DoLoad(const char *filename, LoadFilter *reader, bool load_check) { _sl.lf = reader; @@ -2624,6 +2648,7 @@ /* Load chunks into _load_check_data. * No pools are loaded. References are not possible, and thus do not need resolving. */ SlLoadCheckChunks(); + SlLoadFileMetaInformation(filename); } else { /* Load chunks and resolve references */ SlLoadChunks(); @@ -2662,7 +2687,7 @@ { try { _sl.action = SLA_LOAD; - return DoLoad(reader, false); + return DoLoad(NULL, reader, false); } catch (...) { ClearSaveLoadState(); return SL_REINIT; @@ -2739,7 +2764,7 @@ /* LOAD game */ assert(mode == SL_LOAD || mode == SL_LOAD_CHECK); DEBUG(desync, 1, "load: %s", filename); - return DoLoad(new FileReader(fh), mode == SL_LOAD_CHECK); + return DoLoad(filename, new FileReader(fh), mode == SL_LOAD_CHECK); } catch (...) { ClearSaveLoadState(); Index: src/fios.h =================================================================== --- src/fios.h (revision 24260) +++ src/fios.h (working copy) @@ -40,6 +40,8 @@ struct LoggedAction *gamelog_action; ///< Gamelog actions uint gamelog_actions; ///< Number of gamelog actions + struct tm *savefile_modification_date; + LoadCheckData() : error_data(NULL), grfconfig(NULL), gamelog_action(NULL) { this->Clear(); Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 24260) +++ src/lang/english.txt (working copy) @@ -1742,6 +1742,7 @@ STR_NETWORK_SERVER_LIST_LANGUAGE :{SILVER}Language: {WHITE}{STRING} STR_NETWORK_SERVER_LIST_LANDSCAPE :{SILVER}Landscape: {WHITE}{STRING} STR_NETWORK_SERVER_LIST_MAP_SIZE :{SILVER}Map size: {WHITE}{COMMA}x{COMMA} +STR_NETWORK_SERVER_LIST_FILE_DATE :{SILVER}Date of File: {WHITE}{DATE_LONG} STR_NETWORK_SERVER_LIST_SERVER_VERSION :{SILVER}Server version: {WHITE}{RAW_STRING} STR_NETWORK_SERVER_LIST_SERVER_ADDRESS :{SILVER}Server address: {WHITE}{RAW_STRING} STR_NETWORK_SERVER_LIST_START_DATE :{SILVER}Start date: {WHITE}{DATE_SHORT}