Skip to content

Commit 27eeb35

Browse files
committedSep 27, 2017
Fix some forgotten u16 -> session_t in ad7daf7
1 parent 0df3671 commit 27eeb35

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed
 

‎src/clientiface.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,9 @@ ClientInterface::~ClientInterface()
606606
}
607607
}
608608

609-
std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
609+
std::vector<session_t> ClientInterface::getClientIDs(ClientState min_state)
610610
{
611-
std::vector<u16> reply;
611+
std::vector<session_t> reply;
612612
MutexAutoLock clientslock(m_clients_mutex);
613613

614614
for (const auto &m_client : m_clients) {
@@ -642,14 +642,14 @@ void ClientInterface::step(float dtime)
642642
void ClientInterface::UpdatePlayerList()
643643
{
644644
if (m_env) {
645-
std::vector<u16> clients = getClientIDs();
645+
std::vector<session_t> clients = getClientIDs();
646646
m_clients_names.clear();
647647

648648

649-
if(!clients.empty())
649+
if (!clients.empty())
650650
infostream<<"Players:"<<std::endl;
651651

652-
for (u16 i : clients) {
652+
for (session_t i : clients) {
653653
RemotePlayer *player = m_env->getPlayer(i);
654654

655655
if (player == NULL)

‎src/clientiface.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class ClientInterface {
422422
void step(float dtime);
423423

424424
/* get list of active client id's */
425-
std::vector<u16> getClientIDs(ClientState min_state=CS_Active);
425+
std::vector<session_t> getClientIDs(ClientState min_state=CS_Active);
426426

427427
/* verify is server user limit was reached */
428428
bool isUserLimitReached();

‎src/server.cpp

+26-26
Original file line numberDiff line numberDiff line change
@@ -1270,10 +1270,10 @@ void Server::setInventoryModified(const InventoryLocation &loc, bool playerSend)
12701270

12711271
void Server::SetBlocksNotSent(std::map<v3s16, MapBlock *>& block)
12721272
{
1273-
std::vector<u16> clients = m_clients.getClientIDs();
1273+
std::vector<session_t> clients = m_clients.getClientIDs();
12741274
m_clients.lock();
12751275
// Set the modified blocks unsent for all the clients
1276-
for (const u16 client_id : clients) {
1276+
for (const session_t client_id : clients) {
12771277
if (RemoteClient *client = m_clients.lockedGetClientNoEx(client_id))
12781278
client->SetBlocksNotSent(block);
12791279
}
@@ -1584,9 +1584,9 @@ void Server::SendSpawnParticle(session_t peer_id, u16 protocol_version,
15841584
g_settings->getS16("max_block_send_distance") * MAP_BLOCKSIZE * BS;
15851585

15861586
if (peer_id == PEER_ID_INEXISTENT) {
1587-
std::vector<u16> clients = m_clients.getClientIDs();
1587+
std::vector<session_t> clients = m_clients.getClientIDs();
15881588

1589-
for (const u16 client_id : clients) {
1589+
for (const session_t client_id : clients) {
15901590
RemotePlayer *player = m_env->getPlayer(client_id);
15911591
if (!player)
15921592
continue;
@@ -1633,8 +1633,8 @@ void Server::SendAddParticleSpawner(session_t peer_id, u16 protocol_version,
16331633
{
16341634
if (peer_id == PEER_ID_INEXISTENT) {
16351635
// This sucks and should be replaced:
1636-
std::vector<u16> clients = m_clients.getClientIDs();
1637-
for (const u16 client_id : clients) {
1636+
std::vector<session_t> clients = m_clients.getClientIDs();
1637+
for (const session_t client_id : clients) {
16381638
RemotePlayer *player = m_env->getPlayer(client_id);
16391639
if (!player)
16401640
continue;
@@ -1941,7 +1941,7 @@ s32 Server::playSound(const SimpleSoundSpec &spec,
19411941
return -1;
19421942

19431943
// Filter destination clients
1944-
std::vector<u16> dst_clients;
1944+
std::vector<session_t> dst_clients;
19451945
if(!params.to_player.empty()) {
19461946
RemotePlayer *player = m_env->getPlayer(params.to_player.c_str());
19471947
if(!player){
@@ -1956,9 +1956,9 @@ s32 Server::playSound(const SimpleSoundSpec &spec,
19561956
}
19571957
dst_clients.push_back(player->peer_id);
19581958
} else {
1959-
std::vector<u16> clients = m_clients.getClientIDs();
1959+
std::vector<session_t> clients = m_clients.getClientIDs();
19601960

1961-
for (const u16 client_id : clients) {
1961+
for (const session_t client_id : clients) {
19621962
RemotePlayer *player = m_env->getPlayer(client_id);
19631963
if (!player)
19641964
continue;
@@ -2016,7 +2016,7 @@ void Server::stopSound(s32 handle)
20162016
NetworkPacket pkt(TOCLIENT_STOP_SOUND, 4);
20172017
pkt << handle;
20182018

2019-
for (std::unordered_set<u16>::const_iterator si = psound.clients.begin();
2019+
for (std::unordered_set<session_t>::const_iterator si = psound.clients.begin();
20202020
si != psound.clients.end(); ++si) {
20212021
// Send as reliable
20222022
m_clients.send(*si, 0, &pkt, true);
@@ -2080,8 +2080,8 @@ void Server::sendRemoveNode(v3s16 p, u16 ignore_id,
20802080
NetworkPacket pkt(TOCLIENT_REMOVENODE, 6);
20812081
pkt << p;
20822082

2083-
std::vector<u16> clients = m_clients.getClientIDs();
2084-
for (u16 client_id : clients) {
2083+
std::vector<session_t> clients = m_clients.getClientIDs();
2084+
for (session_t client_id : clients) {
20852085
if (far_players) {
20862086
// Get player
20872087
if (RemotePlayer *player = m_env->getPlayer(client_id)) {
@@ -2110,8 +2110,8 @@ void Server::sendAddNode(v3s16 p, MapNode n, u16 ignore_id,
21102110
float maxd = far_d_nodes*BS;
21112111
v3f p_f = intToFloat(p, BS);
21122112

2113-
std::vector<u16> clients = m_clients.getClientIDs();
2114-
for (const u16 client_id : clients) {
2113+
std::vector<session_t> clients = m_clients.getClientIDs();
2114+
for (const session_t client_id : clients) {
21152115
if (far_players) {
21162116
// Get player
21172117
if (RemotePlayer *player = m_env->getPlayer(client_id)) {
@@ -2145,9 +2145,9 @@ void Server::sendAddNode(v3s16 p, MapNode n, u16 ignore_id,
21452145

21462146
void Server::setBlockNotSent(v3s16 p)
21472147
{
2148-
std::vector<u16> clients = m_clients.getClientIDs();
2148+
std::vector<session_t> clients = m_clients.getClientIDs();
21492149
m_clients.lock();
2150-
for (const u16 i : clients) {
2150+
for (const session_t i : clients) {
21512151
RemoteClient *client = m_clients.lockedGetClientNoEx(i);
21522152
client->SetBlockNotSent(p);
21532153
}
@@ -2189,10 +2189,10 @@ void Server::SendBlocks(float dtime)
21892189
{
21902190
ScopeProfiler sp2(g_profiler, "Server: selecting blocks for sending");
21912191

2192-
std::vector<u16> clients = m_clients.getClientIDs();
2192+
std::vector<session_t> clients = m_clients.getClientIDs();
21932193

21942194
m_clients.lock();
2195-
for (const u16 client_id : clients) {
2195+
for (const session_t client_id : clients) {
21962196
RemoteClient *client = m_clients.lockedGetClientNoEx(client_id, CS_Active);
21972197

21982198
if (!client)
@@ -2675,9 +2675,9 @@ void Server::DeleteClient(session_t peer_id, ClientDeletionReason reason)
26752675
{
26762676
if (player && reason != CDR_DENY) {
26772677
std::ostringstream os(std::ios_base::binary);
2678-
std::vector<u16> clients = m_clients.getClientIDs();
2678+
std::vector<session_t> clients = m_clients.getClientIDs();
26792679

2680-
for (const u16 client_id : clients) {
2680+
for (const session_t client_id : clients) {
26812681
// Get player
26822682
RemotePlayer *player = m_env->getPlayer(client_id);
26832683
if (!player)
@@ -2812,7 +2812,7 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
28122812
*/
28132813
actionstream << "CHAT: " << wide_to_narrow(unescape_enriched(line)) << std::endl;
28142814

2815-
std::vector<u16> clients = m_clients.getClientIDs();
2815+
std::vector<session_t> clients = m_clients.getClientIDs();
28162816

28172817
/*
28182818
Send the message back to the inital sender
@@ -2886,8 +2886,8 @@ std::wstring Server::getStatusString()
28862886
// Information about clients
28872887
bool first = true;
28882888
os<<L", clients={";
2889-
std::vector<u16> clients = m_clients.getClientIDs();
2890-
for (u16 client_id : clients) {
2889+
std::vector<session_t> clients = m_clients.getClientIDs();
2890+
for (session_t client_id : clients) {
28912891
// Get player
28922892
RemotePlayer *player = m_env->getPlayer(client_id);
28932893
// Get name of player
@@ -2927,8 +2927,8 @@ bool Server::checkPriv(const std::string &name, const std::string &priv)
29272927
void Server::reportPrivsModified(const std::string &name)
29282928
{
29292929
if (name.empty()) {
2930-
std::vector<u16> clients = m_clients.getClientIDs();
2931-
for (const u16 client_id : clients) {
2930+
std::vector<session_t> clients = m_clients.getClientIDs();
2931+
for (const session_t client_id : clients) {
29322932
RemotePlayer *player = m_env->getPlayer(client_id);
29332933
reportPrivsModified(player->getName());
29342934
}
@@ -3622,7 +3622,7 @@ ModChannel* Server::getModChannel(const std::string &channel)
36223622
}
36233623

36243624
void Server::broadcastModChannelMessage(const std::string &channel,
3625-
const std::string &message, u16 from_peer)
3625+
const std::string &message, session_t from_peer)
36263626
{
36273627
const std::vector<u16> &peers = m_modchannel_mgr->getChannelPeers(channel);
36283628
if (peers.empty())

0 commit comments

Comments
 (0)
Please sign in to comment.