From 35baed064a4fe3005b555a39dc8611ba1795bbbc Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 25 Aug 2014 01:49:35 +0300 Subject: [PATCH] WIP backup savegames to network --- src/fios_gui.cpp | 3 ++- src/lang/english.txt | 4 ++++ src/settings_type.h | 1 + src/table/gameopt_settings.ini | 10 ++++++++++ src/widgets/fios_widget.h | 2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 758acc961f..b91e4851cb 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -107,6 +107,7 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { EndContainer(), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_LOAD_NETWORK_BUTTON), SetDataTip(STR_SAVELOAD_LOAD_NETWORK_BUTTON, STR_SAVELOAD_LOAD_NETWORK_TOOLTIP), SetFill(1, 0), SetResize(1, 0), EndContainer(), EndContainer(), }; @@ -178,7 +179,7 @@ static const NWidgetPart _nested_save_dialog_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1), NWidget(NWID_HORIZONTAL), - NWidget(NWID_SPACER), SetResize(1, 0), SetFill(1, 1), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_SAVE_NETWORK_BUTTON), SetDataTip(STR_SAVELOAD_SAVE_NETWORK_BUTTON, STR_SAVELOAD_SAVE_NETWORK_TOOLTIP), SetFill(1, 1), SetResize(1, 0), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), EndContainer(), diff --git a/src/lang/english.txt b/src/lang/english.txt index 5e47b35588..6676947e5f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2716,6 +2716,10 @@ STR_SAVELOAD_SAVE_TOOLTIP :{BLACK}Save the STR_SAVELOAD_LOAD_BUTTON :{BLACK}Load STR_SAVELOAD_LOAD_TOOLTIP :{BLACK}Load the selected game STR_SAVELOAD_LOAD_HEIGHTMAP_TOOLTIP :{BLACK}Load the selected heightmap +STR_SAVELOAD_LOAD_NETWORK_BUTTON :{BLACK}Load from network +STR_SAVELOAD_LOAD_NETWORK_TOOLTIP :{BLACK}Load a game from the network storage +STR_SAVELOAD_SAVE_NETWORK_BUTTON :{BLACK}Save to network +STR_SAVELOAD_SAVE_NETWORK_TOOLTIP :{BLACK}Back up the game to the network storage STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Game Details STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}No information available STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING1} diff --git a/src/settings_type.h b/src/settings_type.h index 235b7bebc7..3936aa0694 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -105,6 +105,7 @@ struct GUISettings { ZoomLevelByte zoom_max; ///< maximum zoom out level bool disable_unsuitable_building; ///< disable infrastructure building when no suitable vehicles are available byte autosave; ///< how often should we do autosaves? + byte save_to_network; ///< backup all savegames to network bool threaded_saves; ///< should we do threaded saves? bool keep_all_autosave; ///< name the autosave in a different way bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?" diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini index 3a47c09e33..30b5f667a2 100644 --- a/src/table/gameopt_settings.ini +++ b/src/table/gameopt_settings.ini @@ -19,6 +19,7 @@ static const char *_locale_units = "imperial|metric|si"; static const char *_town_names = "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovak|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan"; static const char *_climates = "temperate|arctic|tropic|toyland"; static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly"; +static const char *_save_to_network = "ask|enabled|disabled"; static const char *_roadsides = "left|right"; static const char *_savegame_date = "long|short|iso"; #ifdef ENABLE_NETWORK @@ -173,6 +174,15 @@ max = 4 full = _autosave_interval cat = SC_BASIC +[SDTC_OMANY] +var = gui.save_to_network +type = SLE_UINT8 +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = 0 +max = 2 +full = _save_to_network +cat = SC_BASIC + [SDT_OMANY] base = GameSettings var = vehicle.road_side diff --git a/src/widgets/fios_widget.h b/src/widgets/fios_widget.h index c94655d767..3f4b49fbee 100644 --- a/src/widgets/fios_widget.h +++ b/src/widgets/fios_widget.h @@ -31,6 +31,8 @@ enum SaveLoadWidgets { WID_SL_NEWGRF_INFO, ///< Button to open NewGgrf configuration. WID_SL_LOAD_BUTTON, ///< Button to load game/scenario. WID_SL_MISSING_NEWGRFS, ///< Button to find missing NewGRFs online. + WID_SL_SAVE_NETWORK_BUTTON, ///< Toggle button to back up savegame to the network storage. + WID_SL_LOAD_NETWORK_BUTTON, ///< Button to load game from the network storage. }; #endif /* WIDGETS_FIOS_WIDGET_H */