aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug_functions.cpp4
-rw-r--r--lobby.cpp2
-rw-r--r--packet_distribution.cpp37
3 files changed, 40 insertions, 3 deletions
diff --git a/debug_functions.cpp b/debug_functions.cpp
index 347e620..848667d 100644
--- a/debug_functions.cpp
+++ b/debug_functions.cpp
@@ -11,7 +11,7 @@ void call_error(QString p_message)
//msgBox->setWindowModality(Qt::NonModal);
- msgBox->show();
+ msgBox->exec();
}
void call_notice(QString p_message)
@@ -23,5 +23,5 @@ void call_notice(QString p_message)
//msgBox->setWindowModality(Qt::NonModal);
- msgBox->show();
+ msgBox->exec();
}
diff --git a/lobby.cpp b/lobby.cpp
index 3581388..e6811b6 100644
--- a/lobby.cpp
+++ b/lobby.cpp
@@ -206,6 +206,8 @@ void Lobby::on_add_to_fav_pressed()
void Lobby::on_add_to_fav_released()
{
+ ao_app->server_packet_received(new AOPacket("AO2CHECK#2.1.1#%"));
+
ui_add_to_fav->set_image("addtofav.png");
//you cant add favorites from favorites m8
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 812c0a6..8f2e4c1 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -350,7 +350,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
int remote_cid = f_contents.at(0).toInt();
if (f_cid != remote_cid && remote_cid != -1)
- return;
+ goto end;
call_notice("You have been kicked.");
construct_lobby();
@@ -367,6 +367,41 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
call_notice("You are banned on this server.");
}
+ else if (header == "AO2CHECK")
+ {
+ if (f_contents.size() < 1)
+ goto end;
+
+ QStringList version_contents = f_contents.at(0).split(".");
+
+ if (version_contents.size() < 3)
+ goto end;
+
+ int f_release = version_contents.at(0).toInt();
+ int f_major = version_contents.at(1).toInt();
+ int f_minor = version_contents.at(2).toInt();
+
+ //qDebug() << "local version: " << get_version_string();
+ //qDebug() << "remote version: " << QString::number(f_release) << QString::number(f_major) << QString::number(f_minor);
+
+ if (get_release() > f_release)
+ goto end;
+ else if (get_release() == f_release)
+ {
+ if (get_major_version() > f_major)
+ goto end;
+ else if (get_major_version() == f_major)
+ {
+ if (get_minor_version() >= f_minor)
+ goto end;
+ }
+ }
+
+ call_notice("Outdated version! Your version: " + get_version_string()
+ + "\nPlease go to aceattorneyonline.com to update.");
+ destruct_courtroom();
+ destruct_lobby();
+ }
else if (header == "checkconnection")
{
send_server_packet(new AOPacket("CH#" + QString::number(w_courtroom->get_cid()) + "#%"));