The Battle for Wesnoth  1.19.7+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 <utility>
19 
20 #include "server/wesnothd/game.hpp"
21 
22 namespace wesnothd
23 {
24 const std::shared_ptr<game> player_record::get_game() const
25 {
26  return game_;
27 }
28 
29 std::shared_ptr<game>& player_record::get_game()
30 {
31  return game_;
32 }
33 
35 {
36  return game_ ? game_->id() : 0;
37 }
38 
39 void player_record::set_game(std::shared_ptr<game> new_game)
40 {
41  game_ = std::move(new_game);
42 }
43 
45 {
46  game_.reset();
47 }
48 
49 }
void set_game(std::shared_ptr< game > new_game)
std::shared_ptr< game > game_
const std::shared_ptr< game > get_game() const