mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-26 02:14:15 +08:00
* new function in networking to send to all gameservers only
* broadcast user stats with gameservers only
This commit is contained in:
parent
e6ebe6fb6b
commit
e143a6dd82
@ -140,6 +140,9 @@ public:
|
||||
// send to all users whose account type is Individual, no need to call set_dest_id(), this is done automatically
|
||||
bool sendToAllIndividuals(Common_Message *msg, bool reliable);
|
||||
|
||||
// send to all users whose account type is GameServer, no need to call set_dest_id(), this is done automatically
|
||||
bool sendToAllGameservers(Common_Message *msg, bool reliable);
|
||||
|
||||
// send to all active/current connections, no need to call set_dest_id(), this is done automatically
|
||||
bool sendToAll(Common_Message *msg, bool reliable);
|
||||
|
||||
|
@ -1262,6 +1262,20 @@ bool Networking::sendToAllIndividuals(Common_Message *msg, bool reliable)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Networking::sendToAllGameservers(Common_Message *msg, bool reliable)
|
||||
{
|
||||
for (auto &conn: connections) {
|
||||
for (auto &steam_id : conn.ids) {
|
||||
if (steam_id.BGameServerAccount()) {
|
||||
msg->set_dest_id(steam_id.ConvertToUint64());
|
||||
sendTo(msg, reliable, &conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Networking::sendToAll(Common_Message *msg, bool reliable)
|
||||
{
|
||||
for (auto &conn: connections) {
|
||||
|
@ -1676,8 +1676,8 @@ void Steam_User_Stats::send_updated_stats()
|
||||
// set_allocated_xxx() takes ownership of the allocated object, no need to delete
|
||||
msg.set_allocated_gameserver_stats_messages(gameserverstats_msg);
|
||||
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
|
||||
// here we send to all users on the network because we don't know the server steamid
|
||||
network->sendToAll(&msg, true);
|
||||
// here we send to all gameservers on the network because we don't know the server steamid
|
||||
network->sendToAllGameservers(&msg, true);
|
||||
|
||||
PRINT_DEBUG(
|
||||
"Steam_User_Stats::send_updated_stats sent updated stats: %zu stats, %zu achievements\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user