config: Treat VERSION specially when probing cache invalidation scenarios

It's not explained in the code at all, but I guess the point of
invalidating the cache when a non-empty or non-argless macro has been
defined is to make sure the cache was really automatically generated and
not tampered with by the user. In such case it should be safe to make an
exception for VERSION, the first engine-generated non-empty macro so
far.

I can't imagine a situation where this would break any other assumptions
at the moment, so I'll leave it to the testers.
This commit is contained in:
Ignacio R. Morelle 2011-03-22 08:40:33 +00:00
parent b9ee8969c5
commit ca3ff0b4a0

View file

@ -162,9 +162,13 @@ namespace game_config {
defines_string << path;
for(preproc_map::const_iterator i = defines_map_.begin(); i != defines_map_.end(); ++i) {
if(i->second.value != "" || i->second.arguments.empty() == false) {
is_valid = false;
ERR_CACHE << "Preprocessor define not valid\n";
break;
// VERSION is defined non-empty by the engine,
// it should be safe to rely on caches containing it.
if(i->first != "VERSION") {
is_valid = false;
ERR_CACHE << "Preprocessor define not valid\n";
break;
}
}
defines_string << " " << i->first;