Add support for single-file gamedata custom overrides (bug 5386, r=psychonic).
authorOndrej Hošek <ondra.hosek@gmail.com>
Mon Apr 07 12:14:26 2014 -0400 (2014-04-07)
changeset 4313ef638270abbf
parent 4312 c189d81f7bf4
child 4314 ec67f6caabba
Add support for single-file gamedata custom overrides (bug 5386, r=psychonic).
core/logic/GameConfigs.cpp
     1.1 --- a/core/logic/GameConfigs.cpp	Sun Apr 06 17:03:29 2014 -0400
     1.2 +++ b/core/logic/GameConfigs.cpp	Mon Apr 07 12:14:26 2014 -0400
     1.3 @@ -792,7 +792,19 @@
     1.4  	{
     1.5  		/* Nope, use the old mechanism. */
     1.6  		smcore.Format(path, sizeof(path), "%s.txt", m_File);
     1.7 -		return EnterFile(path, error, maxlength);
     1.8 +		if (!EnterFile(path, error, maxlength))
     1.9 +		{
    1.10 +			return false;
    1.11 +		}
    1.12 +
    1.13 +		/* Allow customization. */
    1.14 +		g_pSM->BuildPath(Path_SM, path, sizeof(path), "gamedata/custom/%s.txt", m_File);
    1.15 +		if (libsys->PathExists(path))
    1.16 +		{
    1.17 +			smcore.Format(path, sizeof(path), "custom/%s.txt", m_File);
    1.18 +			return EnterFile(path, error, maxlength);
    1.19 +		}
    1.20 +		return true;
    1.21  	}
    1.22  
    1.23  	/* Otherwise, it's time to parse the master. */