Refactored out savegame::savegame_config class

This was basically an unnecessary stub class. It also allows us to
remove the unused soundsource::manager::to_config() function (write_sourcespecs()
did the actual job).
This commit is contained in:
Charles Dang 2016-04-05 18:10:44 +11:00
parent ce7cd0191a
commit 71b154b6e3
15 changed files with 13 additions and 66 deletions

View file

@ -894,7 +894,6 @@
<Unit filename="../../src/saved_game.hpp" />
<Unit filename="../../src/savegame.cpp" />
<Unit filename="../../src/savegame.hpp" />
<Unit filename="../../src/savegame_config.hpp" />
<Unit filename="../../src/scoped_resource.hpp" />
<Unit filename="../../src/scripting/application_lua_kernel.cpp" />
<Unit filename="../../src/scripting/application_lua_kernel.hpp" />

View file

@ -30,7 +30,6 @@ static lg::log_domain log_engine("engine");
const std::string DEFAULT_DIFFICULTY("NORMAL");
game_classification::game_classification():
savegame_config(),
label(),
version(),
campaign_type(),
@ -50,7 +49,6 @@ game_classification::game_classification():
{}
game_classification::game_classification(const config& cfg):
savegame_config(),
label(cfg["label"]),
version(cfg["version"]),
campaign_type(cfg["campaign_type"].to_enum<game_classification::CAMPAIGN_TYPE>(game_classification::CAMPAIGN_TYPE::SCENARIO)),
@ -70,7 +68,6 @@ game_classification::game_classification(const config& cfg):
{}
game_classification::game_classification(const game_classification& gc):
savegame_config(),
label(gc.label),
version(gc.version),
campaign_type(gc.campaign_type),

View file

@ -16,7 +16,7 @@
#define GAME_CLASSIFICATION_HPP_INCLUDED
#include "utils/make_enum.hpp"
#include "savegame_config.hpp"
#include <vector>
class config;
@ -25,7 +25,7 @@ class config;
extern const std::string DEFAULT_DIFFICULTY;
//meta information of the game
class game_classification : public savegame::savegame_config
class game_classification
{
public:
game_classification();

View file

@ -29,7 +29,6 @@ static lg::log_domain log_engine("engine");
#define DBG_NG LOG_STREAM(debug, log_engine)
mp_game_settings::mp_game_settings() :
savegame_config(),
name(),
password(),
hash(),
@ -62,8 +61,7 @@ mp_game_settings::mp_game_settings() :
{}
mp_game_settings::mp_game_settings(const config& cfg)
: savegame_config()
, name(cfg["scenario"].str())
: name(cfg["scenario"].str())
, password()
, hash(cfg["hash"].str())
, mp_era(cfg["mp_era"].str())

View file

@ -20,12 +20,11 @@
#include "config.hpp"
#include "gettext.hpp"
#include "utils/make_enum.hpp"
#include "savegame_config.hpp"
#include "version.hpp"
#include <boost/optional.hpp>
struct mp_game_settings : public savegame::savegame_config
struct mp_game_settings
{
mp_game_settings();
mp_game_settings(const config& cfg);

View file

@ -16,8 +16,6 @@
#include "config.hpp"
#include "map/location.hpp"
#include "savegame_config.hpp"
class team;
class unit;
@ -32,7 +30,8 @@ typedef std::pair<std::set<map_location>, std::set<map_location> >
/*
* Represents the tunnel wml tag.
*/
class teleport_group: public savegame::savegame_config {
class teleport_group
{
public:
/*
* Constructs the object from a saved file.
@ -141,7 +140,8 @@ private:
const teleport_map get_teleport_locations(const unit &u, const team &viewing_team,
bool see_all = false, bool ignore_units = false);
class manager: public savegame::savegame_config {
class manager
{
public:
manager(const config &cfg);

View file

@ -149,7 +149,6 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
CVideo& video, bool skip_replay)
: controller_base(game_config, video)
, observer()
, savegame_config()
, quit_confirmation()
, ticks_(SDL_GetTicks())
, tdata_(tdata)

View file

@ -76,7 +76,7 @@ namespace wb {
// Holds gamestate related objects
class game_state;
class play_controller : public controller_base, public events::observer, public savegame::savegame_config, quit_confirmation
class play_controller : public controller_base, public events::observer, public quit_confirmation
{
public:
play_controller(const config& level, saved_game& state_of_game,

View file

@ -1,31 +0,0 @@
/*
Copyright (C) 2009 - 2016 by Eugen Jiresch
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef SAVEGAME_CONFIG_HPP_INCLUDED
#define SAVEGAME_CONFIG_HPP_INCLUDED
/* interface for building a config from savegame related objects */
class config;
namespace savegame {
class savegame_config
{
public:
virtual ~savegame_config() {}
virtual config to_config() const = 0;
};
}
#endif

View file

@ -32,7 +32,6 @@ unsigned int positional_source::last_id = 0;
manager::manager(const display &disp) :
observer(),
savegame_config(),
sources_(),
disp_(disp)
{
@ -118,13 +117,6 @@ void manager::write_sourcespecs(config& cfg) const
}
}
config manager::to_config() const
{
config cfg;
write_sourcespecs(cfg);
return cfg.child("sound_source");
}
positional_source::positional_source(const sourcespec &spec) :
last_played_(0),
min_delay_(spec.minimum_delay()),

View file

@ -18,7 +18,6 @@
#include "generic_event.hpp"
#include "map/location.hpp"
#include "savegame_config.hpp"
class config;
class display;
@ -74,7 +73,8 @@ public:
void write_config(config& cfg) const;
};
class manager : public events::observer, public savegame::savegame_config {
class manager : public events::observer
{
typedef std::map<std::string, positional_source *> positional_source_map;
typedef positional_source_map::iterator positional_source_iterator;
@ -104,8 +104,6 @@ public:
* "sound_source", appended to existing content.
*/
void write_sourcespecs(config& cfg) const;
config to_config() const;
};
/**

View file

@ -276,7 +276,6 @@ void team::team_info::write(config& cfg) const
}
team::team() :
savegame_config(),
gold_(0),
villages_(),
shroud_(),

View file

@ -19,7 +19,6 @@
#include "utils/make_enum.hpp"
#include "map/location.hpp"
#include "recall_list_manager.hpp"
#include "savegame_config.hpp"
#include "units/ptr.hpp"
#include "util.hpp"
#include "config.hpp"
@ -48,7 +47,7 @@ namespace wb {
* This class stores all the data for a single 'side' (in game nomenclature).
* E.g., there is only one leader unit per team.
*/
class team : public savegame::savegame_config
class team
{
public:

View file

@ -37,7 +37,6 @@ static lg::log_domain log_engine("engine");
#define LOG_NG LOG_STREAM(info, log_engine)
tod_manager::tod_manager(const config& scenario_cfg):
savegame_config(),
currentTime_(0),
times_(),
areas_(),

View file

@ -17,7 +17,6 @@
#include "map/location.hpp"
#include "config.hpp"
#include "time_of_day.hpp"
#include "savegame_config.hpp"
#include <boost/optional.hpp>
@ -31,7 +30,7 @@ namespace random_new
}
//time of day and turn functionality
class tod_manager : public savegame::savegame_config
class tod_manager
{
public:
explicit tod_manager(const config& scenario_cfg = config());