The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
playcampaign.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2005 by David White <[email protected]>
3  Copyright (C) 2005 - 2016 by Philippe Plantier <[email protected]>
4  Part of the Battle for Wesnoth Project http://www.wesnoth.org
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /** @file */
17 
18 #ifndef PLAYCAMPAIGN_H_INCLUDED
19 #define PLAYCAMPAIGN_H_INCLUDED
20 
21 #include "game_end_exceptions.hpp"
22 
23 #include <boost/shared_ptr.hpp>
24 #include <sstream>
25 #include <set>
26 #include <string>
27 
28 class CVideo;
29 class saved_game;
30 class terrain_type_data;
31 class team;
34 
35 class config;
36 
39 {
42  , is_host()
45  , wesnothd_connection(wdc)
46  {
47 
48  }
49  /// players and observers
50  std::set<std::string> connected_players;
51  bool is_host;
55 };
56 
58 {
63  const bool is_unit_test_;
64  bool is_replay_;
66 public:
67  campaign_controller(CVideo& video, saved_game& state, const config& game_config, const tdata_cache & tdata, bool is_unit_test = false)
68  : video_(video)
69  , state_(state)
70  , game_config_(game_config)
71  , tdata_(tdata)
72  , is_unit_test_(is_unit_test)
73  , is_replay_(false)
74  , mp_info_(nullptr)
75  {
76  }
77  LEVEL_RESULT play_game();
78  LEVEL_RESULT play_replay()
79  {
80  is_replay_ = true;
81  return play_game();
82  }
83  void set_mp_info(mp_campaign_info* mp_info) { mp_info_ = mp_info; }
84 private:
85  LEVEL_RESULT playsingle_scenario(end_level_data &end_level);
86  LEVEL_RESULT playmp_scenario(end_level_data &end_level);
87  void show_carryover_message(playsingle_controller& playcontroller, const end_level_data& end_level, LEVEL_RESULT res);
88  static void report_victory(std::ostringstream &report, team& t, int finishing_bonus_per_turn, int turns_left, int finishing_bonus);
89 };
90 
91 #endif // PLAYCAMPAIGN_H_INCLUDED
92 
LEVEL_RESULT play_replay()
LEVEL_RESULT play_game()
bool skip_replay_blindfolded
boost::shared_ptr< terrain_type_data > tdata_cache
mp_campaign_info * mp_info_
void set_mp_info(mp_campaign_info *mp_info)
const config & game_config_
static void report_victory(std::ostringstream &report, team &t, int finishing_bonus_per_turn, int turns_left, int finishing_bonus)
std::set< std::string > connected_players
players and observers
Definition: video.hpp:58
static int report(lua_State *L, int status)
Definition: lua.cpp:134
saved_game & state_
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
LEVEL_RESULT playmp_scenario(end_level_data &end_level)
GLdouble GLdouble t
Definition: glew.h:1366
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
A class that represents a TCP/IP connection to the wesnothd server.
mp_campaign_info(twesnothd_connection &wdc)
LEVEL_RESULT playsingle_scenario(end_level_data &end_level)
twesnothd_connection & wesnothd_connection
GLuint res
Definition: glew.h:9258
campaign_controller(CVideo &video, saved_game &state, const config &game_config, const tdata_cache &tdata, bool is_unit_test=false)
void show_carryover_message(playsingle_controller &playcontroller, const end_level_data &end_level, LEVEL_RESULT res)
const bool is_unit_test_
const tdata_cache & tdata_
Game configuration data as global variables.
Definition: build_info.cpp:38
Additional information on the game outcome which can be provided by WML.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
int turns_left
Definition: pathfind.cpp:163