Keep pointer to PrintConfig instead of copying it.

This commit is contained in:
Y. Sapir 2014-04-28 00:03:22 +03:00
parent c2b249d059
commit d824de6168
2 changed files with 3 additions and 4 deletions

View file

@ -7,7 +7,7 @@ namespace Slic3r {
Extruder::Extruder(int id, PrintConfig *config) Extruder::Extruder(int id, PrintConfig *config)
: id(id), : id(id),
config(*config) // make a copy config(config)
{ {
reset(); reset();
} }
@ -37,7 +37,7 @@ bool
Extruder::use_relative_e_distances() const Extruder::use_relative_e_distances() const
{ {
// TODO: figure out way to avoid static_cast to access hidden const method // TODO: figure out way to avoid static_cast to access hidden const method
const ConfigOption *opt = static_cast<const ConfigBase*>(&this->config) const ConfigOption *opt = static_cast<const ConfigBase*>(this->config)
->option("use_relative_e_distances"); ->option("use_relative_e_distances");
return *static_cast<const ConfigOptionBool*>(opt); return *static_cast<const ConfigOptionBool*>(opt);
} }

View file

@ -23,8 +23,7 @@ class Extruder
double retracted; double retracted;
double restart_extra; double restart_extra;
// TODO: maybe better to keep a reference to an existing object than copy it PrintConfig *config;
PrintConfig config;
}; };
} }