1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

fixed backward incompatible color reading from config

This commit is contained in:
Zeno Rogue 2024-05-28 20:20:56 +02:00
parent 9752cdede1
commit 003ca36ee5

View File

@ -374,7 +374,13 @@ struct color_parameter : public val_parameter<color_t> {
}
cld get_cld() override { return has_alpha ? *value : (*value * 256 + 0xFF); }
void load_from_raw(const string& s) override { *value = parsecolor(s, has_alpha); }
void load_from_raw(const string& s) override {
try {
*value = parsecolor(s, has_alpha);
} catch(hr_parse_exception& e) {
sscanf(s.c_str(), "%x", value);
}
}
string save() override { return has_alpha ? itsh8(*value) : itsh6(*value); }
shared_ptr<parameter> clone(struct local_parameter_set& lps, void *value) override;
};