Fix testimony recorder
Fixes the entirely broken testimony recorder and makes it work like intended. Co-Authored-By: Cerapter <43446478+Cerapter@users.noreply.github.com> Co-Authored-By: Salanto <62221668+Salanto@users.noreply.github.com>
This commit is contained in:
parent
17cd92bc5b
commit
526ebcf635
@ -406,11 +406,11 @@ std::pair<QStringList, AreaData::TestimonyProgress> AreaData::jumpToStatement(in
|
||||
m_statement = f_position;
|
||||
|
||||
if (m_statement > m_testimony.size() - 1) {
|
||||
m_statement = 0;
|
||||
m_statement = 1;
|
||||
return {m_testimony.at(m_statement), TestimonyProgress::LOOPED};
|
||||
}
|
||||
if (m_statement <= 0) {
|
||||
m_statement = 0;
|
||||
if (m_statement <= 1) {
|
||||
m_statement = 1;
|
||||
return {m_testimony.at(m_statement), TestimonyProgress::STAYED_AT_FIRST};
|
||||
}
|
||||
else {
|
||||
|
@ -164,7 +164,7 @@ void AOClient::cmdPauseTestimony(int argc, QStringList argv)
|
||||
{
|
||||
AreaData* area = server->areas[current_area];
|
||||
area->setTestimonyRecording(AreaData::TestimonyRecording::STOPPED);
|
||||
server->broadcast(AOPacket("RT",{"testimony1#1"}), current_area);
|
||||
server->broadcast(AOPacket("RT",{"testimony1", "1"}), current_area);
|
||||
sendServerMessage("Testimony has been stopped.");
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,9 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
|
||||
if (args[4] == ">") {
|
||||
pos = "wit";
|
||||
std::make_pair(args, l_progress) = area->jumpToStatement(area->statement() + 1);
|
||||
auto l_statement = area->jumpToStatement(area->statement() +1);
|
||||
args = l_statement.first;
|
||||
l_progress = l_statement.second;
|
||||
|
||||
if (l_progress == AreaData::TestimonyProgress::LOOPED) {
|
||||
sendServerMessageArea("Last statement reached. Looping to first statement.");
|
||||
@ -796,7 +798,9 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
}
|
||||
if (args[4] == "<") {
|
||||
pos = "wit";
|
||||
std::make_pair(args, l_progress) = area->jumpToStatement(area->statement() - 1);
|
||||
auto l_statement = area->jumpToStatement(area->statement() - 1);
|
||||
args = l_statement.first;
|
||||
l_progress = l_statement.second;
|
||||
|
||||
if (l_progress == AreaData::TestimonyProgress::STAYED_AT_FIRST) {
|
||||
sendServerMessage("First statement reached.");
|
||||
@ -808,7 +812,10 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
QRegularExpressionMatch match = jump.match(decoded_message);
|
||||
if (match.hasMatch()) {
|
||||
pos = "wit";
|
||||
std::make_pair(args, l_progress) = area->jumpToStatement(match.captured("int").toInt());
|
||||
auto l_statement = area->jumpToStatement(match.captured("int").toInt());
|
||||
args = l_statement.first;
|
||||
l_progress = l_statement.second;
|
||||
|
||||
|
||||
switch (l_progress){
|
||||
case AreaData::TestimonyProgress::LOOPED:
|
||||
|
Loading…
Reference in New Issue
Block a user