summaryrefslogtreecommitdiffstats
path: root/crsm.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2015-04-01 15:36:59 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2015-04-01 15:36:59 +0200
commit734ac10797f8a1464d5e12b9fd4cfcc2d2e5e4e3 (patch)
tree5ddd5e53d81c3f8004902f05786c7f8d00c97c72 /crsm.cpp
parent64bfe2fa7bd43de041d69b5fa1687d0a04004866 (diff)
downloadmanager-734ac10797f8a1464d5e12b9fd4cfcc2d2e5e4e3.tar.gz
manager-734ac10797f8a1464d5e12b9fd4cfcc2d2e5e4e3.zip
Added option to randomly enable league for scenarios.lst (--random-
league).
Diffstat (limited to 'crsm.cpp')
-rw-r--r--crsm.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/crsm.cpp b/crsm.cpp
index a1ea679..7de9ea6 100644
--- a/crsm.cpp
+++ b/crsm.cpp
@@ -612,15 +612,21 @@ void CRSM::updateNextAutoScens()
{
while(nextAutoScens.length() < settings["UserListLength"].toInt())
{
+ ScenarioSettings next("");
if(settings["RandomizeAutoHosting"] == "true")
{
- nextAutoScens.append(autolist.at(qrand() % autolist.length()));
+ next = autolist.at(qrand() % autolist.length());
}
else
{
- nextAutoScens.append(autolist.at(current));
+ next = autolist.at(current);
if(++current >= autolist.length()) current = 0;
}
+ if(next.randomLeague)
+ {
+ next.league = qrand() % 2;
+ }
+ nextAutoScens.append(next);
}
}
@@ -795,6 +801,12 @@ void CRSM::readScenarios()
scen.league = true;
scen.name = argList.join(' ');
}
+ else if(argList.first().trimmed() == "--random-league")
+ {
+ argList.removeFirst();
+ scen.randomLeague = true;
+ scen.name = argList.join(' ');
+ }
if(scenExists(scen.name))
{
out(scen.name + "\n");