The Battle for Wesnoth  1.17.0-dev
playcampaign.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2021
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 <memory>
22 #include <sstream>
23 #include <set>
24 #include <string>
25 
26 class saved_game;
27 class terrain_type_data;
28 class team;
30 class config;
32 
34 {
37  , is_host()
38  , current_turn(0)
39  , skip_replay(false)
41  , connection(wdc)
42  {
43  }
44 
45  /** players and observers */
46  std::set<std::string> connected_players;
47  bool is_host;
48  unsigned current_turn;
52 };
53 
55 {
56 public:
57  campaign_controller(saved_game& state, bool is_unit_test = false)
58  : state_(state)
59  , is_unit_test_(is_unit_test)
60  , is_replay_(false)
61  , mp_info_(nullptr)
62  {
63  }
64 
65  LEVEL_RESULT play_game();
66  LEVEL_RESULT play_replay()
67  {
68  is_replay_ = true;
69  return play_game();
70  }
71 
73  {
74  mp_info_ = mp_info;
75  }
76 
77 private:
78  LEVEL_RESULT playsingle_scenario(end_level_data& end_level);
79  LEVEL_RESULT playmp_scenario(end_level_data& end_level);
80 
81  void show_carryover_message(
82  playsingle_controller& playcontroller, const end_level_data& end_level, LEVEL_RESULT res);
83 
85  const bool is_unit_test_;
86  bool is_replay_;
88 };
LEVEL_RESULT play_replay()
mp_game_metadata(wesnothd_connection &wdc)
unsigned current_turn
campaign_controller(saved_game &state, bool is_unit_test=false)
mp_game_metadata * mp_info_
saved_game & state_
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
Contains the database of all known terrain types, both those defined explicitly by WML [terrain_type]...
Definition: type_data.hpp:40
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:72
A class that represents a TCP/IP connection to the wesnothd server.
std::set< std::string > connected_players
players and observers
const bool is_unit_test_
Additional information on the game outcome which can be provided by WML.
void set_mp_info(mp_game_metadata *mp_info)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:61
bool skip_replay_blindfolded
wesnothd_connection & connection