- added guard for intro randomization to avoid forever loop

This commit is contained in:
Mark Vejvoda
2012-10-30 17:07:29 +00:00
parent 8b2e2bfd5d
commit 69b5f9b39c

View File

@@ -434,7 +434,19 @@ Intro::Intro(Program *program):
if(usedIndex.find(picIndex) != usedIndex.end()) {
failedLookups++;
srand(seed.getCurTicks() / failedLookups);
continue;
if(failedLookups > 10000) {
for(unsigned int i = 0;
i < coreData.getMiscTextureList().size(); ++i) {
if(usedIndex.find(i) == usedIndex.end()) {
picIndex = i;
break;
}
}
}
else {
continue;
}
}
//printf("picIndex = %d list count = %d\n",picIndex,coreData.getMiscTextureList().size());
intoTexList.push_back(coreData.getMiscTextureList()[picIndex]);