Refactor the preferences into a proper singleton. (#8930)
The current preferences handling is a mess: * it's essentially a global config object that anything can modify in any way the caller wants, which is managed across multiple source files which have their own oddities and interdependencies. * the general preferences has its own bit of SDL event handling and while I get the idea behind `events::sdl_handler` there's no reason to have SDL events handled in the preferences instead of just calling the relevant preferences setter for each event when it happens. * the general preferences is where most of the preferences are handled and has its `base_manager` struct, which is part of the `manager` struct in the game preferences, which is then implicitly initialized as part of game_launcher's constructor. * the editor preferences are the only preferences in a sub-namespace `preferences::editor` while all other preferences are just in the `preferences` namespace. * the display, editor, and lobby preferences are all dependent on including the game preferences, the credentials are dependent on including the general preferences (but not the game preferences), the game preferences are dependent on including the general preferences, and the advanced preferences are entirely their own thing which is dependent on none of the other preference functionality and manages its own singleton. * nothing checks whether the preferences file has actually been loaded before allowing values to be read from or written to the preferences config - if you attempt to get a value too early in wesnoth's initialization it will silently just give you whatever the default value for that preference happens to be. With this there is instead a single access point (with exceptions handled via friend functions/classes), all predefined preferences are accessed via their own setter/getter, and all mainline preferences are defined in a single file (preference_list.hpp) so it's easily findable what preferences exist and where they're used. Having the list of all mainline preferences listed out also allows the lua preferences API to provide that full list rather than just the list of the preferences that have been set so far. Also it now checks for whether the location of the preferences file is known before attempting to load the preferences file and asserts if someone attempts to use the preferences too early.
This commit is contained in:
parent
81a1ef260d
commit
971073055e
142 changed files with 5090 additions and 5076 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -221,6 +221,7 @@ config.h
|
|||
callgrind.out.*
|
||||
data/dist
|
||||
clean.sh
|
||||
widgets_tested.log
|
||||
|
||||
# clangd cache
|
||||
.cache/clangd
|
||||
|
|
|
@ -889,20 +889,9 @@
|
|||
<Unit filename="../../src/playsingle_controller.hpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.cpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.hpp" />
|
||||
<Unit filename="../../src/preferences/advanced.cpp" />
|
||||
<Unit filename="../../src/preferences/advanced.hpp" />
|
||||
<Unit filename="../../src/preferences/credentials.cpp" />
|
||||
<Unit filename="../../src/preferences/credentials.hpp" />
|
||||
<Unit filename="../../src/preferences/display.cpp" />
|
||||
<Unit filename="../../src/preferences/display.hpp" />
|
||||
<Unit filename="../../src/preferences/editor.cpp" />
|
||||
<Unit filename="../../src/preferences/editor.hpp" />
|
||||
<Unit filename="../../src/preferences/game.cpp" />
|
||||
<Unit filename="../../src/preferences/game.hpp" />
|
||||
<Unit filename="../../src/preferences/general.cpp" />
|
||||
<Unit filename="../../src/preferences/general.hpp" />
|
||||
<Unit filename="../../src/preferences/lobby.cpp" />
|
||||
<Unit filename="../../src/preferences/lobby.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences.cpp" />
|
||||
<Unit filename="../../src/preferences/preferences.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences_list.hpp" />
|
||||
<Unit filename="../../src/quit_confirmation.cpp" />
|
||||
<Unit filename="../../src/quit_confirmation.hpp" />
|
||||
<Unit filename="../../src/random.cpp" />
|
||||
|
|
|
@ -971,20 +971,9 @@
|
|||
<Unit filename="../../src/playsingle_controller.hpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.cpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.hpp" />
|
||||
<Unit filename="../../src/preferences/advanced.cpp" />
|
||||
<Unit filename="../../src/preferences/advanced.hpp" />
|
||||
<Unit filename="../../src/preferences/credentials.cpp" />
|
||||
<Unit filename="../../src/preferences/credentials.hpp" />
|
||||
<Unit filename="../../src/preferences/display.cpp" />
|
||||
<Unit filename="../../src/preferences/display.hpp" />
|
||||
<Unit filename="../../src/preferences/editor.cpp" />
|
||||
<Unit filename="../../src/preferences/editor.hpp" />
|
||||
<Unit filename="../../src/preferences/game.cpp" />
|
||||
<Unit filename="../../src/preferences/game.hpp" />
|
||||
<Unit filename="../../src/preferences/general.cpp" />
|
||||
<Unit filename="../../src/preferences/general.hpp" />
|
||||
<Unit filename="../../src/preferences/lobby.cpp" />
|
||||
<Unit filename="../../src/preferences/lobby.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences.cpp" />
|
||||
<Unit filename="../../src/preferences/preferences.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences_list.hpp" />
|
||||
<Unit filename="../../src/quit_confirmation.cpp" />
|
||||
<Unit filename="../../src/quit_confirmation.hpp" />
|
||||
<Unit filename="../../src/random.cpp" />
|
||||
|
|
|
@ -1007,20 +1007,9 @@
|
|||
<Unit filename="../../src/playsingle_controller.hpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.cpp" />
|
||||
<Unit filename="../../src/playturn_network_adapter.hpp" />
|
||||
<Unit filename="../../src/preferences/advanced.cpp" />
|
||||
<Unit filename="../../src/preferences/advanced.hpp" />
|
||||
<Unit filename="../../src/preferences/credentials.cpp" />
|
||||
<Unit filename="../../src/preferences/credentials.hpp" />
|
||||
<Unit filename="../../src/preferences/display.cpp" />
|
||||
<Unit filename="../../src/preferences/display.hpp" />
|
||||
<Unit filename="../../src/preferences/editor.cpp" />
|
||||
<Unit filename="../../src/preferences/editor.hpp" />
|
||||
<Unit filename="../../src/preferences/game.cpp" />
|
||||
<Unit filename="../../src/preferences/game.hpp" />
|
||||
<Unit filename="../../src/preferences/general.cpp" />
|
||||
<Unit filename="../../src/preferences/general.hpp" />
|
||||
<Unit filename="../../src/preferences/lobby.cpp" />
|
||||
<Unit filename="../../src/preferences/lobby.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences.cpp" />
|
||||
<Unit filename="../../src/preferences/preferences.hpp" />
|
||||
<Unit filename="../../src/preferences/preferences_list.hpp" />
|
||||
<Unit filename="../../src/quit_confirmation.cpp" />
|
||||
<Unit filename="../../src/quit_confirmation.hpp" />
|
||||
<Unit filename="../../src/random.cpp" />
|
||||
|
|
|
@ -87,12 +87,6 @@
|
|||
4649B87E20288DC000827CFB /* random_deterministic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC0680231EA920A300EEE03B /* random_deterministic.cpp */; };
|
||||
4649B87F20288DC300827CFB /* random_synced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC0680251EA920A300EEE03B /* random_synced.cpp */; };
|
||||
4649B88020288DC600827CFB /* random.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC0680271EA920A300EEE03B /* random.cpp */; };
|
||||
4649B88120288DF200827CFB /* credentials.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 903F959B1ED5489500F1BDD3 /* credentials.cpp */; };
|
||||
4649B88220288DF500827CFB /* display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017B1EBE0C4500AE66EE /* display.cpp */; };
|
||||
4649B88320288DF800827CFB /* editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017D1EBE0C4500AE66EE /* editor.cpp */; };
|
||||
4649B88420288DFB00827CFB /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017F1EBE0C4500AE66EE /* game.cpp */; };
|
||||
4649B88520288DFE00827CFB /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5401811EBE0C4500AE66EE /* general.cpp */; };
|
||||
4649B88620288E0000827CFB /* lobby.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5401831EBE0C4500AE66EE /* lobby.cpp */; };
|
||||
4649B88720288E3E00827CFB /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECE09A531EBA529D0020C97B /* parser.cpp */; };
|
||||
4649B88B20288EEF00827CFB /* surface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC669C251DFC95AF00172EED /* surface.cpp */; };
|
||||
4649B88D20288EF900827CFB /* point.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECB6A6321FB8AAC400877C20 /* point.cpp */; };
|
||||
|
@ -259,8 +253,6 @@
|
|||
46D60158255AFA7E00E072F0 /* commandline_argv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46D60156255AFA7E00E072F0 /* commandline_argv.cpp */; };
|
||||
46D60159255AFA7E00E072F0 /* commandline_argv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46D60156255AFA7E00E072F0 /* commandline_argv.cpp */; };
|
||||
46D60162255AFDE100E072F0 /* commandline_argv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46D60156255AFA7E00E072F0 /* commandline_argv.cpp */; };
|
||||
46D6CA012586A176001F0464 /* advanced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46D6C9FF2586A175001F0464 /* advanced.cpp */; };
|
||||
46D6CA022586A176001F0464 /* advanced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46D6C9FF2586A175001F0464 /* advanced.cpp */; };
|
||||
46E2D98F25022BF5003D99F3 /* lua_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46E2D98B25022BF5003D99F3 /* lua_widget.cpp */; };
|
||||
46E2D99025022BF5003D99F3 /* lua_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46E2D98B25022BF5003D99F3 /* lua_widget.cpp */; };
|
||||
46E2D99125022BF6003D99F3 /* lua_widget_attributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46E2D98D25022BF5003D99F3 /* lua_widget_attributes.cpp */; };
|
||||
|
@ -630,6 +622,7 @@
|
|||
4E4A4DBC9F44444A5867EC2B /* migrate_version_selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7B1444E9B79504502208B82 /* migrate_version_selection.cpp */; };
|
||||
508C40A885166B2E3F4245F4 /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; };
|
||||
529242A8856DE8D00988B9BD /* test_schema_self_validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A04033A9545CFE8A226FBD /* test_schema_self_validator.cpp */; };
|
||||
61AB44F89B2EC1B6F92F0193 /* preferences_list.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 95EA4B82BB8CCCBEDD7A00E3 /* preferences_list.hpp */; };
|
||||
620A386E15E9364E00A4F513 /* attack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386215E9364E00A4F513 /* attack.cpp */; };
|
||||
620A386F15E9364E00A4F513 /* create.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386415E9364E00A4F513 /* create.cpp */; };
|
||||
620A387015E9364F00A4F513 /* heal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386615E9364E00A4F513 /* heal.cpp */; };
|
||||
|
@ -673,18 +666,18 @@
|
|||
6A1F44688986D07EB5DBEF75 /* gui_test_dialog.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0110429EAA81AED07D53B749 /* gui_test_dialog.hpp */; };
|
||||
6D574EACA3483ABEE72819F0 /* statistics_record.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27764FB68F02032F1C0B6748 /* statistics_record.cpp */; };
|
||||
77D94146A5FA29849D1A9BD8 /* multiline_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B0F48CE9CF65D9813BE6CDC /* multiline_text.cpp */; };
|
||||
805143B8BABF92CA79BEC8F5 /* gui_test_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7FBD4033B4B52E9424819B5F /* gui_test_dialog.cpp */; };
|
||||
7A0347D48BDB52B1430D9E79 /* migrate_version_selection.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B3DE4F95AF72C6F6BC37E695 /* migrate_version_selection.hpp */; };
|
||||
7A7146D7893AA09891352019 /* test_schema_validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF14AB694764953E2CB3AF7 /* test_schema_validator.cpp */; };
|
||||
7BFC4DF5BFF8CF75855BA662 /* prompt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 67044415B63F5888193BD7A6 /* prompt.cpp */; };
|
||||
7FDF4E8D9C94E7DA8F41F7BB /* tod_new_schedule.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 5D46466DBCD81B13621C7342 /* tod_new_schedule.hpp */; };
|
||||
805143B8BABF92CA79BEC8F5 /* gui_test_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7FBD4033B4B52E9424819B5F /* gui_test_dialog.cpp */; };
|
||||
8150449A8C3B2EC4FD38A44B /* preferences_list.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 95EA4B82BB8CCCBEDD7A00E3 /* preferences_list.hpp */; };
|
||||
867141839BDB89BFE876E310 /* carryover_show_gold.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09A440B1A671C45BE2924FB4 /* carryover_show_gold.cpp */; };
|
||||
87744447951D17AA38BE5F48 /* mp_report.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 58C649488B3014E6F7254B62 /* mp_report.cpp */; };
|
||||
8C704B6F99C824A4073EEBEE /* prompt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 67044415B63F5888193BD7A6 /* prompt.cpp */; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
8E1D442FB4DA43385F58F77F /* combobox.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B3534BCB9BB2673B5E513D67 /* combobox.hpp */; };
|
||||
900000000000000000000009 /* match_history.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4685A5F925B4501E006FD3A1 /* match_history.cpp */; };
|
||||
903F959C1ED5489500F1BDD3 /* credentials.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 903F959B1ED5489500F1BDD3 /* credentials.cpp */; };
|
||||
903F959F1ED5496700F1BDD3 /* hash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B52EE8AD121359A600CFBDAB /* hash.cpp */; };
|
||||
90606A2B1D5599BA00719B40 /* libpcre.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 90606A2A1D5599BA00719B40 /* libpcre.1.dylib */; };
|
||||
9107AE181DB32899001927B0 /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = EC89A1061879D17D00A3B0B1 /* lapi.c */; };
|
||||
|
@ -1134,7 +1127,9 @@
|
|||
9B4B41D29C90B05F03DE21B0 /* edit_pbl_translation.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C679447D91FD3623CC852FF8 /* edit_pbl_translation.hpp */; };
|
||||
9C2743DE8100448B66F7E0AF /* combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 875E45698F8A8D5B750E7317 /* combobox.cpp */; };
|
||||
9C6342BC8A95B6D23D384486 /* gui_test_dialog.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0110429EAA81AED07D53B749 /* gui_test_dialog.hpp */; };
|
||||
9FE64884AE8121CDBABF7D8A /* preferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C1D64406873FEB11E9758A05 /* preferences.cpp */; };
|
||||
AC4242F78B39C571E34AF48F /* edit_unit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A05D48F0A2C022FC128C8B3E /* edit_unit.cpp */; };
|
||||
B45C431C9B7250C3321F8BC2 /* preferences.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2CFD4922B64EA6C9F71F71A2 /* preferences.hpp */; };
|
||||
B508D193100146E300B12852 /* engine_fai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B508D191100146E300B12852 /* engine_fai.cpp */; };
|
||||
B513B2290ED36BFB0006E551 /* libcairo.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B513B2270ED36BFB0006E551 /* libcairo.2.dylib */; };
|
||||
B52EE8841213585300CFBDAB /* tod_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B52EE8821213585300CFBDAB /* tod_manager.cpp */; };
|
||||
|
@ -1292,6 +1287,8 @@
|
|||
D2E9440BBCDCE2A75C93F85D /* migrate_version_selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7B1444E9B79504502208B82 /* migrate_version_selection.cpp */; };
|
||||
DC764C9F94D8B634B47A92B0 /* rich_label.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5E2430098E9A628933A1DB1 /* rich_label.cpp */; };
|
||||
DDA14069BCE29DE0FE71B970 /* gui_test_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7FBD4033B4B52E9424819B5F /* gui_test_dialog.cpp */; };
|
||||
D9E94D2083155213BFA6EDD6 /* preferences.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2CFD4922B64EA6C9F71F71A2 /* preferences.hpp */; };
|
||||
DDE34117BDAA30C965F6E4DB /* preferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C1D64406873FEB11E9758A05 /* preferences.cpp */; };
|
||||
DF974010BB46B844E83F7DDA /* tod_new_schedule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61F473D9AC43768A445E218 /* tod_new_schedule.cpp */; };
|
||||
E1DA41878F0C255769B8239D /* scroll_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755D4555A1DEA29125E7F338 /* scroll_text.cpp */; };
|
||||
E2F24C0CBC863C3DC8A041EF /* edit_pbl.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B2CC45FEA71445AE817CAA6B /* edit_pbl.hpp */; };
|
||||
|
@ -1350,11 +1347,6 @@
|
|||
EC4E3B1D19B2D7AD0049CBD7 /* map_generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC4E3B1A19B2D7AD0049CBD7 /* map_generator.cpp */; };
|
||||
EC4E3B2219B2D8880049CBD7 /* simulated_actions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC4E3B2119B2D8880049CBD7 /* simulated_actions.cpp */; };
|
||||
EC51DB7818F8BFA4004621D9 /* playturn_network_adapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC51DB7618F8BFA4004621D9 /* playturn_network_adapter.cpp */; };
|
||||
EC5401851EBE0C4500AE66EE /* display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017B1EBE0C4500AE66EE /* display.cpp */; };
|
||||
EC5401861EBE0C4500AE66EE /* editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017D1EBE0C4500AE66EE /* editor.cpp */; };
|
||||
EC5401871EBE0C4500AE66EE /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC54017F1EBE0C4500AE66EE /* game.cpp */; };
|
||||
EC5401881EBE0C4500AE66EE /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5401811EBE0C4500AE66EE /* general.cpp */; };
|
||||
EC5401891EBE0C4500AE66EE /* lobby.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5401831EBE0C4500AE66EE /* lobby.cpp */; };
|
||||
EC5430231A4E6024006D206C /* lua_team.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5430211A4E6024006D206C /* lua_team.cpp */; };
|
||||
EC5430241A4E6024006D206C /* lua_unit_type.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5430221A4E6024006D206C /* lua_unit_type.cpp */; };
|
||||
EC5590771A0B11C600675179 /* lua_map_generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC5590761A0B11C600675179 /* lua_map_generator.cpp */; };
|
||||
|
@ -1593,6 +1585,7 @@
|
|||
20E644DC98F26C756364EC2C /* choose_addon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = choose_addon.cpp; sourceTree = "<group>"; };
|
||||
26A04033A9545CFE8A226FBD /* test_schema_self_validator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = test_schema_self_validator.cpp; path = test_schema_self_validator.cpp; sourceTree = "<group>"; };
|
||||
27764FB68F02032F1C0B6748 /* statistics_record.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = statistics_record.cpp; sourceTree = "<group>"; };
|
||||
2CFD4922B64EA6C9F71F71A2 /* preferences.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = preferences.hpp; path = preferences/preferences.hpp; sourceTree = "<group>"; };
|
||||
46081FED2B2F0F6A006ACAD7 /* libpcre2-8.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libpcre2-8.0.dylib"; path = "lib/libpcre2-8.0.dylib"; sourceTree = "<group>"; };
|
||||
46081FF02B2F103E006ACAD7 /* libwebpdemux.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libwebpdemux.2.dylib; path = lib/libwebpdemux.2.dylib; sourceTree = "<group>"; };
|
||||
46081FF32B2F11F3006ACAD7 /* libsharpyuv.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsharpyuv.0.dylib; path = lib/libsharpyuv.0.dylib; sourceTree = "<group>"; };
|
||||
|
@ -1739,8 +1732,6 @@
|
|||
46D6014D255AFA6000E072F0 /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = options.cpp; sourceTree = "<group>"; };
|
||||
46D60156255AFA7E00E072F0 /* commandline_argv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandline_argv.cpp; sourceTree = "<group>"; };
|
||||
46D60157255AFA7E00E072F0 /* commandline_argv.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = commandline_argv.hpp; sourceTree = "<group>"; };
|
||||
46D6C9FF2586A175001F0464 /* advanced.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = advanced.cpp; path = preferences/advanced.cpp; sourceTree = "<group>"; };
|
||||
46D6CA002586A176001F0464 /* advanced.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = advanced.hpp; path = preferences/advanced.hpp; sourceTree = "<group>"; };
|
||||
46DF5BCB1F46173700BE6D24 /* irdya_datetime.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = irdya_datetime.hpp; sourceTree = "<group>"; };
|
||||
46DF5BCC1F46173700BE6D24 /* irdya_datetime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = irdya_datetime.cpp; sourceTree = "<group>"; };
|
||||
46E2D98925022BF4003D99F3 /* lua_widget_methods.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_widget_methods.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2224,8 +2215,6 @@
|
|||
875E45698F8A8D5B750E7317 /* combobox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = combobox.cpp; path = combobox.cpp; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* The Battle for Wesnoth.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "The Battle for Wesnoth.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
903F959B1ED5489500F1BDD3 /* credentials.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = credentials.cpp; path = preferences/credentials.cpp; sourceTree = "<group>"; };
|
||||
903F959D1ED5489D00F1BDD3 /* credentials.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = credentials.hpp; path = preferences/credentials.hpp; sourceTree = "<group>"; };
|
||||
90606A2A1D5599BA00719B40 /* libpcre.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpcre.1.dylib; path = lib/libpcre.1.dylib; sourceTree = "<group>"; };
|
||||
9107AE141DB32862001927B0 /* liblua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblua.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9107AE551DB5BD3B001927B0 /* lprefix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lprefix.h; sourceTree = "<group>"; };
|
||||
|
@ -2415,6 +2404,7 @@
|
|||
91FBBAD71CB6BC3F00470BFE /* filesystem_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = filesystem_sdl.cpp; sourceTree = "<group>"; };
|
||||
91FBBAD91CB6D1B700470BFE /* markov_generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = markov_generator.cpp; sourceTree = "<group>"; };
|
||||
91FBBADA1CB6D1B700470BFE /* markov_generator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = markov_generator.hpp; sourceTree = "<group>"; };
|
||||
95EA4B82BB8CCCBEDD7A00E3 /* preferences_list.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = preferences_list.hpp; path = preferences_list.hpp; sourceTree = "<group>"; };
|
||||
95EB8A50287A02B800B09F95 /* draw_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = draw_manager.cpp; sourceTree = "<group>"; };
|
||||
95EB8A51287A02B800B09F95 /* draw_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = draw_manager.hpp; sourceTree = "<group>"; };
|
||||
95EB8A53287A02EC00B09F95 /* top_level_drawable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = top_level_drawable.hpp; path = gui/core/top_level_drawable.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2744,6 +2734,7 @@
|
|||
B5CE46F712A0417D00D665EE /* side_filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = side_filter.cpp; sourceTree = "<group>"; };
|
||||
B5CE46F812A0417D00D665EE /* side_filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = side_filter.hpp; sourceTree = "<group>"; };
|
||||
BF3B41AF9FEBC9C3A11736A2 /* tab_container.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tab_container.hpp; path = tab_container.hpp; sourceTree = "<group>"; };
|
||||
C1D64406873FEB11E9758A05 /* preferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = preferences.cpp; path = preferences/preferences.cpp; sourceTree = "<group>"; };
|
||||
C61F473D9AC43768A445E218 /* tod_new_schedule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = tod_new_schedule.cpp; sourceTree = "<group>"; };
|
||||
C679447D91FD3623CC852FF8 /* edit_pbl_translation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = edit_pbl_translation.hpp; sourceTree = "<group>"; };
|
||||
C8FF4A8788B6B7E6BE7AB7BB /* rich_label.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = rich_label.hpp; path = rich_label.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2826,16 +2817,6 @@
|
|||
EC5012731E06185600C4DFC6 /* math.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = math.hpp; sourceTree = "<group>"; };
|
||||
EC51DB7618F8BFA4004621D9 /* playturn_network_adapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = playturn_network_adapter.cpp; sourceTree = "<group>"; };
|
||||
EC51DB7718F8BFA4004621D9 /* playturn_network_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = playturn_network_adapter.hpp; sourceTree = "<group>"; };
|
||||
EC54017B1EBE0C4500AE66EE /* display.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = display.cpp; path = preferences/display.cpp; sourceTree = "<group>"; };
|
||||
EC54017C1EBE0C4500AE66EE /* display.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = display.hpp; path = preferences/display.hpp; sourceTree = "<group>"; };
|
||||
EC54017D1EBE0C4500AE66EE /* editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = editor.cpp; path = preferences/editor.cpp; sourceTree = "<group>"; };
|
||||
EC54017E1EBE0C4500AE66EE /* editor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = editor.hpp; path = preferences/editor.hpp; sourceTree = "<group>"; };
|
||||
EC54017F1EBE0C4500AE66EE /* game.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = game.cpp; path = preferences/game.cpp; sourceTree = "<group>"; };
|
||||
EC5401801EBE0C4500AE66EE /* game.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = game.hpp; path = preferences/game.hpp; sourceTree = "<group>"; };
|
||||
EC5401811EBE0C4500AE66EE /* general.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = general.cpp; path = preferences/general.cpp; sourceTree = "<group>"; };
|
||||
EC5401821EBE0C4500AE66EE /* general.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = general.hpp; path = preferences/general.hpp; sourceTree = "<group>"; };
|
||||
EC5401831EBE0C4500AE66EE /* lobby.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lobby.cpp; path = preferences/lobby.cpp; sourceTree = "<group>"; };
|
||||
EC5401841EBE0C4500AE66EE /* lobby.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = lobby.hpp; path = preferences/lobby.hpp; sourceTree = "<group>"; };
|
||||
EC5430211A4E6024006D206C /* lua_team.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_team.cpp; sourceTree = "<group>"; };
|
||||
EC5430221A4E6024006D206C /* lua_unit_type.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_unit_type.cpp; sourceTree = "<group>"; };
|
||||
EC5590761A0B11C600675179 /* lua_map_generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_map_generator.cpp; sourceTree = "<group>"; };
|
||||
|
@ -5114,20 +5095,9 @@
|
|||
EC54017A1EBE0C2B00AE66EE /* preferences */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
46D6C9FF2586A175001F0464 /* advanced.cpp */,
|
||||
46D6CA002586A176001F0464 /* advanced.hpp */,
|
||||
903F959B1ED5489500F1BDD3 /* credentials.cpp */,
|
||||
903F959D1ED5489D00F1BDD3 /* credentials.hpp */,
|
||||
EC54017B1EBE0C4500AE66EE /* display.cpp */,
|
||||
EC54017C1EBE0C4500AE66EE /* display.hpp */,
|
||||
EC54017D1EBE0C4500AE66EE /* editor.cpp */,
|
||||
EC54017E1EBE0C4500AE66EE /* editor.hpp */,
|
||||
EC54017F1EBE0C4500AE66EE /* game.cpp */,
|
||||
EC5401801EBE0C4500AE66EE /* game.hpp */,
|
||||
EC5401811EBE0C4500AE66EE /* general.cpp */,
|
||||
EC5401821EBE0C4500AE66EE /* general.hpp */,
|
||||
EC5401831EBE0C4500AE66EE /* lobby.cpp */,
|
||||
EC5401841EBE0C4500AE66EE /* lobby.hpp */,
|
||||
C1D64406873FEB11E9758A05 /* preferences.cpp */,
|
||||
2CFD4922B64EA6C9F71F71A2 /* preferences.hpp */,
|
||||
95EA4B82BB8CCCBEDD7A00E3 /* preferences_list.hpp */,
|
||||
);
|
||||
name = preferences;
|
||||
sourceTree = "<group>";
|
||||
|
@ -5172,6 +5142,8 @@
|
|||
8E1D442FB4DA43385F58F77F /* combobox.hpp in Headers */,
|
||||
B7B34687A61290490C1616D3 /* tab_container.hpp in Headers */,
|
||||
365D4F89BD511BC074E639D7 /* migrate_version_selection.hpp in Headers */,
|
||||
D9E94D2083155213BFA6EDD6 /* preferences.hpp in Headers */,
|
||||
8150449A8C3B2EC4FD38A44B /* preferences_list.hpp in Headers */,
|
||||
3DED4C43AC1B737C15549CEC /* rich_label.hpp in Headers */,
|
||||
9C6342BC8A95B6D23D384486 /* gui_test_dialog.hpp in Headers */,
|
||||
);
|
||||
|
@ -5190,6 +5162,8 @@
|
|||
D09A4D40A36568E32D8723F7 /* combobox.hpp in Headers */,
|
||||
3CC6488695A7293C9CFC2CB6 /* tab_container.hpp in Headers */,
|
||||
7A0347D48BDB52B1430D9E79 /* migrate_version_selection.hpp in Headers */,
|
||||
B45C431C9B7250C3321F8BC2 /* preferences.hpp in Headers */,
|
||||
61AB44F89B2EC1B6F92F0193 /* preferences_list.hpp in Headers */,
|
||||
022640C59A7BD907C810FA99 /* rich_label.hpp in Headers */,
|
||||
6A1F44688986D07EB5DBEF75 /* gui_test_dialog.hpp in Headers */,
|
||||
);
|
||||
|
@ -5422,7 +5396,6 @@
|
|||
46F92E052174F6A400602C1C /* preferences_dialog.cpp in Sources */,
|
||||
46F92E992174F6A400602C1C /* slider.cpp in Sources */,
|
||||
B59F96D5103478C900A57C1A /* aspect.cpp in Sources */,
|
||||
46D6CA012586A176001F0464 /* advanced.cpp in Sources */,
|
||||
B55BE03211234AAB00154E6C /* astarsearch.cpp in Sources */,
|
||||
B5599B910EC62181008DD061 /* attack_prediction.cpp in Sources */,
|
||||
B54AC6DF0FEA9EB5006F6FBD /* attack.cpp in Sources */,
|
||||
|
@ -5628,7 +5601,6 @@
|
|||
46F92DE52174F6A400602C1C /* terrain_layers.cpp in Sources */,
|
||||
B5599B2F0EC62181008DD061 /* log.cpp in Sources */,
|
||||
46F92DB32174F6A300602C1C /* game_load.cpp in Sources */,
|
||||
EC5401871EBE0C4500AE66EE /* game.cpp in Sources */,
|
||||
ECB6A6331FB8AAC500877C20 /* point.cpp in Sources */,
|
||||
EC218EA01A106648007C910C /* lua_common.cpp in Sources */,
|
||||
ECD5D7BF1A22DC8600114175 /* lua_cpp_function.cpp in Sources */,
|
||||
|
@ -5637,7 +5609,6 @@
|
|||
ECA1E0F21A1271AC00426E00 /* lua_gui2.cpp in Sources */,
|
||||
46F92D872174F6A300602C1C /* horizontal_list.cpp in Sources */,
|
||||
91AF564F284D8A8B007A7652 /* walker_container.cpp in Sources */,
|
||||
EC5401851EBE0C4500AE66EE /* display.cpp in Sources */,
|
||||
46F92C1E2174F5D700602C1C /* help.cpp in Sources */,
|
||||
F4D5483E15198D060058C8A7 /* lua_jailbreak_exception.cpp in Sources */,
|
||||
EC218EA11A106648007C910C /* lua_kernel_base.cpp in Sources */,
|
||||
|
@ -5682,7 +5653,6 @@
|
|||
F480CD1F14034E6D007175D6 /* mapbuilder.cpp in Sources */,
|
||||
ECA1E1011A12755B00426E00 /* mapgen_lua_kernel.cpp in Sources */,
|
||||
B5599B260EC62181008DD061 /* menu_events.cpp in Sources */,
|
||||
903F959C1ED5489500F1BDD3 /* credentials.cpp in Sources */,
|
||||
EC44E382181DDAF90037A62F /* menu_item.cpp in Sources */,
|
||||
46F92DC52174F6A300602C1C /* modeless_dialog.cpp in Sources */,
|
||||
46F92D9B2174F6A300602C1C /* depcheck_confirm_change.cpp in Sources */,
|
||||
|
@ -5789,7 +5759,6 @@
|
|||
46F92E312174F6A400602C1C /* custom_tod.cpp in Sources */,
|
||||
46F92DA92174F6A300602C1C /* screenshot_notification.cpp in Sources */,
|
||||
B5599AFF0EC62181008DD061 /* soundsource.cpp in Sources */,
|
||||
EC5401861EBE0C4500AE66EE /* editor.cpp in Sources */,
|
||||
B54AC6E80FEA9EB5006F6FBD /* stage_rca.cpp in Sources */,
|
||||
46F92D8D2174F6A300602C1C /* placer.cpp in Sources */,
|
||||
46F92DD52174F6A300602C1C /* edit_text.cpp in Sources */,
|
||||
|
@ -5904,7 +5873,6 @@
|
|||
91ECD5D21BA11A5200B25CF1 /* unit_creator.cpp in Sources */,
|
||||
911F2DAD1BA086A400E3102E /* window.cpp in Sources */,
|
||||
919B37F81BAF789E00E0094C /* synced_user_choice.cpp in Sources */,
|
||||
EC5401891EBE0C4500AE66EE /* lobby.cpp in Sources */,
|
||||
46F92E4D2174F6A400602C1C /* walker_widget.cpp in Sources */,
|
||||
91FAC70A1C7FBC3400DAB2C3 /* lua_formula_bridge.cpp in Sources */,
|
||||
91FBBAD81CB6BC3F00470BFE /* filesystem_sdl.cpp in Sources */,
|
||||
|
@ -5921,7 +5889,6 @@
|
|||
918C8A201D05F9AA009744A0 /* wesnothd_connection.cpp in Sources */,
|
||||
46F92F172174FEC000602C1C /* font_config.cpp in Sources */,
|
||||
914F2F861D35253900A42440 /* location_palette.cpp in Sources */,
|
||||
EC5401881EBE0C4500AE66EE /* general.cpp in Sources */,
|
||||
913D26771D3C9697002FF3AB /* name_generator_factory.cpp in Sources */,
|
||||
9193FC7E1D5BB64F004F6C07 /* advancement.cpp in Sources */,
|
||||
9193FC821D5C2CF8004F6C07 /* lua_unit.cpp in Sources */,
|
||||
|
@ -5951,6 +5918,7 @@
|
|||
D2E9440BBCDCE2A75C93F85D /* migrate_version_selection.cpp in Sources */,
|
||||
F00C4D628A6DEFF4F2A66243 /* rich_label.cpp in Sources */,
|
||||
805143B8BABF92CA79BEC8F5 /* gui_test_dialog.cpp in Sources */,
|
||||
9FE64884AE8121CDBABF7D8A /* preferences.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -6166,7 +6134,6 @@
|
|||
91E3568B1CACC77E00774252 /* synced_context.cpp in Sources */,
|
||||
46F92E3E2174F6A400602C1C /* new_map.cpp in Sources */,
|
||||
46F92D922174F6A300602C1C /* gui_definition.cpp in Sources */,
|
||||
4649B88320288DF800827CFB /* editor.cpp in Sources */,
|
||||
91E3568C1CACC77E00774252 /* synced_user_choice.cpp in Sources */,
|
||||
91E3568D1CACC77E00774252 /* syncmp_handler.cpp in Sources */,
|
||||
91E3568E1CACC77E00774252 /* team.cpp in Sources */,
|
||||
|
@ -6195,7 +6162,6 @@
|
|||
91E3569B1CACC7CE00774252 /* undo_dismiss_action.cpp in Sources */,
|
||||
46F92E122174F6A400602C1C /* mp_staging.cpp in Sources */,
|
||||
46F92DF22174F6A400602C1C /* manager.cpp in Sources */,
|
||||
4649B88520288DFE00827CFB /* general.cpp in Sources */,
|
||||
46F92DE02174F6A300602C1C /* select_orb_colors.cpp in Sources */,
|
||||
46F92E742174F6A400602C1C /* addon_list.cpp in Sources */,
|
||||
91E3569C1CACC7CE00774252 /* undo_move_action.cpp in Sources */,
|
||||
|
@ -6323,7 +6289,6 @@
|
|||
91E356E51CACC93000774252 /* palette_manager.cpp in Sources */,
|
||||
46F92DCE2174F6A300602C1C /* log_settings.cpp in Sources */,
|
||||
46F92DDE2174F6A300602C1C /* edit_label.cpp in Sources */,
|
||||
4649B88120288DF200827CFB /* credentials.cpp in Sources */,
|
||||
91E356E61CACC93000774252 /* terrain_palettes.cpp in Sources */,
|
||||
91E356E71CACC93000774252 /* tristate_button.cpp in Sources */,
|
||||
91E356E81CACC93000774252 /* unit_palette.cpp in Sources */,
|
||||
|
@ -6415,7 +6380,6 @@
|
|||
91A214FB1CAD66CC00927AEA /* picture.cpp in Sources */,
|
||||
91AF5654284D90ED007A7652 /* walker_container.cpp in Sources */,
|
||||
91A214FC1CAD66CC00927AEA /* image_modifications.cpp in Sources */,
|
||||
4649B88420288DFB00827CFB /* game.cpp in Sources */,
|
||||
46F92E322174F6A400602C1C /* custom_tod.cpp in Sources */,
|
||||
91A214FE1CAD66CC00927AEA /* key.cpp in Sources */,
|
||||
91A214FF1CAD66CC00927AEA /* language.cpp in Sources */,
|
||||
|
@ -6478,7 +6442,6 @@
|
|||
91A2156B1CAD6DA400927AEA /* lua_race.cpp in Sources */,
|
||||
46F92E962174F6A400602C1C /* spacer.cpp in Sources */,
|
||||
91A2156C1CAD6DA500927AEA /* lua_rng.cpp in Sources */,
|
||||
4649B88620288E0000827CFB /* lobby.cpp in Sources */,
|
||||
91A2156D1CAD6DA500927AEA /* lua_team.cpp in Sources */,
|
||||
91A2156F1CAD6DA500927AEA /* lua_unit_type.cpp in Sources */,
|
||||
91D816832894DB0B00631AFB /* simple_wml.cpp in Sources */,
|
||||
|
@ -6514,7 +6477,6 @@
|
|||
91A215851CAD884A00927AEA /* abilities.cpp in Sources */,
|
||||
46685C9E219D518B0009CFFE /* schema_validator.cpp in Sources */,
|
||||
46F92E9A2174F6A400602C1C /* slider.cpp in Sources */,
|
||||
4649B88220288DF500827CFB /* display.cpp in Sources */,
|
||||
91A215861CAD884A00927AEA /* animation.cpp in Sources */,
|
||||
91A215871CAD884B00927AEA /* animation_component.cpp in Sources */,
|
||||
46685C96219D518B0009CFFE /* tag.cpp in Sources */,
|
||||
|
@ -6580,7 +6542,6 @@
|
|||
46F92E1A2174F6A400602C1C /* mp_connect.cpp in Sources */,
|
||||
4649B88020288DC600827CFB /* random.cpp in Sources */,
|
||||
4649B88E20288F1E00827CFB /* lua_audio.cpp in Sources */,
|
||||
46D6CA022586A176001F0464 /* advanced.cpp in Sources */,
|
||||
916718FB1CADAA1200B055A9 /* fake_display.cpp in Sources */,
|
||||
916718FD1CADAA1200B055A9 /* game_config_manager_tests.cpp in Sources */,
|
||||
916718FF1CADAA1D00B055A9 /* fire_event.cpp in Sources */,
|
||||
|
@ -6639,6 +6600,7 @@
|
|||
4E4A4DBC9F44444A5867EC2B /* migrate_version_selection.cpp in Sources */,
|
||||
DC764C9F94D8B634B47A92B0 /* rich_label.cpp in Sources */,
|
||||
DDA14069BCE29DE0FE71B970 /* gui_test_dialog.cpp in Sources */,
|
||||
DDE34117BDAA30C965F6E4DB /* preferences.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -30,8 +30,7 @@ hotkey/hotkey_item.cpp
|
|||
hotkey/hotkey_manager.cpp
|
||||
picture.cpp
|
||||
image_modifications.cpp
|
||||
preferences/credentials.cpp
|
||||
preferences/general.cpp
|
||||
preferences/preferences.cpp
|
||||
key.cpp
|
||||
language.cpp
|
||||
map/label.cpp
|
||||
|
|
|
@ -312,11 +312,7 @@ play_controller.cpp
|
|||
playmp_controller.cpp
|
||||
playsingle_controller.cpp
|
||||
playturn_network_adapter.cpp
|
||||
preferences/advanced.cpp
|
||||
preferences/display.cpp
|
||||
preferences/editor.cpp
|
||||
preferences/game.cpp
|
||||
preferences/lobby.cpp
|
||||
preferences/preferences.cpp
|
||||
random_deterministic.cpp
|
||||
random_synced.cpp
|
||||
recall_list_manager.cpp
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "filesystem.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
|
||||
|
@ -65,7 +65,7 @@ achievement::achievement(const config& cfg, const std::string& content_for, bool
|
|||
if(sub_id.empty()) {
|
||||
ERR_CONFIG << "Achievement " << id_ << " has a sub-achievement missing the id attribute:\n" << sub_ach.debug();
|
||||
} else {
|
||||
sub_achievements_.emplace_back(sub_ach, achieved_ || preferences::sub_achievement(content_for, id_, sub_id));
|
||||
sub_achievements_.emplace_back(sub_ach, achieved_ || prefs::get().sub_achievement(content_for, id_, sub_id));
|
||||
max_progress_++;
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ achievement_group::achievement_group(const config& cfg)
|
|||
ERR_CONFIG << content_for_ + " achievement id " << id << " contains a comma, skipping.";
|
||||
continue;
|
||||
} else {
|
||||
achievements_.emplace_back(ach, content_for_, preferences::achievement(content_for_, id), preferences::progress_achievement(content_for_, id));
|
||||
achievements_.emplace_back(ach, content_for_, prefs::get().achievement(content_for_, id), prefs::get().progress_achievement(content_for_, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "ai/manager.hpp" // for manager, holder
|
||||
#include "ai/lua/aspect_advancements.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_data.hpp" //resources::gamedata->phase()
|
||||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/unit_advance.hpp"
|
||||
|
@ -67,7 +67,7 @@ namespace
|
|||
std::vector<unit_const_ptr> previews;
|
||||
|
||||
for (const std::string& advance : u.advances_to()) {
|
||||
preferences::encountered_units().insert(advance);
|
||||
prefs::get().encountered_units().insert(advance);
|
||||
previews.push_back(get_advanced_unit(u, advance));
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ void advance_unit(map_location loc, const advancement_option &advance_to, bool f
|
|||
if ( !use_amla )
|
||||
{
|
||||
resources::controller->statistics().advance_unit(*new_unit);
|
||||
preferences::encountered_units().insert(new_unit->type_id());
|
||||
prefs::get().encountered_units().insert(new_unit->type_id());
|
||||
LOG_CF << "Added '" << new_unit->type_id() << "' to the encountered units.";
|
||||
}
|
||||
u->anim_comp().clear_haloes();
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "map/map.hpp"
|
||||
#include "mouse_handler_base.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "random.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -1311,7 +1311,7 @@ void attack::unit_killed(unit_info& attacker,
|
|||
game_events::entity_location reanim_loc(defender.loc_, newunit->underlying_id());
|
||||
resources::game_events->pump().fire("unit_placed", reanim_loc);
|
||||
|
||||
preferences::encountered_units().insert(newunit->type_id());
|
||||
prefs::get().encountered_units().insert(newunit->type_id());
|
||||
|
||||
if(update_display_) {
|
||||
display::get_singleton()->invalidate(death_loc);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "filter_context.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
|
@ -671,7 +671,7 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
|
|||
return std::tuple(true, 0, false);
|
||||
new_unit_itor->set_hidden(true);
|
||||
}
|
||||
preferences::encountered_units().insert(new_unit_itor->type_id());
|
||||
prefs::get().encountered_units().insert(new_unit_itor->type_id());
|
||||
current_team.spend_gold(cost);
|
||||
|
||||
if ( show ) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "actions/vision.hpp"
|
||||
|
||||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "hotkey/hotkey_item.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
|
@ -1363,7 +1363,7 @@ std::size_t move_unit_and_record(const std::vector<map_location> &steps,
|
|||
resources::gameboard->units().find(steps.front())->side() - 1];
|
||||
continued_move |= !current_team.fog_or_shroud();
|
||||
}
|
||||
const bool skip_ally_sighted = !preferences::interrupt_when_ally_sighted();
|
||||
const bool skip_ally_sighted = !prefs::get().interrupt_when_ally_sighted();
|
||||
|
||||
// Evaluate this move.
|
||||
unit_mover mover(steps, move_spectator, continued_move, skip_ally_sighted);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "display.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_data.hpp" // for resources::gamedata conversion variable_set
|
||||
#include "game_version.hpp"
|
||||
#include "log.hpp"
|
||||
|
@ -193,7 +193,7 @@ void unit_creator::add_unit(const config &cfg, const vconfig* vcfg)
|
|||
//add to recall list
|
||||
team_.recall_list().add(new_unit);
|
||||
DBG_NG << "inserting unit with id=["<<id<<"] on recall list for side " << new_unit->side();
|
||||
preferences::encountered_units().insert(new_unit->type_id());
|
||||
prefs::get().encountered_units().insert(new_unit->type_id());
|
||||
}
|
||||
} else {
|
||||
//get unit from recall list
|
||||
|
@ -217,7 +217,7 @@ void unit_creator::post_create(const map_location &loc, const unit &new_unit, bo
|
|||
{
|
||||
|
||||
if (discover_) {
|
||||
preferences::encountered_units().insert(new_unit.type_id());
|
||||
prefs::get().encountered_units().insert(new_unit.type_id());
|
||||
}
|
||||
|
||||
bool show = show_ && (display::get_singleton() !=nullptr) && !display::get_singleton()->fogged(loc);
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#include "gui/dialogs/message.hpp"
|
||||
#include "gui/widgets/retval.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "serialization/utf8_exception.hpp"
|
||||
#include "utils/parse_network_address.hpp"
|
||||
|
@ -286,14 +285,14 @@ bool addons_client::delete_remote_addon(const std::string& id, std::string& resp
|
|||
|
||||
// if the passphrase isn't provided from the _server.pbl, try to pre-populate it from the preferences before prompting for it
|
||||
if(cfg["passphrase"].empty()) {
|
||||
cfg["passphrase"] = preferences::password(preferences::campaign_server(), cfg["author"]);
|
||||
cfg["passphrase"] = prefs::get().password(prefs::get().campaign_server(), cfg["author"]);
|
||||
if(!gui2::dialogs::addon_auth::execute(cfg)) {
|
||||
config dummy;
|
||||
config& error = dummy.add_child("error");
|
||||
error["message"] = "Password not provided.";
|
||||
return !update_last_error(dummy);
|
||||
} else {
|
||||
preferences::set_password(preferences::campaign_server(), cfg["author"], cfg["passphrase"]);
|
||||
prefs::get().set_password(prefs::get().campaign_server(), cfg["author"], cfg["passphrase"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "config_cache.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/addon/manager.hpp"
|
||||
#include "gui/dialogs/addon/uninstall_list.hpp"
|
||||
|
@ -66,7 +66,7 @@ bool addons_manager_ui(const std::string& remote_address)
|
|||
{
|
||||
bool need_wml_cache_refresh = false;
|
||||
|
||||
preferences::set_campaign_server(remote_address);
|
||||
prefs::get().set_campaign_server(remote_address);
|
||||
|
||||
try {
|
||||
addons_client client(remote_address);
|
||||
|
@ -231,7 +231,7 @@ bool manage_addons()
|
|||
// NOTE: the following two values are also known by WML, so don't change them.
|
||||
static const int addon_uninstall = 2;
|
||||
|
||||
std::string host_name = preferences::campaign_server();
|
||||
std::string host_name = prefs::get().campaign_server();
|
||||
const bool have_addons = !installed_addons().empty();
|
||||
|
||||
gui2::dialogs::addon_connect addon_dlg(host_name, have_addons);
|
||||
|
@ -254,7 +254,7 @@ bool manage_addons()
|
|||
|
||||
bool ad_hoc_addon_fetch_session(const std::vector<std::string>& addon_ids)
|
||||
{
|
||||
std::string remote_address = preferences::campaign_server();
|
||||
std::string remote_address = prefs::get().campaign_server();
|
||||
|
||||
// These exception handlers copied from addon_manager_ui fcn above.
|
||||
try {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "actions/attack.hpp"
|
||||
#include "actions/create.hpp"
|
||||
#include "attack_prediction.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "mouse_handler_base.hpp"
|
||||
|
@ -476,7 +476,7 @@ void move_result::do_execute()
|
|||
/*std::vector<map_location> steps*/ route_->steps,
|
||||
/*::actions::undo_list* undo_stack*/ nullptr,
|
||||
/*bool continue_move*/ true,
|
||||
/*bool show_move*/ !preferences::skip_ai_moves(),
|
||||
/*bool show_move*/ !prefs::get().skip_ai_moves(),
|
||||
/*bool* interrupted*/ nullptr,
|
||||
/*::actions::move_unit_spectator* move_spectator*/ &move_spectator);
|
||||
|
||||
|
@ -658,7 +658,7 @@ void recall_result::do_execute()
|
|||
synced_context::run_in_synced_context_if_not_already("recall",
|
||||
replay_helper::get_recall(unit_id_, recall_location_, recall_from_),
|
||||
false,
|
||||
!preferences::skip_ai_moves(),
|
||||
!prefs::get().skip_ai_moves(),
|
||||
synced_context::ignore_error_function);
|
||||
|
||||
set_gamestate_changed();
|
||||
|
@ -804,7 +804,7 @@ void recruit_result::do_execute()
|
|||
}
|
||||
|
||||
resources::undo_stack->clear();
|
||||
synced_context::run_in_synced_context_if_not_already("recruit", replay_helper::get_recruit(u->id(), recruit_location_, recruit_from_), false, !preferences::skip_ai_moves());
|
||||
synced_context::run_in_synced_context_if_not_already("recruit", replay_helper::get_recruit(u->id(), recruit_location_, recruit_from_), false, !prefs::get().skip_ai_moves());
|
||||
|
||||
set_gamestate_changed();
|
||||
try {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "actions/attack.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "random.hpp"
|
||||
|
||||
#include <array>
|
||||
|
@ -2333,7 +2333,7 @@ void combatant::fight(combatant& opponent, bool levelup_considered)
|
|||
|
||||
bool use_monte_carlo_simulation =
|
||||
fight_complexity(split.size(), opp_split.size(), u_, opponent.u_) > MONTE_CARLO_SIMULATION_THRESHOLD
|
||||
&& preferences::damage_prediction_allow_monte_carlo_simulation();
|
||||
&& prefs::get().damage_prediction_allow_monte_carlo_simulation();
|
||||
|
||||
if(use_monte_carlo_simulation) {
|
||||
// A very complex fight. Use Monte Carlo simulation instead of exact
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "gui/dialogs/multiplayer/mp_report.hpp"
|
||||
#include "gui/dialogs/preferences_dialog.hpp"
|
||||
#include "map_command_handler.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace events {
|
||||
|
||||
|
@ -77,7 +77,7 @@ void chat_command_handler::do_ignore()
|
|||
utils::string_map symbols;
|
||||
symbols["nick"] = get_arg(1);
|
||||
|
||||
if (preferences::add_acquaintance(get_arg(1), "ignore", get_data(2)).first) {
|
||||
if (prefs::get().add_acquaintance(get_arg(1), "ignore", get_data(2)).first) {
|
||||
print(_("ignores list"), VGETTEXT("Added to ignore list: $nick", symbols));
|
||||
chat_handler_.user_relation_changed(get_arg(1));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void chat_command_handler::do_friend()
|
|||
utils::string_map symbols;
|
||||
symbols["nick"] = get_arg(1);
|
||||
|
||||
if (preferences::add_acquaintance(get_arg(1), "friend", get_data(2)).first) {
|
||||
if (prefs::get().add_acquaintance(get_arg(1), "friend", get_data(2)).first) {
|
||||
print(_("friends list"), VGETTEXT("Added to friends list: $nick", symbols));
|
||||
chat_handler_.user_relation_changed(get_arg(1));
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void chat_command_handler::do_friend()
|
|||
void chat_command_handler::do_remove()
|
||||
{
|
||||
for (int i = 1;!get_arg(i).empty();i++) {
|
||||
preferences::remove_acquaintance(get_arg(i));
|
||||
prefs::get().remove_acquaintance(get_arg(i));
|
||||
chat_handler_.user_relation_changed(get_arg(i));
|
||||
utils::string_map symbols;
|
||||
symbols["nick"] = get_arg(i);
|
||||
|
@ -119,7 +119,7 @@ void chat_command_handler::do_remove()
|
|||
|
||||
void chat_command_handler::do_display()
|
||||
{
|
||||
gui2::dialogs::preferences_dialog::display(preferences::VIEW_FRIENDS);
|
||||
gui2::dialogs::preferences_dialog::display(pref_constants::VIEW_FRIENDS);
|
||||
}
|
||||
|
||||
void chat_command_handler::do_version() {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "chat_command_handler.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define ERR_NG LOG_STREAM(err, log_engine)
|
||||
|
@ -133,7 +133,7 @@ void chat_handler::send_whisper(const std::string& receiver, const std::string&
|
|||
config cwhisper, data;
|
||||
cwhisper["receiver"] = receiver;
|
||||
cwhisper["message"] = message;
|
||||
cwhisper["sender"] = preferences::login();
|
||||
cwhisper["sender"] = prefs::get().login();
|
||||
data.add_child("whisper", std::move(cwhisper));
|
||||
send_to_server(data);
|
||||
}
|
||||
|
@ -158,14 +158,14 @@ void chat_handler::send_chat_room_message(const std::string& room,
|
|||
config cmsg, data;
|
||||
cmsg["room"] = room;
|
||||
cmsg["message"] = message;
|
||||
cmsg["sender"] = preferences::login();
|
||||
cmsg["sender"] = prefs::get().login();
|
||||
data.add_child("message", std::move(cmsg));
|
||||
send_to_server(data);
|
||||
}
|
||||
|
||||
void chat_handler::add_chat_room_message_sent(const std::string &room, const std::string &message)
|
||||
{
|
||||
add_chat_room_message_received(room, preferences::login(), message);
|
||||
add_chat_room_message_received(room, prefs::get().login(), message);
|
||||
}
|
||||
|
||||
void chat_handler::add_chat_room_message_received(const std::string &room,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "hotkey/command_executor.hpp"
|
||||
#include "log.hpp"
|
||||
#include "mouse_handler_base.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "scripting/plugins/context.hpp"
|
||||
#include "show_dialog.hpp" //gui::in_dialog
|
||||
#include "gui/core/event/handler.hpp" // gui2::is_in_dialog
|
||||
|
@ -299,13 +299,13 @@ bool controller_base::handle_scroll(int mousex, int mousey, int mouse_flags)
|
|||
{
|
||||
const bool mouse_in_window =
|
||||
video::window_has_mouse_focus()
|
||||
|| preferences::get_scroll_when_mouse_outside(true);
|
||||
|| prefs::get().get_scroll_when_mouse_outside(true);
|
||||
|
||||
int scroll_speed = preferences::scroll_speed();
|
||||
int scroll_speed = prefs::get().scroll_speed();
|
||||
double dx = 0.0, dy = 0.0;
|
||||
|
||||
int scroll_threshold = preferences::mouse_scroll_enabled()
|
||||
? preferences::mouse_scroll_threshold()
|
||||
int scroll_threshold = prefs::get().mouse_scroll_enabled()
|
||||
? prefs::get().mouse_scroll_threshold()
|
||||
: 0;
|
||||
|
||||
for(const theme::menu& m : get_display().get_theme().menus()) {
|
||||
|
@ -355,7 +355,7 @@ bool controller_base::handle_scroll(int mousex, int mousey, int mouse_flags)
|
|||
events::mouse_handler_base& mh_base = get_mouse_handler_base();
|
||||
|
||||
// Scroll with middle-mouse if enabled
|
||||
if((mouse_flags & SDL_BUTTON_MMASK) != 0 && preferences::middle_click_scrolls()) {
|
||||
if((mouse_flags & SDL_BUTTON_MMASK) != 0 && prefs::get().middle_click_scrolls()) {
|
||||
const SDL_Point original_loc = mh_base.get_scroll_start();
|
||||
|
||||
if(mh_base.scroll_started()) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "countdown_clock.hpp"
|
||||
|
||||
#include "team.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
namespace {
|
||||
|
@ -73,7 +73,7 @@ void countdown_clock::maybe_play_sound()
|
|||
{
|
||||
if(!playing_sound_ && team_.countdown_time() < WARNTIME )
|
||||
{
|
||||
if(preferences::turn_bell() || preferences::sound_on() || preferences::UI_sound_on())
|
||||
if(prefs::get().turn_bell() || prefs::get().sound_on() || prefs::get().ui_sound_on())
|
||||
{
|
||||
const int loop_ticks = team_.countdown_time();
|
||||
const int fadein_ticks = (loop_ticks > WARNTIME / 2) ? loop_ticks - WARNTIME / 2 : 0;
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include "cursor.hpp"
|
||||
|
||||
#include "picture.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/display.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "sdl/utils.hpp"
|
||||
|
||||
#include <boost/logic/tribool.hpp>
|
||||
|
@ -84,7 +83,7 @@ bool have_focus = true;
|
|||
|
||||
bool use_color_cursors()
|
||||
{
|
||||
return game_config::editor == false && preferences::use_color_cursors();
|
||||
return game_config::editor == false && prefs::get().use_color_cursors();
|
||||
}
|
||||
|
||||
SDL_Cursor* create_cursor(surface surf)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_version.hpp"
|
||||
|
||||
// Set the default severity with the second parameter.
|
||||
|
@ -79,7 +79,7 @@ std::string deprecated_message(
|
|||
const lg::logger& out_log = *log_ptr;
|
||||
FORCE_LOG_TO(out_log, log_deprecate) << message;
|
||||
// whether to show the error in the ingame chat area
|
||||
if(preferences::get_show_deprecation(game_config::wesnoth_version.is_dev_version())) {
|
||||
if(prefs::get().get_show_deprecation(game_config::wesnoth_version.is_dev_version())) {
|
||||
lg::log_to_chat() << message << '\n';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "filesystem.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "utils/general.hpp"
|
||||
|
||||
|
@ -150,13 +150,13 @@ inline std::string pretty_path(const std::string& path)
|
|||
|
||||
inline config get_bookmarks_config()
|
||||
{
|
||||
auto cfg = preferences::dir_bookmarks();
|
||||
auto cfg = prefs::get().dir_bookmarks();
|
||||
return cfg ? *cfg : config{};
|
||||
}
|
||||
|
||||
inline void commit_bookmarks_config(config& cfg)
|
||||
{
|
||||
preferences::set_dir_bookmarks(cfg);
|
||||
prefs::get().set_dir_bookmarks(cfg);
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "filesystem.hpp"
|
||||
#include "font/sdl_ttf_compat.hpp"
|
||||
#include "font/text.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "halo.hpp"
|
||||
#include "hotkey/command_executor.hpp"
|
||||
#include "log.hpp"
|
||||
|
@ -155,7 +155,7 @@ display::display(const display_context* dc,
|
|||
, xpos_(0)
|
||||
, ypos_(0)
|
||||
, view_locked_(false)
|
||||
, theme_(theme::get_theme_config(theme_id.empty() ? preferences::theme() : theme_id), video::game_canvas())
|
||||
, theme_(theme::get_theme_config(theme_id.empty() ? prefs::get().theme() : theme_id), video::game_canvas())
|
||||
, zoom_index_(0)
|
||||
, fake_unit_man_(new fake_unit_manager(*this))
|
||||
, builder_(new terrain_builder(level, (dc_ ? &dc_->map() : nullptr), theme_.border().tile_image, theme_.border().show_border))
|
||||
|
@ -215,13 +215,13 @@ display::display(const display_context* dc,
|
|||
fill_images_list(game_config::fog_prefix, fog_images_);
|
||||
fill_images_list(game_config::shroud_prefix, shroud_images_);
|
||||
|
||||
unsigned int tile_size = preferences::tile_size();
|
||||
unsigned int tile_size = prefs::get().tile_size();
|
||||
if(tile_size < MinZoom || tile_size > MaxZoom)
|
||||
tile_size = DefaultZoom;
|
||||
zoom_index_ = get_zoom_levels_index(tile_size);
|
||||
zoom_ = zoom_levels[zoom_index_];
|
||||
if(zoom_ != preferences::tile_size()) // correct saved tile_size if necessary
|
||||
preferences::set_tile_size(zoom_);
|
||||
if(zoom_ != prefs::get().tile_size()) // correct saved tile_size if necessary
|
||||
prefs::get().set_tile_size(zoom_);
|
||||
|
||||
init_flags();
|
||||
|
||||
|
@ -1539,7 +1539,7 @@ void display::set_diagnostic(const std::string& msg)
|
|||
|
||||
void display::update_fps_count()
|
||||
{
|
||||
static int time_between_draws = preferences::draw_delay();
|
||||
static int time_between_draws = prefs::get().draw_delay();
|
||||
if(time_between_draws < 0) {
|
||||
time_between_draws = 1000 / video::current_refresh_rate();
|
||||
}
|
||||
|
@ -1687,7 +1687,7 @@ void display::draw_minimap()
|
|||
|
||||
void display::draw_minimap_units()
|
||||
{
|
||||
if (!preferences::minimap_draw_units() || is_blindfolded()) return;
|
||||
if (!prefs::get().minimap_draw_units() || is_blindfolded()) return;
|
||||
|
||||
double xscaling = 1.0 * minimap_location_.w / get_map().w();
|
||||
double yscaling = 1.0 * minimap_location_.h / get_map().h();
|
||||
|
@ -1703,7 +1703,7 @@ void display::draw_minimap_units()
|
|||
int side = u.side();
|
||||
color_t col = team::get_minimap_color(side);
|
||||
|
||||
if(!preferences::minimap_movement_coding()) {
|
||||
if(!prefs::get().minimap_movement_coding()) {
|
||||
auto status = orb_status::allied;
|
||||
if(dc_->teams()[currentTeam_].is_enemy(side)) {
|
||||
status = orb_status::enemy;
|
||||
|
@ -1902,7 +1902,7 @@ bool display::set_zoom(unsigned int amount, const bool validate_value_and_set_in
|
|||
last_zoom_ = zoom_;
|
||||
}
|
||||
|
||||
preferences::set_tile_size(zoom_);
|
||||
prefs::get().set_tile_size(zoom_);
|
||||
|
||||
labels().recalculate_labels();
|
||||
redraw_background_ = true;
|
||||
|
@ -1942,7 +1942,7 @@ bool display::tile_nearly_on_screen(const map_location& loc) const
|
|||
|
||||
void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force)
|
||||
{
|
||||
if(!force && (view_locked_ || !preferences::scroll_to_action())) return;
|
||||
if(!force && (view_locked_ || !prefs::get().scroll_to_action())) return;
|
||||
if(video::headless()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1956,7 +1956,7 @@ void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_ty
|
|||
int xmove = xpos - xpos_;
|
||||
int ymove = ypos - ypos_;
|
||||
|
||||
if(scroll_type == WARP || scroll_type == ONSCREEN_WARP || turbo_speed() > 2.0 || preferences::scroll_speed() > 99) {
|
||||
if(scroll_type == WARP || scroll_type == ONSCREEN_WARP || turbo_speed() > 2.0 || prefs::get().scroll_speed() > 99) {
|
||||
scroll(xmove,ymove,true);
|
||||
redraw_minimap();
|
||||
events::draw();
|
||||
|
@ -1988,7 +1988,7 @@ void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_ty
|
|||
const double accel_time = 0.3 / turbo_speed(); // seconds until full speed is reached
|
||||
const double decel_time = 0.4 / turbo_speed(); // seconds from full speed to stop
|
||||
|
||||
double velocity_max = preferences::scroll_speed() * 60.0;
|
||||
double velocity_max = prefs::get().scroll_speed() * 60.0;
|
||||
velocity_max *= turbo_speed();
|
||||
double accel = velocity_max / accel_time;
|
||||
double decel = velocity_max / decel_time;
|
||||
|
@ -2187,14 +2187,14 @@ void display::bounds_check_position(int& xpos, int& ypos) const
|
|||
|
||||
double display::turbo_speed() const
|
||||
{
|
||||
bool res = preferences::turbo();
|
||||
bool res = prefs::get().turbo();
|
||||
if(keys_[SDLK_LSHIFT] || keys_[SDLK_RSHIFT]) {
|
||||
res = !res;
|
||||
}
|
||||
|
||||
res |= video::headless();
|
||||
if(res)
|
||||
return preferences::turbo_speed();
|
||||
return prefs::get().turbo_speed();
|
||||
else
|
||||
return 1.0;
|
||||
}
|
||||
|
@ -2418,7 +2418,7 @@ void display::draw()
|
|||
drawing_buffer_commit();
|
||||
}
|
||||
|
||||
if(preferences::show_fps() || debug_flag_set(DEBUG_BENCHMARK)) {
|
||||
if(prefs::get().show_fps() || debug_flag_set(DEBUG_BENCHMARK)) {
|
||||
update_fps_label();
|
||||
update_fps_count();
|
||||
} else if(fps_handle_ != 0) {
|
||||
|
@ -2433,8 +2433,8 @@ void display::update()
|
|||
update_render_textures();
|
||||
|
||||
// Trigger cache rebuild if animated water preference has changed.
|
||||
if(animate_water_ != preferences::animate_water()) {
|
||||
animate_water_ = preferences::animate_water();
|
||||
if(animate_water_ != prefs::get().animate_water()) {
|
||||
animate_water_ = prefs::get().animate_water();
|
||||
builder_->rebuild_cache_all();
|
||||
}
|
||||
|
||||
|
@ -2703,7 +2703,7 @@ void display::draw_hex(const map_location& loc)
|
|||
});
|
||||
|
||||
// Draw the grid, if that's been enabled
|
||||
if(preferences::grid()) {
|
||||
if(prefs::get().grid()) {
|
||||
static const image::locator grid_top{game_config::images::grid_top};
|
||||
static const image::locator grid_bottom{game_config::images::grid_bottom};
|
||||
|
||||
|
@ -3225,7 +3225,7 @@ void display::invalidate_animations()
|
|||
{
|
||||
// There are timing issues with this, but i'm not touching it.
|
||||
new_animation_frame();
|
||||
animate_map_ = preferences::animate_map();
|
||||
animate_map_ = prefs::get().animate_map();
|
||||
if(animate_map_) {
|
||||
for(const map_location& loc : get_visible_hexes()) {
|
||||
if(shrouded(loc))
|
||||
|
|
|
@ -793,10 +793,10 @@ protected:
|
|||
map_location mouseoverHex_;
|
||||
CKey keys_;
|
||||
|
||||
/** Local cache for preferences::animate_map, since it is constantly queried. */
|
||||
/** Local cache for prefs::get().animate_map, since it is constantly queried. */
|
||||
bool animate_map_;
|
||||
|
||||
/** Local version of preferences::animate_water, used to detect when it's changed. */
|
||||
/** Local version of prefs::get().animate_water, used to detect when it's changed. */
|
||||
bool animate_water_;
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,13 +18,12 @@
|
|||
#include "display.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_board.hpp" // <-- only needed for is_observer()
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "log.hpp"
|
||||
#include "font/sdl_ttf_compat.hpp"
|
||||
#include "mp_ui_alerts.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "color.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "serialization/utf8_exception.hpp"
|
||||
#include "video.hpp" // only for faked
|
||||
|
||||
|
@ -63,10 +62,10 @@ void display_chat_manager::add_chat_message(const std::time_t& time, const std::
|
|||
}
|
||||
}
|
||||
|
||||
if (!preferences::parse_should_show_lobby_join(sender, message)) return;
|
||||
if (preferences::is_ignored(sender)) return;
|
||||
if (!prefs::get().parse_should_show_lobby_join(sender, message)) return;
|
||||
if (prefs::get().is_ignored(sender)) return;
|
||||
|
||||
//preferences::parse_admin_authentication(sender, message); TODO: replace
|
||||
//prefs::get().parse_admin_authentication(sender, message); TODO: replace
|
||||
|
||||
bool is_observer = false;
|
||||
{ //TODO: Clean this block up somehow
|
||||
|
@ -80,9 +79,9 @@ void display_chat_manager::add_chat_message(const std::time_t& time, const std::
|
|||
|
||||
if (bell) {
|
||||
if ((type == events::chat_handler::MESSAGE_PRIVATE && (!is_observer || whisper))
|
||||
|| utils::word_match(message, preferences::login())) {
|
||||
|| utils::word_match(message, prefs::get().login())) {
|
||||
mp::ui_alerts::private_message(false, sender, message);
|
||||
} else if (preferences::is_friend(sender)) {
|
||||
} else if (prefs::get().is_friend(sender)) {
|
||||
mp::ui_alerts::friend_message(false, sender, message);
|
||||
} else if (sender == "server") {
|
||||
mp::ui_alerts::server_message(false, sender, message);
|
||||
|
@ -149,7 +148,7 @@ void display_chat_manager::add_chat_message(const std::time_t& time, const std::
|
|||
|
||||
// Prepend message with timestamp.
|
||||
std::stringstream message_complete;
|
||||
message_complete << preferences::get_chat_timestamp(time) << str.str();
|
||||
message_complete << prefs::get().get_chat_timestamp(time) << str.str();
|
||||
|
||||
const SDL_Rect rect = my_disp_.map_outside_area();
|
||||
|
||||
|
@ -192,8 +191,8 @@ void display_chat_manager::prune_chat_messages(bool remove_all)
|
|||
{
|
||||
//NOTE: prune_chat_messages(false) seems to be only called when a new message is added, which in
|
||||
// particular means the aging feature won't work unless new messages are addded regularly
|
||||
const unsigned message_aging = preferences::chat_message_aging();
|
||||
const unsigned max_chat_messages = preferences::chat_lines();
|
||||
const unsigned message_aging = prefs::get().chat_message_aging();
|
||||
const unsigned max_chat_messages = prefs::get().chat_lines();
|
||||
const bool enable_aging = message_aging != 0;
|
||||
|
||||
const unsigned remove_before = enable_aging ? safe_subtract(SDL_GetTicks(), message_aging * 60 * 1000) : 0;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "exceptions.hpp"
|
||||
#include "log.hpp"
|
||||
#include "gui/core/top_level_drawable.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "sdl/rect.hpp"
|
||||
#include "utils/general.hpp"
|
||||
#include "video.hpp"
|
||||
|
@ -186,7 +186,7 @@ int get_frame_length()
|
|||
// allow 1ms for general processing
|
||||
int vsync_delay = (1000 / rr) - 1;
|
||||
// if there's a preferred limit, limit to that
|
||||
return std::clamp(vsync_delay, preferences::draw_delay(), 1000);
|
||||
return std::clamp(vsync_delay, prefs::get().draw_delay(), 1000);
|
||||
}
|
||||
|
||||
static void wait_for_vsync()
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "editor/action/mouse/mouse_action.hpp"
|
||||
|
||||
#include "preferences/editor.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
#include "gui/dialogs/editor/edit_unit.hpp"
|
||||
|
@ -102,9 +102,9 @@ void editor_controller::init_gui()
|
|||
gui_->change_display_context(&get_current_map_context());
|
||||
gui_->add_redraw_observer(std::bind(&editor_controller::display_redraw_callback, this, std::placeholders::_1));
|
||||
floating_label_manager_.reset(new font::floating_label_context());
|
||||
gui().set_debug_flag(display::DEBUG_COORDINATES, preferences::editor::draw_hex_coordinates());
|
||||
gui().set_debug_flag(display::DEBUG_TERRAIN_CODES, preferences::editor::draw_terrain_codes());
|
||||
gui().set_debug_flag(display::DEBUG_NUM_BITMAPS, preferences::editor::draw_num_of_bitmaps());
|
||||
gui().set_debug_flag(display::DEBUG_COORDINATES, prefs::get().editor_draw_hex_coordinates());
|
||||
gui().set_debug_flag(display::DEBUG_TERRAIN_CODES, prefs::get().editor_draw_terrain_codes());
|
||||
gui().set_debug_flag(display::DEBUG_NUM_BITMAPS, prefs::get().editor_draw_num_of_bitmaps());
|
||||
// halo_manager_.reset(new halo::manager(*gui_));
|
||||
// resources::halo = halo_manager_.get();
|
||||
// ^ These lines no longer necessary, the gui owns its halo manager.
|
||||
|
@ -567,7 +567,7 @@ hotkey::ACTION_STATE editor_controller::get_action_state(const hotkey::ui_comman
|
|||
return toolkit_->is_active_brush("brush-sw-ne") ? ACTION_ON : ACTION_OFF;
|
||||
|
||||
case HOTKEY_TOGGLE_GRID:
|
||||
return preferences::grid() ? ACTION_ON : ACTION_OFF;
|
||||
return prefs::get().grid() ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_EDITOR_SELECT_ALL:
|
||||
return get_current_map_context().map().everything_selected() ?
|
||||
ACTION_SELECTED : ACTION_DESELECTED;
|
||||
|
@ -592,15 +592,15 @@ hotkey::ACTION_STATE editor_controller::get_action_state(const hotkey::ui_comman
|
|||
return gui_->debug_flag_set(display::DEBUG_NUM_BITMAPS) ? ACTION_ON : ACTION_OFF;
|
||||
|
||||
case HOTKEY_MINIMAP_DRAW_VILLAGES:
|
||||
return (preferences::minimap_draw_villages()) ? ACTION_ON : ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_villages()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_CODING_UNIT:
|
||||
return (preferences::minimap_movement_coding()) ? ACTION_ON : ACTION_OFF;
|
||||
return (prefs::get().minimap_movement_coding()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_CODING_TERRAIN:
|
||||
return (preferences::minimap_terrain_coding()) ? ACTION_ON : ACTION_OFF;
|
||||
return (prefs::get().minimap_terrain_coding()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_DRAW_UNITS:
|
||||
return (preferences::minimap_draw_units()) ? ACTION_ON : ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_units()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_DRAW_TERRAIN:
|
||||
return (preferences::minimap_draw_terrain()) ? ACTION_ON : ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_terrain()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_ZOOM_DEFAULT:
|
||||
return (gui_->get_zoom_factor() == 1.0) ? ACTION_ON : ACTION_OFF;
|
||||
|
||||
|
@ -1081,17 +1081,17 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
|
|||
|
||||
case HOTKEY_EDITOR_DRAW_COORDINATES:
|
||||
gui().toggle_debug_flag(display::DEBUG_COORDINATES);
|
||||
preferences::editor::set_draw_hex_coordinates(gui().debug_flag_set(display::DEBUG_COORDINATES));
|
||||
prefs::get().set_editor_draw_hex_coordinates(gui().debug_flag_set(display::DEBUG_COORDINATES));
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
|
||||
gui().toggle_debug_flag(display::DEBUG_TERRAIN_CODES);
|
||||
preferences::editor::set_draw_terrain_codes(gui().debug_flag_set(display::DEBUG_TERRAIN_CODES));
|
||||
prefs::get().set_editor_draw_terrain_codes(gui().debug_flag_set(display::DEBUG_TERRAIN_CODES));
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_DRAW_NUM_OF_BITMAPS:
|
||||
gui().toggle_debug_flag(display::DEBUG_NUM_BITMAPS);
|
||||
preferences::editor::set_draw_num_of_bitmaps(gui().debug_flag_set(display::DEBUG_NUM_BITMAPS));
|
||||
prefs::get().set_editor_draw_num_of_bitmaps(gui().debug_flag_set(display::DEBUG_NUM_BITMAPS));
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_REMOVE_LOCATION: {
|
||||
|
@ -1228,7 +1228,7 @@ void editor_controller::preferences()
|
|||
|
||||
void editor_controller::toggle_grid()
|
||||
{
|
||||
preferences::set_grid(!preferences::grid());
|
||||
prefs::get().set_grid(!prefs::get().grid());
|
||||
gui_->invalidate_all();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "editor/action/action.hpp"
|
||||
#include "editor/controller/editor_controller.hpp"
|
||||
#include "preferences/editor.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
#include "gui/dialogs/prompt.hpp"
|
||||
|
@ -74,12 +74,12 @@ context_manager::context_manager(editor_display& gui, const game_config_view& ga
|
|||
: locs_(nullptr)
|
||||
, gui_(gui)
|
||||
, game_config_(game_config)
|
||||
, default_dir_(preferences::editor::default_dir())
|
||||
, default_dir_(prefs::get().default_dir())
|
||||
, current_addon_(addon_id)
|
||||
, map_generators_()
|
||||
, last_map_generator_(nullptr)
|
||||
, current_context_index_(0)
|
||||
, auto_update_transitions_(preferences::editor::auto_update_transitions())
|
||||
, auto_update_transitions_(prefs::get().editor_auto_update_transitions())
|
||||
, map_contexts_()
|
||||
, clipboard_()
|
||||
{
|
||||
|
@ -158,11 +158,11 @@ void context_manager::reload_map()
|
|||
bool context_manager::is_active_transitions_hotkey(const std::string& item)
|
||||
{
|
||||
switch (auto_update_transitions_) {
|
||||
case preferences::editor::TRANSITION_UPDATE_ON:
|
||||
case pref_constants::TRANSITION_UPDATE_ON:
|
||||
return (item == "editor-auto-update-transitions");
|
||||
case preferences::editor::TRANSITION_UPDATE_PARTIAL:
|
||||
case pref_constants::TRANSITION_UPDATE_PARTIAL:
|
||||
return (item == "editor-partial-update-transitions");
|
||||
case preferences::editor::TRANSITION_UPDATE_OFF:
|
||||
case pref_constants::TRANSITION_UPDATE_OFF:
|
||||
return (item == "editor-no-update-transitions");
|
||||
}
|
||||
|
||||
|
@ -171,10 +171,10 @@ bool context_manager::is_active_transitions_hotkey(const std::string& item)
|
|||
|
||||
bool context_manager::toggle_update_transitions()
|
||||
{
|
||||
auto_update_transitions_ = (auto_update_transitions_ + 1) % preferences::editor::TRANSITION_UPDATE_COUNT;
|
||||
preferences::editor::set_auto_update_transitions(auto_update_transitions_);
|
||||
auto_update_transitions_ = (auto_update_transitions_ + 1) % pref_constants::TRANSITION_UPDATE_COUNT;
|
||||
prefs::get().set_editor_auto_update_transitions(auto_update_transitions_);
|
||||
|
||||
if(auto_update_transitions_ != preferences::editor::TRANSITION_UPDATE_ON) {
|
||||
if(auto_update_transitions_ != pref_constants::TRANSITION_UPDATE_ON) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ void context_manager::load_map_dialog(bool force_same_context /* = false */)
|
|||
|
||||
void context_manager::load_mru_item(unsigned index, bool force_same_context /* = false */)
|
||||
{
|
||||
const std::vector<std::string>& mru = preferences::editor::recent_files();
|
||||
const std::vector<std::string>& mru = prefs::get().recent_files();
|
||||
if(mru.empty() || index >= mru.size()) {
|
||||
return;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ void context_manager::expand_open_maps_menu(std::vector<config>& items, int i)
|
|||
|
||||
void context_manager::expand_load_mru_menu(std::vector<config>& items, int i)
|
||||
{
|
||||
std::vector<std::string> mru = preferences::editor::recent_files();
|
||||
std::vector<std::string> mru = prefs::get().recent_files();
|
||||
|
||||
auto pos = items.erase(items.begin() + i);
|
||||
|
||||
|
@ -573,8 +573,8 @@ void context_manager::refresh_after_action(bool drag_part)
|
|||
const std::set<map_location>& changed_locs = get_map_context().changed_locations();
|
||||
|
||||
if(get_map_context().needs_terrain_rebuild()) {
|
||||
if((auto_update_transitions_ == preferences::editor::TRANSITION_UPDATE_ON)
|
||||
|| ((auto_update_transitions_ == preferences::editor::TRANSITION_UPDATE_PARTIAL)
|
||||
if((auto_update_transitions_ == pref_constants::TRANSITION_UPDATE_ON)
|
||||
|| ((auto_update_transitions_ == pref_constants::TRANSITION_UPDATE_PARTIAL)
|
||||
&& (!drag_part || get_map_context().everything_changed())))
|
||||
{
|
||||
gui_.rebuild_all();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "editor/map/map_context.hpp"
|
||||
#include "editor/map/map_fragment.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "preferences/editor.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
class map_generator;
|
||||
class game_config_view;
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
void set_update_transitions_mode(int mode)
|
||||
{
|
||||
auto_update_transitions_ = mode;
|
||||
preferences::editor::set_auto_update_transitions(mode);
|
||||
prefs::get().set_editor_auto_update_transitions(mode);
|
||||
}
|
||||
|
||||
bool toggle_update_transitions();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/message.hpp"
|
||||
#include "map/label.hpp"
|
||||
#include "preferences/editor.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/binary_or_text.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
|
@ -992,7 +992,7 @@ void map_context::clear_modified()
|
|||
|
||||
void map_context::add_to_recent_files()
|
||||
{
|
||||
preferences::editor::add_recent_files_entry(get_filename());
|
||||
prefs::get().add_recent_files_entry(get_filename());
|
||||
}
|
||||
|
||||
bool map_context::can_undo() const
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "desktop/clipboard.hpp"
|
||||
#include "log.hpp"
|
||||
#include "draw_manager.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "quit_confirmation.hpp"
|
||||
#include "sdl/userevent.hpp"
|
||||
#include "utils/ranges.hpp"
|
||||
|
@ -619,6 +620,7 @@ void pump()
|
|||
<< event.window.data1 << 'x' << event.window.data2;
|
||||
info.resize_dimensions.first = event.window.data1;
|
||||
info.resize_dimensions.second = event.window.data2;
|
||||
prefs::get().set_resolution(video::window_size());
|
||||
break;
|
||||
|
||||
// Once everything has had a chance to respond to the resize,
|
||||
|
@ -629,7 +631,13 @@ void pump()
|
|||
break;
|
||||
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
LOG_DP << "events/MAXIMIZED";
|
||||
prefs::get().set_maximized(true);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESTORED:
|
||||
LOG_DP << "events/RESTORED";
|
||||
prefs::get().set_maximized(prefs::get().fullscreen());
|
||||
break;
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
// Not used.
|
||||
|
|
|
@ -566,6 +566,11 @@ std::string get_next_filename(const std::string& name, const std::string& extens
|
|||
|
||||
static bfs::path user_data_dir, user_config_dir, cache_dir;
|
||||
|
||||
bool is_userdata_initialized()
|
||||
{
|
||||
return !user_data_dir.string().empty();
|
||||
}
|
||||
|
||||
const std::string get_version_path_suffix(const version_info& version)
|
||||
{
|
||||
std::ostringstream s;
|
||||
|
|
|
@ -147,6 +147,8 @@ const std::string& get_version_path_suffix();
|
|||
* maximum 1000 files then start always giving 999
|
||||
*/
|
||||
std::string get_next_filename(const std::string& name, const std::string& extension);
|
||||
|
||||
bool is_userdata_initialized();
|
||||
void set_user_config_dir(const std::string& path);
|
||||
void set_user_data_dir(std::string path);
|
||||
void set_cache_dir(const std::string& path);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "floating_label.hpp"
|
||||
#include "font/standard_colors.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
#include <ctime>
|
||||
|
@ -45,7 +45,7 @@ namespace gui{
|
|||
}
|
||||
if(check_ != nullptr) {
|
||||
if(mode_ == TEXTBOX_MESSAGE) {
|
||||
preferences::set_message_private(check_->checked());
|
||||
prefs::get().set_message_private(check_->checked());
|
||||
}
|
||||
}
|
||||
box_.reset(nullptr);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "gui/core/log.hpp"
|
||||
#include "sdl/point.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "video.hpp"
|
||||
|
||||
|
||||
|
@ -584,7 +584,7 @@ pango_text& pango_text::set_family_class(font::family_class fclass)
|
|||
|
||||
pango_text& pango_text::set_font_size(unsigned font_size)
|
||||
{
|
||||
font_size = preferences::font_scaled(font_size) * pixel_scale_;
|
||||
font_size = prefs::get().font_scaled(font_size) * pixel_scale_;
|
||||
|
||||
if(font_size != font_size_) {
|
||||
font_size_ = font_size;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "assert.h"
|
||||
#include "gettext.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace utils {
|
||||
|
||||
|
@ -43,7 +43,7 @@ std::string format_time_summary(std::time_t t) {
|
|||
const int days_apart = current_time.tm_yday - save_time.tm_yday;
|
||||
if(days_apart == 0) {
|
||||
// save is from today
|
||||
if(preferences::use_twelve_hour_clock_format() == false) {
|
||||
if(prefs::get().use_twelve_hour_clock_format() == false) {
|
||||
// TRANSLATORS: 24-hour time, eg '13:59'
|
||||
format_string = _("%H:%M");
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ std::string format_time_summary(std::time_t t) {
|
|||
}
|
||||
} else if(days_apart > 0 && days_apart <= current_time.tm_wday) {
|
||||
// save is from this week
|
||||
if(preferences::use_twelve_hour_clock_format() == false) {
|
||||
if(prefs::get().use_twelve_hour_clock_format() == false) {
|
||||
// TRANSLATORS: Day of week + 24-hour time, eg 'Sunday, 13:59'
|
||||
format_string = _("%A, %H:%M");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "config.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "recall_list_manager.hpp"
|
||||
#include "units/unit.hpp"
|
||||
#include "units/animation_component.hpp"
|
||||
|
@ -361,7 +361,7 @@ bool game_board::change_terrain(const map_location &loc, const t_translation::te
|
|||
return false;
|
||||
}
|
||||
|
||||
preferences::encountered_terrains().insert(new_t);
|
||||
prefs::get().encountered_terrains().insert(new_t);
|
||||
|
||||
if(map_->tdata()->is_village(old_t) && !map_->tdata()->is_village(new_t)) {
|
||||
int owner = village_owner(loc);
|
||||
|
@ -372,7 +372,7 @@ bool game_board::change_terrain(const map_location &loc, const t_translation::te
|
|||
map_->set_terrain(loc, new_t);
|
||||
|
||||
for(const t_translation::terrain_code& ut : map_->underlying_union_terrain(loc)) {
|
||||
preferences::encountered_terrains().insert(ut);
|
||||
prefs::get().encountered_terrains().insert(ut);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "config.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "game_version.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
|
@ -78,7 +78,7 @@ config game_classification::to_config() const
|
|||
cfg["difficulty"] = difficulty;
|
||||
cfg["random_mode"] = random_mode;
|
||||
cfg["oos_debug"] = oos_debug;
|
||||
cfg["core"] = preferences::core_id();
|
||||
cfg["core"] = prefs::get().core_id();
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
#include "language.hpp"
|
||||
#include "log.hpp"
|
||||
#include "picture.hpp"
|
||||
#include "preferences/advanced.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "scripting/game_lua_kernel.hpp"
|
||||
#include "serialization/schema_validator.hpp"
|
||||
#include "sound.hpp"
|
||||
|
@ -76,15 +75,15 @@ game_config_manager::game_config_manager(const commandline_options& cmdline_opts
|
|||
}
|
||||
|
||||
// Clean the cache of any old Wesnoth version's cache data
|
||||
if(const std::string last_cleaned = preferences::last_cache_cleared_version(); !last_cleaned.empty()) {
|
||||
if(const std::string last_cleaned = prefs::get().last_cache_cleared_version(); !last_cleaned.empty()) {
|
||||
if(version_info{last_cleaned} < game_config::wesnoth_version) {
|
||||
if(cache_.clean_cache()) {
|
||||
preferences::set_last_cache_cleared_version(game_config::wesnoth_version.str());
|
||||
prefs::get().set_last_cache_cleared_version(game_config::wesnoth_version.str());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If the preference wasn't set, set it, else the cleaning will never happen :P
|
||||
preferences::set_last_cache_cleared_version(game_config::wesnoth_version.str());
|
||||
prefs::get().set_last_cache_cleared_version(game_config::wesnoth_version.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,11 +121,10 @@ bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload)
|
|||
|
||||
// Load the standard hotkeys, then apply any player customizations.
|
||||
hotkey::load_default_hotkeys(game_config());
|
||||
preferences::load_hotkeys();
|
||||
prefs::get().load_hotkeys();
|
||||
});
|
||||
|
||||
// TODO: consider making this part of preferences::manager in some fashion
|
||||
preferences::init_advanced_manager(game_config());
|
||||
prefs::get().load_advanced_prefs(game_config());
|
||||
|
||||
::init_textdomains(game_config());
|
||||
about::set_about(game_config());
|
||||
|
@ -276,7 +274,7 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
|
|||
if(id == "default" && !current_core_valid) {
|
||||
wml_tree_root = path;
|
||||
}
|
||||
if(id == preferences::core_id()) {
|
||||
if(id == prefs::get().core_id()) {
|
||||
current_core_valid = true;
|
||||
wml_tree_root = path;
|
||||
}
|
||||
|
@ -288,11 +286,11 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
|
|||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading core data."),
|
||||
_("Core ID: ") + preferences::core_id()
|
||||
_("Core ID: ") + prefs::get().core_id()
|
||||
+ '\n' + _("Error loading the core with named id.")
|
||||
+ '\n' + _("Falling back to the default core."));
|
||||
});
|
||||
preferences::set_core_id("default");
|
||||
prefs::get().set_core_id("default");
|
||||
}
|
||||
|
||||
// check if we have a valid default core which should always be the case.
|
||||
|
@ -366,13 +364,13 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
|
|||
e.message);
|
||||
});
|
||||
load_game_config(reload_everything, classification, scenario_id);
|
||||
} else if(preferences::core_id() != "default") {
|
||||
} else if(prefs::get().core_id() != "default") {
|
||||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading custom game configuration files. The game will fallback to the default core files."),
|
||||
e.message);
|
||||
});
|
||||
preferences::set_core_id("default");
|
||||
prefs::get().set_core_id("default");
|
||||
game_config::no_addons = false;
|
||||
load_game_config(reload_everything, classification, scenario_id);
|
||||
} else {
|
||||
|
@ -537,7 +535,7 @@ void game_config_manager::load_addons_cfg()
|
|||
|
||||
// Skip add-ons not matching our current core. Cores themselves should be selectable
|
||||
// at all times, so they aren't considered here.
|
||||
if(!metadata.empty() && metadata["type"] != "core" && using_core != preferences::core_id()) {
|
||||
if(!metadata.empty() && metadata["type"] != "core" && using_core != prefs::get().core_id()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "fake_unit_manager.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "font/standard_colors.hpp"
|
||||
|
@ -587,7 +587,7 @@ void game_display::set_route(const pathfind::marked_route *route)
|
|||
|
||||
void game_display::float_label(const map_location& loc, const std::string& text, const color_t& color)
|
||||
{
|
||||
if(preferences::show_floating_labels() == false || fogged(loc)) {
|
||||
if(prefs::get().show_floating_labels() == false || fogged(loc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "mp_game_settings.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "map_settings.hpp"
|
||||
#include "tod_manager.hpp"
|
||||
|
||||
|
@ -58,109 +57,109 @@ bool configure_engine::force_lock_settings() const
|
|||
std::string configure_engine::game_name_default()
|
||||
{
|
||||
utils::string_map i18n_symbols;
|
||||
i18n_symbols["login"] = preferences::login();
|
||||
i18n_symbols["login"] = prefs::get().login();
|
||||
return VGETTEXT("$login|’s game", i18n_symbols);
|
||||
}
|
||||
|
||||
int configure_engine::num_turns_default() const
|
||||
{
|
||||
return use_map_settings() ? settings::get_turns(initial_cfg()["turns"]) : preferences::turns();
|
||||
return use_map_settings() ? settings::get_turns(initial_cfg()["turns"]) : prefs::get().turns();
|
||||
}
|
||||
|
||||
int configure_engine::village_gold_default() const
|
||||
{
|
||||
return use_map_settings()
|
||||
? settings::get_village_gold(initial_cfg()["mp_village_gold"], &state_.classification())
|
||||
: preferences::village_gold();
|
||||
: prefs::get().village_gold();
|
||||
}
|
||||
|
||||
int configure_engine::village_support_default() const
|
||||
{
|
||||
return use_map_settings()
|
||||
? settings::get_village_support(initial_cfg()["mp_village_support"])
|
||||
: preferences::village_support();
|
||||
: prefs::get().village_support();
|
||||
}
|
||||
|
||||
int configure_engine::xp_modifier_default() const
|
||||
{
|
||||
return use_map_settings()
|
||||
? settings::get_xp_modifier(initial_cfg()["experience_modifier"])
|
||||
: preferences::xp_modifier();
|
||||
: prefs::get().xp_modifier();
|
||||
}
|
||||
|
||||
int configure_engine::mp_countdown_init_time_default() const
|
||||
{
|
||||
return preferences::countdown_init_time();
|
||||
return prefs::get().countdown_init_time();
|
||||
}
|
||||
|
||||
int configure_engine::mp_countdown_reservoir_time_default() const
|
||||
{
|
||||
return preferences::countdown_reservoir_time();
|
||||
return prefs::get().countdown_reservoir_time();
|
||||
}
|
||||
|
||||
int configure_engine::mp_countdown_turn_bonus_default() const
|
||||
{
|
||||
return preferences::countdown_turn_bonus();
|
||||
return prefs::get().countdown_turn_bonus();
|
||||
}
|
||||
|
||||
int configure_engine::mp_countdown_action_bonus_default() const
|
||||
{
|
||||
return preferences::countdown_action_bonus();
|
||||
return prefs::get().countdown_action_bonus();
|
||||
}
|
||||
|
||||
bool configure_engine::mp_countdown_default() const
|
||||
{
|
||||
return preferences::countdown();
|
||||
return prefs::get().countdown();
|
||||
}
|
||||
|
||||
bool configure_engine::use_map_settings_default() const
|
||||
{
|
||||
return force_lock_settings() || preferences::use_map_settings();
|
||||
return force_lock_settings() || prefs::get().use_map_settings();
|
||||
}
|
||||
|
||||
bool configure_engine::random_start_time_default() const
|
||||
{
|
||||
return use_map_settings()
|
||||
? initial_cfg()["random_start_time"].to_bool(false)
|
||||
: preferences::random_start_time();
|
||||
: prefs::get().random_start_time();
|
||||
}
|
||||
|
||||
bool configure_engine::fog_game_default() const
|
||||
{
|
||||
return use_map_settings()
|
||||
? initial_cfg()["mp_fog"].to_bool(state_.classification().is_normal_mp_game())
|
||||
: preferences::fog();
|
||||
: prefs::get().fog();
|
||||
}
|
||||
|
||||
bool configure_engine::shroud_game_default() const
|
||||
{
|
||||
return use_map_settings() ? initial_cfg()["mp_shroud"].to_bool(false) : preferences::shroud();
|
||||
return use_map_settings() ? initial_cfg()["mp_shroud"].to_bool(false) : prefs::get().shroud();
|
||||
}
|
||||
|
||||
bool configure_engine::allow_observers_default() const
|
||||
{
|
||||
return preferences::allow_observers();
|
||||
return prefs::get().allow_observers();
|
||||
}
|
||||
|
||||
bool configure_engine::shuffle_sides_default() const
|
||||
{
|
||||
return preferences::shuffle_sides();
|
||||
return prefs::get().shuffle_sides();
|
||||
}
|
||||
|
||||
random_faction_mode::type configure_engine::random_faction_mode_default() const
|
||||
{
|
||||
return random_faction_mode::get_enum(preferences::random_faction_mode()).value_or(random_faction_mode::type::independent);
|
||||
return random_faction_mode::get_enum(prefs::get().random_faction_mode()).value_or(random_faction_mode::type::independent);
|
||||
}
|
||||
|
||||
void configure_engine::set_options(const config& cfg)
|
||||
{
|
||||
parameters_.options = cfg;
|
||||
preferences::set_options(cfg);
|
||||
prefs::get().set_options(cfg);
|
||||
}
|
||||
|
||||
const config& configure_engine::options_default() const
|
||||
{
|
||||
return preferences::options();
|
||||
return prefs::get().options();
|
||||
}
|
||||
|
||||
void configure_engine::write_parameters()
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
#include "game_initialization/mp_game_utils.hpp"
|
||||
#include "game_initialization/multiplayer.hpp"
|
||||
#include "game_initialization/playcampaign.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
|
@ -204,10 +203,10 @@ connect_engine::connect_engine(saved_game& state, const bool first_scenario, mp_
|
|||
|
||||
if(first_scenario_) {
|
||||
// Add host to the connected users list.
|
||||
import_user(preferences::login(), false);
|
||||
import_user(prefs::get().login(), false);
|
||||
} else {
|
||||
// Add host but don't assign a side to him.
|
||||
import_user(preferences::login(), true);
|
||||
import_user(prefs::get().login(), true);
|
||||
|
||||
// Load reserved players information into the sides.
|
||||
load_previous_sides_users();
|
||||
|
@ -741,7 +740,7 @@ void connect_engine::send_level_data() const
|
|||
"create_game", config {
|
||||
"name", params_.name,
|
||||
"password", params_.password,
|
||||
"ignored", preferences::get_ignored_delim(),
|
||||
"ignored", prefs::get().get_ignored_delim(),
|
||||
"auto_hosted", false,
|
||||
},
|
||||
});
|
||||
|
@ -968,13 +967,13 @@ config side_engine::new_config() const
|
|||
// The hosts receives the serversided controller tweaks after the start event, but
|
||||
// for mp sync it's very important that the controller types are correct
|
||||
// during the start/prestart event (otherwise random unit creation during prestart fails).
|
||||
res["is_local"] = player_id_ == preferences::login() || controller_ == CNTR_COMPUTER || controller_ == CNTR_LOCAL;
|
||||
res["is_local"] = player_id_ == prefs::get().login() || controller_ == CNTR_COMPUTER || controller_ == CNTR_LOCAL;
|
||||
|
||||
// This function (new_config) is only meant to be called by the host's machine, which is why this check
|
||||
// works. It essentially certifies that whatever side has the player_id that matches the host's login
|
||||
// will be flagged. The reason we cannot check mp_game_metadata::is_host is because that flag is *always*
|
||||
// true on the host's machine, meaning this flag would be set to true for every side.
|
||||
res["is_host"] = player_id_ == preferences::login();
|
||||
res["is_host"] = player_id_ == prefs::get().login();
|
||||
|
||||
std::string desc = user_description();
|
||||
if(!desc.empty()) {
|
||||
|
@ -1011,17 +1010,17 @@ config side_engine::new_config() const
|
|||
// The "player_id" is the id of the client who controls that side. It's always the host for Local and AI players and
|
||||
// always empty for free/reserved sides or null controlled sides. You can use !res["player_id"].empty() to check
|
||||
// whether a side is already taken.
|
||||
assert(!preferences::login().empty());
|
||||
assert(!prefs::get().login().empty());
|
||||
if(controller_ == CNTR_LOCAL) {
|
||||
res["player_id"] = preferences::login();
|
||||
res["current_player"] = preferences::login();
|
||||
res["player_id"] = prefs::get().login();
|
||||
res["current_player"] = prefs::get().login();
|
||||
} else if(controller_ == CNTR_RESERVED) {
|
||||
res.remove_attribute("player_id");
|
||||
res["current_player"] = reserved_for_;
|
||||
} else if(controller_ == CNTR_COMPUTER) {
|
||||
// TODO: what is the content of player_id_ here ?
|
||||
res["current_player"] = desc;
|
||||
res["player_id"] = preferences::login();
|
||||
res["player_id"] = prefs::get().login();
|
||||
} else if(!player_id_.empty()) {
|
||||
res["player_id"] = player_id_;
|
||||
res["current_player"] = player_id_;
|
||||
|
@ -1146,7 +1145,7 @@ bool side_engine::ready_for_start() const
|
|||
}
|
||||
|
||||
if(controller_ == CNTR_NETWORK) {
|
||||
if(player_id_ == preferences::login() || !waiting_to_choose_faction_ || !allow_changes_) {
|
||||
if(player_id_ == prefs::get().login() || !waiting_to_choose_faction_ || !allow_changes_) {
|
||||
// The host is ready. A network player, who got a chance
|
||||
// to choose faction if allowed, is also ready.
|
||||
return true;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "filesystem.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_initialization/component_availability.hpp"
|
||||
#include "generators/map_create.hpp"
|
||||
#include "gui/dialogs/campaign_difficulty.hpp"
|
||||
|
@ -219,10 +219,10 @@ void campaign::set_metadata()
|
|||
|
||||
void campaign::mark_if_completed()
|
||||
{
|
||||
data_["completed"] = preferences::is_campaign_completed(data_["id"]);
|
||||
data_["completed"] = prefs::get().is_campaign_completed(data_["id"]);
|
||||
|
||||
for(auto& cfg : data_.child_range("difficulty")) {
|
||||
cfg["completed_at"] = preferences::is_campaign_completed(data_["id"], cfg["define"]);
|
||||
cfg["completed_at"] = prefs::get().is_campaign_completed(data_["id"], cfg["define"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ create_engine::create_engine(saved_game& state)
|
|||
|
||||
state_.mp_settings().saved_game = saved_game_mode::type::no;
|
||||
|
||||
for(const std::string& str : preferences::modifications(state_.classification().is_multiplayer())) {
|
||||
for(const std::string& str : prefs::get().modifications(state_.classification().is_multiplayer())) {
|
||||
if(game_config_.find_child("modification", "id", str)) {
|
||||
state_.classification().active_mods.push_back(str);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
#include "map/exception.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "mp_game_settings.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
|
||||
|
@ -72,11 +71,11 @@ user_info::user_state user_info::get_state(int selected_game_id) const
|
|||
|
||||
user_info::user_relation user_info::get_relation() const
|
||||
{
|
||||
if(name == preferences::login()) {
|
||||
if(name == prefs::get().login()) {
|
||||
return user_relation::ME;
|
||||
} else if(preferences::is_ignored(name)) {
|
||||
} else if(prefs::get().is_ignored(name)) {
|
||||
return user_relation::IGNORED;
|
||||
} else if(preferences::is_friend(name)) {
|
||||
} else if(prefs::get().is_friend(name)) {
|
||||
return user_relation::FRIEND;
|
||||
} else {
|
||||
return user_relation::NEUTRAL;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#include "log.hpp"
|
||||
#include "map_settings.hpp"
|
||||
#include "multiplayer_error_codes.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "saved_game.hpp"
|
||||
|
@ -314,7 +313,7 @@ std::unique_ptr<wesnothd_connection> mp_manager::open_connection(std::string hos
|
|||
|
||||
// Enter login loop
|
||||
while(true) {
|
||||
std::string login = preferences::login();
|
||||
std::string login = prefs::get().login();
|
||||
|
||||
config response;
|
||||
config& sp = response.add_child("login");
|
||||
|
@ -353,7 +352,7 @@ std::unique_ptr<wesnothd_connection> mp_manager::open_connection(std::string hos
|
|||
if(!error) break;
|
||||
|
||||
do {
|
||||
std::string password = preferences::password(host, login);
|
||||
std::string password = prefs::get().password(host, login);
|
||||
|
||||
const bool fall_through = (*error)["force_confirmation"].to_bool()
|
||||
? (gui2::show_message(_("Confirm"), (*error)["message"], gui2::dialogs::message::ok_cancel_buttons) == gui2::retval::CANCEL)
|
||||
|
@ -468,7 +467,7 @@ std::unique_ptr<wesnothd_connection> mp_manager::open_connection(std::string hos
|
|||
}
|
||||
|
||||
// If we have got a new username we have to start all over again
|
||||
} while(login == preferences::login());
|
||||
} while(login == prefs::get().login());
|
||||
|
||||
// Somewhat hacky...
|
||||
// If we broke out of the do-while loop above error is still going to be nullopt
|
||||
|
@ -585,7 +584,7 @@ void mp_manager::enter_staging_mode()
|
|||
// If we have a connection, set the appropriate info. No connection means we're in local game mode.
|
||||
if(connection) {
|
||||
metadata = std::make_unique<mp_game_metadata>(*connection);
|
||||
metadata->connected_players.insert(preferences::login());
|
||||
metadata->connected_players.insert(prefs::get().login());
|
||||
metadata->is_host = true;
|
||||
}
|
||||
|
||||
|
@ -620,9 +619,9 @@ void mp_manager::enter_wait_mode(int game_id, bool observe)
|
|||
metadata.current_turn = gi->current_turn;
|
||||
}
|
||||
|
||||
if(preferences::skip_mp_replay() || preferences::blindfold_replay()) {
|
||||
if(prefs::get().skip_mp_replay() || prefs::get().blindfold_replay()) {
|
||||
metadata.skip_replay = true;
|
||||
metadata.skip_replay_blindfolded = preferences::blindfold_replay();
|
||||
metadata.skip_replay_blindfolded = prefs::get().blindfold_replay();
|
||||
}
|
||||
|
||||
bool dlg_ok = false;
|
||||
|
@ -681,7 +680,7 @@ void start_local_game()
|
|||
{
|
||||
DBG_MP << "starting local game";
|
||||
|
||||
preferences::set_message_private(false);
|
||||
prefs::get().set_message_private(false);
|
||||
|
||||
mp_manager(std::nullopt).enter_create_mode();
|
||||
}
|
||||
|
@ -695,7 +694,7 @@ void start_local_game_commandline(const commandline_options& cmdline_opts)
|
|||
// The setup is done equivalently to lobby MP games using as much of existing
|
||||
// code as possible. This means that some things are set up that are not
|
||||
// needed in commandline mode, but they are required by the functions called.
|
||||
preferences::set_message_private(false);
|
||||
prefs::get().set_message_private(false);
|
||||
|
||||
DBG_MP << "entering create mode";
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "log.hpp"
|
||||
#include "map/exception.hpp"
|
||||
#include "playmp_controller.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "saved_game.hpp"
|
||||
#include "savegame.hpp"
|
||||
#include "sound.hpp"
|
||||
|
@ -182,12 +182,12 @@ level_result::type campaign_controller::play_game()
|
|||
return res;
|
||||
}
|
||||
|
||||
if(preferences::delete_saves()) {
|
||||
if(prefs::get().delete_saves()) {
|
||||
savegame::clean_saves(state_.classification().label);
|
||||
}
|
||||
|
||||
if(preferences::save_replays() && end_level.replay_save) {
|
||||
savegame::replay_savegame save(state_, preferences::save_compression_format());
|
||||
if(prefs::get().save_replays() && end_level.replay_save) {
|
||||
savegame::replay_savegame save(state_, prefs::get().save_compression_format());
|
||||
save.save_game_automatic(true);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ level_result::type campaign_controller::play_game()
|
|||
if(state_.get_scenario_id().empty()) {
|
||||
// Don't show The End for multiplayer scenarios.
|
||||
if(res == level_result::type::victory && !state_.classification().is_normal_mp_game()) {
|
||||
preferences::add_completed_campaign(
|
||||
prefs::get().add_completed_campaign(
|
||||
state_.classification().campaign, state_.classification().difficulty);
|
||||
|
||||
if(state_.classification().end_credits) {
|
||||
|
@ -266,7 +266,7 @@ level_result::type campaign_controller::play_game()
|
|||
// For multiplayer, we want the save to contain the starting position.
|
||||
// For campaigns however, this is the start-of-scenario save and the
|
||||
// starting position needs to be empty, to force a reload of the scenario config.
|
||||
savegame::scenariostart_savegame save(state_, preferences::save_compression_format());
|
||||
savegame::scenariostart_savegame save(state_, prefs::get().save_compression_format());
|
||||
save.save_game_automatic();
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ level_result::type campaign_controller::play_game()
|
|||
}
|
||||
|
||||
if(state_.classification().is_scenario()) {
|
||||
if(preferences::delete_saves()) {
|
||||
if(prefs::get().delete_saves()) {
|
||||
savegame::clean_saves(state_.classification().label);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,7 @@
|
|||
#include "language.hpp" // for language_def, etc
|
||||
#include "log.hpp" // for LOG_STREAM, logger, general, etc
|
||||
#include "map/exception.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/display.hpp"
|
||||
#include "preferences/general.hpp" // for disable_preferences_save, etc
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "save_index.hpp"
|
||||
#include "scripting/application_lua_kernel.hpp"
|
||||
#include "sdl/surface.hpp" // for surface
|
||||
|
@ -93,7 +91,6 @@ namespace bp = boost::process;
|
|||
game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
||||
: cmdline_opts_(cmdline_opts)
|
||||
, font_manager_()
|
||||
, prefs_manager_()
|
||||
, image_manager_()
|
||||
, main_event_context_()
|
||||
, hotkey_manager_()
|
||||
|
@ -131,7 +128,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
}
|
||||
|
||||
if(cmdline_opts_.core_id) {
|
||||
preferences::set_core_id(*cmdline_opts_.core_id);
|
||||
prefs::get().set_core_id(*cmdline_opts_.core_id);
|
||||
}
|
||||
if(cmdline_opts_.campaign) {
|
||||
jump_to_campaign_.jump = true;
|
||||
|
@ -174,7 +171,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
}
|
||||
}
|
||||
if(cmdline_opts_.fps)
|
||||
preferences::set_show_fps(true);
|
||||
prefs::get().set_show_fps(true);
|
||||
if(cmdline_opts_.fullscreen)
|
||||
start_in_fullscreen_ = true;
|
||||
if(cmdline_opts_.load)
|
||||
|
@ -187,11 +184,11 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
if(1000 % fps != 0) {
|
||||
++fps;
|
||||
}
|
||||
preferences::set_draw_delay(fps);
|
||||
prefs::get().set_draw_delay(fps);
|
||||
}
|
||||
if(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test) {
|
||||
no_sound = true;
|
||||
preferences::disable_preferences_save();
|
||||
prefs::get().disable_preferences_save();
|
||||
}
|
||||
if(cmdline_opts_.new_widgets)
|
||||
gui2::new_widgets = true;
|
||||
|
@ -205,8 +202,8 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
const int xres = std::get<0>(*cmdline_opts_.resolution);
|
||||
const int yres = std::get<1>(*cmdline_opts_.resolution);
|
||||
if(xres > 0 && yres > 0) {
|
||||
preferences::set_resolution(point(xres, yres));
|
||||
preferences::set_maximized(false);
|
||||
prefs::get().set_resolution(point(xres, yres));
|
||||
prefs::get().set_maximized(false);
|
||||
}
|
||||
}
|
||||
if(cmdline_opts_.screenshot) {
|
||||
|
@ -214,7 +211,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
screenshot_map_ = *cmdline_opts_.screenshot_map_file;
|
||||
screenshot_filename_ = *cmdline_opts_.screenshot_output_file;
|
||||
no_sound = true;
|
||||
preferences::disable_preferences_save();
|
||||
prefs::get().disable_preferences_save();
|
||||
}
|
||||
if (cmdline_opts_.server){
|
||||
jump_to_multiplayer_ = true;
|
||||
|
@ -224,17 +221,17 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
} else {
|
||||
// Pick the first server in config
|
||||
if(game_config::server_list.size() > 0) {
|
||||
multiplayer_server_ = preferences::network_host();
|
||||
multiplayer_server_ = prefs::get().network_host();
|
||||
} else {
|
||||
multiplayer_server_ = "";
|
||||
}
|
||||
}
|
||||
if(cmdline_opts_.username) {
|
||||
preferences::disable_preferences_save();
|
||||
preferences::set_login(*cmdline_opts_.username);
|
||||
prefs::get().disable_preferences_save();
|
||||
prefs::get().set_login(*cmdline_opts_.username);
|
||||
if(cmdline_opts_.password) {
|
||||
preferences::disable_preferences_save();
|
||||
preferences::set_password(*cmdline_opts.server, *cmdline_opts.username, *cmdline_opts_.password);
|
||||
prefs::get().disable_preferences_save();
|
||||
prefs::get().set_password(*cmdline_opts.server, *cmdline_opts.username, *cmdline_opts_.password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,15 +260,15 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
|
|||
}
|
||||
|
||||
// disable sound in nosound mode, or when sound engine failed to initialize
|
||||
if(no_sound || ((preferences::sound_on() || preferences::music_on() ||
|
||||
preferences::turn_bell() || preferences::UI_sound_on()) &&
|
||||
if(no_sound || ((prefs::get().sound_on() || prefs::get().music_on() ||
|
||||
prefs::get().turn_bell() || prefs::get().ui_sound_on()) &&
|
||||
!sound::init_sound())) {
|
||||
preferences::set_sound(false);
|
||||
preferences::set_music(false);
|
||||
preferences::set_turn_bell(false);
|
||||
preferences::set_UI_sound(false);
|
||||
prefs::get().set_sound(false);
|
||||
prefs::get().set_music(false);
|
||||
prefs::get().set_turn_bell(false);
|
||||
prefs::get().set_ui_sound(false);
|
||||
} else if(no_music) { // else disable the music in nomusic mode
|
||||
preferences::set_music(false);
|
||||
prefs::get().set_music(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,8 +818,8 @@ bool game_launcher::goto_editor()
|
|||
void game_launcher::start_wesnothd()
|
||||
{
|
||||
std::string wesnothd_program = "";
|
||||
if(!preferences::get_mp_server_program_name().empty()) {
|
||||
wesnothd_program = preferences::get_mp_server_program_name();
|
||||
if(!prefs::get().get_mp_server_program_name().empty()) {
|
||||
wesnothd_program = prefs::get().get_mp_server_program_name();
|
||||
} else {
|
||||
wesnothd_program = filesystem::get_wesnothd_name();
|
||||
}
|
||||
|
@ -848,7 +845,7 @@ void game_launcher::start_wesnothd()
|
|||
}
|
||||
catch(const bp::process_error& e)
|
||||
{
|
||||
preferences::set_mp_server_program_name("");
|
||||
prefs::get().set_mp_server_program_name("");
|
||||
|
||||
// Couldn't start server so throw error
|
||||
WRN_GENERAL << "Failed to start server " << wesnothd_program << ":\n" << e.what();
|
||||
|
@ -863,7 +860,7 @@ bool game_launcher::play_multiplayer(mp_mode mode)
|
|||
try {
|
||||
start_wesnothd();
|
||||
} catch(const game::mp_server_error&) {
|
||||
preferences::show_wesnothd_server_search();
|
||||
prefs::get().show_wesnothd_server_search();
|
||||
|
||||
try {
|
||||
start_wesnothd();
|
||||
|
@ -880,10 +877,10 @@ bool game_launcher::play_multiplayer(mp_mode mode)
|
|||
}
|
||||
|
||||
// The prompt saves its input to preferences.
|
||||
multiplayer_server_ = preferences::network_host();
|
||||
multiplayer_server_ = prefs::get().network_host();
|
||||
|
||||
if(multiplayer_server_ != preferences::builtin_servers_list().front().address) {
|
||||
preferences::set_network_host(multiplayer_server_);
|
||||
if(multiplayer_server_ != prefs::get().builtin_servers_list().front().address) {
|
||||
prefs::get().set_network_host(multiplayer_server_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "game_end_exceptions.hpp" // for LEVEL_RESULT, etc
|
||||
#include "hotkey/hotkey_manager.hpp" // for manager
|
||||
#include "picture.hpp" // for manager
|
||||
#include "preferences/game.hpp" // for manager
|
||||
#include "saved_game.hpp" // for saved_game
|
||||
#include "savegame.hpp" // for clean_saves, etc
|
||||
#include "sound.hpp" // for music_thinker
|
||||
|
@ -132,7 +131,6 @@ private:
|
|||
bool start_in_fullscreen_ = false;
|
||||
|
||||
font::manager font_manager_;
|
||||
const preferences::manager prefs_manager_;
|
||||
const image::manager image_manager_;
|
||||
const events::event_context main_event_context_;
|
||||
const hotkey::manager hotkey_manager_;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "pathfind/pathfind.hpp"
|
||||
#include "pathfind/teleport.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "random_deterministic.hpp"
|
||||
#include "reports.hpp"
|
||||
#include "scripting/game_lua_kernel.hpp"
|
||||
|
@ -202,7 +202,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
|
||||
for(std::size_t i = 0; i < board_.teams().size(); i++) {
|
||||
// Labels from players in your ignore list default to hidden
|
||||
if(preferences::is_ignored(board_.teams()[i].current_player())) {
|
||||
if(prefs::get().is_ignored(board_.teams()[i].current_player())) {
|
||||
std::string label_cat = "side:" + std::to_string(i + 1);
|
||||
board_.hidden_label_categories().push_back(label_cat);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "gui/auxiliary/tips.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "random.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
|
@ -47,7 +47,7 @@ std::vector<game_tip> load(const config& cfg)
|
|||
std::vector<game_tip> shuffle(const std::vector<game_tip>& tips)
|
||||
{
|
||||
std::vector<game_tip> result = tips;
|
||||
const std::set<std::string>& units = preferences::encountered_units();
|
||||
const std::set<std::string>& units = prefs::get().encountered_units();
|
||||
|
||||
// Remove entries whose filters do not match from the tips list.
|
||||
const auto iter = std::remove_if(result.begin(), result.end(), [&units](const game_tip& tip) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "gui/widgets/progress_bar.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CONFIG LOG_STREAM(err, log_config)
|
||||
|
@ -40,7 +40,7 @@ REGISTER_DIALOG(achievements_dialog)
|
|||
achievements_dialog::achievements_dialog()
|
||||
: modal_dialog(window_id())
|
||||
, achieve_()
|
||||
, last_selected_(preferences::selected_achievement_group())
|
||||
, last_selected_(prefs::get().selected_achievement_group())
|
||||
, achievements_box_(nullptr)
|
||||
, content_names_(nullptr)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void achievements_dialog::pre_show(window& win)
|
|||
|
||||
void achievements_dialog::post_show(window&)
|
||||
{
|
||||
preferences::set_selected_achievement_group(last_selected_);
|
||||
prefs::get().set_selected_achievement_group(last_selected_);
|
||||
}
|
||||
|
||||
void achievements_dialog::set_achievements_row()
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "gui/widgets/menu_button.hpp"
|
||||
#include "gui/widgets/password_box.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
|
@ -35,8 +35,8 @@ addon_auth::addon_auth(config& cfg)
|
|||
, cfg_(cfg)
|
||||
{
|
||||
register_bool("remember_password", false,
|
||||
&preferences::remember_password,
|
||||
&preferences::set_remember_password);
|
||||
[]() {return prefs::get().remember_password();},
|
||||
[](bool v) {prefs::get().set_remember_password(v);});
|
||||
}
|
||||
|
||||
void addon_auth::pre_show(window& win)
|
||||
|
|
|
@ -37,13 +37,11 @@
|
|||
#include "gui/widgets/drawing.hpp"
|
||||
#include "gui/widgets/text_box.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "picture.hpp"
|
||||
#include "language.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "utils/general.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
|
@ -447,8 +445,8 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
order_dropdown.set_values(order_dropdown_entries);
|
||||
{
|
||||
const std::string saved_order_name = preferences::addon_manager_saved_order_name();
|
||||
const sort_order::type saved_order_direction = preferences::addon_manager_saved_order_direction();
|
||||
const std::string saved_order_name = prefs::get().addon_manager_saved_order_name();
|
||||
const sort_order::type saved_order_direction = prefs::get().addon_manager_saved_order_direction();
|
||||
|
||||
if(!saved_order_name.empty()) {
|
||||
auto order_it = std::find_if(all_orders_.begin(), all_orders_.end(),
|
||||
|
@ -794,8 +792,8 @@ void addon_manager::order_addons()
|
|||
}
|
||||
|
||||
find_widget<addon_list>(get_window(), "addons", false).set_addon_order(func);
|
||||
preferences::set_addon_manager_saved_order_name(order_struct.as_preference);
|
||||
preferences::set_addon_manager_saved_order_direction(order);
|
||||
prefs::get().set_addon_manager_saved_order_name(order_struct.as_preference);
|
||||
prefs::get().set_addon_manager_saved_order_direction(order);
|
||||
}
|
||||
|
||||
void addon_manager::on_order_changed(unsigned int sort_column, sort_order::type order)
|
||||
|
@ -808,8 +806,8 @@ void addon_manager::on_order_changed(unsigned int sort_column, sort_order::type
|
|||
++index;
|
||||
}
|
||||
order_menu.set_value(index);
|
||||
preferences::set_addon_manager_saved_order_name(order_it->as_preference);
|
||||
preferences::set_addon_manager_saved_order_direction(order);
|
||||
prefs::get().set_addon_manager_saved_order_name(order_it->as_preference);
|
||||
prefs::get().set_addon_manager_saved_order_direction(order);
|
||||
}
|
||||
|
||||
template<void(addon_manager::*fptr)(const addon_info& addon)>
|
||||
|
@ -933,11 +931,11 @@ void addon_manager::publish_addon(const addon_info& addon)
|
|||
|
||||
// if the passphrase isn't provided from the _server.pbl, try to pre-populate it from the preferences before prompting for it
|
||||
if(cfg["passphrase"].empty()) {
|
||||
cfg["passphrase"] = preferences::password(preferences::campaign_server(), cfg["author"]);
|
||||
cfg["passphrase"] = prefs::get().password(prefs::get().campaign_server(), cfg["author"]);
|
||||
if(!gui2::dialogs::addon_auth::execute(cfg)) {
|
||||
return;
|
||||
} else {
|
||||
preferences::set_password(preferences::campaign_server(), cfg["author"], cfg["passphrase"]);
|
||||
prefs::get().set_password(prefs::get().campaign_server(), cfg["author"], cfg["passphrase"]);
|
||||
}
|
||||
} else if(cfg["forum_auth"].to_bool()) {
|
||||
// if the uploader's forum password is present in the _server.pbl
|
||||
|
@ -1040,7 +1038,7 @@ static std::string format_addon_time(std::time_t time)
|
|||
if(time) {
|
||||
std::ostringstream ss;
|
||||
|
||||
const std::string format = preferences::use_twelve_hour_clock_format()
|
||||
const std::string format = prefs::get().use_twelve_hour_clock_format()
|
||||
// TRANSLATORS: Month + day of month + year + 12-hour time, eg 'November 02 2021, 1:59 PM'. Format for your locale.
|
||||
// Format reference: https://www.boost.org/doc/libs/1_85_0/doc/html/date_time/date_time_io.html#date_time.format_flags
|
||||
? _("%B %d %Y, %I:%M %p")
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
static lg::log_domain log_wml("wml");
|
||||
#define WRN_WML LOG_STREAM(warn, log_wml)
|
||||
|
@ -100,7 +100,7 @@ void campaign_difficulty::pre_show(window& window)
|
|||
}
|
||||
|
||||
styled_widget& widget = find_widget<styled_widget>(&grid, "victory", false);
|
||||
if(preferences::is_campaign_completed(campaign_id_, d["define"])) {
|
||||
if(prefs::get().is_campaign_completed(campaign_id_, d["define"])) {
|
||||
// Use different laurels according to the difficulty level, following the
|
||||
// pre-existing convention established in campaign_selection class.
|
||||
// Assumes ascending order of difficulty and gold laurel is set first
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "gui/widgets/tree_view.hpp"
|
||||
#include "gui/widgets/tree_view_node.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include "utils/irdya_datetime.hpp"
|
||||
|
@ -90,7 +90,7 @@ void campaign_selection::campaign_selected()
|
|||
entry["label"] = cfg["label"].str() + " (" + cfg["description"].str() + ")";
|
||||
entry["image"] = cfg["image"].str("misc/blank-hex.png");
|
||||
|
||||
if(preferences::is_campaign_completed(tree.selected_item()->id(), cfg["define"])) {
|
||||
if(prefs::get().is_campaign_completed(tree.selected_item()->id(), cfg["define"])) {
|
||||
std::string laurel;
|
||||
|
||||
if(n + 1 >= max_n) {
|
||||
|
@ -228,7 +228,7 @@ void campaign_selection::sort_campaigns(campaign_selection::CAMPAIGN_ORDER order
|
|||
|
||||
bool exists_in_filtered_result = false;
|
||||
for(unsigned i = 0; i < levels.size(); ++i) {
|
||||
bool completed = preferences::is_campaign_completed(levels[i]->data()["id"]);
|
||||
bool completed = prefs::get().is_campaign_completed(levels[i]->data()["id"]);
|
||||
config::const_child_itors difficulties = levels[i]->data().child_range("difficulty");
|
||||
auto did_complete_at = [](const config& c) { return c["completed_at"].to_bool(); };
|
||||
|
||||
|
@ -494,7 +494,7 @@ void campaign_selection::post_show(window& window)
|
|||
|
||||
rng_mode_ = RNG_MODE(std::clamp<unsigned>(find_widget<menu_button>(&window, "rng_menu", false).get_value(), RNG_DEFAULT, RNG_BIASED));
|
||||
|
||||
preferences::set_modifications(engine_.active_mods(), false);
|
||||
prefs::get().set_modifications(engine_.active_mods(), false);
|
||||
}
|
||||
|
||||
void campaign_selection::mod_toggled()
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "font/pango/escape.hpp"
|
||||
#include "desktop/clipboard.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "log.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
chat_log_history.begin() + last))
|
||||
{
|
||||
const std::string& timestamp
|
||||
= preferences::get_chat_timestamp(t.time());
|
||||
= prefs::get().get_chat_timestamp(t.time());
|
||||
|
||||
if(!lcfilter.empty()) {
|
||||
const std::string& lcsample = utf8::lowercase(timestamp)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
|
@ -48,14 +48,14 @@ void editor_choose_addon::post_show(window& win)
|
|||
|
||||
if(selected_row == 0) {
|
||||
addon_id_ = "///newaddon///";
|
||||
preferences::set_editor_chosen_addon("");
|
||||
prefs::get().set_editor_chosen_addon("");
|
||||
} else if(selected_row == 1 && find_widget<toggle_button>(get_window(), "show_all", false).get_value_bool()) {
|
||||
addon_id_ = "mainline";
|
||||
preferences::set_editor_chosen_addon("");
|
||||
prefs::get().set_editor_chosen_addon("");
|
||||
} else {
|
||||
grid* row = existing_addons.get_row_grid(selected_row);
|
||||
addon_id_ = dynamic_cast<label*>(row->find("existing_addon_id", false))->get_label();
|
||||
preferences::set_editor_chosen_addon(addon_id_);
|
||||
prefs::get().set_editor_chosen_addon(addon_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void editor_choose_addon::populate_list(bool show_all)
|
|||
{"existing_addon_id", widget_item{{"label", dir}}},
|
||||
};
|
||||
existing_addons.add_row(entry);
|
||||
if(dir == preferences::editor_chosen_addon()) {
|
||||
if(dir == prefs::get().editor_chosen_addon()) {
|
||||
selected_row = existing_addons.get_item_count()-1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "gui/dialogs/game_delete.hpp"
|
||||
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
|
@ -23,23 +23,23 @@ namespace gui2::dialogs
|
|||
REGISTER_DIALOG(game_delete)
|
||||
|
||||
/**
|
||||
* Helper to invert @ref preferences::ask_delete_saves.
|
||||
* Helper to invert @ref prefs::get().ask_delete_saves.
|
||||
*
|
||||
* The value stored and the way shown is inverted.
|
||||
*/
|
||||
static bool get_dont_ask_again()
|
||||
{
|
||||
return !preferences::ask_delete_saves();
|
||||
return !prefs::get().ask_delete_saves();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to invert @ref preferences::set_ask_delete_saves.
|
||||
* Helper to invert @ref prefs::get().set_ask_delete_saves.
|
||||
*
|
||||
* The value stored and the way shown is inverted.
|
||||
*/
|
||||
static void set_dont_ask_again(const bool ask_again)
|
||||
{
|
||||
preferences::set_ask_delete_saves(!ask_again);
|
||||
prefs::get().set_ask_delete_saves(!ask_again);
|
||||
}
|
||||
|
||||
game_delete::game_delete()
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "gui/widgets/window.hpp"
|
||||
#include "language.hpp"
|
||||
#include "picture.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "utils/general.hpp"
|
||||
#include <functional>
|
||||
|
@ -487,7 +487,7 @@ void game_load::delete_button_callback()
|
|||
if(index < games_.size()) {
|
||||
|
||||
// See if we should ask the user for deletion confirmation
|
||||
if(preferences::ask_delete_saves()) {
|
||||
if(prefs::get().ask_delete_saves()) {
|
||||
if(!gui2::dialogs::game_delete::execute()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "game_config.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "language.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ void language_selection::post_show(window& window)
|
|||
assert(res != -1);
|
||||
|
||||
::set_language(langs_[res]);
|
||||
preferences::set_language(langs_[res].localename);
|
||||
prefs::get().set_language(langs_[res].localename);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
@ -120,7 +119,7 @@ void migrate_version_selection::post_show(window& window)
|
|||
|
||||
if(filesystem::file_exists(old_migrate_prefs_file)) {
|
||||
already_migrated = true;
|
||||
migrate_preferences(old_migrate_prefs_file);
|
||||
prefs::get().migrate_preferences(old_migrate_prefs_file);
|
||||
}
|
||||
if(filesystem::file_exists(old_migrate_credentials_file)) {
|
||||
already_migrated = true;
|
||||
|
@ -130,15 +129,14 @@ void migrate_version_selection::post_show(window& window)
|
|||
if(!already_migrated)
|
||||
#endif
|
||||
{
|
||||
migrate_preferences(migrate_prefs_file);
|
||||
prefs::get().migrate_preferences(migrate_prefs_file);
|
||||
migrate_credentials(migrate_credentials_file);
|
||||
}
|
||||
|
||||
// reload preferences and credentials
|
||||
// otherwise the copied files won't be used and also will get overwritten/deleted when Wesnoth closes
|
||||
preferences::load_base_prefs();
|
||||
preferences::load_game_prefs();
|
||||
preferences::load_credentials();
|
||||
|
||||
prefs::get().reload_preferences();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,36 +166,6 @@ std::string migrate_version_selection::old_config_dir()
|
|||
return old_config_dir;
|
||||
}
|
||||
|
||||
void migrate_version_selection::migrate_preferences(const std::string& migrate_prefs_file)
|
||||
{
|
||||
if(migrate_prefs_file != filesystem::get_prefs_file() && filesystem::file_exists(migrate_prefs_file)) {
|
||||
// if the file doesn't exist, just copy the file over
|
||||
// else need to merge the preferences file
|
||||
if(!filesystem::file_exists(filesystem::get_prefs_file())) {
|
||||
filesystem::copy_file(migrate_prefs_file, filesystem::get_prefs_file());
|
||||
} else {
|
||||
config current_cfg;
|
||||
filesystem::scoped_istream current_stream = filesystem::istream_file(filesystem::get_prefs_file(), false);
|
||||
read(current_cfg, *current_stream);
|
||||
config old_cfg;
|
||||
filesystem::scoped_istream old_stream = filesystem::istream_file(migrate_prefs_file, false);
|
||||
read(old_cfg, *old_stream);
|
||||
|
||||
// when both files have the same attribute, use the one from whichever was most recently modified
|
||||
bool current_prefs_are_older = filesystem::file_modified_time(filesystem::get_prefs_file()) < filesystem::file_modified_time(migrate_prefs_file);
|
||||
for(const config::attribute& val : old_cfg.attribute_range()) {
|
||||
if(current_prefs_are_older || !current_cfg.has_attribute(val.first)) {
|
||||
preferences::set(val.first, val.second);
|
||||
}
|
||||
}
|
||||
|
||||
// don't touch child tags
|
||||
|
||||
preferences::write_preferences();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void migrate_version_selection::migrate_credentials(const std::string& migrate_credentials_file)
|
||||
{
|
||||
// don't touch the credentials file on migrator re-run if it already exists
|
||||
|
|
|
@ -33,7 +33,6 @@ private:
|
|||
virtual const std::string& window_id() const override;
|
||||
|
||||
std::string old_config_dir();
|
||||
void migrate_preferences(const std::string& prefs_dir);
|
||||
void migrate_credentials(const std::string& credentials_dir);
|
||||
|
||||
std::vector<std::string> versions_;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "help/help.hpp"
|
||||
#include "preferences/game.hpp" // for encountered_units
|
||||
#include "preferences/preferences.hpp" // for encountered_units
|
||||
#include "units/types.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
@ -191,7 +191,7 @@ void faction_select::profile_button_callback()
|
|||
const std::string& leader_type = find_widget<menu_button>(get_window(), "leader_menu", false).get_value_string();
|
||||
const unit_type* ut = unit_types.find(leader_type);
|
||||
if(ut != nullptr) {
|
||||
preferences::encountered_units().insert(ut->id());
|
||||
prefs::get().encountered_units().insert(ut->id());
|
||||
help::show_unit_description(*ut);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,9 @@
|
|||
#include "font/text_formatting.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "help/help.hpp"
|
||||
#include "preferences/lobby.hpp"
|
||||
#include "wesnothd_connection.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
@ -75,23 +74,23 @@ mp_lobby::mp_lobby(mp::lobby_info& info, wesnothd_connection& connection, int& j
|
|||
, chatbox_(nullptr)
|
||||
, filter_friends_(register_bool("filter_with_friends",
|
||||
true,
|
||||
preferences::fi_friends_in_game,
|
||||
preferences::set_fi_friends_in_game,
|
||||
[]() {return prefs::get().fi_friends_in_game();},
|
||||
[](bool v) {prefs::get().set_fi_friends_in_game(v);},
|
||||
std::bind(&mp_lobby::update_gamelist_filter, this)))
|
||||
, filter_ignored_(register_bool("filter_with_ignored",
|
||||
true,
|
||||
preferences::fi_blocked_in_game,
|
||||
preferences::set_fi_blocked_in_game,
|
||||
[]() {return prefs::get().fi_blocked_in_game();},
|
||||
[](bool v) {prefs::get().set_fi_blocked_in_game(v);},
|
||||
std::bind(&mp_lobby::update_gamelist_filter, this)))
|
||||
, filter_slots_(register_bool("filter_vacant_slots",
|
||||
true,
|
||||
preferences::fi_vacant_slots,
|
||||
preferences::set_fi_vacant_slots,
|
||||
[]() {return prefs::get().fi_vacant_slots();},
|
||||
[](bool v) {prefs::get().set_fi_vacant_slots(v);},
|
||||
std::bind(&mp_lobby::update_gamelist_filter, this)))
|
||||
, filter_invert_(register_bool("filter_invert",
|
||||
true,
|
||||
preferences::fi_invert,
|
||||
preferences::set_fi_invert,
|
||||
[]() {return prefs::get().fi_invert();},
|
||||
[](bool v) {prefs::get().set_fi_invert(v);},
|
||||
std::bind(&mp_lobby::update_gamelist_filter, this)))
|
||||
, filter_auto_hosted_(false)
|
||||
, filter_text_(nullptr)
|
||||
|
@ -606,11 +605,11 @@ void mp_lobby::pre_show(window& window)
|
|||
|
||||
menu_button& replay_options = find_widget<menu_button>(&window, "replay_options", false);
|
||||
|
||||
if(preferences::skip_mp_replay()) {
|
||||
if(prefs::get().skip_mp_replay()) {
|
||||
replay_options.set_selected(1);
|
||||
}
|
||||
|
||||
if(preferences::blindfold_replay()) {
|
||||
if(prefs::get().blindfold_replay()) {
|
||||
replay_options.set_selected(2);
|
||||
}
|
||||
|
||||
|
@ -1007,8 +1006,8 @@ void mp_lobby::skip_replay_changed_callback()
|
|||
{
|
||||
// TODO: this prefence should probably be controlled with an enum
|
||||
const int value = find_widget<menu_button>(get_window(), "replay_options", false).get_value();
|
||||
preferences::set_skip_mp_replay(value == 1);
|
||||
preferences::set_blindfold_replay(value == 2);
|
||||
prefs::get().set_skip_mp_replay(value == 1);
|
||||
prefs::get().set_blindfold_replay(value == 2);
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include "mp_ui_alerts.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
@ -36,15 +36,15 @@ namespace gui2::dialogs
|
|||
|
||||
static toggle_button* setup_pref_toggle_button(const std::string& id, const std::string& type, bool def, window& window)
|
||||
{
|
||||
toggle_button* b = find_widget<toggle_button>(&window, id+"_"+type, false, true);
|
||||
b->set_value(preferences::mp_alert_option(id, type, def));
|
||||
|
||||
//ensure we have yes / no for the toggle button, so that the preference matches the toggle button for sure.
|
||||
if (preferences::has_mp_alert_option(id, type)) {
|
||||
preferences::set_mp_alert_option(id, type, def);
|
||||
if (!prefs::get().has_mp_alert_option(id, type)) {
|
||||
prefs::get().set_mp_alert_option(id, type, def);
|
||||
}
|
||||
|
||||
connect_signal_mouse_left_click(*b, std::bind([b, id, type]() { preferences::set_mp_alert_option(id, type, b->get_value_bool()); }));
|
||||
toggle_button* b = find_widget<toggle_button>(&window, id+"_"+type, false, true);
|
||||
b->set_value(prefs::get().mp_alert_option(id, type, def));
|
||||
|
||||
connect_signal_mouse_left_click(*b, std::bind([b, id, type]() { prefs::get().set_mp_alert_option(id, type, b->get_value_bool()); }));
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ static void setup_item(const std::string& item, window& window)
|
|||
if (!desktop::notifications::available()) {
|
||||
notif->set_value(false);
|
||||
notif->set_active(false);
|
||||
preferences::set_mp_alert_option(item, "notif", false);
|
||||
prefs::get().set_mp_alert_option(item, "notif", false);
|
||||
} else {
|
||||
notif->set_active(true);
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ static void setup_item(const std::string& item, window& window)
|
|||
|
||||
static void set_pref_and_button(const std::string& id, const std::string& type, bool value, window& window)
|
||||
{
|
||||
preferences::set_mp_alert_option(id, type, value);
|
||||
toggle_button* button = find_widget<toggle_button>(&window, id, false, true);
|
||||
prefs::get().set_mp_alert_option(id, type, value);
|
||||
toggle_button* button = find_widget<toggle_button>(&window, id+"_"+type, false, true);
|
||||
button->set_value(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
|
@ -107,7 +107,7 @@ void mp_change_control::pre_show(window& window)
|
|||
temp_nicks.insert(observers.begin(), observers.end());
|
||||
|
||||
// In case we are an observer, it isn't in the observers set and has to be added manually.
|
||||
temp_nicks.insert(preferences::login());
|
||||
temp_nicks.insert(prefs::get().login());
|
||||
|
||||
//
|
||||
// Initialize nick list
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "gui/dialogs/multiplayer/mp_connect.hpp"
|
||||
|
||||
#include "gettext.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gui/auxiliary/field.hpp"
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
#include "gui/dialogs/modal_dialog.hpp"
|
||||
|
@ -65,11 +65,11 @@ mp_connect::mp_connect()
|
|||
: modal_dialog(window_id())
|
||||
, host_name_(register_text("host_name",
|
||||
true,
|
||||
preferences::network_host,
|
||||
preferences::set_network_host,
|
||||
[]() {return prefs::get().network_host();},
|
||||
[](std::string v) {prefs::get().set_network_host(v);},
|
||||
true))
|
||||
, builtin_servers_(preferences::builtin_servers_list())
|
||||
, user_servers_(preferences::user_servers_list())
|
||||
, builtin_servers_(prefs::get().builtin_servers_list())
|
||||
, user_servers_(prefs::get().user_servers_list())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void mp_connect::on_server_add()
|
|||
info.address = address;
|
||||
|
||||
user_servers_.insert(user_servers_.begin() + mem_pos, info);
|
||||
preferences::set_user_servers_list(user_servers_);
|
||||
prefs::get().set_user_servers_list(user_servers_);
|
||||
|
||||
insert_into_server_listbox(server_list, info, ui_pos);
|
||||
select_first_match();
|
||||
|
@ -211,7 +211,7 @@ void mp_connect::on_server_delete()
|
|||
}
|
||||
|
||||
user_servers_.erase(user_servers_.begin() + selection.relative_index());
|
||||
preferences::set_user_servers_list(user_servers_);
|
||||
prefs::get().set_user_servers_list(user_servers_);
|
||||
|
||||
server_list.remove_row(selection.row());
|
||||
on_server_select();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "gui/widgets/toggle_panel.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map_settings.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "save_index.hpp"
|
||||
#include "savegame.hpp"
|
||||
|
||||
|
@ -56,9 +56,6 @@ namespace gui2::dialogs
|
|||
// Special retval value for loading a game
|
||||
static const int LOAD_GAME = 100;
|
||||
|
||||
// Shorthand
|
||||
namespace prefs = preferences;
|
||||
|
||||
REGISTER_DIALOG(mp_create_game)
|
||||
|
||||
mp_create_game::mp_create_game(saved_game& state, bool local_mode)
|
||||
|
@ -68,25 +65,55 @@ mp_create_game::mp_create_game(saved_game& state, bool local_mode)
|
|||
, options_manager_()
|
||||
, selected_game_index_(-1)
|
||||
, selected_rfm_index_(-1)
|
||||
, use_map_settings_(register_bool( "use_map_settings", true, prefs::use_map_settings, prefs::set_use_map_settings,
|
||||
, use_map_settings_(register_bool( "use_map_settings", true,
|
||||
[]() {return prefs::get().use_map_settings();},
|
||||
[](bool v) {prefs::get().set_use_map_settings(v);},
|
||||
std::bind(&mp_create_game::update_map_settings, this)))
|
||||
, fog_(register_bool("fog", true, prefs::fog, prefs::set_fog))
|
||||
, shroud_(register_bool("shroud", true, prefs::shroud, prefs::set_shroud))
|
||||
, start_time_(register_bool("random_start_time", true, prefs::random_start_time, prefs::set_random_start_time))
|
||||
, time_limit_(register_bool("time_limit", true, prefs::countdown, prefs::set_countdown,
|
||||
, fog_(register_bool("fog", true,
|
||||
[]() {return prefs::get().fog();},
|
||||
[](bool v) {prefs::get().set_fog(v);}))
|
||||
, shroud_(register_bool("shroud", true,
|
||||
[]() {return prefs::get().shroud();},
|
||||
[](bool v) {prefs::get().set_shroud(v);}))
|
||||
, start_time_(register_bool("random_start_time", true,
|
||||
[]() {return prefs::get().random_start_time();},
|
||||
[](bool v) {prefs::get().set_random_start_time(v);}))
|
||||
, time_limit_(register_bool("time_limit", true,
|
||||
[]() {return prefs::get().countdown();},
|
||||
[](bool v) {prefs::get().set_countdown(v);},
|
||||
std::bind(&mp_create_game::update_map_settings, this)))
|
||||
, shuffle_sides_(register_bool("shuffle_sides", true, prefs::shuffle_sides, prefs::set_shuffle_sides))
|
||||
, observers_(register_bool("observers", true, prefs::allow_observers, prefs::set_allow_observers))
|
||||
, shuffle_sides_(register_bool("shuffle_sides", true,
|
||||
[]() {return prefs::get().shuffle_sides();},
|
||||
[](bool v) {prefs::get().set_shuffle_sides(v);}))
|
||||
, observers_(register_bool("observers", true,
|
||||
[]() {return prefs::get().allow_observers();},
|
||||
[](bool v) {prefs::get().set_allow_observers(v);}))
|
||||
, strict_sync_(register_bool("strict_sync", true))
|
||||
, private_replay_(register_bool("private_replay", true))
|
||||
, turns_(register_integer("turn_count", true, prefs::turns, prefs::set_turns))
|
||||
, gold_(register_integer("village_gold", true, prefs::village_gold, prefs::set_village_gold))
|
||||
, support_(register_integer("village_support", true, prefs::village_support, prefs::set_village_support))
|
||||
, experience_(register_integer("experience_modifier", true, prefs::xp_modifier, prefs::set_xp_modifier))
|
||||
, init_turn_limit_(register_integer("init_turn_limit", true, prefs::countdown_init_time, prefs::set_countdown_init_time))
|
||||
, turn_bonus_(register_integer("turn_bonus", true, prefs::countdown_turn_bonus, prefs::set_countdown_turn_bonus))
|
||||
, reservoir_(register_integer("reservoir", true, prefs::countdown_reservoir_time, prefs::set_countdown_reservoir_time))
|
||||
, action_bonus_(register_integer("action_bonus", true, prefs::countdown_action_bonus, prefs::set_countdown_action_bonus))
|
||||
, turns_(register_integer("turn_count", true,
|
||||
[]() {return prefs::get().turns();},
|
||||
[](int v) {prefs::get().set_turns(v);}))
|
||||
, gold_(register_integer("village_gold", true,
|
||||
[]() {return prefs::get().village_gold();},
|
||||
[](int v) {prefs::get().set_village_gold(v);}))
|
||||
, support_(register_integer("village_support", true,
|
||||
[]() {return prefs::get().village_support();},
|
||||
[](int v) {prefs::get().set_village_support(v);}))
|
||||
, experience_(register_integer("experience_modifier", true,
|
||||
[]() {return prefs::get().xp_modifier();},
|
||||
[](int v) {prefs::get().set_xp_modifier(v);}))
|
||||
, init_turn_limit_(register_integer("init_turn_limit", true,
|
||||
[]() {return prefs::get().countdown_init_time();},
|
||||
[](int v) {prefs::get().set_countdown_init_time(v);}))
|
||||
, turn_bonus_(register_integer("turn_bonus", true,
|
||||
[]() {return prefs::get().countdown_turn_bonus();},
|
||||
[](int v) {prefs::get().set_countdown_turn_bonus(v);}))
|
||||
, reservoir_(register_integer("reservoir", true,
|
||||
[]() {return prefs::get().countdown_reservoir_time();},
|
||||
[](int v) {prefs::get().set_countdown_reservoir_time(v);}))
|
||||
, action_bonus_(register_integer("action_bonus", true,
|
||||
[]() {return prefs::get().countdown_action_bonus();},
|
||||
[](int v) {prefs::get().set_countdown_action_bonus(v);}))
|
||||
, mod_list_()
|
||||
, eras_menu_button_()
|
||||
, local_mode_(local_mode)
|
||||
|
@ -172,7 +199,7 @@ void mp_create_game::pre_show(window& win)
|
|||
// Helper to make sure the initially selected level type is valid
|
||||
auto get_initial_type_index = [this]()->int {
|
||||
const auto index = std::find_if(level_types_.begin(), level_types_.end(), [](level_type_info& info) {
|
||||
return info.first == *level_type::get_enum(preferences::level_type());
|
||||
return info.first == *level_type::get_enum(prefs::get().level_type());
|
||||
});
|
||||
|
||||
if(index != level_types_.end()) {
|
||||
|
@ -192,7 +219,7 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
mod_list_ = &find_widget<listbox>(&win, "mod_list", false);
|
||||
|
||||
const auto& activemods = preferences::modifications();
|
||||
const auto& activemods = prefs::get().modifications();
|
||||
for(const auto& mod : create_engine_.get_extras_by_type(ng::create_engine::MOD)) {
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
@ -239,7 +266,7 @@ void mp_create_game::pre_show(window& win)
|
|||
connect_signal_notify_modified(*eras_menu_button_,
|
||||
std::bind(&mp_create_game::on_era_select, this));
|
||||
|
||||
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, preferences::era());
|
||||
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, prefs::get().era());
|
||||
if(era_selection >= 0) {
|
||||
eras_menu_button_->set_selected(era_selection);
|
||||
}
|
||||
|
@ -249,7 +276,7 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
// Set up random faction mode menu_button
|
||||
//
|
||||
const int initial_index = static_cast<int>(random_faction_mode::get_enum(prefs::random_faction_mode()).value_or(random_faction_mode::type::independent));
|
||||
const int initial_index = static_cast<int>(random_faction_mode::get_enum(prefs::get().random_faction_mode()).value_or(random_faction_mode::type::independent));
|
||||
|
||||
menu_button& rfm_menu_button = find_widget<menu_button>(&win, "random_faction_mode", false);
|
||||
rfm_menu_button.set_selected(initial_index);
|
||||
|
@ -317,7 +344,7 @@ void mp_create_game::pre_show(window& win)
|
|||
win.add_to_keyboard_chain(&list);
|
||||
|
||||
// This handles the initial game selection as well
|
||||
display_games_of_type(level_types_[get_initial_type_index()].first, preferences::level());
|
||||
display_games_of_type(level_types_[get_initial_type_index()].first, prefs::get().level());
|
||||
|
||||
// Initial tab selection must be done after game selection so the field widgets are set to their correct active state.
|
||||
on_tab_select();
|
||||
|
@ -804,15 +831,15 @@ void mp_create_game::set_active_mods(const std::vector<std::string>& val)
|
|||
void mp_create_game::reset_timer_settings()
|
||||
{
|
||||
// This allows the defaults to be returned by the pref getters below
|
||||
preferences::erase("mp_countdown_init_time");
|
||||
preferences::erase("mp_countdown_reservoir_time");
|
||||
preferences::erase("mp_countdown_turn_bonus");
|
||||
preferences::erase("mp_countdown_action_bonus");
|
||||
prefs::get().clear_countdown_init_time();
|
||||
prefs::get().clear_countdown_reservoir_time();
|
||||
prefs::get().clear_countdown_turn_bonus();
|
||||
prefs::get().clear_countdown_action_bonus();
|
||||
|
||||
init_turn_limit_->set_widget_value(preferences::countdown_init_time());
|
||||
turn_bonus_->set_widget_value(preferences::countdown_turn_bonus());
|
||||
reservoir_->set_widget_value(preferences::countdown_reservoir_time());
|
||||
action_bonus_->set_widget_value(preferences::countdown_action_bonus());
|
||||
init_turn_limit_->set_widget_value(prefs::get().countdown_init_time());
|
||||
turn_bonus_->set_widget_value(prefs::get().countdown_turn_bonus());
|
||||
reservoir_->set_widget_value(prefs::get().countdown_reservoir_time());
|
||||
action_bonus_->set_widget_value(prefs::get().countdown_action_bonus());
|
||||
}
|
||||
|
||||
bool mp_create_game::dialog_exit_hook(window& /*window*/)
|
||||
|
@ -855,10 +882,10 @@ void mp_create_game::post_show(window& window)
|
|||
}
|
||||
|
||||
if(get_retval() == retval::OK) {
|
||||
prefs::set_modifications(create_engine_.active_mods());
|
||||
prefs::set_level_type(static_cast<int>(create_engine_.current_level_type()));
|
||||
prefs::set_level(create_engine_.current_level().id());
|
||||
prefs::set_era(create_engine_.current_era().id);
|
||||
prefs::get().set_modifications(create_engine_.active_mods());
|
||||
prefs::get().set_level_type(static_cast<int>(create_engine_.current_level_type()));
|
||||
prefs::get().set_level(create_engine_.current_level().id());
|
||||
prefs::get().set_era(create_engine_.current_era().id);
|
||||
|
||||
create_engine_.prepare_for_era_and_mods();
|
||||
|
||||
|
@ -939,7 +966,7 @@ void mp_create_game::post_show(window& window)
|
|||
config_engine_->set_random_faction_mode(type);
|
||||
|
||||
// Since we don't have a field handling this option, we need to save the value manually
|
||||
prefs::set_random_faction_mode(random_faction_mode::get_string(type));
|
||||
prefs::get().set_random_faction_mode(random_faction_mode::get_string(type));
|
||||
|
||||
// Save custom option settings
|
||||
config_engine_->set_options(options_manager_->get_options_config());
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_host_game_prompt.hpp"
|
||||
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
|
@ -24,19 +24,19 @@ namespace gui2::dialogs
|
|||
REGISTER_DIALOG(mp_host_game_prompt)
|
||||
|
||||
/**
|
||||
* Helper for @ref preferences::ask_delete_saves.
|
||||
* Helper for @ref prefs::get().ask_delete_saves.
|
||||
*/
|
||||
static bool get_do_not_show_again()
|
||||
{
|
||||
return preferences::mp_server_warning_disabled() != 1;
|
||||
return prefs::get().mp_server_warning_disabled() != 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for @ref preferences::set_ask_delete_saves.
|
||||
* Helper for @ref prefs::get().set_ask_delete_saves.
|
||||
*/
|
||||
static void set_do_not_show_again(const bool do_not_show_again)
|
||||
{
|
||||
preferences::set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
|
||||
prefs::get().set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
|
||||
}
|
||||
|
||||
mp_host_game_prompt::mp_host_game_prompt()
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "gui/widgets/tree_view_node.hpp"
|
||||
#include "log.hpp"
|
||||
#include "mp_ui_alerts.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "saved_game.hpp"
|
||||
#include "side_controller.hpp"
|
||||
#include "units/types.hpp"
|
||||
|
@ -164,7 +164,7 @@ bool mp_join_game::fetch_game_config()
|
|||
for(const config& side : get_scenario().child_range("side")) {
|
||||
// TODO: it can happen that the scenario specifies that the controller
|
||||
// of a side should also gain control of another side.
|
||||
if(side["controller"] == side_controller::reserved && side["current_player"] == preferences::login()) {
|
||||
if(side["controller"] == side_controller::reserved && side["current_player"] == prefs::get().login()) {
|
||||
side_choice = &side;
|
||||
side_num_choice = side_num_counter;
|
||||
break;
|
||||
|
@ -176,14 +176,14 @@ bool mp_join_game::fetch_game_config()
|
|||
side_num_choice = side_num_counter;
|
||||
}
|
||||
|
||||
if(side["current_player"] == preferences::login()) {
|
||||
if(side["current_player"] == prefs::get().login()) {
|
||||
side_choice = &side;
|
||||
side_num_choice = side_num_counter;
|
||||
break; // Found the preferred one
|
||||
}
|
||||
}
|
||||
|
||||
if(side["player_id"] == preferences::login()) {
|
||||
if(side["player_id"] == prefs::get().login()) {
|
||||
// We already own a side in this game
|
||||
return true;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ bool mp_join_game::show_flg_select(int side_num, bool first_time)
|
|||
config faction;
|
||||
config& change = faction.add_child("change_faction");
|
||||
change["change_faction"] = true;
|
||||
change["name"] = preferences::login();
|
||||
change["name"] = prefs::get().login();
|
||||
change["faction"] = flg.current_faction()["id"];
|
||||
change["leader"] = flg.current_leader();
|
||||
change["gender"] = flg.current_gender();
|
||||
|
@ -448,7 +448,7 @@ void mp_join_game::generate_side_list()
|
|||
|
||||
auto* select_leader_button = find_widget<button>(&row_grid, "select_leader", false, false);
|
||||
if(select_leader_button) {
|
||||
if(side["player_id"] == preferences::login() && side["allow_changes"].to_bool(true)) {
|
||||
if(side["player_id"] == prefs::get().login() && side["allow_changes"].to_bool(true)) {
|
||||
//
|
||||
// Small wrapper function in order to set the handled and halt parameters and prevent
|
||||
// crashes in case the dialog closes and the original button to which the callback was
|
||||
|
@ -578,7 +578,7 @@ void mp_join_game::post_show(window& window)
|
|||
|
||||
mp::ui_alerts::game_has_begun();
|
||||
} else if(observe_game_) {
|
||||
mp::send_to_server(config("observer_quit", config { "name", preferences::login() }));
|
||||
mp::send_to_server(config("observer_quit", config { "name", prefs::get().login() }));
|
||||
} else {
|
||||
mp::send_to_server(config("leave_game"));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_login.hpp"
|
||||
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/auxiliary/field.hpp"
|
||||
#include "gui/widgets/password_box.hpp"
|
||||
|
@ -35,25 +35,25 @@ mp_login::mp_login(const std::string& host, const std::string& label, const bool
|
|||
{
|
||||
register_label("login_label", false, label);
|
||||
username_ = register_text("user_name", true,
|
||||
&preferences::login,
|
||||
&preferences::set_login,
|
||||
[]() {return prefs::get().login();},
|
||||
[](std::string v) {prefs::get().set_login(v);},
|
||||
!focus_password);
|
||||
|
||||
register_bool("remember_password", false,
|
||||
&preferences::remember_password,
|
||||
&preferences::set_remember_password);
|
||||
[]() {return prefs::get().remember_password();},
|
||||
[](bool v) {prefs::get().set_remember_password(v);});
|
||||
}
|
||||
|
||||
void mp_login::load_password()
|
||||
{
|
||||
text_box& pwd = find_widget<text_box>(this, "password", false);
|
||||
pwd.set_value(preferences::password(host_, username_->get_widget_value()));
|
||||
pwd.set_value(prefs::get().password(host_, username_->get_widget_value()));
|
||||
}
|
||||
|
||||
void mp_login::save_password()
|
||||
{
|
||||
password_box& pwd = find_widget<password_box>(this, "password", false);
|
||||
preferences::set_password(host_, username_->get_widget_value(), pwd.get_real_value());
|
||||
prefs::get().set_password(host_, username_->get_widget_value(), pwd.get_real_value());
|
||||
}
|
||||
|
||||
void mp_login::pre_show(window& win)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/text_box.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ static const std::string forum_registration_url = "https://forums.wesnoth.org/uc
|
|||
|
||||
void mp_method_selection::pre_show(window& window)
|
||||
{
|
||||
user_name_ = preferences::login();
|
||||
user_name_ = prefs::get().login();
|
||||
|
||||
text_box* user_widget = find_widget<text_box>(&window, "user_name", false, true);
|
||||
user_widget->set_value(user_name_);
|
||||
|
@ -60,7 +60,7 @@ void mp_method_selection::post_show(window& window)
|
|||
user_widget.save_to_history();
|
||||
|
||||
user_name_ = user_widget.get_value();
|
||||
preferences::set_login(user_name_);
|
||||
prefs::get().set_login(user_name_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_options_helper.hpp"
|
||||
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/menu_button.hpp"
|
||||
|
@ -38,7 +38,7 @@ mp_options_helper::mp_options_helper(window& window, ng::create_engine& create_e
|
|||
, visible_options_()
|
||||
, options_data_()
|
||||
{
|
||||
for(const auto c : preferences::options().all_children_range()) {
|
||||
for(const auto c : prefs::get().options().all_children_range()) {
|
||||
for(const auto& saved_option : c.cfg.child_range("option")) {
|
||||
options_data_[c.cfg["id"]][saved_option["id"]] = saved_option["value"];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "gui/widgets/text_box.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_initialization/multiplayer.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
|
@ -162,19 +162,19 @@ void lobby_player_info::update_relation()
|
|||
|
||||
void lobby_player_info::add_to_friends_button_callback()
|
||||
{
|
||||
preferences::add_acquaintance(info_.name, "friend", "");
|
||||
prefs::get().add_acquaintance(info_.name, "friend", "");
|
||||
update_relation();
|
||||
}
|
||||
|
||||
void lobby_player_info::add_to_ignores_button_callback()
|
||||
{
|
||||
preferences::add_acquaintance(info_.name, "ignore", "");
|
||||
prefs::get().add_acquaintance(info_.name, "ignore", "");
|
||||
update_relation();
|
||||
}
|
||||
|
||||
void lobby_player_info::remove_from_list_button_callback()
|
||||
{
|
||||
preferences::remove_acquaintance(info_.name);
|
||||
prefs::get().remove_acquaintance(info_.name);
|
||||
update_relation();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ player_list_helper::player_list_helper(window* window)
|
|||
// add ourselves as the host
|
||||
widget_data data = {
|
||||
{ "player_type_icon", {{ "label", "misc/leader-crown.png~CROP(12, 1, 15, 15)"}}},
|
||||
{ "player_name", {{ "label", preferences::login()}}}
|
||||
{ "player_name", {{ "label", prefs::get().login()}}}
|
||||
};
|
||||
list_.add_row(data);
|
||||
list_.select_row(0);
|
||||
|
@ -43,7 +43,7 @@ void player_list_helper::update_list(const config::const_child_itors& users)
|
|||
widget_item item;
|
||||
|
||||
const std::string name = user["name"];
|
||||
const bool is_you = name == preferences::login();
|
||||
const bool is_you = name == prefs::get().login();
|
||||
|
||||
std::string icon;
|
||||
if(user["host"].to_bool()) {
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
#include "gettext.hpp"
|
||||
#include "hotkey/hotkey_item.hpp"
|
||||
#include "lexical_cast.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/display.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/lobby.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "theme.hpp"
|
||||
#include "video.hpp"
|
||||
|
@ -106,14 +101,10 @@ void volume_setter_on_change(widget& w)
|
|||
|
||||
} // end anon namespace
|
||||
|
||||
using namespace preferences;
|
||||
using avp = preferences::advanced_manager::option;
|
||||
|
||||
REGISTER_DIALOG(preferences_dialog)
|
||||
|
||||
preferences_dialog::preferences_dialog(const PREFERENCE_VIEW initial_view)
|
||||
preferences_dialog::preferences_dialog(const pref_constants::PREFERENCE_VIEW initial_view)
|
||||
: modal_dialog(window_id())
|
||||
, adv_preferences_(preferences::get_advanced_preferences())
|
||||
, resolutions_() // should be populated by set_resolution_list before use
|
||||
, themes_() // populated by set_theme_list
|
||||
, last_selected_item_(0)
|
||||
|
@ -160,7 +151,7 @@ void preferences_dialog::set_theme_list(menu_button& theme_list)
|
|||
std::size_t current_theme = 0;
|
||||
for(std::size_t i = 0; i < themes_.size(); ++i) {
|
||||
options.emplace_back("label", themes_[i].name, "tooltip", themes_[i].description);
|
||||
if(themes_[i].id == preferences::theme()) {
|
||||
if(themes_[i].id == prefs::get().theme()) {
|
||||
current_theme = i;
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +159,7 @@ void preferences_dialog::set_theme_list(menu_button& theme_list)
|
|||
theme_list.set_values(options, current_theme);
|
||||
}
|
||||
|
||||
widget_data preferences_dialog::get_friends_list_row_data(const acquaintance& entry)
|
||||
widget_data preferences_dialog::get_friends_list_row_data(const preferences::acquaintance& entry)
|
||||
{
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
@ -202,14 +193,14 @@ widget_data preferences_dialog::get_friends_list_row_data(const acquaintance& en
|
|||
|
||||
void preferences_dialog::on_friends_list_select(listbox& list, text_box& textbox)
|
||||
{
|
||||
const int num_friends = get_acquaintances().size();
|
||||
const int num_friends = prefs::get().get_acquaintances().size();
|
||||
const int sel = list.get_selected_row();
|
||||
|
||||
if(sel < 0 || sel >= num_friends) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, acquaintance>::const_iterator who = get_acquaintances().begin();
|
||||
std::map<std::string, preferences::acquaintance>::const_iterator who = prefs::get().get_acquaintances().begin();
|
||||
std::advance(who, sel);
|
||||
|
||||
textbox.set_value(who->second.get_nick() + " " + who->second.get_notes());
|
||||
|
@ -245,7 +236,7 @@ void preferences_dialog::add_friend_list_entry(const bool is_friend, text_box& t
|
|||
username = username.substr(0, pos);
|
||||
}
|
||||
|
||||
auto [entry, added_new] = add_acquaintance(username, (is_friend ? "friend": "ignore"), reason);
|
||||
auto [entry, added_new] = prefs::get().add_acquaintance(username, (is_friend ? "friend": "ignore"), reason);
|
||||
|
||||
if(!entry) {
|
||||
gui2::show_transient_message(_("Error"), _("Invalid username"));
|
||||
|
@ -284,7 +275,7 @@ void preferences_dialog::remove_friend_list_entry(listbox& friends_list, text_bo
|
|||
{
|
||||
const int selected_row = std::max(0, friends_list.get_selected_row());
|
||||
|
||||
std::map<std::string, acquaintance>::const_iterator who = get_acquaintances().begin();
|
||||
std::map<std::string, preferences::acquaintance>::const_iterator who = prefs::get().get_acquaintances().begin();
|
||||
std::advance(who, selected_row);
|
||||
|
||||
const std::string to_remove = !textbox.text().empty() ? textbox.text() : who->second.get_nick();
|
||||
|
@ -294,7 +285,7 @@ void preferences_dialog::remove_friend_list_entry(listbox& friends_list, text_bo
|
|||
return;
|
||||
}
|
||||
|
||||
if(!remove_acquaintance(to_remove)) {
|
||||
if(!prefs::get().remove_acquaintance(to_remove)) {
|
||||
gui2::show_transient_error_message(_("Not on friends or ignore lists"));
|
||||
return;
|
||||
}
|
||||
|
@ -307,6 +298,29 @@ void preferences_dialog::remove_friend_list_entry(listbox& friends_list, text_bo
|
|||
update_friends_list_controls(list);
|
||||
}
|
||||
|
||||
void preferences_dialog::apply_pixel_scale()
|
||||
{
|
||||
// Update pixel scale preference.
|
||||
slider& ps_slider = find_widget<slider>(this, "pixel_scale_slider", false);
|
||||
prefs::get().set_pixel_scale(ps_slider.get_value());
|
||||
|
||||
// Update auto pixel scale preference.
|
||||
toggle_button& auto_ps_toggle =
|
||||
find_widget<toggle_button>(this, "auto_pixel_scale", false);
|
||||
prefs::get().set_auto_pixel_scale(auto_ps_toggle.get_value_bool());
|
||||
|
||||
// Update draw buffers, taking these into account.
|
||||
video::update_buffers();
|
||||
|
||||
// Update game display, if active
|
||||
if(::display* disp = display::get_singleton()) {
|
||||
disp->queue_rerender();
|
||||
}
|
||||
|
||||
// Raise a window resize event so we can react to the change
|
||||
events::raise_resize_event();
|
||||
}
|
||||
|
||||
template<bool(*toggle_getter)(), bool(*toggle_setter)(bool), int(*vol_getter)(), void(*vol_setter)(int)>
|
||||
void preferences_dialog::initialize_sound_option_group(const std::string& id_suffix)
|
||||
{
|
||||
|
@ -331,29 +345,29 @@ void preferences_dialog::initialize_sound_option_group(const std::string& id_suf
|
|||
std::bind(volume_setter_on_change<vol_setter>, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void preferences_dialog::apply_pixel_scale()
|
||||
{
|
||||
// Update pixel scale preference.
|
||||
slider& ps_slider = find_widget<slider>(this, "pixel_scale_slider", false);
|
||||
set_pixel_scale(ps_slider.get_value());
|
||||
/* SOUND FX wrappers for template */
|
||||
static bool sound_on(){return prefs::get().sound_on();}
|
||||
static bool set_sound(bool v){return prefs::get().set_sound(v);}
|
||||
static int sound_volume(){return prefs::get().sound_volume();}
|
||||
static void set_sound_volume(int v){prefs::get().set_sound_volume(v);}
|
||||
|
||||
// Update auto pixel scale preference.
|
||||
toggle_button& auto_ps_toggle =
|
||||
find_widget<toggle_button>(this, "auto_pixel_scale", false);
|
||||
set_auto_pixel_scale(auto_ps_toggle.get_value_bool());
|
||||
/* MUSIC wrappers for template */
|
||||
static bool music_on(){return prefs::get().music_on();}
|
||||
static bool set_music(bool v){return prefs::get().set_music(v);}
|
||||
static int music_volume(){return prefs::get().music_volume();}
|
||||
static void set_music_volume(int v){prefs::get().set_music_volume(v);}
|
||||
|
||||
// Update draw buffers, taking these into account.
|
||||
video::update_buffers();
|
||||
|
||||
// Update game display, if active
|
||||
if(::display* disp = display::get_singleton()) {
|
||||
disp->queue_rerender();
|
||||
}
|
||||
|
||||
// Raise a window resize event so we can react to the change
|
||||
events::raise_resize_event();
|
||||
}
|
||||
/* TURN BELL wrappers for template */
|
||||
static bool turn_bell(){return prefs::get().turn_bell();}
|
||||
static bool set_turn_bell(bool v){return prefs::get().set_turn_bell(v);}
|
||||
static int bell_volume(){return prefs::get().bell_volume();}
|
||||
static void set_bell_volume(int v){prefs::get().set_bell_volume(v);}
|
||||
|
||||
/* UI FX wrappers for template */
|
||||
static bool ui_sound_on(){return prefs::get().ui_sound_on();}
|
||||
static bool set_ui_sound(bool v){return prefs::get().set_ui_sound(v);}
|
||||
static int ui_volume(){return prefs::get().ui_volume();}
|
||||
static void set_ui_volume(int v){prefs::get().set_ui_volume(v);}
|
||||
|
||||
/**
|
||||
* Sets up states and callbacks for each of the widgets
|
||||
|
@ -366,17 +380,20 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* SCROLL SPEED */
|
||||
register_integer("scroll_speed", true,
|
||||
scroll_speed, set_scroll_speed);
|
||||
[]() {return prefs::get().scroll_speed();},
|
||||
[](int v) {prefs::get().set_scroll_speed(v);});
|
||||
|
||||
/* ACCELERATED SPEED */
|
||||
register_bool("turbo_toggle", true, turbo, set_turbo);
|
||||
register_bool("turbo_toggle", true,
|
||||
[]() {return prefs::get().turbo();},
|
||||
[](bool v) {prefs::get().set_turbo(v);});
|
||||
|
||||
const auto accl_load = [this]()->int {
|
||||
return std::distance(accl_speeds_.begin(), std::find(accl_speeds_.begin(), accl_speeds_.end(), turbo_speed()));
|
||||
return std::distance(accl_speeds_.begin(), std::find(accl_speeds_.begin(), accl_speeds_.end(), prefs::get().turbo_speed()));
|
||||
};
|
||||
|
||||
const auto accl_save = [this](int i) {
|
||||
set_turbo_speed(accl_speeds_[i]);
|
||||
prefs::get().set_turbo_speed(accl_speeds_[i]);
|
||||
};
|
||||
|
||||
register_integer("turbo_slider", true,
|
||||
|
@ -389,39 +406,48 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* SKIP AI MOVES */
|
||||
register_bool("skip_ai_moves", true,
|
||||
skip_ai_moves, set_skip_ai_moves);
|
||||
[]() {return prefs::get().skip_ai_moves();},
|
||||
[](bool v) {prefs::get().set_skip_ai_moves(v);});
|
||||
|
||||
/* DISABLE AUTO MOVES */
|
||||
register_bool("disable_auto_moves", true,
|
||||
disable_auto_moves, set_disable_auto_moves);
|
||||
[]() {return prefs::get().disable_auto_moves();},
|
||||
[](bool v) {prefs::get().set_disable_auto_moves(v);});
|
||||
|
||||
/* TURN DIALOG */
|
||||
register_bool("show_turn_dialog", true,
|
||||
turn_dialog, set_turn_dialog);
|
||||
[]() {return prefs::get().turn_dialog();},
|
||||
[](bool v) {prefs::get().set_turn_dialog(v);});
|
||||
|
||||
/* ENABLE PLANNING MODE */
|
||||
register_bool("whiteboard_on_start", true,
|
||||
enable_whiteboard_mode_on_start, set_enable_whiteboard_mode_on_start);
|
||||
[]() {return prefs::get().enable_whiteboard_mode_on_start();},
|
||||
[](bool v) {prefs::get().set_enable_whiteboard_mode_on_start(v);});
|
||||
|
||||
/* HIDE ALLY PLANS */
|
||||
register_bool("whiteboard_hide_allies", true,
|
||||
hide_whiteboard, set_hide_whiteboard);
|
||||
[]() {return prefs::get().hide_whiteboard();},
|
||||
[](bool v) {prefs::get().set_hide_whiteboard(v);});
|
||||
|
||||
/* INTERRUPT ON SIGHTING */
|
||||
register_bool("interrupt_move_when_ally_sighted", true,
|
||||
interrupt_when_ally_sighted, set_interrupt_when_ally_sighted);
|
||||
[]() {return prefs::get().interrupt_when_ally_sighted();},
|
||||
[](bool v) {prefs::get().set_interrupt_when_ally_sighted(v);});
|
||||
|
||||
/* SAVE REPLAYS */
|
||||
register_bool("save_replays", true,
|
||||
save_replays, set_save_replays);
|
||||
[]() {return prefs::get().save_replays();},
|
||||
[](bool v) {prefs::get().set_save_replays(v);});
|
||||
|
||||
/* DELETE AUTOSAVES */
|
||||
register_bool("delete_saves", true,
|
||||
delete_saves, set_delete_saves);
|
||||
[]() {return prefs::get().delete_saves();},
|
||||
[](bool v) {prefs::get().set_delete_saves(v);});
|
||||
|
||||
/* MAX AUTO SAVES */
|
||||
register_integer("max_saves_slider", true,
|
||||
autosavemax, set_autosavemax);
|
||||
[]() {return prefs::get().autosavemax();},
|
||||
[](int v) {prefs::get().set_autosavemax(v);});
|
||||
|
||||
/* CACHE MANAGE */
|
||||
connect_signal_mouse_left_click(find_widget<button>(this, "cachemg", false),
|
||||
|
@ -435,7 +461,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
toggle_button& toggle_fullscreen =
|
||||
find_widget<toggle_button>(this, "fullscreen", false);
|
||||
|
||||
toggle_fullscreen.set_value(fullscreen());
|
||||
toggle_fullscreen.set_value(prefs::get().fullscreen());
|
||||
|
||||
// We bind a special callback function, so setup_single_toggle() is not used
|
||||
connect_signal_mouse_left_click(toggle_fullscreen, std::bind(
|
||||
|
@ -445,7 +471,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
menu_button& res_list = find_widget<menu_button>(this, "resolution_set", false);
|
||||
|
||||
res_list.set_use_markup(true);
|
||||
res_list.set_active(!fullscreen());
|
||||
res_list.set_active(!prefs::get().fullscreen());
|
||||
|
||||
set_resolution_list(res_list);
|
||||
|
||||
|
@ -456,7 +482,8 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* PIXEL SCALE */
|
||||
register_integer("pixel_scale_slider", true,
|
||||
pixel_scale, set_pixel_scale);
|
||||
[]() {return prefs::get().pixel_scale();},
|
||||
[](int v) {prefs::get().set_pixel_scale(v);});
|
||||
|
||||
slider& ps_slider =
|
||||
find_widget<slider>(this, "pixel_scale_slider", false);
|
||||
|
@ -465,7 +492,8 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* AUTOMATIC PIXEL SCALE */
|
||||
register_bool("auto_pixel_scale", true,
|
||||
auto_pixel_scale, set_auto_pixel_scale,
|
||||
[]() {return prefs::get().auto_pixel_scale();},
|
||||
[](bool v) {prefs::get().set_auto_pixel_scale(v);},
|
||||
[&](widget& w) { disable_widget_on_toggle_inverted<slider>(*this, w, "pixel_scale_slider"); }, true);
|
||||
|
||||
toggle_button& auto_ps_toggle =
|
||||
|
@ -475,34 +503,44 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* SHOW FLOATING LABELS */
|
||||
register_bool("show_floating_labels", true,
|
||||
show_floating_labels, set_show_floating_labels);
|
||||
[]() {return prefs::get().show_floating_labels();},
|
||||
[](bool v) {prefs::get().set_show_floating_labels(v);});
|
||||
|
||||
/* SHOW TEAM COLORS */
|
||||
register_bool("show_ellipses", true,
|
||||
show_side_colors, set_show_side_colors);
|
||||
[]() {return prefs::get().show_side_colors();},
|
||||
[](bool v) {prefs::get().set_show_side_colors(v);});
|
||||
|
||||
/* SHOW GRID */
|
||||
register_bool("show_grid", true,
|
||||
preferences::grid, set_grid);
|
||||
[]() {return prefs::get().grid();},
|
||||
[](bool v) {prefs::get().set_grid(v);});
|
||||
|
||||
/* ANIMATE MAP */
|
||||
register_bool("animate_terrains", true, animate_map, set_animate_map,
|
||||
register_bool("animate_terrains", true,
|
||||
[]() {return prefs::get().animate_map();},
|
||||
[](bool v) {prefs::get().set_animate_map(v);},
|
||||
[&](widget& w) { disable_widget_on_toggle<toggle_button>(*this, w, "animate_water"); }, true);
|
||||
|
||||
/* ANIMATE WATER */
|
||||
register_bool("animate_water", true,
|
||||
animate_water, set_animate_water);
|
||||
[]() {return prefs::get().animate_water();},
|
||||
[](bool v) {prefs::get().set_animate_water(v);});
|
||||
|
||||
/* SHOW UNIT STANDING ANIMS */
|
||||
register_bool("animate_units_standing", true,
|
||||
show_standing_animations, set_show_standing_animations);
|
||||
[]() {return prefs::get().show_standing_animations();},
|
||||
[](bool v) {prefs::get().set_show_standing_animations(v);});
|
||||
|
||||
/* SHOW UNIT IDLE ANIMS */
|
||||
register_bool("animate_units_idle", true, idle_anim, set_idle_anim,
|
||||
register_bool("animate_units_idle", true,
|
||||
[]() {return prefs::get().idle_anim();},
|
||||
[](bool v) {prefs::get().set_idle_anim(v);},
|
||||
[&](widget& w) { disable_widget_on_toggle<slider>(*this, w, "idle_anim_frequency"); });
|
||||
|
||||
register_integer("idle_anim_frequency", true,
|
||||
idle_anim_rate, set_idle_anim_rate);
|
||||
[]() {return prefs::get().idle_anim_rate();},
|
||||
[](int v) {prefs::get().set_idle_anim_rate(v);});
|
||||
|
||||
/* FONT SCALING */
|
||||
//register_integer("scaling_slider", true,
|
||||
|
@ -510,10 +548,12 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* FPS LIMITER */
|
||||
register_bool("fps_limiter", true,
|
||||
[]() { return draw_delay() != 0; }, [](bool v) { set_draw_delay(v ? -1 : 0); });
|
||||
[]() { return prefs::get().draw_delay() != 0; }, [](bool v) { prefs::get().set_draw_delay(v ? -1 : 0); });
|
||||
|
||||
/* VSYNC */
|
||||
register_bool("vsync", true, vsync, set_vsync);
|
||||
register_bool("vsync", true,
|
||||
[]() {return prefs::get().vsync();},
|
||||
[](bool v) {prefs::get().set_vsync(v);});
|
||||
|
||||
/* SELECT THEME */
|
||||
menu_button& theme_list = find_widget<menu_button>(this, "choose_theme", false);
|
||||
|
@ -535,13 +575,14 @@ void preferences_dialog::initialize_callbacks()
|
|||
initialize_sound_option_group<music_on, set_music, music_volume, set_music_volume>("music");
|
||||
|
||||
register_bool("sound_toggle_stop_music_in_background", true,
|
||||
stop_music_in_background, set_stop_music_in_background);
|
||||
[]() {return prefs::get().stop_music_in_background();},
|
||||
[](bool v) {prefs::get().set_stop_music_in_background(v);});
|
||||
|
||||
/* TURN BELL */
|
||||
initialize_sound_option_group<turn_bell, set_turn_bell, bell_volume, set_bell_volume>("bell");
|
||||
|
||||
/* UI FX */
|
||||
initialize_sound_option_group<UI_sound_on, set_UI_sound, UI_volume, set_UI_volume>("uisfx");
|
||||
initialize_sound_option_group<ui_sound_on, set_ui_sound, ui_volume, set_ui_volume>("uisfx");
|
||||
|
||||
//
|
||||
// MULTIPLAYER PANEL
|
||||
|
@ -549,29 +590,33 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* CHAT LINES */
|
||||
register_integer("chat_lines", true,
|
||||
chat_lines, set_chat_lines);
|
||||
[]() {return prefs::get().chat_lines();},
|
||||
[](int v) {prefs::get().set_chat_lines(v);});
|
||||
|
||||
/* CHAT TIMESTAMPPING */
|
||||
register_bool("chat_timestamps", true,
|
||||
chat_timestamping, set_chat_timestamping);
|
||||
[]() {return prefs::get().chat_timestamping();},
|
||||
[](bool v) {prefs::get().set_chat_timestamping(v);});
|
||||
|
||||
/* SAVE PASSWORD */
|
||||
register_bool("remember_password", true,
|
||||
remember_password, set_remember_password);
|
||||
[]() {return prefs::get().remember_password();},
|
||||
[](bool v) {prefs::get().set_remember_password(v);});
|
||||
|
||||
/* WHISPERS FROM FRIENDS ONLY */
|
||||
register_bool("lobby_whisper_friends_only", true,
|
||||
whisper_friends_only, set_whisper_friends_only);
|
||||
[]() {return prefs::get().whisper_friends_only();},
|
||||
[](bool v) {prefs::get().set_whisper_friends_only(v);});
|
||||
|
||||
/* LOBBY JOIN NOTIFICATIONS */
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_none", false, true), lobby_joins::show_none);
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_friends", false, true), lobby_joins::show_friends);
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_all", false, true), lobby_joins::show_all);
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_none", false, true), pref_constants::lobby_joins::show_none);
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_friends", false, true), pref_constants::lobby_joins::show_friends);
|
||||
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_all", false, true), pref_constants::lobby_joins::show_all);
|
||||
|
||||
lobby_joins_group.set_member_states(get_lobby_joins());
|
||||
lobby_joins_group.set_member_states(prefs::get().get_lobby_joins());
|
||||
|
||||
lobby_joins_group.set_callback_on_value_change([&](widget&, const lobby_joins val) {
|
||||
_set_lobby_joins(val);
|
||||
lobby_joins_group.set_callback_on_value_change([&](widget&, const pref_constants::lobby_joins val) {
|
||||
prefs::get().set_lobby_joins(val);
|
||||
});
|
||||
|
||||
/* FRIENDS LIST */
|
||||
|
@ -579,7 +624,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
friends_list.clear();
|
||||
|
||||
for(const auto& entry : get_acquaintances()) {
|
||||
for(const auto& entry : prefs::get().get_acquaintances()) {
|
||||
friends_list.add_row(get_friends_list_row_data(entry.second));
|
||||
}
|
||||
|
||||
|
@ -619,8 +664,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
/* SET WESNOTHD PATH */
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(this, "mp_wesnothd", false), std::bind(
|
||||
&show_wesnothd_server_search));
|
||||
find_widget<button>(this, "mp_wesnothd", false), std::bind([]() {return prefs::get().show_wesnothd_server_search();}));
|
||||
|
||||
|
||||
//
|
||||
|
@ -631,8 +675,8 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
widget_data row_data;
|
||||
|
||||
for(const auto& option : adv_preferences_) {
|
||||
const std::string& pref_name = option.field;
|
||||
for(const auto& option : prefs::get().get_advanced_preferences()) {
|
||||
const std::string pref_name = option.field;
|
||||
|
||||
row_data["pref_name"]["label"] = option.name;
|
||||
grid* main_grid = &advanced.add_row(row_data);
|
||||
|
@ -649,16 +693,14 @@ void preferences_dialog::initialize_callbacks()
|
|||
}
|
||||
|
||||
switch(option.type) {
|
||||
case avp::avd_type::TOGGLE: {
|
||||
//main_grid->remove_child("setter");
|
||||
case preferences::option::avd_type::TOGGLE: {
|
||||
|
||||
toggle_box.set_visible(widget::visibility::visible);
|
||||
toggle_box.set_value(get(pref_name, option.cfg["default"].to_bool()));
|
||||
toggle_box.set_value(preferences_dialog_friend::get(pref_name, option.cfg["default"].to_bool()));
|
||||
|
||||
// We need to bind a lambda here since preferences::set is overloaded.
|
||||
// A lambda alone would be more verbose because it'd need to specify all the parameters.
|
||||
connect_signal_mouse_left_click(toggle_box, std::bind(
|
||||
[&, pref_name]() { set(pref_name, toggle_box.get_value_bool()); }
|
||||
[&, pref_name]() { preferences_dialog_friend::set(pref_name, toggle_box.get_value_bool()); }
|
||||
));
|
||||
|
||||
gui2::bind_status_label<toggle_button>(
|
||||
|
@ -667,7 +709,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
break;
|
||||
}
|
||||
|
||||
case avp::avd_type::SLIDER: {
|
||||
case preferences::option::avd_type::SLIDER: {
|
||||
auto setter_widget = build_single_widget_instance<slider>(config {"definition", "minimal"});
|
||||
setter_widget->set_id("setter");
|
||||
// Maximum must be set first or this will assert
|
||||
|
@ -678,12 +720,11 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
slider& slide = find_widget<slider>(&details_grid, "setter", false);
|
||||
|
||||
slide.set_value(lexical_cast_default<int>(get(pref_name), option.cfg["default"].to_int()));
|
||||
slide.set_value(preferences_dialog_friend::get(pref_name, option.cfg["default"].to_int()));
|
||||
|
||||
// We need to bind a lambda here since preferences::set is overloaded.
|
||||
// A lambda alone would be more verbose because it'd need to specify all the parameters.
|
||||
connect_signal_notify_modified(slide, std::bind(
|
||||
[&, pref_name]() { set(pref_name, slide.get_value()); }
|
||||
[&, pref_name]() { preferences_dialog_friend::set(pref_name, slide.get_value()); }
|
||||
));
|
||||
|
||||
gui2::bind_status_label<slider>(main_grid, "setter", default_status_value_getter<slider>, "value");
|
||||
|
@ -691,7 +732,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
break;
|
||||
}
|
||||
|
||||
case avp::avd_type::COMBO: {
|
||||
case preferences::option::avd_type::COMBO: {
|
||||
std::vector<config> menu_data;
|
||||
std::vector<std::string> option_ids;
|
||||
|
||||
|
@ -707,7 +748,7 @@ void preferences_dialog::initialize_callbacks()
|
|||
|
||||
// Attempt to find an initial selection
|
||||
int selected = std::distance(option_ids.begin(), std::find(option_ids.begin(), option_ids.end(),
|
||||
get(pref_name, option.cfg["default"].str())
|
||||
preferences_dialog_friend::get(pref_name, option.cfg["default"].str())
|
||||
));
|
||||
|
||||
// If the saved option value was invalid, reset selection to 0.
|
||||
|
@ -725,17 +766,16 @@ void preferences_dialog::initialize_callbacks()
|
|||
menu.set_use_markup(true);
|
||||
menu.set_values(menu_data, selected);
|
||||
|
||||
// We need to bind a lambda here since preferences::set is overloaded.
|
||||
// A lambda alone would be more verbose because it'd need to specify all the parameters.
|
||||
connect_signal_notify_modified(menu,
|
||||
std::bind([=](widget& w) { set(pref_name, option_ids[dynamic_cast<menu_button&>(w).get_value()]); }, std::placeholders::_1));
|
||||
std::bind([=](widget& w) { preferences_dialog_friend::set(pref_name, option_ids[dynamic_cast<menu_button&>(w).get_value()]); }, std::placeholders::_1));
|
||||
|
||||
gui2::bind_status_label<menu_button>(main_grid, "setter", default_status_value_getter<menu_button>, "value");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case avp::avd_type::SPECIAL: {
|
||||
case preferences::option::avd_type::SPECIAL: {
|
||||
//main_grid->remove_child("setter");
|
||||
|
||||
auto value_widget = build_single_widget_instance<image>();
|
||||
|
@ -921,7 +961,7 @@ void preferences_dialog::default_hotkey_callback()
|
|||
{
|
||||
gui2::show_transient_message(_("Hotkeys Reset"), _("All hotkeys have been reset to their default values."));
|
||||
|
||||
clear_hotkeys();
|
||||
prefs::get().clear_hotkeys();
|
||||
|
||||
// Set up the list again and reselect the default sorting option.
|
||||
listbox& hotkey_list = setup_hotkey_list();
|
||||
|
@ -997,9 +1037,9 @@ void preferences_dialog::hotkey_filter_callback()
|
|||
void preferences_dialog::on_advanced_prefs_list_select(listbox& list)
|
||||
{
|
||||
const int selected_row = list.get_selected_row();
|
||||
const auto& pref = adv_preferences_[selected_row];
|
||||
const auto& pref = prefs::get().get_advanced_preferences()[selected_row];
|
||||
|
||||
if(pref.type == avp::avd_type::SPECIAL) {
|
||||
if(pref.type == preferences::option::avd_type::SPECIAL) {
|
||||
if(pref.field == "logging") {
|
||||
gui2::dialogs::log_settings::display();
|
||||
} else if(pref.field == "orb_color") {
|
||||
|
@ -1013,7 +1053,7 @@ void preferences_dialog::on_advanced_prefs_list_select(listbox& list)
|
|||
|
||||
const bool has_description = !pref.description.empty();
|
||||
|
||||
if(has_description || (pref.type != avp::avd_type::SPECIAL && pref.type != avp::avd_type::TOGGLE)) {
|
||||
if(has_description || (pref.type != preferences::option::avd_type::SPECIAL && pref.type != preferences::option::avd_type::TOGGLE)) {
|
||||
find_widget<widget>(list.get_row_grid(selected_row), "prefs_setter_grid", false)
|
||||
.set_visible(widget::visibility::visible);
|
||||
}
|
||||
|
@ -1132,7 +1172,7 @@ void preferences_dialog::handle_theme_select()
|
|||
const auto& theme = themes_.at(selection);
|
||||
auto* display = display::get_singleton();
|
||||
|
||||
preferences::set_theme(theme.id);
|
||||
prefs::get().set_theme(theme.id);
|
||||
if(display && resources::gamedata && resources::gamedata->get_theme().empty()) {
|
||||
display->set_theme(theme.id);
|
||||
}
|
||||
|
@ -1155,11 +1195,11 @@ void preferences_dialog::on_tab_select()
|
|||
|
||||
void preferences_dialog::post_show(window& /*window*/)
|
||||
{
|
||||
save_hotkeys();
|
||||
prefs::get().save_hotkeys();
|
||||
|
||||
// Save new prefs to disk. This also happens on app close, but doing
|
||||
// it here too ensures nothing is lost in case of, say, a crash.
|
||||
write_preferences();
|
||||
prefs::get().write_preferences();
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
|
|
|
@ -18,21 +18,12 @@
|
|||
#include "gui/dialogs/modal_dialog.hpp"
|
||||
#include "gui/widgets/group.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
#include "preferences/advanced.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "theme.hpp"
|
||||
|
||||
// This file is not named preferences.hpp in order -I conflicts with
|
||||
// src/preferences.hpp.
|
||||
|
||||
//struct theme_info;
|
||||
|
||||
namespace preferences {
|
||||
enum PREFERENCE_VIEW {
|
||||
VIEW_DEFAULT,
|
||||
VIEW_FRIENDS
|
||||
};
|
||||
// This file is not named preferences.hpp in order -I conflicts with src/preferences.hpp.
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* Map containing page mappings that can be used to set the initially displayed page
|
||||
* of the dialog. The pair is in an 0-indexed toplevel stack/substack format, where
|
||||
|
@ -44,9 +35,9 @@ namespace preferences {
|
|||
* widget would allow specifying page by string id, but that would require changes to
|
||||
* generator. It's something to look into, however.
|
||||
*/
|
||||
static std::map<PREFERENCE_VIEW, std::pair<int,int>> pef_view_map {
|
||||
{VIEW_DEFAULT, {0,0}},
|
||||
{VIEW_FRIENDS, {4,1}}
|
||||
static std::map<pref_constants::PREFERENCE_VIEW, std::pair<int,int>> pef_view_map {
|
||||
{pref_constants::VIEW_DEFAULT, {0,0}},
|
||||
{pref_constants::VIEW_FRIENDS, {4,1}}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,7 +54,7 @@ namespace dialogs
|
|||
class preferences_dialog : public modal_dialog
|
||||
{
|
||||
public:
|
||||
preferences_dialog(const preferences::PREFERENCE_VIEW initial_view = preferences::VIEW_DEFAULT);
|
||||
preferences_dialog(const pref_constants::PREFERENCE_VIEW initial_view = pref_constants::VIEW_DEFAULT);
|
||||
|
||||
/** The display function -- see @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(preferences_dialog)
|
||||
|
@ -110,9 +101,7 @@ private:
|
|||
void default_hotkey_callback();
|
||||
void hotkey_filter_callback();
|
||||
|
||||
group<preferences::lobby_joins> lobby_joins_group;
|
||||
|
||||
const preferences::advanced_pref_list& adv_preferences_;
|
||||
group<pref_constants::lobby_joins> lobby_joins_group;
|
||||
|
||||
std::vector<point> resolutions_;
|
||||
std::vector<theme_info> themes_;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include "game_config.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace gui2::dialogs
|
||||
|
@ -43,23 +43,23 @@ REGISTER_DIALOG(select_orb_colors)
|
|||
|
||||
select_orb_colors::select_orb_colors()
|
||||
: modal_dialog(window_id())
|
||||
, show_unmoved_(preferences::show_unmoved_orb())
|
||||
, show_partial_(preferences::show_partial_orb())
|
||||
, show_disengaged_(preferences::show_disengaged_orb())
|
||||
, show_moved_(preferences::show_moved_orb())
|
||||
, show_ally_(preferences::show_ally_orb())
|
||||
, two_color_ally_(preferences::show_status_on_ally_orb())
|
||||
, show_enemy_(preferences::show_enemy_orb())
|
||||
, show_unmoved_(prefs::get().show_unmoved_orb())
|
||||
, show_partial_(prefs::get().show_partial_orb())
|
||||
, show_disengaged_(prefs::get().show_disengaged_orb())
|
||||
, show_moved_(prefs::get().show_moved_orb())
|
||||
, show_ally_(prefs::get().show_ally_orb())
|
||||
, two_color_ally_(prefs::get().show_status_on_ally_orb())
|
||||
, show_enemy_(prefs::get().show_enemy_orb())
|
||||
{
|
||||
}
|
||||
|
||||
void select_orb_colors::pre_show(window& window)
|
||||
{
|
||||
setup_orb_group("unmoved", show_unmoved_, preferences::unmoved_color());
|
||||
setup_orb_group_two_color("partial", show_partial_, show_disengaged_, preferences::partial_color());
|
||||
setup_orb_group("moved", show_moved_, preferences::moved_color());
|
||||
setup_orb_group_two_color("ally", show_ally_, two_color_ally_, preferences::allied_color());
|
||||
setup_orb_group("enemy", show_enemy_, preferences::enemy_color());
|
||||
setup_orb_group("unmoved", show_unmoved_, prefs::get().unmoved_color());
|
||||
setup_orb_group_two_color("partial", show_partial_, show_disengaged_, prefs::get().partial_color());
|
||||
setup_orb_group("moved", show_moved_, prefs::get().moved_color());
|
||||
setup_orb_group_two_color("ally", show_ally_, two_color_ally_, prefs::get().allied_color());
|
||||
setup_orb_group("enemy", show_enemy_, prefs::get().enemy_color());
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "orb_defaults", false), std::bind(&select_orb_colors::reset_orb_callback, this));
|
||||
|
@ -71,19 +71,19 @@ void select_orb_colors::post_show(window&)
|
|||
return;
|
||||
}
|
||||
|
||||
preferences::set_show_unmoved_orb(show_unmoved_);
|
||||
preferences::set_show_partial_orb(show_partial_);
|
||||
preferences::set_show_disengaged_orb(show_disengaged_);
|
||||
preferences::set_show_moved_orb(show_moved_);
|
||||
preferences::set_show_ally_orb(show_ally_);
|
||||
preferences::set_show_status_on_ally_orb(two_color_ally_);
|
||||
preferences::set_show_enemy_orb(show_enemy_);
|
||||
prefs::get().set_show_unmoved_orb(show_unmoved_);
|
||||
prefs::get().set_show_partial_orb(show_partial_);
|
||||
prefs::get().set_show_disengaged_orb(show_disengaged_);
|
||||
prefs::get().set_show_moved_orb(show_moved_);
|
||||
prefs::get().set_show_ally_orb(show_ally_);
|
||||
prefs::get().set_show_status_on_ally_orb(two_color_ally_);
|
||||
prefs::get().set_show_enemy_orb(show_enemy_);
|
||||
|
||||
preferences::set_unmoved_color(groups_["unmoved"].get_active_member_value());
|
||||
preferences::set_partial_color(groups_["partial"].get_active_member_value());
|
||||
preferences::set_moved_color(groups_["moved"].get_active_member_value());
|
||||
preferences::set_allied_color(groups_["ally"].get_active_member_value());
|
||||
preferences::set_enemy_color(groups_["enemy"].get_active_member_value());
|
||||
prefs::get().set_unmoved_color(groups_["unmoved"].get_active_member_value());
|
||||
prefs::get().set_partial_color(groups_["partial"].get_active_member_value());
|
||||
prefs::get().set_moved_color(groups_["moved"].get_active_member_value());
|
||||
prefs::get().set_allied_color(groups_["ally"].get_active_member_value());
|
||||
prefs::get().set_enemy_color(groups_["enemy"].get_active_member_value());
|
||||
}
|
||||
|
||||
void select_orb_colors::setup_orb_toggle(const std::string& base_id, bool& shown)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "gui/dialogs/gui_test_dialog.hpp"
|
||||
#include "language.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
//#define DEBUG_TOOLTIP
|
||||
#ifdef DEBUG_TOOLTIP
|
||||
#include "gui/dialogs/tooltip.hpp"
|
||||
|
@ -518,7 +518,7 @@ void title_screen::button_callback_multiplayer()
|
|||
|
||||
const auto res = dlg.get_choice();
|
||||
|
||||
if(res == decltype(dlg)::choice::HOST && preferences::mp_server_warning_disabled() < 2) {
|
||||
if(res == decltype(dlg)::choice::HOST && prefs::get().mp_server_warning_disabled() < 2) {
|
||||
if(!gui2::dialogs::mp_host_game_prompt::execute()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ void title_screen::button_callback_multiplayer()
|
|||
|
||||
switch(res) {
|
||||
case decltype(dlg)::choice::JOIN:
|
||||
game_.select_mp_server(preferences::builtin_servers_list().front().address);
|
||||
game_.select_mp_server(prefs::get().builtin_servers_list().front().address);
|
||||
get_window()->set_retval(MP_CONNECT);
|
||||
break;
|
||||
case decltype(dlg)::choice::CONNECT:
|
||||
|
@ -554,7 +554,7 @@ void title_screen::button_callback_cores()
|
|||
for(const config& core : game_config_manager::get()->game_config().child_range("core")) {
|
||||
cores.push_back(core);
|
||||
|
||||
if(core["id"] == preferences::core_id()) {
|
||||
if(core["id"] == prefs::get().core_id()) {
|
||||
current = cores.size() - 1;
|
||||
}
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ void title_screen::button_callback_cores()
|
|||
if(core_dlg.show()) {
|
||||
const std::string& core_id = cores[core_dlg.get_choice()]["id"];
|
||||
|
||||
preferences::set_core_id(core_id);
|
||||
prefs::get().set_core_id(core_id);
|
||||
get_window()->set_retval(RELOAD_GAME_DATA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "gui/core/log.hpp"
|
||||
#include "gui/core/gui_definition.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
#include "serialization/schema_validator.hpp"
|
||||
|
@ -66,7 +66,7 @@ void init()
|
|||
//
|
||||
// Parse GUI definitions.
|
||||
//
|
||||
const std::string& current_theme = preferences::gui_theme();
|
||||
const std::string& current_theme = prefs::get().gui_theme();
|
||||
|
||||
for(const config& g : cfg.child_range("gui")) {
|
||||
const std::string id = g["id"];
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
#include "game_initialization/multiplayer.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/lobby.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "scripting/plugins/manager.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
|
@ -180,7 +178,7 @@ void chatbox::chat_input_keypress_callback(const SDL_Keycode key)
|
|||
// TODO: very inefficient! Very! D:
|
||||
std::vector<std::string> matches;
|
||||
for(const auto& ui : li->users()) {
|
||||
if(ui.name != preferences::login()) {
|
||||
if(ui.name != prefs::get().login()) {
|
||||
matches.push_back(ui.name);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +221,7 @@ void chatbox::append_to_chatbox(const std::string& text, std::size_t id, const b
|
|||
|
||||
const std::string before_message = log.get_label().empty() ? "" : "\n";
|
||||
const std::string new_text = formatter()
|
||||
<< log.get_label() << before_message << "<span color='#bcb088'>" << preferences::get_chat_timestamp(std::time(0)) << text << "</span>";
|
||||
<< log.get_label() << before_message << "<span color='#bcb088'>" << prefs::get().get_chat_timestamp(std::time(0)) << text << "</span>";
|
||||
|
||||
log.set_use_markup(true);
|
||||
log.set_label(new_text);
|
||||
|
@ -245,9 +243,9 @@ void chatbox::append_to_chatbox(const std::string& text, std::size_t id, const b
|
|||
|
||||
void chatbox::send_chat_message(const std::string& message, bool /*allies_only*/)
|
||||
{
|
||||
add_chat_message(std::time(nullptr), preferences::login(), 0, message);
|
||||
add_chat_message(std::time(nullptr), prefs::get().login(), 0, message);
|
||||
|
||||
::config c {"message", ::config {"message", message, "sender", preferences::login()}};
|
||||
::config c {"message", ::config {"message", message, "sender", prefs::get().login()}};
|
||||
send_to_server(c);
|
||||
}
|
||||
|
||||
|
@ -289,10 +287,10 @@ void chatbox::add_chat_message(const std::time_t& /*time*/,
|
|||
void chatbox::add_whisper_sent(const std::string& receiver, const std::string& message)
|
||||
{
|
||||
if(whisper_window_active(receiver)) {
|
||||
add_active_window_message(preferences::login(), message, true);
|
||||
} else if(lobby_chat_window* t = whisper_window_open(receiver, preferences::auto_open_whisper_windows())) {
|
||||
add_active_window_message(prefs::get().login(), message, true);
|
||||
} else if(lobby_chat_window* t = whisper_window_open(receiver, prefs::get().auto_open_whisper_windows())) {
|
||||
switch_to_window(t);
|
||||
add_active_window_message(preferences::login(), message, true);
|
||||
add_active_window_message(prefs::get().login(), message, true);
|
||||
} else {
|
||||
add_active_window_whisper(VGETTEXT("whisper to $receiver", {{"receiver", receiver}}), message, true);
|
||||
}
|
||||
|
@ -300,8 +298,8 @@ void chatbox::add_whisper_sent(const std::string& receiver, const std::string& m
|
|||
|
||||
void chatbox::add_whisper_received(const std::string& sender, const std::string& message)
|
||||
{
|
||||
bool can_go_to_active = !preferences::whisper_friends_only() || preferences::is_friend(sender);
|
||||
bool can_open_new = preferences::auto_open_whisper_windows() && can_go_to_active;
|
||||
bool can_go_to_active = !prefs::get().whisper_friends_only() || prefs::get().is_friend(sender);
|
||||
bool can_open_new = prefs::get().auto_open_whisper_windows() && can_go_to_active;
|
||||
|
||||
if(whisper_window_open(sender, can_open_new)) {
|
||||
if(whisper_window_active(sender)) {
|
||||
|
@ -334,7 +332,7 @@ void chatbox::add_chat_room_message_sent(const std::string& room, const std::str
|
|||
switch_to_window(t);
|
||||
}
|
||||
|
||||
add_active_window_message(preferences::login(), message, true);
|
||||
add_active_window_message(prefs::get().login(), message, true);
|
||||
}
|
||||
|
||||
void chatbox::add_chat_room_message_received(const std::string& room,
|
||||
|
@ -354,9 +352,9 @@ void chatbox::add_chat_room_message_received(const std::string& room,
|
|||
|
||||
if(speaker == "server") {
|
||||
notify_mode = mp::notify_mode::server_message;
|
||||
} else if (utils::word_match(message, preferences::login())) {
|
||||
} else if (utils::word_match(message, prefs::get().login())) {
|
||||
notify_mode = mp::notify_mode::own_nick;
|
||||
} else if (preferences::is_friend(speaker)) {
|
||||
} else if (prefs::get().is_friend(speaker)) {
|
||||
notify_mode = mp::notify_mode::friend_message;
|
||||
}
|
||||
|
||||
|
@ -580,17 +578,17 @@ void chatbox::process_message(const ::config& data, bool whisper /*= false*/)
|
|||
DBG_LB << "process message from " << sender << " " << (whisper ? "(w)" : "")
|
||||
<< ", len " << data["message"].str().size();
|
||||
|
||||
if(preferences::is_ignored(sender)) {
|
||||
if(prefs::get().is_ignored(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& message = data["message"];
|
||||
//preferences::parse_admin_authentication(sender, message); TODO: replace
|
||||
//prefs::get().parse_admin_authentication(sender, message); TODO: replace
|
||||
|
||||
if(whisper) {
|
||||
add_whisper_received(sender, message);
|
||||
} else {
|
||||
if (!preferences::parse_should_show_lobby_join(sender, message)) return;
|
||||
if (!prefs::get().parse_should_show_lobby_join(sender, message)) return;
|
||||
|
||||
std::string room = data["room"];
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "gui/core/register_widget.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "gui/core/widget_definition.hpp"
|
||||
#include "gui/core/window_builder.hpp"
|
||||
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <functional>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "gui/core/register_widget.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include <functional>
|
||||
#include "wml_exception.hpp"
|
||||
|
@ -40,7 +40,7 @@ REGISTER_WIDGET(text_box)
|
|||
text_history text_history::get_history(const std::string& id,
|
||||
const bool enabled)
|
||||
{
|
||||
std::vector<std::string>* vec = preferences::get_history(id);
|
||||
std::vector<std::string>* vec = prefs::get().get_history(id);
|
||||
return text_history(vec, enabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "language.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "help/help.hpp"
|
||||
#include "help/help_impl.hpp"
|
||||
|
@ -157,7 +157,7 @@ static inline std::string get_mp_tooltip(int total_movement, std::function<int (
|
|||
return "";
|
||||
}
|
||||
|
||||
for(t_translation::terrain_code terrain : preferences::encountered_terrains()) {
|
||||
for(t_translation::terrain_code terrain : prefs::get().encountered_terrains()) {
|
||||
if(terrain == t_translation::FOGGED || terrain == t_translation::VOID_TERRAIN || t_translation::terrain_matches(terrain, t_translation::ALL_OFF_MAP)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "config.hpp" // for config, etc
|
||||
#include "events.hpp" // for draw, pump, etc
|
||||
#include "font/constants.hpp" // for relative_size
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "gettext.hpp" // for _
|
||||
#include "help/help_browser.hpp" // for help_browser
|
||||
|
@ -216,14 +216,14 @@ void show_with_toplevel(const section &toplevel_sec,
|
|||
// needed to create the help topics
|
||||
unit_types.build_all(unit_type::HELP_INDEXED);
|
||||
|
||||
if (preferences::encountered_units().size() != size_t(last_num_encountered_units) ||
|
||||
preferences::encountered_terrains().size() != size_t(last_num_encountered_terrains) ||
|
||||
if (prefs::get().encountered_units().size() != size_t(last_num_encountered_units) ||
|
||||
prefs::get().encountered_terrains().size() != size_t(last_num_encountered_terrains) ||
|
||||
last_debug_state != game_config::debug ||
|
||||
last_num_encountered_units < 0)
|
||||
{
|
||||
// More units or terrains encountered, update the contents.
|
||||
last_num_encountered_units = preferences::encountered_units().size();
|
||||
last_num_encountered_terrains = preferences::encountered_terrains().size();
|
||||
last_num_encountered_units = prefs::get().encountered_units().size();
|
||||
last_num_encountered_terrains = prefs::get().encountered_terrains().size();
|
||||
last_debug_state = game_config::debug;
|
||||
generate_contents();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "formula/string_utils.hpp" // for VGETTEXT
|
||||
#include "game_config.hpp" // for debug, menu_contract, etc
|
||||
#include "game_config_manager.hpp" // for game_config_manager
|
||||
#include "preferences/game.hpp" // for encountered_terrains, etc
|
||||
#include "preferences/preferences.hpp" // for encountered_terrains, etc
|
||||
#include "gettext.hpp" // for _, gettext, N_
|
||||
#include "help/help_topic_generators.hpp"
|
||||
#include "hotkey/hotkey_command.hpp" // for is_scope_active, etc
|
||||
|
@ -982,8 +982,8 @@ void generate_terrain_sections(section& sec, int /*level*/)
|
|||
|
||||
bool hidden = info.hide_help();
|
||||
|
||||
if (preferences::encountered_terrains().find(t)
|
||||
== preferences::encountered_terrains().end() && !info.is_overlay())
|
||||
if (prefs::get().encountered_terrains().find(t)
|
||||
== prefs::get().encountered_terrains().end() && !info.is_overlay())
|
||||
hidden = true;
|
||||
|
||||
topic terrain_topic;
|
||||
|
@ -1188,12 +1188,12 @@ std::vector<topic> generate_unit_topics(const bool sort_generated, const std::st
|
|||
|
||||
UNIT_DESCRIPTION_TYPE description_type(const unit_type &type)
|
||||
{
|
||||
if (game_config::debug || preferences::show_all_units_in_help() ||
|
||||
if (game_config::debug || prefs::get().show_all_units_in_help() ||
|
||||
hotkey::is_scope_active(hotkey::SCOPE_EDITOR) ) {
|
||||
return FULL_DESCRIPTION;
|
||||
}
|
||||
|
||||
const std::set<std::string> &encountered_units = preferences::encountered_units();
|
||||
const std::set<std::string> &encountered_units = prefs::get().encountered_units();
|
||||
if (encountered_units.find(type.id()) != encountered_units.end()) {
|
||||
return FULL_DESCRIPTION;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "lexical_cast.hpp"
|
||||
#include "log.hpp" // for LOG_STREAM, log_domain, etc
|
||||
#include "picture.hpp" // for get_image
|
||||
#include "preferences/general.hpp" // for font_scaled
|
||||
#include "preferences/preferences.hpp" // for font_scaled
|
||||
#include "sdl/rect.hpp" // for draw_rectangle, etc
|
||||
#include "sdl/texture.hpp" // for texture
|
||||
#include "serialization/parser.hpp" // for read, write
|
||||
|
@ -306,7 +306,7 @@ void help_text_area::add_text_item(const std::string& text, const std::string& r
|
|||
{
|
||||
const int font_size = _font_size < 0 ? normal_font_size : _font_size;
|
||||
// font::line_width(), font::get_rendered_text() are not use scaled font inside
|
||||
const int scaled_font_size = preferences::font_scaled(font_size);
|
||||
const int scaled_font_size = prefs::get().font_scaled(font_size);
|
||||
if (text.empty())
|
||||
return;
|
||||
const int remaining_width = get_remaining_width();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "font/sdl_ttf_compat.hpp"
|
||||
#include "formula/string_utils.hpp" // for VNGETTEXT
|
||||
#include "game_config.hpp" // for debug, menu_contract, etc
|
||||
#include "preferences/game.hpp" // for encountered_terrains, etc
|
||||
#include "preferences/preferences.hpp" // for encountered_terrains, etc
|
||||
#include "gettext.hpp" // for _, gettext, N_
|
||||
#include "language.hpp" // for string_table, symbol_table
|
||||
#include "log.hpp" // for LOG_STREAM, logger, etc
|
||||
|
@ -756,7 +756,7 @@ std::string unit_topic_generator::operator()() const {
|
|||
push_header(first_row, _("Defense"));
|
||||
push_header(first_row, _("Movement Cost"));
|
||||
|
||||
const bool has_terrain_defense_caps = movement_type.has_terrain_defense_caps(preferences::encountered_terrains());
|
||||
const bool has_terrain_defense_caps = movement_type.has_terrain_defense_caps(prefs::get().encountered_terrains());
|
||||
if (has_terrain_defense_caps) {
|
||||
push_header(first_row, _("Defense Cap"));
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ std::string unit_topic_generator::operator()() const {
|
|||
|
||||
std::set<terrain_movement_info> terrain_moves;
|
||||
|
||||
for (t_translation::terrain_code terrain : preferences::encountered_terrains()) {
|
||||
for (t_translation::terrain_code terrain : prefs::get().encountered_terrains()) {
|
||||
if (terrain == t_translation::FOGGED || terrain == t_translation::VOID_TERRAIN || t_translation::terrain_matches(terrain, t_translation::ALL_OFF_MAP)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "filesystem.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "display.hpp"
|
||||
#include "quit_confirmation.hpp"
|
||||
#include "sdl/surface.hpp"
|
||||
|
@ -367,23 +367,23 @@ bool command_executor::do_execute_command(const hotkey::ui_command& cmd, bool pr
|
|||
surrender_game();
|
||||
break;
|
||||
case HOTKEY_MINIMAP_DRAW_TERRAIN:
|
||||
preferences::toggle_minimap_draw_terrain();
|
||||
prefs::get().toggle_minimap_draw_terrain();
|
||||
recalculate_minimap();
|
||||
break;
|
||||
case HOTKEY_MINIMAP_CODING_TERRAIN:
|
||||
preferences::toggle_minimap_terrain_coding();
|
||||
prefs::get().toggle_minimap_terrain_coding();
|
||||
recalculate_minimap();
|
||||
break;
|
||||
case HOTKEY_MINIMAP_CODING_UNIT:
|
||||
preferences::toggle_minimap_movement_coding();
|
||||
prefs::get().toggle_minimap_movement_coding();
|
||||
recalculate_minimap();
|
||||
break;
|
||||
case HOTKEY_MINIMAP_DRAW_UNITS:
|
||||
preferences::toggle_minimap_draw_units();
|
||||
prefs::get().toggle_minimap_draw_units();
|
||||
recalculate_minimap();
|
||||
break;
|
||||
case HOTKEY_MINIMAP_DRAW_VILLAGES:
|
||||
preferences::toggle_minimap_draw_villages();
|
||||
prefs::get().toggle_minimap_draw_villages();
|
||||
recalculate_minimap();
|
||||
break;
|
||||
case HOTKEY_ACHIEVEMENTS:
|
||||
|
@ -628,10 +628,10 @@ void command_executor::execute_command_wrap(const command_executor::queued_comma
|
|||
make_screenshot(_("Screenshot"), false);
|
||||
break;
|
||||
case HOTKEY_ANIMATE_MAP:
|
||||
preferences::set_animate_map(!preferences::animate_map());
|
||||
prefs::get().set_animate_map(!prefs::get().animate_map());
|
||||
break;
|
||||
case HOTKEY_MOUSE_SCROLL:
|
||||
preferences::enable_mouse_scroll(!preferences::mouse_scroll_enabled());
|
||||
prefs::get().enable_mouse_scroll(!prefs::get().mouse_scroll_enabled());
|
||||
break;
|
||||
case HOTKEY_MUTE:
|
||||
{
|
||||
|
@ -641,19 +641,19 @@ void command_executor::execute_command_wrap(const command_executor::queued_comma
|
|||
bool playing_sound,playing_music;
|
||||
before_muted_s() : playing_sound(false),playing_music(false){}
|
||||
} before_muted;
|
||||
if (preferences::music_on() || preferences::sound_on())
|
||||
if (prefs::get().music_on() || prefs::get().sound_on())
|
||||
{
|
||||
// then remember settings and mute both
|
||||
before_muted.playing_sound = preferences::sound_on();
|
||||
before_muted.playing_music = preferences::music_on();
|
||||
preferences::set_sound(false);
|
||||
preferences::set_music(false);
|
||||
before_muted.playing_sound = prefs::get().sound_on();
|
||||
before_muted.playing_music = prefs::get().music_on();
|
||||
prefs::get().set_sound(false);
|
||||
prefs::get().set_music(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// then set settings before mute
|
||||
preferences::set_sound(before_muted.playing_sound);
|
||||
preferences::set_music(before_muted.playing_music);
|
||||
prefs::get().set_sound(before_muted.playing_sound);
|
||||
prefs::get().set_music(before_muted.playing_music);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_events/wmi_manager.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
#include "hotkey/hotkey_item.hpp"
|
||||
|
@ -220,12 +220,12 @@ void play_controller::hotkey_handler::search(){
|
|||
|
||||
void play_controller::hotkey_handler::toggle_accelerated_speed()
|
||||
{
|
||||
preferences::set_turbo(!preferences::turbo());
|
||||
prefs::get().set_turbo(!prefs::get().turbo());
|
||||
|
||||
display::announce_options ao;
|
||||
ao.discard_previous = true;
|
||||
|
||||
if (preferences::turbo())
|
||||
if (prefs::get().turbo())
|
||||
{
|
||||
utils::string_map symbols;
|
||||
symbols["hk"] = hotkey::get_names(hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_ACCELERATED).id);
|
||||
|
@ -405,9 +405,9 @@ static void trim_items(std::vector<T>& newitems)
|
|||
template<typename F>
|
||||
static void foreach_autosave(int turn, saved_game& sg, F func) {
|
||||
|
||||
const compression::format comp_format = preferences::save_compression_format();
|
||||
const compression::format comp_format = prefs::get().save_compression_format();
|
||||
|
||||
compression::format compression_format = preferences::save_compression_format();
|
||||
compression::format compression_format = prefs::get().save_compression_format();
|
||||
savegame::autosave_savegame autosave(sg, compression_format);
|
||||
savegame::scenariostart_savegame scenariostart_save(sg, compression_format);
|
||||
|
||||
|
@ -544,15 +544,15 @@ hotkey::ACTION_STATE play_controller::hotkey_handler::get_action_state(const hot
|
|||
switch(cmd.hotkey_command) {
|
||||
|
||||
case hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES:
|
||||
return (preferences::minimap_draw_villages()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_villages()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_MINIMAP_CODING_UNIT:
|
||||
return (preferences::minimap_movement_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
return (prefs::get().minimap_movement_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_MINIMAP_CODING_TERRAIN:
|
||||
return (preferences::minimap_terrain_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
return (prefs::get().minimap_terrain_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_MINIMAP_DRAW_UNITS:
|
||||
return (preferences::minimap_draw_units()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_units()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN:
|
||||
return (preferences::minimap_draw_terrain()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
return (prefs::get().minimap_draw_terrain()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_ZOOM_DEFAULT:
|
||||
return (gui()->get_zoom_factor() == 1.0) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
|
||||
case hotkey::HOTKEY_DELAY_SHROUD:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "gettext.hpp"
|
||||
#include "language.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
|
@ -336,7 +336,7 @@ const language_def& get_locale()
|
|||
|
||||
assert(!known_languages.empty());
|
||||
|
||||
const std::string& prefs_locale = preferences::language();
|
||||
const std::string& prefs_locale = prefs::get().language();
|
||||
if(prefs_locale.empty() == false) {
|
||||
translation::set_language(prefs_locale, nullptr);
|
||||
for(language_list::const_iterator i = known_languages.begin();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "game_board.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "game_end_exceptions.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "game_initialization/multiplayer.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
@ -65,8 +65,6 @@
|
|||
#include "mouse_events.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "playsingle_controller.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/display.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "replay_controller.hpp"
|
||||
#include "replay_helper.hpp"
|
||||
|
@ -203,18 +201,18 @@ void menu_handler::speak()
|
|||
? board().is_observer()
|
||||
? _("Send to observers only")
|
||||
: _("Send to allies only")
|
||||
: "", preferences::message_private(), *gui_);
|
||||
: "", prefs::get().message_private(), *gui_);
|
||||
}
|
||||
|
||||
void menu_handler::whisper()
|
||||
{
|
||||
preferences::set_message_private(true);
|
||||
prefs::get().set_message_private(true);
|
||||
speak();
|
||||
}
|
||||
|
||||
void menu_handler::shout()
|
||||
{
|
||||
preferences::set_message_private(false);
|
||||
prefs::get().set_message_private(false);
|
||||
speak();
|
||||
}
|
||||
|
||||
|
@ -577,7 +575,7 @@ bool menu_handler::end_turn(int side_num)
|
|||
// Skip the confirmations that follow.
|
||||
}
|
||||
// Ask for confirmation if the player hasn't made any moves.
|
||||
else if(preferences::confirm_no_moves() && !pc_.get_undo_stack().player_acted()
|
||||
else if(prefs::get().confirm_no_moves() && !pc_.get_undo_stack().player_acted()
|
||||
&& (!pc_.get_whiteboard() || !pc_.get_whiteboard()->current_side_has_actions())
|
||||
&& units_alive(side_num, pc_.get_units())) {
|
||||
const int res = gui2::show_message("",
|
||||
|
@ -588,7 +586,7 @@ bool menu_handler::end_turn(int side_num)
|
|||
}
|
||||
}
|
||||
// Ask for confirmation if units still have some movement left.
|
||||
else if(preferences::yellow_confirm() && partmoved_units(side_num, pc_.get_units(), board(), pc_.get_whiteboard())) {
|
||||
else if(prefs::get().yellow_confirm() && partmoved_units(side_num, pc_.get_units(), board(), pc_.get_whiteboard())) {
|
||||
const int res = gui2::show_message("",
|
||||
_("Some units have movement left. Do you really want to end your turn?"),
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
@ -597,7 +595,7 @@ bool menu_handler::end_turn(int side_num)
|
|||
}
|
||||
}
|
||||
// Ask for confirmation if units still have all movement left.
|
||||
else if(preferences::green_confirm() && unmoved_units(side_num, pc_.get_units(), board(), pc_.get_whiteboard())) {
|
||||
else if(prefs::get().green_confirm() && unmoved_units(side_num, pc_.get_units(), board(), pc_.get_whiteboard())) {
|
||||
const int res = gui2::show_message("",
|
||||
_("Some units have not moved. Do you really want to end your turn?"),
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
@ -987,13 +985,13 @@ void menu_handler::execute_gotos(mouse_handler& mousehandler, int side)
|
|||
|
||||
void menu_handler::toggle_ellipses()
|
||||
{
|
||||
preferences::set_ellipses(!preferences::ellipses());
|
||||
prefs::get().set_ellipses(!prefs::get().ellipses());
|
||||
gui_->invalidate_all(); // TODO can fewer tiles be invalidated?
|
||||
}
|
||||
|
||||
void menu_handler::toggle_grid()
|
||||
{
|
||||
preferences::set_grid(!preferences::grid());
|
||||
prefs::get().set_grid(!prefs::get().grid());
|
||||
gui_->invalidate_all();
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1060,7 @@ void menu_handler::add_chat_message(const std::time_t& time,
|
|||
|
||||
plugins_manager::get()->notify_event("chat",
|
||||
config {
|
||||
"sender", preferences::login(),
|
||||
"sender", prefs::get().login(),
|
||||
"message", message,
|
||||
"whisper", type == events::chat_handler::MESSAGE_PRIVATE,
|
||||
}
|
||||
|
@ -1309,7 +1307,7 @@ protected:
|
|||
"whiteboard_options", &console_handler::do_whiteboard_options, _("Access whiteboard options dialog."));
|
||||
register_alias("whiteboard_options", "wbo");
|
||||
|
||||
if(auto alias_list = preferences::get_alias()) {
|
||||
if(auto alias_list = prefs::get().get_alias()) {
|
||||
for(const config::attribute& a : alias_list->attribute_range()) {
|
||||
register_alias(a.second, a.first);
|
||||
}
|
||||
|
@ -1324,7 +1322,7 @@ private:
|
|||
void menu_handler::send_chat_message(const std::string& message, bool allies_only)
|
||||
{
|
||||
config cfg;
|
||||
cfg["id"] = preferences::login();
|
||||
cfg["id"] = prefs::get().login();
|
||||
cfg["message"] = message;
|
||||
const std::time_t time = ::std::time(nullptr);
|
||||
std::stringstream ss;
|
||||
|
@ -1496,7 +1494,7 @@ void console_handler::do_droid()
|
|||
menu_handler_.board().get_team(side).make_droid();
|
||||
changed = true;
|
||||
if(is_ai) {
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", preferences::login(), "to", side_controller::human}});
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", prefs::get().login(), "to", side_controller::human}});
|
||||
}
|
||||
print(get_cmd(), VGETTEXT("Side '$side' controller is now controlled by: AI.", symbols));
|
||||
} else {
|
||||
|
@ -1512,7 +1510,7 @@ void console_handler::do_droid()
|
|||
menu_handler_.board().get_team(side).make_proxy_human();
|
||||
changed = true;
|
||||
if(is_ai) {
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", preferences::login(), "to", side_controller::human}});
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", prefs::get().login(), "to", side_controller::human}});
|
||||
}
|
||||
print(get_cmd(), VGETTEXT("Side '$side' controller is now controlled by: human.", symbols));
|
||||
} else {
|
||||
|
@ -1528,7 +1526,7 @@ void console_handler::do_droid()
|
|||
menu_handler_.board().get_team(side).make_droid();
|
||||
changed = true;
|
||||
if(is_human || is_proxy_human) {
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", preferences::login(), "to", side_controller::ai}});
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", prefs::get().login(), "to", side_controller::ai}});
|
||||
}
|
||||
print(get_cmd(), VGETTEXT("Side '$side' controller is now fully controlled by: AI.", symbols));
|
||||
} else {
|
||||
|
@ -1544,7 +1542,7 @@ void console_handler::do_droid()
|
|||
menu_handler_.board().get_team(side).make_proxy_human();
|
||||
changed = true;
|
||||
if(is_ai) {
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", preferences::login(), "to", side_controller::human}});
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", prefs::get().login(), "to", side_controller::human}});
|
||||
}
|
||||
print(get_cmd(), VGETTEXT("Side '$side' controller is now controlled by: human.", symbols));
|
||||
} else {
|
||||
|
@ -1552,7 +1550,7 @@ void console_handler::do_droid()
|
|||
menu_handler_.board().get_team(side).make_droid();
|
||||
changed = true;
|
||||
if(is_ai) {
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", preferences::login(), "to", side_controller::human}});
|
||||
menu_handler_.pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", prefs::get().login(), "to", side_controller::human}});
|
||||
}
|
||||
print(get_cmd(), VGETTEXT("Side '$side' controller is now controlled by: AI.", symbols));
|
||||
}
|
||||
|
@ -1628,7 +1626,7 @@ void console_handler::do_idle()
|
|||
|
||||
void console_handler::do_theme()
|
||||
{
|
||||
preferences::show_theme_dialog();
|
||||
prefs::get().show_theme_dialog();
|
||||
}
|
||||
|
||||
struct save_id_matches
|
||||
|
@ -1754,7 +1752,7 @@ void console_handler::do_layers()
|
|||
|
||||
void console_handler::do_fps()
|
||||
{
|
||||
preferences::set_show_fps(!preferences::show_fps());
|
||||
prefs::get().set_show_fps(!prefs::get().show_fps());
|
||||
}
|
||||
|
||||
void console_handler::do_benchmark()
|
||||
|
@ -1905,7 +1903,7 @@ void console_handler::do_unsafe_lua()
|
|||
|
||||
void console_handler::do_custom()
|
||||
{
|
||||
preferences::set_custom_command(get_data());
|
||||
prefs::get().set_custom_command(get_data());
|
||||
}
|
||||
|
||||
void console_handler::do_set_alias()
|
||||
|
@ -1922,9 +1920,9 @@ void console_handler::do_set_alias()
|
|||
// equal to itself here. Later preferences will filter empty alias.
|
||||
register_alias(alias, alias);
|
||||
}
|
||||
preferences::add_alias(alias, command);
|
||||
prefs::get().add_alias(alias, command);
|
||||
// directly save it for the moment, but will slow commands sequence
|
||||
preferences::write_preferences();
|
||||
prefs::get().write_preferences();
|
||||
} else {
|
||||
// "alias something" display its value
|
||||
// if no alias, will be "'something' = 'something'"
|
||||
|
@ -2017,7 +2015,7 @@ void console_handler::do_unit()
|
|||
void console_handler::do_discover()
|
||||
{
|
||||
for(const unit_type_data::unit_type_map::value_type& i : unit_types.types()) {
|
||||
preferences::encountered_units().insert(i.second.id());
|
||||
prefs::get().encountered_units().insert(i.second.id());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2026,7 +2024,7 @@ void console_handler::do_undiscover()
|
|||
const int res = gui2::show_message("Undiscover",
|
||||
_("Do you wish to clear all of your discovered units from help?"), gui2::dialogs::message::yes_no_buttons);
|
||||
if(res != gui2::retval::CANCEL) {
|
||||
preferences::encountered_units().clear();
|
||||
prefs::get().encountered_units().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2124,7 +2122,7 @@ void menu_handler::user_command()
|
|||
void menu_handler::request_control_change(int side_num, const std::string& player)
|
||||
{
|
||||
std::string side = std::to_string(side_num);
|
||||
if(board().get_team(side_num).is_local_human() && player == preferences::login()) {
|
||||
if(board().get_team(side_num).is_local_human() && player == prefs::get().login()) {
|
||||
// this is already our side.
|
||||
return;
|
||||
} else {
|
||||
|
@ -2136,7 +2134,7 @@ void menu_handler::request_control_change(int side_num, const std::string& playe
|
|||
|
||||
void menu_handler::custom_command()
|
||||
{
|
||||
for(const std::string& command : utils::split(preferences::custom_command(), ';')) {
|
||||
for(const std::string& command : utils::split(prefs::get().custom_command(), ';')) {
|
||||
do_command(command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "picture.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "team.hpp"
|
||||
#include "terrain/type_data.hpp"
|
||||
|
@ -45,11 +45,11 @@ std::function<rect(rect)> prep_minimap_for_rendering(
|
|||
bool ignore_terrain_disabled)
|
||||
{
|
||||
// Drawing mode flags.
|
||||
const bool preferences_minimap_draw_terrain = preferences::minimap_draw_terrain() || ignore_terrain_disabled;
|
||||
const bool preferences_minimap_terrain_coding = preferences::minimap_terrain_coding();
|
||||
const bool preferences_minimap_draw_villages = preferences::minimap_draw_villages();
|
||||
const bool preferences_minimap_draw_units = preferences::minimap_draw_units();
|
||||
const bool preferences_minimap_unit_coding = preferences::minimap_movement_coding();
|
||||
const bool preferences_minimap_draw_terrain = prefs::get().minimap_draw_terrain() || ignore_terrain_disabled;
|
||||
const bool preferences_minimap_terrain_coding = prefs::get().minimap_terrain_coding();
|
||||
const bool preferences_minimap_draw_villages = prefs::get().minimap_draw_villages();
|
||||
const bool preferences_minimap_draw_units = prefs::get().minimap_draw_units();
|
||||
const bool preferences_minimap_unit_coding = prefs::get().minimap_movement_coding();
|
||||
|
||||
const int scale = (preferences_minimap_draw_terrain && preferences_minimap_terrain_coding) ? 24 : 4;
|
||||
|
||||
|
@ -235,11 +235,11 @@ std::function<rect(rect)> prep_minimap_for_rendering(
|
|||
col = team::get_minimap_color(side_num);
|
||||
} else {
|
||||
if(vw->owns_village(loc)) {
|
||||
col = game_config::color_info(preferences::unmoved_color()).rep();
|
||||
col = game_config::color_info(prefs::get().unmoved_color()).rep();
|
||||
} else if(vw->is_enemy(side_num)) {
|
||||
col = game_config::color_info(preferences::enemy_color()).rep();
|
||||
col = game_config::color_info(prefs::get().enemy_color()).rep();
|
||||
} else {
|
||||
col = game_config::color_info(preferences::allied_color()).rep();
|
||||
col = game_config::color_info(prefs::get().allied_color()).rep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "cursor.hpp"
|
||||
#include "display.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "sdl/rect.hpp"
|
||||
#include "tooltips.hpp"
|
||||
#include "sdl/input.hpp" // get_mouse_state
|
||||
|
@ -171,7 +171,7 @@ bool mouse_handler_base::mouse_button_event(const SDL_MouseButtonEvent& event, u
|
|||
|
||||
void mouse_handler_base::mouse_press(const SDL_MouseButtonEvent& event, const bool browse)
|
||||
{
|
||||
if(is_middle_click(event) && !preferences::middle_click_scrolls()) {
|
||||
if(is_middle_click(event) && !prefs::get().middle_click_scrolls()) {
|
||||
simple_warp_ = true;
|
||||
}
|
||||
|
||||
|
@ -359,8 +359,8 @@ void mouse_handler_base::mouse_wheel(int scrollx, int scrolly, bool browse)
|
|||
int x, y;
|
||||
sdl::get_mouse_state(&x, &y);
|
||||
|
||||
int movex = scrollx * preferences::scroll_speed();
|
||||
int movey = scrolly * preferences::scroll_speed();
|
||||
int movex = scrollx * prefs::get().scroll_speed();
|
||||
int movey = scrolly * prefs::get().scroll_speed();
|
||||
|
||||
// Don't scroll map if cursor is not in gamemap area
|
||||
if(!gui().map_area().contains(x, y)) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
#include <string>
|
||||
|
@ -36,55 +36,44 @@ namespace
|
|||
{
|
||||
bool lobby_pref(const std::string& id)
|
||||
{
|
||||
return preferences::mp_alert_option(id, "lobby", get_def_pref_lobby(id));
|
||||
return prefs::get().mp_alert_option(id, "lobby", get_def_pref_lobby(id));
|
||||
}
|
||||
|
||||
bool sound_pref(const std::string& id)
|
||||
{
|
||||
return preferences::mp_alert_option(id, "sound", get_def_pref_sound(id));
|
||||
return prefs::get().mp_alert_option(id, "sound", get_def_pref_sound(id));
|
||||
}
|
||||
|
||||
bool notif_pref(const std::string& id)
|
||||
{
|
||||
return preferences::mp_alert_option(id, "notif", get_def_pref_notif(id));
|
||||
return prefs::get().mp_alert_option(id, "notif", get_def_pref_notif(id));
|
||||
}
|
||||
|
||||
const std::string _player_joins = "player_joins";
|
||||
const std::string _player_leaves = "player_leaves";
|
||||
const std::string _private_message = "private_message";
|
||||
const std::string _friend_message = "friend_message";
|
||||
const std::string _public_message = "public_message";
|
||||
const std::string _server_message = "server_message";
|
||||
const std::string _ready_for_start = "ready_for_start";
|
||||
const std::string _game_has_begun = "game_has_begun";
|
||||
const std::string _turn_changed = "turn_changed";
|
||||
const std::string _game_created = "game_created";
|
||||
} // end anonymous namespace
|
||||
|
||||
const std::vector<std::string> items{
|
||||
_player_joins,
|
||||
_player_leaves,
|
||||
_private_message,
|
||||
_friend_message,
|
||||
_public_message,
|
||||
_server_message,
|
||||
_ready_for_start,
|
||||
_game_has_begun,
|
||||
_turn_changed,
|
||||
_game_created,
|
||||
pref_constants::player_joins,
|
||||
pref_constants::player_leaves,
|
||||
pref_constants::private_message,
|
||||
pref_constants::friend_message,
|
||||
pref_constants::public_message,
|
||||
pref_constants::server_message,
|
||||
pref_constants::ready_for_start,
|
||||
pref_constants::game_has_begun,
|
||||
pref_constants::turn_changed,
|
||||
pref_constants::game_created,
|
||||
};
|
||||
|
||||
void game_created(const std::string& scenario, const std::string& name)
|
||||
{
|
||||
if(!lobby_pref(_game_created)) {
|
||||
if(!lobby_pref(pref_constants::game_created)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_game_created)) {
|
||||
if(sound_pref(pref_constants::game_created)) {
|
||||
sound::play_UI_sound(game_config::sounds::game_created);
|
||||
}
|
||||
|
||||
if(notif_pref(_game_created)) {
|
||||
if(notif_pref(pref_constants::game_created)) {
|
||||
const std::string message = VGETTEXT("A game ($name|, $scenario|) has been created", {{"name", name}, {"scenario", scenario}});
|
||||
desktop::notifications::send(_("Wesnoth"), message, desktop::notifications::OTHER);
|
||||
}
|
||||
|
@ -92,123 +81,123 @@ void game_created(const std::string& scenario, const std::string& name)
|
|||
|
||||
void player_joins(bool is_lobby)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_player_joins)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::player_joins)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_player_joins)) {
|
||||
if(sound_pref(pref_constants::player_joins)) {
|
||||
sound::play_UI_sound(game_config::sounds::player_joins);
|
||||
}
|
||||
|
||||
if(notif_pref(_player_joins)) {
|
||||
if(notif_pref(pref_constants::player_joins)) {
|
||||
desktop::notifications::send(_("Wesnoth"), _("A player has joined"), desktop::notifications::OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
void player_leaves(bool is_lobby)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_player_leaves)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::player_leaves)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_player_leaves)) {
|
||||
if(sound_pref(pref_constants::player_leaves)) {
|
||||
sound::play_UI_sound(game_config::sounds::player_leaves);
|
||||
}
|
||||
|
||||
if(notif_pref(_player_leaves)) {
|
||||
if(notif_pref(pref_constants::player_leaves)) {
|
||||
desktop::notifications::send(_("Wesnoth"), _("A player has left"), desktop::notifications::OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
void public_message(bool is_lobby, const std::string& sender, const std::string& message)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_public_message)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::public_message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_public_message)) {
|
||||
if(sound_pref(pref_constants::public_message)) {
|
||||
sound::play_UI_sound(game_config::sounds::public_message);
|
||||
}
|
||||
|
||||
if(notif_pref(_public_message)) {
|
||||
if(notif_pref(pref_constants::public_message)) {
|
||||
desktop::notifications::send(sender, message, desktop::notifications::CHAT);
|
||||
}
|
||||
}
|
||||
|
||||
void friend_message(bool is_lobby, const std::string& sender, const std::string& message)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_friend_message)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::friend_message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_friend_message)) {
|
||||
if(sound_pref(pref_constants::friend_message)) {
|
||||
sound::play_UI_sound(game_config::sounds::friend_message);
|
||||
}
|
||||
|
||||
if(notif_pref(_friend_message)) {
|
||||
if(notif_pref(pref_constants::friend_message)) {
|
||||
desktop::notifications::send(sender, message, desktop::notifications::CHAT);
|
||||
}
|
||||
}
|
||||
|
||||
void private_message(bool is_lobby, const std::string& sender, const std::string& message)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_private_message)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::private_message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_private_message)) {
|
||||
if(sound_pref(pref_constants::private_message)) {
|
||||
sound::play_UI_sound(game_config::sounds::private_message);
|
||||
}
|
||||
|
||||
if(notif_pref(_private_message)) {
|
||||
if(notif_pref(pref_constants::private_message)) {
|
||||
desktop::notifications::send(sender, message, desktop::notifications::CHAT);
|
||||
}
|
||||
}
|
||||
|
||||
void server_message(bool is_lobby, const std::string& sender, const std::string& message)
|
||||
{
|
||||
if(is_lobby && !lobby_pref(_server_message)) {
|
||||
if(is_lobby && !lobby_pref(pref_constants::server_message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound_pref(_server_message)) {
|
||||
if(sound_pref(pref_constants::server_message)) {
|
||||
sound::play_UI_sound(game_config::sounds::server_message);
|
||||
}
|
||||
|
||||
if(notif_pref(_server_message)) {
|
||||
if(notif_pref(pref_constants::server_message)) {
|
||||
desktop::notifications::send(sender, message, desktop::notifications::CHAT);
|
||||
}
|
||||
}
|
||||
|
||||
void ready_for_start()
|
||||
{
|
||||
if(sound_pref(_ready_for_start)) {
|
||||
if(preferences::UI_sound_on()) {
|
||||
if(sound_pref(pref_constants::ready_for_start)) {
|
||||
if(prefs::get().ui_sound_on()) {
|
||||
// this is play_bell instead of play_UI_sound to economize on sound channels. UI only has two
|
||||
// sounds, and turn bell has a dedicated channel.
|
||||
sound::play_bell(game_config::sounds::ready_for_start);
|
||||
}
|
||||
}
|
||||
|
||||
if(notif_pref(_ready_for_start)) {
|
||||
if(notif_pref(pref_constants::ready_for_start)) {
|
||||
desktop::notifications::send(_("Wesnoth"), _("Ready to start!"), desktop::notifications::OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
void game_has_begun()
|
||||
{
|
||||
if(sound_pref(_game_has_begun)) {
|
||||
if(sound_pref(pref_constants::game_has_begun)) {
|
||||
sound::play_UI_sound(game_config::sounds::game_has_begun);
|
||||
}
|
||||
|
||||
if(notif_pref(_game_has_begun)) {
|
||||
if(notif_pref(pref_constants::game_has_begun)) {
|
||||
desktop::notifications::send(_("Wesnoth"), _("Game has begun!"), desktop::notifications::OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
void turn_changed(const std::string& player_name)
|
||||
{
|
||||
if(notif_pref(_turn_changed)) {
|
||||
if(notif_pref(pref_constants::turn_changed)) {
|
||||
utils::string_map player;
|
||||
player["name"] = player_name;
|
||||
desktop::notifications::send(_("Turn changed"), VGETTEXT("$name has taken control", player), desktop::notifications::TURN_CHANGED);
|
||||
|
@ -217,23 +206,23 @@ void turn_changed(const std::string& player_name)
|
|||
|
||||
bool get_def_pref_sound(const std::string& id)
|
||||
{
|
||||
return (id != _public_message && id != _friend_message);
|
||||
return (id != pref_constants::public_message && id != pref_constants::friend_message);
|
||||
}
|
||||
|
||||
bool get_def_pref_notif(const std::string& id)
|
||||
{
|
||||
return (desktop::notifications::available() && (
|
||||
id == _private_message ||
|
||||
id == _ready_for_start ||
|
||||
id == _game_has_begun ||
|
||||
id == _turn_changed ||
|
||||
id == _game_created
|
||||
id == pref_constants::private_message ||
|
||||
id == pref_constants::ready_for_start ||
|
||||
id == pref_constants::game_has_begun ||
|
||||
id == pref_constants::turn_changed ||
|
||||
id == pref_constants::game_created
|
||||
));
|
||||
}
|
||||
|
||||
bool get_def_pref_lobby(const std::string& id)
|
||||
{
|
||||
return (id == _private_message || id == _server_message || id == _game_created);
|
||||
return (id == pref_constants::private_message || id == pref_constants::server_message || id == pref_constants::game_created);
|
||||
}
|
||||
|
||||
} // end namespace mp_ui_alerts
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
#include "log.hpp"
|
||||
#include "map/label.hpp"
|
||||
#include "pathfind/teleport.hpp"
|
||||
#include "preferences/credentials.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "random.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -232,7 +231,7 @@ void play_controller::init(const config& level)
|
|||
|
||||
LOG_NG << "loading units..." << (SDL_GetTicks() - ticks());
|
||||
gui2::dialogs::loading_screen::progress(loading_stage::load_units);
|
||||
preferences::encounter_all_content(gamestate().board_);
|
||||
prefs::get().encounter_all_content(gamestate().board_);
|
||||
|
||||
LOG_NG << "initializing theme... " << (SDL_GetTicks() - ticks());
|
||||
gui2::dialogs::loading_screen::progress(loading_stage::init_theme);
|
||||
|
@ -728,7 +727,7 @@ void play_controller::tab()
|
|||
}
|
||||
|
||||
// Add nicks from friendlist
|
||||
const std::map<std::string, std::string> friends = preferences::get_acquaintances_nice("friend");
|
||||
const std::map<std::string, std::string> friends = prefs::get().get_acquaintances_nice("friend");
|
||||
|
||||
for(std::map<std::string, std::string>::const_iterator iter = friends.begin(); iter != friends.end(); ++iter) {
|
||||
dictionary.insert((*iter).first);
|
||||
|
@ -736,7 +735,7 @@ void play_controller::tab()
|
|||
|
||||
// Exclude own nick from tab-completion.
|
||||
// NOTE why ?
|
||||
dictionary.erase(preferences::login());
|
||||
dictionary.erase(prefs::get().login());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -865,26 +864,26 @@ void play_controller::save_game()
|
|||
assert(!gamestate().events_manager_->is_event_running());
|
||||
|
||||
scoped_savegame_snapshot snapshot(*this);
|
||||
savegame::ingame_savegame save(saved_game_, preferences::save_compression_format());
|
||||
savegame::ingame_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.save_game_interactive("", savegame::savegame::OK_CANCEL);
|
||||
}
|
||||
|
||||
void play_controller::save_game_auto(const std::string& filename)
|
||||
{
|
||||
scoped_savegame_snapshot snapshot(*this);
|
||||
savegame::ingame_savegame save(saved_game_, preferences::save_compression_format());
|
||||
savegame::ingame_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.save_game_automatic(false, filename);
|
||||
}
|
||||
|
||||
void play_controller::save_replay()
|
||||
{
|
||||
savegame::replay_savegame save(saved_game_, preferences::save_compression_format());
|
||||
savegame::replay_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.save_game_interactive("", savegame::savegame::OK_CANCEL);
|
||||
}
|
||||
|
||||
void play_controller::save_replay_auto(const std::string& filename)
|
||||
{
|
||||
savegame::replay_savegame save(saved_game_, preferences::save_compression_format());
|
||||
savegame::replay_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.save_game_automatic(false, filename);
|
||||
}
|
||||
|
||||
|
@ -1042,14 +1041,14 @@ void play_controller::update_gui_to_player(const int team_index, const bool obse
|
|||
void play_controller::do_autosave()
|
||||
{
|
||||
scoped_savegame_snapshot snapshot(*this);
|
||||
savegame::autosave_savegame save(saved_game_, preferences::save_compression_format());
|
||||
save.autosave(false, preferences::autosavemax(), preferences::INFINITE_AUTO_SAVES);
|
||||
savegame::autosave_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.autosave(false, prefs::get().autosavemax(), pref_constants::INFINITE_AUTO_SAVES);
|
||||
}
|
||||
|
||||
void play_controller::do_consolesave(const std::string& filename)
|
||||
{
|
||||
scoped_savegame_snapshot snapshot(*this);
|
||||
savegame::ingame_savegame save(saved_game_, preferences::save_compression_format());
|
||||
savegame::ingame_savegame save(saved_game_, prefs::get().save_compression_format());
|
||||
save.save_game_automatic(true, filename);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
#include "log.hpp"
|
||||
#include "map/label.hpp"
|
||||
#include "mp_ui_alerts.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "preferences/preferences.hpp"
|
||||
#include "replay_helper.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "savegame.hpp"
|
||||
|
@ -122,7 +121,7 @@ void playmp_controller::play_human_turn()
|
|||
undo_stack().clear();
|
||||
}
|
||||
|
||||
if(!preferences::disable_auto_moves()) {
|
||||
if(!prefs::get().disable_auto_moves()) {
|
||||
execute_gotos();
|
||||
}
|
||||
|
||||
|
@ -406,13 +405,13 @@ playmp_controller::PROCESS_DATA_RESULT playmp_controller::process_network_data_i
|
|||
{
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), message.value()["sender"], message.value()["side"],
|
||||
message.value()["message"], events::chat_handler::MESSAGE_PUBLIC,
|
||||
preferences::message_bell());
|
||||
prefs::get().message_bell());
|
||||
}
|
||||
else if (auto whisper = cfg.optional_child("whisper") /*&& is_observer()*/)
|
||||
{
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), "whisper: " + whisper["sender"].str(), 0,
|
||||
whisper["message"], events::chat_handler::MESSAGE_PRIVATE,
|
||||
preferences::message_bell());
|
||||
prefs::get().message_bell());
|
||||
}
|
||||
else if (auto observer = cfg.optional_child("observer") )
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue