The Battle for Wesnoth  1.19.5+dev
player_connection.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2024
3  by Sergey Popov <loonycyborg@gmail.com>
4  Part of the Battle for Wesnoth Project https://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 
17 
18 #include "server/wesnothd/game.hpp"
19 
20 namespace wesnothd
21 {
22 const std::shared_ptr<game> player_record::get_game() const
23 {
24  return game_;
25 }
26 
27 std::shared_ptr<game>& player_record::get_game()
28 {
29  return game_;
30 }
31 
33 {
34  return game_ ? game_->id() : 0;
35 }
36 
37 void player_record::set_game(std::shared_ptr<game> new_game)
38 {
39  game_ = new_game;
40 }
41 
43 {
44  game_.reset();
45 }
46 
47 }
void set_game(std::shared_ptr< game > new_game)
std::shared_ptr< game > game_
const std::shared_ptr< game > get_game() const