The Battle for Wesnoth  1.19.5+dev
playcampaign.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2024
3  by Philippe Plantier <ayin@anathas.org>
4  Copyright (C) 2003 - 2005 by David White <dave@whitevine.net>
5  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY.
13 
14  See the COPYING file for more details.
15 */
16 
17 #pragma once
18 
19 #include "game_end_exceptions.hpp"
20 
21 #include <set>
22 #include <string>
23 
24 class saved_game;
26 
28 {
31  , is_host()
32  , current_turn(0)
33  , skip_replay(false)
35  , connection(wdc)
36  {
37  }
38 
39  /** players and observers */
40  std::set<std::string> connected_players;
41  bool is_host;
42  unsigned current_turn;
46 };
47 
49 {
50 public:
51  campaign_controller(saved_game& state, bool is_unit_test = false)
52  : state_(state)
53  , is_unit_test_(is_unit_test)
54  , is_replay_(false)
55  , mp_info_(nullptr)
56  {
57  }
58 
60 
63  {
64  is_replay_ = true;
65  return play_game();
66  }
67 
69  {
70  mp_info_ = mp_info;
71  }
72 
73 private:
76 
78  const bool is_unit_test_;
79  bool is_replay_;
81 };
const bool is_unit_test_
level_result::type play_game()
level_result::type playsingle_scenario(end_level_data &end_level)
mp_game_metadata * mp_info_
level_result::type play_replay()
saved_game & state_
void set_mp_info(mp_game_metadata *mp_info)
level_result::type playmp_scenario(end_level_data &end_level)
campaign_controller(saved_game &state, bool is_unit_test=false)
A class that represents a TCP/IP connection to the wesnothd server.
Contains the exception interfaces used to signal completion of a scenario, campaign or turn.
Additional information on the game outcome which can be provided by WML.
wesnothd_connection & connection
mp_game_metadata(wesnothd_connection &wdc)
unsigned current_turn
bool skip_replay_blindfolded
std::set< std::string > connected_players
players and observers