MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / UpdateObject

Method UpdateObject

engine/Poseidon/Network/NetworkClientActions.cpp:251–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249 msg._remove = true;
250 SendMsg(&msg, NMFGuaranteed);
251
252 return true;
253}
254
255int NetworkClient::UpdateObject(NetworkObject* object, NetworkMessageClass cls, NetMsgFlags dwFlags)
256{
257 if (!object)
258 {
259 return -1;
260 }
261 if (_state < NGSLoadIsland)
262 {
263 return -1;
264 }
265
266 // find local objects
267 NetworkId id = object->GetNetworkId();
268 if (id.IsNull())
269 {
270 RptF("Client: Nonnetwork object %x.", object);
271 return -1;
272 }
273 if (!object->IsLocal())
274 {
275 RptF("Update of nonlocal object %d:%d called", id.creator, id.id);
276 return -1;
277 }
278#if CHECK_MSG
279 CheckLocalObjects();
280#endif
281 NetworkLocalObjectInfo* localObject = GetLocalObjectInfo(id);
282 if (!localObject)
283 {
284 return -1;
285 }
286
287 NetworkUpdateInfo& info = localObject->updates[cls];
288
289 // send message to center
290 NetworkMessageType msgType = object->GetNMType(cls);
291 if (msgType == NMTNone)
292 {
293 return -1;
294 }
295
296 // FIX
297 bool IsDedicatedServer();
298 if (msgType == NMTUpdateClientInfo && _parent->GetServer() && IsDedicatedServer())
299 {
300 return -1;
301 }
302
303 NetworkMessageFormatBase* format = GetFormat(/*LOCAL_PLAYER, */ msgType);
304
305 // create message
306 Ref<NetworkMessage> msg = new NetworkMessage();
307 // must be Ref - msg is stored
308 msg->time = Glob.time;

Callers

nothing calls this directly

Calls 13

IsDedicatedServerFunction · 0.85
GlobalTickCountFunction · 0.85
GetServerMethod · 0.80
SetClassMethod · 0.80
SetInitialUpdateMethod · 0.80
GetNetworkIdMethod · 0.45
IsNullMethod · 0.45
IsLocalMethod · 0.45
GetNMTypeMethod · 0.45
TransferMsgMethod · 0.45
GetIndicesMethod · 0.45
IdxTransferMethod · 0.45

Tested by

no test coverage detected