The Battle for Wesnoth  1.17.0-dev
playcampaign.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2021
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include "game_end_exceptions.hpp"
18 
19 #include <memory>
20 #include <sstream>
21 #include <set>
22 #include <string>
23 
24 class saved_game;
25 class terrain_type_data;
26 class team;
28 class config;
30 
32 {
35  , is_host()
36  , current_turn(0)
37  , skip_replay(false)
39  , connection(wdc)
40  {
41  }
42 
43  /** players and observers */
44  std::set<std::string> connected_players;
45  bool is_host;
46  unsigned current_turn;
50 };
51 
53 {
54 public:
55  campaign_controller(saved_game& state, bool is_unit_test = false)
56  : state_(state)
57  , is_unit_test_(is_unit_test)
58  , is_replay_(false)
59  , mp_info_(nullptr)
60  {
61  }
62 
63  LEVEL_RESULT play_game();
64  LEVEL_RESULT play_replay()
65  {
66  is_replay_ = true;
67  return play_game();
68  }
69 
71  {
72  mp_info_ = mp_info;
73  }
74 
75 private:
76  LEVEL_RESULT playsingle_scenario(end_level_data& end_level);
77  LEVEL_RESULT playmp_scenario(end_level_data& end_level);
78 
79  void show_carryover_message(
80  playsingle_controller& playcontroller, const end_level_data& end_level, LEVEL_RESULT res);
81 
83  const bool is_unit_test_;
84  bool is_replay_;
86 };
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:39
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:71
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:59
bool skip_replay_blindfolded
wesnothd_connection & connection