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

Method Update

ogsr_engine/xrGame/xrServer.cpp:159–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157#endif
158
159void xrServer::Update()
160{
161 NET_Packet Packet;
162 csPlayers.Enter();
163
164 VERIFY(verify_entities());
165
166 ProceedDelayedPackets();
167 // game update
168 game->ProcessDelayedEvent();
169 game->Update();
170
171 // spawn queue
172 u32 svT = Device.TimerAsync();
173 while (!(q_respawn.empty() || (svT < q_respawn.begin()->timestamp)))
174 {
175 // get
176 svs_respawn R = *q_respawn.begin();
177 q_respawn.erase(q_respawn.begin());
178
179 //
180 CSE_Abstract* E = ID_to_entity(R.phantom);
181 E->Spawn_Write(Packet, FALSE);
182 u16 ID;
183 Packet.r_begin(ID);
184 R_ASSERT(M_SPAWN == ID);
185 ClientID clientID;
186 clientID.set(0xffff);
187 Process_spawn(Packet, clientID);
188 }
189
190 SendUpdatesToAll();
191
192 if (game->sv_force_sync)
193 Perform_game_export();
194
195 VERIFY(verify_entities());
196 //-----------------------------------------------------
197 // Remove any of long time disconnected players
198 for (u32 DI = 0; DI < net_Players_disconnected.size();)
199 {
200 IClient* CL = net_Players_disconnected[DI];
201 if (CL->dwTime_LastUpdate + g_sv_Client_Reconnect_Time * 60000 < Device.dwTimeGlobal)
202 {
203 client_Destroy(CL);
204 continue;
205 }
206 DI++;
207 }
208
209 csPlayers.Leave();
210}
211
212void xrServer::SendUpdatesToAll()
213{

Callers

nothing calls this directly

Calls 10

ProcessDelayedEventMethod · 0.80
Spawn_WriteMethod · 0.80
LeaveMethod · 0.80
EnterMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
eraseMethod · 0.45
r_beginMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected