simplify convoluted if statement

This commit is contained in:
2024-11-26 11:35:43 -06:00
committed by Celtic Minstrel
parent c537a3701c
commit c913b11047

View File

@@ -178,11 +178,11 @@ static const std::set<eBtnType> labelledButtons{BTN_TINY, BTN_LED, BTN_PUSH};
void cButton::validatePostParse(ticpp::Element& elem, std::string fname, const std::set<std::string>& attrs, const std::multiset<std::string>& elems) {
cControl::validatePostParse(elem, fname, attrs, elems);
if(getType() == CTRL_BTN && !attrs.count("type")) throw xMissingAttr(elem.Value(), "type", elem.Row(), elem.Column(), fname);
if(type == BTN_PUSH && !getText().empty() && !attrs.count("width"))
throw xMissingAttr(elem.Value(), "width", elem.Row(), elem.Column(), fname);
if(labelledButtons.count(type)) {
if(!attrs.count("color") && !attrs.count("colour") && parent->getBg() == cDialog::BG_DARK)
setColour(sf::Color::White);
if(type != BTN_TINY && type != BTN_LED && !getText().empty() && !attrs.count("width"))
throw xMissingAttr(elem.Value(), "width", elem.Row(), elem.Column(), fname);
}
}