mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-19 14:54:07 +00:00
fixed backward incompatible color reading from config
This commit is contained in:
parent
9752cdede1
commit
003ca36ee5
@ -374,7 +374,13 @@ struct color_parameter : public val_parameter<color_t> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cld get_cld() override { return has_alpha ? *value : (*value * 256 + 0xFF); }
|
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); }
|
string save() override { return has_alpha ? itsh8(*value) : itsh6(*value); }
|
||||||
shared_ptr<parameter> clone(struct local_parameter_set& lps, void *value) override;
|
shared_ptr<parameter> clone(struct local_parameter_set& lps, void *value) override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user