The Battle for Wesnoth  1.19.17+dev
help.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2025
3  by David White <dave@whitevine.net>
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 class terrain_type;
19 class unit;
20 class unit_type;
21 
22 #include <string>
23 
24 namespace help {
25 
26 /**
27  * The help implementation caches data parsed from the game_config. This class
28  * is used to control the lifecycle of that cache, so that the cache will be
29  * cleared before the game_config itself changes.
30  *
31  * Note: it's okay to call any of the help::show_* functions without creating
32  * an instance of help_manager - that will simply mean that the cache is
33  * cleared before the show function returns.
34  *
35  * Creating two instances of this will cause an assert.
36  */
37 struct help_manager {
38  help_manager() = default;
39  help_manager(const help_manager&) = delete;
40  help_manager& operator=(const help_manager&) = delete;
41  ~help_manager();
42 };
43 
44 void init_help();
45 
46 /**
47  * Open the help browser. The help browser will have the topic with id
48  * show_topic open if it is not the empty string. The default topic
49  * will be shown if show_topic is the empty string.
50  */
51 void show_help(const std::string& show_topic = "");
52 
53 /**
54  * Given a unit type, find the corresponding help topic's id.
55  */
56 std::string get_unit_type_help_id(const unit_type& t);
57 
58 void show_unit_description(const unit_type &t);
59 void show_unit_description(const unit &u);
61 
62 } // End namespace help.
double t
Definition: astarsearch.cpp:63
A single unit type that the player may recruit.
Definition: types.hpp:43
This class represents a single unit of a specific type.
Definition: unit.hpp:132
void show_help(const std::string &show_topic)
Open the help browser, show topic with id show_topic.
Definition: help.cpp:114
std::string get_unit_type_help_id(const unit_type &t)
Given a unit type, find the corresponding help topic's id.
Definition: help.cpp:63
void show_terrain_description(const terrain_type &t)
Definition: help.cpp:58
void init_help()
Definition: help.cpp:120
void show_unit_description(const unit &u)
Definition: help.cpp:89
The help implementation caches data parsed from the game_config.
Definition: help.hpp:37
help_manager & operator=(const help_manager &)=delete
help_manager(const help_manager &)=delete
help_manager()=default