mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-26 18:10:35 +00:00
fixes to savers
This commit is contained in:
parent
c42a06772b
commit
7a09ab2cb0
26
config.cpp
26
config.cpp
@ -243,7 +243,7 @@ struct custom_setting : public setting {
|
||||
function<bool(void*)> custom_affect;
|
||||
void show_edit_option(int key) override { custom_viewer(key); }
|
||||
cld get_cld() override { return custom_value(); }
|
||||
supersaver *make_saver() override;
|
||||
supersaver *make_saver() { throw hr_exception("make_saver for custom_setting"); }
|
||||
void set_cld(cld x) override { }
|
||||
bool affects(void *v) override { return custom_affect(v); }
|
||||
};
|
||||
@ -354,30 +354,6 @@ template<> struct saver<unsigned> : dsaver<unsigned> {
|
||||
virtual void swap_with(supersaver *s) { swap(val, ((saver<unsigned>*)s)->val); }
|
||||
};
|
||||
|
||||
template<> struct saver<eVariation> : dsaver<eVariation> {
|
||||
explicit saver(eVariation& val) : dsaver<eVariation>(val) { }
|
||||
string save() override { return its((int) val); }
|
||||
void load(const string& s) override { val = (eVariation) atoi(s.c_str()); }
|
||||
virtual void clone(struct local_parameter_set& lps, void *value) override { addsaverenum(*(eVariation*) value, lps.label + name); }
|
||||
virtual void swap_with(supersaver *s) { swap(val, ((saver<eVariation>*)s)->val); }
|
||||
};
|
||||
|
||||
template<> struct saver<eGeometry> : dsaver<eGeometry> {
|
||||
explicit saver(eGeometry& val) : dsaver<eGeometry>(val) { }
|
||||
string save() override { return its((int) val); }
|
||||
void load(const string& s) override { val = (eGeometry) atoi(s.c_str()); }
|
||||
virtual void clone(struct local_parameter_set& lps, void *value) override { addsaverenum(*(eGeometry*) value, lps.label + name); }
|
||||
virtual void swap_with(supersaver *s) { swap(val, ((saver<eGeometry>*)s)->val); }
|
||||
};
|
||||
|
||||
template<> struct saver<eModel> : dsaver<eModel> {
|
||||
explicit saver(eModel& val) : dsaver<eModel>(val) { }
|
||||
string save() override { return its((int) val); }
|
||||
void load(const string& s) override { val = (eModel) atoi(s.c_str()); }
|
||||
virtual void clone(struct local_parameter_set& lps, void *value) override { addsaverenum(*(eModel*) value, lps.label + name); }
|
||||
virtual void swap_with(supersaver *s) { swap(val, ((saver<eModel>*)s)->val); }
|
||||
};
|
||||
|
||||
template<> struct saver<string> : dsaver<string> {
|
||||
explicit saver(string& val) : dsaver<string>(val) { }
|
||||
string save() override { return val; }
|
||||
|
Loading…
Reference in New Issue
Block a user