Merge branch 'master' of https://github.com/wesnoth/wesnoth
This commit is contained in:
commit
1a693ef8f1
8 changed files with 43 additions and 51 deletions
|
@ -22,7 +22,6 @@
|
|||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "mp_options.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "savegame.hpp"
|
||||
#include "tod_manager.hpp"
|
||||
|
@ -143,20 +142,6 @@ void level_to_gamestate(const config& level, saved_game& state)
|
|||
state = saved_game(level);
|
||||
state.classification().campaign_type = type;
|
||||
state.mp_settings().show_connect = show_connect;
|
||||
// Any replay data is only temporary and should be removed from
|
||||
// the level data in case we want to save the game later.
|
||||
if (const config& replay_data = level.child("replay"))
|
||||
{
|
||||
LOG_NW << "setting replay\n";
|
||||
recorder = replay(replay_data);
|
||||
if (!recorder.empty()) {
|
||||
recorder.set_skip(false);
|
||||
recorder.set_to_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//save id setting was moved to play_controller.
|
||||
}
|
||||
|
||||
void check_response(network::connection res, const config& data)
|
||||
|
|
|
@ -1070,7 +1070,6 @@ void lobby::process_event()
|
|||
}
|
||||
|
||||
if(quit_game_.pressed()) {
|
||||
recorder.set_skip(false);
|
||||
set_result(QUIT);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ static void show_carryover_message(saved_game& gamestate, playsingle_controller&
|
|||
LEVEL_RESULT play_replay(display& disp, saved_game& gamestate, const config& game_config,
|
||||
CVideo& video, bool is_unit_test)
|
||||
{
|
||||
recorder = replay(gamestate.replay_data);
|
||||
// 'starting_pos' will contain the position we start the game from.
|
||||
// this call also might expand [scenario] in case thatt there is no replay_start
|
||||
const config& starting_pos = gamestate.get_replay_starting_pos();
|
||||
|
@ -262,6 +263,9 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
|
|||
const config& game_config, io_type_t io_type, bool skip_replay,
|
||||
bool network_game, bool blindfold_replay, bool is_unit_test)
|
||||
{
|
||||
recorder = replay(gamestate.replay_data);
|
||||
recorder.set_to_end();
|
||||
|
||||
gamestate.expand_scenario();
|
||||
|
||||
game_classification::CAMPAIGN_TYPE game_type = gamestate.classification().campaign_type;
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "game_initialization/playcampaign.hpp" // for play_game, etc
|
||||
#include "preferences.hpp" // for disable_preferences_save, etc
|
||||
#include "preferences_display.hpp" // for detect_video_settings, etc
|
||||
#include "replay.hpp" // for replay, recorder
|
||||
#include "resources.hpp" // for config_manager
|
||||
#include "savegame.hpp" // for clean_saves, etc
|
||||
#include "sdl/utils.hpp" // for surface
|
||||
|
@ -113,6 +112,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
|
|||
screenshot_map_(),
|
||||
screenshot_filename_(),
|
||||
state_(),
|
||||
play_replay_(false),
|
||||
multiplayer_server_(),
|
||||
jump_to_multiplayer_(false),
|
||||
jump_to_campaign_(false, -1, "", ""),
|
||||
|
@ -653,34 +653,17 @@ bool game_launcher::load_game()
|
|||
}
|
||||
return false;
|
||||
}
|
||||
recorder = replay(state_.replay_data);
|
||||
recorder.start_replay();
|
||||
recorder.set_skip(false);
|
||||
|
||||
LOG_CONFIG << "has is middle game savefile: " << (state_.is_mid_game_save() ? "yes" : "no") << "\n";
|
||||
play_replay_ = load.show_replay();
|
||||
LOG_CONFIG << "is middle game savefile: " << (state_.is_mid_game_save() ? "yes" : "no") << "\n";
|
||||
LOG_CONFIG << "show replay: " << (play_replay_ ? "yes" : "no") << "\n";
|
||||
// in case load.show_replay() && !state_.is_mid_game_save()
|
||||
// there won't be any turns to replay, but the
|
||||
// user gets to watch the intro sequence again ...
|
||||
|
||||
if (!state_.is_mid_game_save()) {
|
||||
//this is a start-of-scenario
|
||||
if (load.show_replay()) {
|
||||
// There won't be any turns to replay, but the
|
||||
// user gets to watch the intro sequence again ...
|
||||
LOG_CONFIG << "replaying (start of scenario)\n";
|
||||
} else {
|
||||
LOG_CONFIG << "skipping...\n";
|
||||
recorder.set_skip(false);
|
||||
}
|
||||
} else {
|
||||
// We have a snapshot. But does the user want to see a replay?
|
||||
if(load.show_replay()) {
|
||||
statistics::clear_current_scenario();
|
||||
LOG_CONFIG << "replaying (snapshot)\n";
|
||||
} else {
|
||||
LOG_CONFIG << "setting replay to end...\n";
|
||||
recorder.set_to_end();
|
||||
if(!recorder.at_end()) {
|
||||
WRN_CONFIG << "recorder is not at the end!!!" << std::endl;
|
||||
}
|
||||
}
|
||||
if(state_.is_mid_game_save() && load.show_replay())
|
||||
{
|
||||
statistics::clear_current_scenario();
|
||||
}
|
||||
|
||||
if(state_.classification().campaign_type == game_classification::MULTIPLAYER) {
|
||||
|
@ -720,6 +703,7 @@ bool game_launcher::new_campaign()
|
|||
|
||||
state_.mp_settings().show_configure = false;
|
||||
state_.mp_settings().show_connect = false;
|
||||
play_replay_ = false;
|
||||
|
||||
return sp::enter_create_mode(disp(), resources::config_manager->game_config(),
|
||||
state_, jump_to_campaign_, true);
|
||||
|
@ -972,6 +956,12 @@ void game_launcher::show_preferences()
|
|||
|
||||
void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
||||
{
|
||||
if(play_replay_)
|
||||
{
|
||||
play_replay();
|
||||
return;
|
||||
}
|
||||
|
||||
loadscreen::global_loadscreen_manager loadscreen_manager(disp().video());
|
||||
loadscreen::start_stage("load data");
|
||||
if(reload == RELOAD_DATA) {
|
||||
|
|
|
@ -123,6 +123,7 @@ private:
|
|||
std::string screenshot_map_, screenshot_filename_;
|
||||
|
||||
saved_game state_;
|
||||
bool play_replay_;
|
||||
|
||||
std::string multiplayer_server_;
|
||||
bool jump_to_multiplayer_;
|
||||
|
|
|
@ -418,6 +418,10 @@ possible_end_play_signal playsingle_controller::play_scenario_main_loop(end_leve
|
|||
// allow the first turn to have an autosave.
|
||||
do_autosaves_ = !loading_game_;
|
||||
ai_testing::log_game_start();
|
||||
if(gamestate_.board_.teams().empty())
|
||||
{
|
||||
ERR_NG << "Playing game with 0 teams." << std::endl;
|
||||
}
|
||||
for(; ; first_player_ = 1) {
|
||||
PROPOGATE_END_PLAY_SIGNAL( play_turn() );
|
||||
do_autosaves_ = true;
|
||||
|
|
|
@ -355,7 +355,22 @@ private:
|
|||
int nsides_;
|
||||
bool started_;
|
||||
|
||||
/** The current scenario data. */
|
||||
/**
|
||||
The current scenario data.´
|
||||
WRONG! This contains the initial state or the state from which
|
||||
the game was loaded from.
|
||||
Using this to make assumptions about the current gamestate is
|
||||
extremely dangerous and should especially not be done for anything
|
||||
that can be nodified by wml (especially by [modify_side]),
|
||||
like team_name, controller ... in [side].
|
||||
FIXME: move every code here that uses this object to query those
|
||||
information to the clients. But note that there are some checks
|
||||
(like controller == null) that are definitely needed by the server and
|
||||
in this case we should try to modify the client to inform the server if
|
||||
a change of those properties occur. Ofc we shouldn't update level_
|
||||
then, but rather store that information in a seperate object
|
||||
(like in side_controllers_).
|
||||
*/
|
||||
simple_wml::document level_;
|
||||
|
||||
/** Replay data. */
|
||||
|
|
|
@ -779,13 +779,7 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recorder.at_end()){
|
||||
game->launch_game(should_reload);
|
||||
}
|
||||
else{
|
||||
game->play_replay();
|
||||
}
|
||||
game->launch_game(should_reload);
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
|
Loading…
Add table
Reference in a new issue