Skip to content

Commit

Permalink
Help/Manager: don't need to keep a game config pointer anymore
Browse files Browse the repository at this point in the history
I had removed the code that used it. We can just keep a help config pointer.
  • Loading branch information
Vultraz authored and CelticMinstrel committed Oct 24, 2018
1 parent b81b5ba commit 0e21a64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions src/help/manager.cpp
Expand Up @@ -25,8 +25,7 @@
namespace help
{
help_manager::help_manager()
: game_cfg_(nullptr)
, help_cfg_(nullptr)
: help_cfg_(nullptr)
, toplevel_section_(nullptr)
, hidden_sections_(nullptr)
, num_last_encountered_units_(-1)
Expand Down Expand Up @@ -104,20 +103,17 @@ void help_manager::reset_contents()
num_last_encountered_terrains_ = -1;
}

void help_manager::update_config_pointers()
void help_manager::update_config_pointer()
{
game_cfg_ = &game_config_manager::get()->game_config();
assert(game_cfg_);

help_cfg_ = &game_cfg_->child_or_empty("help");
help_cfg_ = &game_config_manager::get()->game_config().child_or_empty("help");
assert(help_cfg_);
}

void help_manager::build_topic_tree()
{
// We probaby don't need to update the pointers every time, but it's the
// simplest way to ensure these are always valid.
update_config_pointers();
update_config_pointer();

try {
// Start by parsing [toplevel]. It cascades down and parses all referenced sections and topics.
Expand Down
3 changes: 1 addition & 2 deletions src/help/manager.hpp
Expand Up @@ -60,12 +60,11 @@ class help_manager
/** Returns true if we need to regenerate the toplevel and hidden sections. */
bool content_update_needed() const;

void update_config_pointers();
void update_config_pointer();

/** Fills in both toplevel_section_ and hidden_sections_. */
void build_topic_tree();

const config* game_cfg_;
const config* help_cfg_;

/** The default toplevel section node. */
Expand Down

0 comments on commit 0e21a64

Please sign in to comment.