light: move empty values check to its own function

This commit is contained in:
Eric Wasylishen 2016-09-19 14:28:50 -06:00
parent fdb5394cc5
commit 63d2bcf91c
1 changed files with 15 additions and 10 deletions

View File

@ -155,6 +155,20 @@ MatchTargets(void)
}
}
static void
CheckEmptyValues(const std::vector<entdict_t> &edicts)
{
// empty values warning
for (const auto &entdict : edicts) {
for (const auto &keyval : entdict) {
if (keyval.first.empty() || keyval.second.empty()) {
logprint("WARNING: empty key/value \"%s\" \"%s\"\n",
keyval.first.c_str(), keyval.second.c_str());
}
}
}
}
/**
* Checks `entdicts` for unmatched targets/targetnames and prints warnings
*/
@ -900,17 +914,8 @@ LoadEntities(const globalconfig_t &cfg, const bsp2_t *bsp)
entdicts = EntData_Parse(bsp->dentdata);
// empty values warning
for (const auto &entdict : entdicts) {
for (const auto &keyval : entdict) {
if (keyval.first.empty() || keyval.second.empty()) {
logprint("WARNING: empty key/value \"%s\" \"%s\"\n",
keyval.first.c_str(), keyval.second.c_str());
}
}
}
CheckTargets();
CheckEmptyValues(entdicts);
// First pass: make permanent changes to the bsp entdata that we will write out
// at the end of the light process.