The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
lobby_data.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2009 - 2025
3 by Tomasz Sniatowski <kailoran@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
16#pragma once
17
18#include <vector>
19#include <string>
20
21class config;
22
23namespace mp {
24
25/**
26 * This class represents the information a client has about another player
27 */
29{
30 explicit user_info(const config& c);
31
32 enum class user_relation {
33 ME,
34 FRIEND,
35 NEUTRAL,
37 };
38
39 enum class user_state {
40 LOBBY,
41 GAME,
43 };
44
45 bool operator<(const user_info& b) const;
46
47 user_state get_state(int selected_game_id) const;
49
50 std::string name;
56};
57
58/**
59 * This class represents the info a client has about a game on the server
60 */
62{
63 game_info(const config& c, const std::vector<std::string>& installed_addons);
64
65 bool can_join() const;
66 bool can_observe() const;
67
68 int id;
69 std::string map_data;
70 std::string name;
71 std::string scenario;
72 std::string scenario_id;
73 std::string type_marker;
75 std::string map_info;
76 std::string map_size_info;
77 std::string era;
78
79 /** List of modification names and whether they're installed or not. */
80 std::vector<std::pair<std::string, bool>> mod_info;
81
82 std::string gold;
83 std::string support;
84 std::string xp;
85 std::string vision;
86 std::string status; // vacant slots or turn info
87 std::string time_limit;
88 std::size_t vacant_slots;
89
90 unsigned int current_turn;
92 bool started;
93 bool fog;
94 bool shroud;
99 // TODO: what does it do? it doesn't seem to be used.
104
109
110 enum class disp_status {
111 CLEAN,
112 NEW,
113 UPDATED,
114 DELETED
115 };
116
118
120
122 std::string addon_id;
124 std::string message;
125 };
126
127 std::vector<required_addon> required_addons;
129
131
132 const char* display_status_string() const;
133
134 bool match_string_filter(const std::string& filter) const;
135};
136
137}
std::vector< std::string > installed_addons()
Retrieves the names of all installed add-ons.
Definition manager.cpp:186
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
Main entry points of multiplayer mode.
This class represents the info a client has about a game on the server.
std::string name
std::string scenario_id
std::string type_marker
bool can_join() const
std::vector< required_addon > required_addons
std::string scenario
std::string era
std::string map_size_info
addon_req check_addon_version_compatibility(const config &local_item, const config &game)
unsigned int current_turn
std::string xp
std::string map_info
std::string status
addon_req addons_outcome
std::size_t vacant_slots
std::string gold
disp_status display_status
bool can_observe() const
bool use_map_settings
std::string support
std::string vision
std::string time_limit
const char * display_status_string() const
std::vector< std::pair< std::string, bool > > mod_info
List of modification names and whether they're installed or not.
bool match_string_filter(const std::string &filter) const
std::string map_data
This class represents the information a client has about another player.
user_state get_state(int selected_game_id) const
user_relation get_relation() const
std::string name
bool operator<(const user_info &b) const
#define c
#define b