diff --git a/core/src/area_data.cpp b/core/src/area_data.cpp index 78d3aa0..17dd7b8 100644 --- a/core/src/area_data.cpp +++ b/core/src/area_data.cpp @@ -406,11 +406,11 @@ std::pair 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 { diff --git a/core/src/commands/casing.cpp b/core/src/commands/casing.cpp index 9a8aa3b..0568c29 100644 --- a/core/src/commands/casing.cpp +++ b/core/src/commands/casing.cpp @@ -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."); } diff --git a/core/src/packets.cpp b/core/src/packets.cpp index 3551d73..4c4e0d0 100644 --- a/core/src/packets.cpp +++ b/core/src/packets.cpp @@ -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: