133 Commits

Author SHA1 Message Date
Charles Dang
fef1132a71 Remove game_config_view ctor argument from savegame::loadgame
This took the same global game_config_view object in all invocations.
2021-01-05 23:02:21 +11:00
Charles Dang
22ef5e8958 Initialize all load_game_metadata members 2021-01-05 21:34:08 +11:00
Charles Dang
a065208334 Removed load_game_metadata ctor (used aggregate init) 2021-01-05 19:28:48 +11:00
gfgtdf
93aa2ca409 deploy new game_config_view object
the game_config_view object offers const
access to the game_config object, furthermore
it allows the game_config config object to be
replaced by a vector of config objects which
is what we will do later.
2020-06-29 15:16:05 +02:00
Steve Cotton
b66bdb8a16 Add other versions of Wesnoth to the Load Game dialog
If a save directory from another version is found, a drop-down list of
directories is added below the filter box in the Load Game dialog.

Refactor save_index_class to allow instances for other directories.

Design idea: all new saves go in to the main save directory. Games can be
loaded from other directories, but those directories are treated as read-only.
When building an index for other directories, the index is kept in memory and
not written to disk - this results in some noticeable lag in the UI when
opening the other versions' directories, but not the usual save dir.
2019-11-03 12:11:51 +01:00
Charles Dang
533facbe83 Ensure invalid savename characters are stripped from scenario names earlier (fixes #4116)
This ensures the invalid characters are never saved internally in the first place, so this should
cover any case besides the aforementioned bug that might crop up.
2019-07-01 18:31:05 +11:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0678f40a209797d72dfaba3e5e88545
(cherry-picked from commit bc4d22dc72e79c3d6a3364ac896e473afd298246)
2018-10-07 03:23:36 +00:00
Charles Dang
8a4d1ad145 Saved Game: reame "starting pos" to "starting point" to avoid confusion
The old name was too easy to confuse with a side's map staring position, something
I've done several times.

(cherry-picked from commit 8f93d0a7c67f77e3917c5a24c55a9d450579a423)
2018-10-07 03:21:07 +00:00
Iris Morelle
c97251921a Set a custom dialog caption for the synced debug command prompt
This replaces the caption with something more apropos than the generic
"Save Game" caption. It necessitates a minor API change though.

(cherry-picked from commit b7e08977edd703ad9f146fd81768b2f09c39facd)
2018-10-07 03:18:20 +00:00
Jyrki Vesterinen
d2748dc425 Quit pretending that underscores in savefile names are actually spaces
The code was frantically converting spaces to underscores and back to keep
the facade up, and sometimes it failed (#1567).

The solution is obvious: simply use spaces for real in savefile names.
This way the conversion is only needed in one place (when generating the
suggested filename).

Fixes #1567. As a minor bonus, this also makes the "save game" dialog show
the filename with spaces.
2018-02-07 21:36:12 +02:00
Jyrki Vesterinen
5ec8d630ed Create savegame filenames with the same code as in actual saving
Follow-up to commit 057a53055f74348c56d97c2c7ae0ab11a71b88cd.

Otherwise, Menu -> Back to... would be broken whenever the logic differs
between that feature and actual saving.
2018-02-07 21:03:46 +02:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
583670ac2b Savegame: removed unused game_display references from various classes
No idea when these became unused, though. Doesn't seem to be by CVideo argument cleanup.
2017-12-03 07:18:23 +11:00
Charles Dang
c67f5c352a Cleaned up more unnecessary CVideo function arguments and class members
* Dropped unused CVideo class member references.
* Replaced the lone usecase of the CVideo member in loadgame with the singleton and removed said member.
* Removed CVideo references from a bunch of addon management functions.
* Cleaned up a *lot* of now-unnecessary forward CVideo declarations.
2017-11-21 03:07:23 +11:00
Charles Dang
464cf07a8b Fix Travis GCC warnings for f2b31ba082e1
This also removes a bunch of unnecessary CVideo arguments from various savegame functions that
emerged as I cleaned up the unused parameters. savegame::save_game did take a CVideo pointer
that did look like it was intended to be a sort of do-show-dialog flag, but since that parameter
was never passed as null, I removed it.
2017-11-20 22:29:49 +11:00
Charles Dang
96ea0eb6b9 Removed trailing tabs and whitespaces from C++ source
[ci skip]

I ran the command used in 9b7b1751fdda, excluding results in lua/ and spirit_po/.

Also, once again, for some reason actions/vision.hpp gets registered as massively changed
(similar to f11fa0652af0) despite nothing really having changed at all.
2017-05-16 06:46:43 +11:00
Charles Dang
2101353d36 Convert include guards to the shorter #pragma once
Turns out I mistook @celticminstrel's opinion that we should use include guards over pragma (737916e).
Since all major compilers support `#pragma once`, there's no reason not to use it.

For future mergability reasons, this excludes src/spirit_po and src/xBRZ. It also excludes src/boost-patched.
2017-05-09 19:41:37 +11:00
Rikard Falkeborn
94e73a7ccc Add const to some more functions 2017-04-17 16:51:30 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
e0614251c4 Rename exception classes to avoid t- prefix 2016-11-09 01:13:17 -05:00
Celtic Minstrel
9232b5bf87 Fix compiler warnings 2016-09-10 21:47:48 -04:00
gfgtdf
dcd037e530 small load_game_exception refactor
* Moves load_game_exception to savegame.hpp and cleans some #includes
* Removes the load_game_exception statis members and replaces them with
a non-static load_game_metadata member.
* Adds loadgame::DIALOG_TYPE to remove the gui1 dependency.
* Fixes loading of replay saves.
* Adds soem mising override specifers in savegame.hpp
2016-09-10 20:33:18 +02:00
Charles Dang
6aee108298 loadgame: replaced individual flag getters with data struct getter 2016-09-08 12:37:43 +11:00
Charles Dang
a0ad80299b Fixed a bunch of issues with game loading
* If no game was show in the dialog (due to an invalid filter) one could still use Enter to load a game
* In the same situation above, ESC would cause a crash
* Canceling the Select Difficulty dialog would still try to load a game
  This might have been the intended behavior, but it's not optimal.
2016-09-08 07:50:51 +11:00
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04:00
Charles Dang
fb904c6b31 Pass savegame summary config to loadgame class 2016-02-29 22:30:30 +11:00
gfgtdf
efcfe3b38a reset 'ignore oos messages' when starting a new game 2016-02-28 20:23:56 +01:00
gfgtdf
93c53df6d8 remove display dependency from mp connect code.
and from codes that are used by it, specially the loadgame and the
networkrecieve dialog.
2016-01-12 23:18:01 +01:00
Chris Beck
ba51524f6e update copyright to year 2016
using this shell script:

find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
2016-01-02 23:59:31 -05:00
Elvish_Hunter
9b7b1751fd Removed trailing tabs and whitespaces from C++ source
I used this command line: find <source directory> -name \*.\[ch\]pp -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
2015-12-21 20:39:46 +01:00
Charles Dang
0d3c749abc Removed unused parameters from savegame::load_game() 2015-10-17 06:28:28 +11:00
Chris Beck
c47c92da22 savegame logic: make the version check GUI sequence a static fcn
This allows it to be used just with the data from a save index
record and not an entire loaded save.
2015-03-06 17:55:12 -05:00
gfgtdf
0da5b24a76 copy snapshot less often when saving
First we remove the snapshot_ memaber form savegame class which was
previously copied with saved_game.set_snapshot

Second we use copy and swap in saved_game::set_snapshot
saved_game::set_scenario, this makes it possible to apply copy elison
and saves another copy of the snapshot if the compiler is smart enough.
2015-02-13 21:01:29 +01:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Chris Beck
615d4024ce don't ask the user twice about old version when loading a save
The issue only affected saves loaded from the in-game menu.
2014-12-14 22:45:07 -05:00
Charles Dang
c9f5d7e829 Remove usecases of illegal_filename_exception 2014-12-14 23:26:38 +11:00
Chris Beck
7441a53a17 in in-game load dialog, check health and version before exit game
This is fixes a minor bug:
When loading a save from the in-game load dialog, as soon as the
user clicks "ok" to load a savefile, an exception would be thrown
which effectively quits the game, before determining the integrity
and version info of that file.

It's better not to exit a running game if the new game can't be
loaded, so in this commit check these things and abort before
exiting if appropriate.
2014-12-14 23:26:35 +11:00
Charles Dang
c3268b816b Refactor part of the load game code to remove load_game_canceled_exception
Instead of throwing an exception, the relevant functions will return a false bool
2014-12-14 23:26:33 +11:00
Alexander van Gessel (AI0867)
e5cb79b8e9 Move everything in src/filesystem.hpp into its own namespace
This is a chearry pick by me (gfgtdf) of 66176b1738. It differes a lot from the original becasue since there were so much merging conflics i decided to do it mostly from scratch.

Conflicts:
	src/addon/manager.cpp
	src/addon/manager_ui.cpp
	src/campaign_server/campaign_server.cpp
	src/config_cache.cpp
	src/create_engine.cpp
	src/editor/map/context_manager.cpp
	src/editor/map/map_context.cpp
	src/font.cpp
	src/game_config_manager.cpp
	src/gamestatus.cpp
	src/gui/dialogs/editor/custom_tod.cpp
	src/gui/dialogs/lobby/lobby_data.cpp
	src/gui/dialogs/mp_create_game.cpp
	src/gui/widgets/settings.cpp
	src/hotkeys.cpp
	src/image.cpp
	src/multiplayer_lobby.cpp
	src/network.cpp
	src/playcampaign.cpp
	src/preferences.cpp
	src/savegame.cpp
	src/serialization/preprocessor.cpp
	src/tests/main.cpp
	src/wesnoth.cpp
	src/widgets/button.cpp
2014-10-13 18:31:18 +02:00
Chris Beck
d4235f0589 remove some dead code "fill_mplevel_config" 2014-07-12 01:28:21 -04:00
gfgtdf
63c07fea3e move game_classification to its own file 2014-06-17 00:12:42 +02:00
gfgtdf
64580a7a81 more convert_old_saves function to savegame.cpp 2014-06-16 23:59:50 +02:00
gfgtdf
dd7dca975d fixup scenario advancing
the "gamestate().remove_snapshot();" is unneded and would undo the
"gamestate().set_snapshot();" in playcampaign
2014-06-15 17:00:54 +02:00
gfgtdf
929b7dfede rename game_state -> saved_game
and move it into a new file.
2014-06-11 01:21:22 +02:00
gfgtdf
bbcae1c14e remove unused function 2014-06-09 00:51:38 +02:00
Mark de Wever
09122880e0 Remove redundant declarations. 2014-06-07 16:35:01 +02:00
gfgtdf
294379a157 split savegame.cpp into 2 2014-06-06 02:52:10 +02:00
gfgtdf
b401f76f50 remove game_state::write_snapshot 2014-06-06 02:51:56 +02:00
gfgtdf
afbf5c6e58 remove resources::state_of_game
we don't want to expose the fileds "snapshot", "carryover_sides".
instead we only add classification, and mp_game_setting to resources
which are members of game_state.

in order to do that, we have to add a do_autosave method to
play_controller.

this commit also moves some code from game_state::write_snapshot to
play_controller::to_config which was intended to be in a different
commit.
2014-06-01 23:59:15 +02:00
gfgtdf
f086963b39 remove "difficulty_" from game_data and carryover
we already have this data in the classification.
same will happen to random_mode
2014-05-31 23:11:25 +02:00