Added "HOOK_SERVER_PING" call to older protocols
This commit is contained in:
parent
2cca4d70c8
commit
cfdf39a75f
@ -1013,6 +1013,11 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
{
|
{
|
||||||
AString Reply;
|
AString Reply;
|
||||||
cServer * Server = cRoot::Get()->GetServer();
|
cServer * Server = cRoot::Get()->GetServer();
|
||||||
|
|
||||||
|
AString Motd = Server->GetDescription();
|
||||||
|
int NumPlayers = Server->GetNumPlayers();
|
||||||
|
int MaxPlayers = Server->GetMaxPlayers();
|
||||||
|
|
||||||
switch (cRoot::Get()->GetPrimaryServerVersion())
|
switch (cRoot::Get()->GetPrimaryServerVersion())
|
||||||
{
|
{
|
||||||
case PROTO_VERSION_1_2_5:
|
case PROTO_VERSION_1_2_5:
|
||||||
@ -1020,11 +1025,11 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
{
|
{
|
||||||
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
||||||
Printf(Reply, "%s%s%i%s%i",
|
Printf(Reply, "%s%s%i%s%i",
|
||||||
Server->GetDescription().c_str(),
|
Motd.c_str(),
|
||||||
cChatColor::Delimiter,
|
cChatColor::Delimiter,
|
||||||
Server->GetNumPlayers(),
|
NumPlayers,
|
||||||
cChatColor::Delimiter,
|
cChatColor::Delimiter,
|
||||||
Server->GetMaxPlayers()
|
MaxPlayers
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1051,13 +1056,7 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
m_Buffer.ReadByte(val); // 0x01 magic value
|
m_Buffer.ReadByte(val); // 0x01 magic value
|
||||||
ASSERT(val == 0x01);
|
ASSERT(val == 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://wiki.vg/wiki/index.php?title=Server_List_Ping&oldid=3100
|
|
||||||
AString NumPlayers;
|
|
||||||
Printf(NumPlayers, "%d", Server->GetNumPlayers());
|
|
||||||
AString MaxPlayers;
|
|
||||||
Printf(MaxPlayers, "%d", Server->GetMaxPlayers());
|
|
||||||
|
|
||||||
AString ProtocolVersionNum;
|
AString ProtocolVersionNum;
|
||||||
Printf(ProtocolVersionNum, "%d", cRoot::Get()->GetPrimaryServerVersion());
|
Printf(ProtocolVersionNum, "%d", cRoot::Get()->GetPrimaryServerVersion());
|
||||||
AString ProtocolVersionTxt(GetVersionTextFromInt(cRoot::Get()->GetPrimaryServerVersion()));
|
AString ProtocolVersionTxt(GetVersionTextFromInt(cRoot::Get()->GetPrimaryServerVersion()));
|
||||||
@ -1070,11 +1069,11 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(ProtocolVersionTxt);
|
Reply.append(ProtocolVersionTxt);
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(Server->GetDescription());
|
Reply.append(Motd);
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(NumPlayers);
|
Reply.append(Printf("%d", NumPlayers));
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(MaxPlayers);
|
Reply.append(Printf("%d", MaxPlayers));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // switch (m_PrimaryServerVersion)
|
} // switch (m_PrimaryServerVersion)
|
||||||
|
Loading…
Reference in New Issue
Block a user