Deprecate demo playback /min_wait (#498)

This commit is contained in:
Crystalwarrior 2021-03-20 21:41:35 +03:00 committed by GitHub
parent 4bfd9f0d14
commit e3ba27c47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 30 deletions

View File

@ -20,7 +20,6 @@ public:
bool server_started = false;
int port = 27088;
int max_wait = -1;
int min_wait = -1;
private:
void handle_packet(AOPacket packet);

View File

@ -212,35 +212,11 @@ void DemoServer::handle_packet(AOPacket packet)
}
else if (contents[1].startsWith("/min_wait"))
{
QStringList args = contents[1].split(" ");
if (args.size() > 1)
{
bool ok;
int p_min_wait = args.at(1).toInt(&ok);
if (ok)
{
if (p_min_wait < 0)
p_min_wait = -1;
min_wait = p_min_wait;
client_sock->write("CT#DEMO#Setting min_wait to ");
client_sock->write(QString::number(min_wait).toUtf8());
client_sock->write(" milliseconds.#1#%");
}
else
{
client_sock->write("CT#DEMO#Not a valid integer!#1#%");
}
}
else
{
client_sock->write("CT#DEMO#Current min_wait is ");
client_sock->write(QString::number(min_wait).toUtf8());
client_sock->write(" milliseconds.#1#%");
}
client_sock->write("CT#DEMO#min_wait is deprecated. Use the client Settings for minimum wait instead!");
}
else if (contents[1].startsWith("/help"))
{
client_sock->write("CT#DEMO#Available commands:\nload, play, pause, max_wait, min_wait, help#1#%");
client_sock->write("CT#DEMO#Available commands:\nload, play, pause, max_wait, help#1#%");
}
}
}
@ -285,9 +261,6 @@ void DemoServer::playback()
int duration = wait_packet.get_contents().at(0).toInt();
if (max_wait != -1 && duration + elapsed_time > max_wait)
duration = qMax(0, max_wait - elapsed_time);
// We use elapsed_time to make sure that the packet we're using min_wait on is "priority" (e.g. IC)
if (elapsed_time == 0 && min_wait != -1 && duration < min_wait)
duration = min_wait;
elapsed_time += duration;
timer->start(duration);
}