1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

fixed some issues with param_i and param_enum

This commit is contained in:
Zeno Rogue 2021-04-30 19:43:14 +02:00
parent f6f1bbe5a8
commit 4cd43b3f27

View File

@ -111,6 +111,9 @@ template<class T> struct enum_setting : list_setting {
virtual bool affects(void* v) override { return v == value; } virtual bool affects(void* v) override { return v == value; }
virtual void add_as_saver() override; virtual void add_as_saver() override;
virtual cld get_cld() override { return get_value(); } virtual cld get_cld() override { return get_value(); }
virtual void load_from(const string& s) override {
*value = (T) parseint(s);
}
}; };
struct float_setting : public setting { struct float_setting : public setting {
@ -403,7 +406,7 @@ EX int_setting *param_i(int& val, const string s, int dft) {
} }
u->add_as_saver(); u->add_as_saver();
auto f = &*u; auto f = &*u;
params[s] = std::move(u); params[u->parameter_name] = std::move(u);
return f; return f;
} }
@ -445,7 +448,7 @@ template<class T> enum_setting<T> *param_enum(T& val, const string p, const stri
u->last_value = u->get_cld(); u->last_value = u->get_cld();
u->add_as_saver(); u->add_as_saver();
auto f = &*u; auto f = &*u;
params[s] = std::move(u); params[p] = std::move(u);
return f; return f;
} }
#endif #endif