Compare commits

...

3 Commits

Author SHA1 Message Date
Automatic Release Builder
c92a953511 new version: 2016.4.3 2016-12-05 13:28:25 +01:00
James Turner
863ae19d1d Package::indexOfvariant works on fully-qualified IDs.
Should fix issues restoring variants in the launcher.
2016-11-29 15:44:19 +00:00
Automatic Release Builder
cd7b6d69b0 new version: 2016.4.2 2016-11-22 09:38:58 +01:00
3 changed files with 20 additions and 3 deletions

View File

@@ -175,9 +175,14 @@ int parseTest()
// expected
}
unsigned int skisVariantFull = p2->indexOfVariant("org.flightgear.test.catalog1.c172p-skis");
VERIFY(skisVariantFull > 0);
unsigned int skisVariant = p2->indexOfVariant("c172p-skis");
VERIFY(skisVariant > 0);
COMPARE(skisVariant, skisVariantFull);
pkg::Package::ThumbnailVec thumbs2 = p2->thumbnailsForVariant(skisVariant);
COMPARE(thumbs2.size(), 2);

View File

@@ -340,13 +340,25 @@ std::string Package::nameForVariant(const std::string& vid) const
unsigned int Package::indexOfVariant(const std::string& vid) const
{
if (vid == id()) {
// accept fully-qualified IDs here
std::string actualId = vid;
size_t lastDot = vid.rfind('.');
if (lastDot != std::string::npos) {
std::string catalogId = vid.substr(0, lastDot);
if (catalogId != catalog()->id()) {
throw sg_exception("Bad fully-qualified ID:" + vid + ", package mismatch" );
}
actualId = vid.substr(lastDot + 1);
}
if (actualId == id()) {
return 0;
}
unsigned int result = 1;
for (SGPropertyNode* var : m_props->getChildren("variant")) {
if (var->getStringValue("id") == vid) {
if (var->getStringValue("id") == actualId) {
return result;
}

View File

@@ -1 +1 @@
2016.4.1
2016.4.3