diff options
Diffstat (limited to 'src/crsm.cpp')
| -rw-r--r-- | src/crsm.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp index ec249a6..0b22d72 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -167,7 +167,7 @@ void CRSM::readServerOutput() } } - else if(session["IrcUseIngameChat"] == "true") + else if(Session.IrcUseIngameChat) { connection->sendCommand(IrcCommand::createMessage(Config.IRC.IngameChannel, "[Clonk]<" + user + "> " + msg)); } @@ -187,7 +187,7 @@ void CRSM::readServerOutput() connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); greetMapper.setMapping(timer, info.pcName); timer->start(1000); - if(session["IrcUseIngameChat"] == "true") + if(Session.IrcUseIngameChat) { connection->sendCommand(IrcCommand::createMessage(Config.IRC.IngameChannel, "[Clonk] " + info.toString() + " verbunden.")); } @@ -219,11 +219,11 @@ void CRSM::readServerOutput() static QRegExp startExp("^Start!\\s*$"); if(startExp.exactMatch(what)) { - if(session["league"] != "true") + if(Session.League) { writeToServer(QString("/set maxplayer 0\n")); } - session["running"] = "true"; + Session.Running = true; } @@ -236,7 +236,7 @@ void CRSM::readServerOutput() ClientInfo &info = getClientInfo(infoMatch.cap(1), infoMatch.cap(2).toInt(), infoMatch.cap(3)); writeToServer(QString(info.nick +" ist ein L34V0R!\n")); - if(session["IrcUseIngameChat"] == "true") + if(Session.IrcUseIngameChat) { connection->sendCommand(IrcCommand::createMessage(Config.IRC.IngameChannel, "[Clonk] " + info.toString() + " entfernt" + leaveExp.cap(2))); } @@ -250,11 +250,11 @@ void CRSM::readServerOutput() clients.remove(info.pcName); } - if(clients.size() == 0 && userlist.length() > 0 && session["userwish"] != "true") + if(clients.size() == 0 && userlist.length() > 0 && !Session.UserWish) { processManager->closeProgFifos(); } - else if(clients.size() == 0 && Config.Clonk.Server.EmptyTimer != -1 && (session["CountDown"] == "false" || session["CountDown"].toInt() > Config.Clonk.Server.EmptyTimer)) + else if(clients.size() == 0 && Config.Clonk.Server.EmptyTimer != -1 && (Session.CountDown == -1 || Session.CountDown > Config.Clonk.Server.EmptyTimer)) { writeToServer("/start " + QString::number(Config.Clonk.Server.EmptyTimer) + "\n"); } @@ -263,13 +263,13 @@ void CRSM::readServerOutput() static QRegExp countDownExp("^(?:Das Spiel beginnt in (\\d+) Sekunden\\!|The game will start in (\\d+) seconds\\.)"); if(countDownExp.exactMatch(what)) { - session["CountDown"] = countDownExp.cap(1); + Session.CountDown = countDownExp.cap(1).toInt(); } static QRegExp countDownStopExp("^(?:Spielstart abgebrochen\\.|Game start aborted\\.)"); if(countDownStopExp.exactMatch(what)) { - session["CountDown"] = "false"; + Session.CountDown = -1; } } @@ -297,7 +297,7 @@ void CRSM::readInput() processManager->closeProgFifos(); Config.Auto.ProcessManager.ReattachId.clear(); finish = true; - if(session["hosting"] != "true") + if(!Session.Hosting) scenarioFinished(); return; } @@ -343,12 +343,12 @@ void CRSM::readInput() void CRSM::nextScen() { - session["hosting"] = "true"; + Session.Hosting = true; if(userlist.length()>0) { startScen(userlist.at(0), args); userlist.removeFirst(); - session["userwish"] = "true"; + Session.UserWish = true; } else { @@ -390,7 +390,7 @@ void CRSM::scenarioFinished() QCoreApplication::quit(); return; } - session.clear(); + Session.clear(); sessionAdmin = ClientInfo(); ircAdmin = ClientInfo(); clients.clear(); @@ -532,13 +532,13 @@ void CRSM::ircMessageReceived(IrcMessage *message) { if(Config.IRC.UseIngameChat && !Config.IRC.IngameChannel.isEmpty()) { - if(session["hosting"] != "true") + if(!Session.Hosting) { connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Kein laufendes Spiel.")); } else { - connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + session["scenname"] + " | Ingamechat ist " + (session["IrcUseIngameChat"] == "true" ? "" : "de") + "aktviert.")); + connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + Session.ScenarioName + " | Ingamechat ist " + (Session.IrcUseIngameChat ? "" : "de") + "aktviert.")); } } } @@ -674,11 +674,11 @@ void CRSM::startScen(const ScenarioSettings &scen, QStringList argList) scoreboardFile.open(QFile::WriteOnly); scoreboardFile.close(); - session["scenname"] = scen.name; - session["IrcUseIngameChat"] = Config.IRC.UseIngameChat ? "true" : "false"; + Session.ScenarioName = scen.name; + Session.IrcUseIngameChat = Config.IRC.UseIngameChat; if(Config.IRC.UseIngameChat && !Config.IRC.IngameChannel.isEmpty()) { - connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + session["scenname"] + " | Ingamechat ist " + (session["IrcUseIngameChat"] == "true" ? "" : "de") + "aktviert.")); + connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + Session.ScenarioName + " | Ingamechat ist " + (Session.IrcUseIngameChat ? "" : "de") + "aktviert.")); } filename = scen.name; while(Config.Hosting.Alias.contains(filename)) @@ -687,7 +687,7 @@ void CRSM::startScen(const ScenarioSettings &scen, QStringList argList) if(scen.league) { argList << "/league"; - session["league"] = "true"; + Session.League = true; } else { @@ -1244,9 +1244,9 @@ QString CRSM::ircActivateIngameChat(bool activated) { if(Config.IRC.UseIngameChat && !Config.IRC.IngameChannel.isEmpty()) { - session["IrcUseIngameChat"] = activated ? "true" : "false"; - connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + session["scenname"] + " | Ingamechat ist " + (session["IrcUseIngameChat"] == "true" ? "" : "de") + "aktviert.")); - return "Ingamechat wurde " + (session["IrcUseIngameChat"] == "true" ? QString("") : QString("de")) + "aktviert."; + Session.IrcUseIngameChat = activated; + connection->sendCommand(IrcCommand::createTopic(Config.IRC.IngameChannel, "Aktuelles Szenario: " + Session.ScenarioName + " | Ingamechat ist " + (Session.IrcUseIngameChat ? "" : "de") + "aktviert.")); + return "Ingamechat wurde " + (Session.IrcUseIngameChat ? QString("") : QString("de")) + "aktviert."; } else return "Ingamechat ist administrativ deaktiviert!"; @@ -1752,13 +1752,13 @@ CMD_FUNCTION_IMPL(host) { userlist << scen; respond(client, "Szenario " + scen.name + " wurde der Warteschlange" + (scen.league ? " mit Liga" : "") + " hinzugefügt.\n"); - if(userlist.length() == 1 && session["userwish"] != "true" && session["running"] != "true" && session["hosting"] == "true" && clients.size() > 0) + if(userlist.length() == 1 && !Session.UserWish && !Session.Running && Session.Hosting && clients.size() > 0) respond(client, "Überrede alle Spieler zu leaven und dein Wunsch wird sofort gehostet ;-)\n"); - else if(session["hosting"] != "true") + else if(!Session.Hosting) { nextScen(); } - else if(clients.size() == 0 && session["userwish"] != "true") + else if(clients.size() == 0 && !Session.UserWish) { processManager->closeProgFifos(); } @@ -1800,7 +1800,7 @@ CMD_FUNCTION_IMPL(autohost) { autoHost = true; respond(client, "Automatisches Hosting aktiviert.\n"); - if(session["hosting"] != "true") + if(!Session.Hosting) { nextScen(); } @@ -2094,7 +2094,7 @@ CMD_FUNCTION_IMPL(exit) processManager->closeProgFifos(); Config.Auto.ProcessManager.ReattachId.clear(); finish = true; - if(session["hosting"] != "true") + if(!Session.Hosting) scenarioFinished(); } |
