MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / SendUpdatesToAll

Method SendUpdatesToAll

ogsr_engine/xrGame/xrServer.cpp:212–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void xrServer::SendUpdatesToAll()
213{
214 m_iCurUpdatePacket = 0;
215 NET_Packet* pCurUpdatePacket = &(m_aUpdatePackets[0]);
216 pCurUpdatePacket->B.count = 0;
217 u32 position;
218
219 for (u32 client = 0; client < net_Players.size(); ++client)
220 { // for each client
221 // Initialize process and check for available bandwidth
222 xrClientData* Client = (xrClientData*)net_Players[client];
223 if (!Client->net_Ready)
224 continue;
225 if (false
226
227#ifdef DEBUG
228 && !g_sv_SendUpdate
229#endif
230 )
231 continue;
232
233 // Send relevant entities to client
234 NET_Packet Packet;
235 u16 PacketType = M_UPDATE;
236 Packet.w_begin(PacketType);
237 // GameUpdate
238 game->net_Export_Update(Packet, Client->ID, Client->ID);
239 game->net_Export_GameTime(Packet);
240
241 if (Client->flags.bLocal) // this is server client;
242 {
243 SendTo(Client->ID, Packet, net_flags(FALSE, TRUE));
244 continue;
245 }
246
247 if (m_aUpdatePackets[0].B.count != 0) // not a first client in update cycle
248 {
249 m_aUpdatePackets[0].w_seek(0, Packet.B.data, Packet.B.count);
250 }
251 else
252 {
253 m_aUpdatePackets[0].w(Packet.B.data, Packet.B.count);
254
255 if (g_Dump_Update_Write)
256 {
257 if (Client->ps)
258 Msg("---- UPDATE_Write to %s --- ", Client->ps->getName());
259 else
260 Msg("---- UPDATE_Write to %s --- ", *(Client->name));
261 }
262
263 NET_Packet tmpPacket;
264
265 xrS_entities::iterator I = entities.begin();
266 xrS_entities::iterator E = entities.end();
267 for (; I != E; ++I)
268 { // all entities
269 CSE_Abstract& Test = *(I->second);

Callers

nothing calls this directly

Calls 15

net_flagsFunction · 0.85
MsgFunction · 0.85
w_beginMethod · 0.80
net_Export_UpdateMethod · 0.80
net_Export_GameTimeMethod · 0.80
w_seekMethod · 0.80
isMethod · 0.80
Net_RelevantMethod · 0.80
w_chunk_open8Method · 0.80
w_tellMethod · 0.80
w_chunk_close8Method · 0.80
u32Enum · 0.70

Tested by

no test coverage detected