diff --git a/src/graphics/graphics_restrictions.cpp b/src/graphics/graphics_restrictions.cpp index 083df9c6a..6f020b673 100644 --- a/src/graphics/graphics_restrictions.cpp +++ b/src/graphics/graphics_restrictions.cpp @@ -33,9 +33,6 @@ namespace GraphicsRestrictions class Rule; namespace Private { - /** List of all rules. */ - std::vector m_all_rules; - /** Stores for each grpahics restriction if it's enabled or not. */ std::vector m_all_graphics_restriction; @@ -343,33 +340,6 @@ void unitTesting() assert(Version("1.2.3") == Version("1.2.3")); } // unitTesting -// ---------------------------------------------------------------------------- -/** Determines graphical features that need to be disabled for the - * specified driver, graphics card and OS. - * \param driver_version The GL_VERSION string (i.e. opengl and version - * number). - * \param card_name The GL_RENDERER string (i.e. graphics card). - */ -void determineRestrictions(const std::string &driver_version, - const std::string &card_name) -{ - Version version(driver_version, card_name); - for(unsigned int i=0; iapplies(card_name, version)) - { - std::vector rules = m_all_rules[i]->getRestrictions(); - std::vector::iterator p; - for (p = rules.begin(); p != rules.end(); p++) - { - GraphicsRestrictionsType t = getTypeForName(*p); - if (t != GR_COUNT) - m_all_graphics_restriction[t] = true; - } // for p in rules - } // if m_all_rules[i].applies() - } // for i in m_all_rules -} // determineRestrictions - // ---------------------------------------------------------------------------- /** Reads in the graphical restriction file. * \param driver_version The GL_VERSION string (i.e. opengl and version @@ -399,20 +369,31 @@ void init(const std::string &driver_version, filename.c_str()); return; } + + Version version(driver_version, card_name); for (unsigned int i = 0; igetNumNodes(); i++) { - const XMLNode *rule = rules->getNode(i); - if (rule->getName() != "card") + const XMLNode *xml_rule = rules->getNode(i); + if (xml_rule->getName() != "card") { Log::warn("Graphics", "Incorrect node '%s' found in '%s' - ignored.", - rule->getName().c_str(), filename.c_str()); + xml_rule->getName().c_str(), filename.c_str()); continue; } - m_all_rules.push_back(new Rule(rule)); + Rule rule(xml_rule); + if (rule.applies(card_name, version)) + { + std::vector restrictions = rule.getRestrictions(); + std::vector::iterator p; + for (p = restrictions.begin(); p != restrictions.end(); p++) + { + GraphicsRestrictionsType t = getTypeForName(*p); + if (t != GR_COUNT) + m_all_graphics_restriction[t] = true; + } // for p in rules + } // if m_all_rules[i].applies() } delete rules; - - determineRestrictions(driver_version, card_name); } // init // ----------------------------------------------------------------------------