send only x offset to old clients
This commit is contained in:
parent
d84c20784d
commit
6aff469a8c
@ -59,6 +59,13 @@ class AOClient : public QObject {
|
|||||||
QString ooc_name = "";
|
QString ooc_name = "";
|
||||||
QString showname = "";
|
QString showname = "";
|
||||||
bool global_enabled = true;
|
bool global_enabled = true;
|
||||||
|
struct ClientVersion {
|
||||||
|
QString string;
|
||||||
|
int release = -1;
|
||||||
|
int major = -1;
|
||||||
|
int minor = -1;
|
||||||
|
}
|
||||||
|
ClientVersion version;
|
||||||
|
|
||||||
QMap<QString, unsigned long long> ACLFlags {
|
QMap<QString, unsigned long long> ACLFlags {
|
||||||
{"NONE", 0ULL},
|
{"NONE", 0ULL},
|
||||||
|
@ -54,6 +54,30 @@ void AOClient::pktSoftwareId(AreaData* area, int argc, QStringList argv, AOPacke
|
|||||||
"y_offset"
|
"y_offset"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Extremely cursed client version string validation
|
||||||
|
// Ideally version strings should be X.X.X but it can be literally anything
|
||||||
|
// so we have to be super careful
|
||||||
|
version->string = argv[1];
|
||||||
|
QString version_raw = argv[1].split(".");
|
||||||
|
bool ok;
|
||||||
|
int release_version = version_raw[0].toInt(&ok);
|
||||||
|
if (ok && version_raw.size() >= 1)
|
||||||
|
version.release = release_version;
|
||||||
|
if (ok && version_raw.size() >= 2) {
|
||||||
|
int major_version = version_raw[1].toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
version.major = major_version;
|
||||||
|
}
|
||||||
|
if (ok && version_raw.size() >= 3) {
|
||||||
|
int minor_version = version_raw[2].toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
version.minor = minor_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sendPacket("PN", {QString::number(server->player_count), max_players});
|
sendPacket("PN", {QString::number(server->player_count), max_players});
|
||||||
sendPacket("FL", feature_list);
|
sendPacket("FL", feature_list);
|
||||||
}
|
}
|
||||||
@ -456,8 +480,17 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
|
|
||||||
// self offset
|
// self offset
|
||||||
offset = incoming_args[17].toString();
|
offset = incoming_args[17].toString();
|
||||||
|
// versions 2.6-2.8 cannot validate y-offset so we send them just the x-offset
|
||||||
|
if ((version.release == 2) && (version.major == 6 || version.major == 7 || version.major == 8)) {
|
||||||
|
QString x_offset = offset.split("&")[0];
|
||||||
|
args.append(x_offset);
|
||||||
|
QString other_x_offset = other_offset.split("&")[0];
|
||||||
|
args.append(other_x_offset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
args.append(offset);
|
args.append(offset);
|
||||||
args.append(other_offset);
|
args.append(other_offset);
|
||||||
|
}
|
||||||
args.append(other_flip);
|
args.append(other_flip);
|
||||||
|
|
||||||
// noninterrupting preanim
|
// noninterrupting preanim
|
||||||
|
Loading…
Reference in New Issue
Block a user