mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 06:01:17 +02:00
- added guard for intro randomization to avoid forever loop
This commit is contained in:
@@ -434,7 +434,19 @@ Intro::Intro(Program *program):
|
|||||||
if(usedIndex.find(picIndex) != usedIndex.end()) {
|
if(usedIndex.find(picIndex) != usedIndex.end()) {
|
||||||
failedLookups++;
|
failedLookups++;
|
||||||
srand(seed.getCurTicks() / 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());
|
//printf("picIndex = %d list count = %d\n",picIndex,coreData.getMiscTextureList().size());
|
||||||
intoTexList.push_back(coreData.getMiscTextureList()[picIndex]);
|
intoTexList.push_back(coreData.getMiscTextureList()[picIndex]);
|
||||||
|
Reference in New Issue
Block a user