1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Utopia won't give same artifact twice.

This commit is contained in:
DjWarmonger
2009-09-19 09:47:22 +00:00
parent 1f958bc240
commit 763571062d

View File

@@ -3897,11 +3897,10 @@ void CBank::reset(ui16 var1, ui16 var2) //prevents desync
} }
} }
artifacts.clear(); artifacts.clear();
std::vector<CArtifact*>::iterator index;
for (ui8 i = 0; i <= 3; i++) for (ui8 i = 0; i <= 3; i++)
{ {
std::vector<CArtifact*> arts; //to avoid addition of different tiers std::vector<CArtifact*> arts; //to avoid addition of different tiers
for (ui8 n = 0; n < bc->artifacts[i]; n++)
{
switch (i) switch (i)
{ {
case 0: case 0:
@@ -3917,7 +3916,12 @@ void CBank::reset(ui16 var1, ui16 var2) //prevents desync
cb->getAllowed (arts, CArtifact::ART_RELIC); cb->getAllowed (arts, CArtifact::ART_RELIC);
break; break;
} }
artifacts.push_back (arts[var2 % arts.size()]->id); for (ui8 n = 0; n < bc->artifacts[i]; n++)
{
index = arts.begin() + var2 % arts.size();
artifacts.push_back ((*index)->id);
arts.erase(index);
var2 *= (var1 + n * i); //almost like random var2 *= (var1 + n * i); //almost like random
} }
} }