Skip to content

Commit

Permalink
Extract FILENAMES["gfxdir"] into a static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
BevapDin committed Nov 17, 2019
1 parent fd71a90 commit 9867ab1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/path_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static void update_config_dir();
static void update_pathname( const std::string &name, const std::string &path );

static std::string motd_value;
static std::string gfxdir_value;

/** Map where we store filenames */
std::map<std::string, std::string> FILENAMES;
Expand Down Expand Up @@ -87,7 +88,7 @@ void update_pathname( const std::string &name, const std::string &path )
void update_datadir()
{
// Shared dirs
update_pathname( "gfxdir", FILENAMES["datadir"] + "gfx/" );
gfxdir_value = FILENAMES["datadir"] + "gfx/";
update_pathname( "fontdir", FILENAMES["datadir"] + "font/" );
update_pathname( "rawdir", FILENAMES["datadir"] + "raw/" );
update_pathname( "jsondir", FILENAMES["datadir"] + "core/" );
Expand Down Expand Up @@ -120,14 +121,14 @@ void PATH_INFO::set_standard_filenames()
if( !FILENAMES["base_path"].empty() ) {
#if defined(DATA_DIR_PREFIX)
update_pathname( "datadir", FILENAMES["base_path"] + "share/cataclysm-dda/" );
update_pathname( "gfxdir", FILENAMES["datadir"] + "gfx/" );
gfxdir_value = FILENAMES["datadir"] + "gfx/";
#else
update_pathname( "datadir", FILENAMES["base_path"] + "data/" );
update_pathname( "gfxdir", FILENAMES["base_path"] + "gfx/" );
gfxdir_value = FILENAMES["base_path"] + "gfx/";
#endif
} else {
update_pathname( "datadir", "data/" );
update_pathname( "gfxdir", "gfx/" );
gfxdir_value = "gfx/";
}

// Shared dirs
Expand Down Expand Up @@ -419,7 +420,7 @@ std::string PATH_INFO::soundpack_conf()
}
std::string PATH_INFO::gfxdir()
{
return FILENAMES["gfxdir"];
return gfxdir_value;
}
std::string PATH_INFO::data_sound()
{
Expand Down

0 comments on commit 9867ab1

Please sign in to comment.