From 2ad601debe1af58ac2662910f638714a6e135b0c Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 3 May 2015 21:58:03 -0700 Subject: [PATCH] Move SDL send into plSDLModifier. It was the only user of SendSDLState, and doing this removes the need to link against plNetClientMgr. --- .../PubUtilLib/plModifier/plSDLModifier.cpp | 33 ++++++++++++++++--- .../plNetClient/plNetClientMgrSend.cpp | 31 ----------------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp index c6af1fc2..069de24f 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp @@ -91,15 +91,40 @@ void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint bool dirtyOnly = (sendFlags & plSynchedObject::kForceFullSend) == 0; bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0; int writeOptions=0; + // if (dirtyOnly) writeOptions |= plSDL::kDirtyOnly; if (broadcast) writeOptions |= plSDL::kBroadcast; - + writeOptions |= plSDL::kTimeStampOnRead; - - plNetClientMgr::GetInstance()->StoreSDLState(state, senderKey->GetUoid(), sendFlags, writeOptions); - + + + // send to server + plNetMsgSDLState* msg = state->PrepNetMsg(0, writeOptions); + msg->SetNetProtocol(kNetProtocolCli2Game); + msg->ObjectInfo()->SetUoid(senderKey->GetUoid()); + + if (sendFlags & plSynchedObject::kNewState) + msg->SetBit(plNetMessage::kNewSDLState); + + if (sendFlags & plSynchedObject::kUseRelevanceRegions) + msg->SetBit(plNetMessage::kUseRelevanceRegions); + + if (sendFlags & plSynchedObject::kDontPersistOnServer) + msg->SetPersistOnServer(false); + + if (sendFlags & plSynchedObject::kIsAvatarState) + msg->SetIsAvatarState(true); + + if (broadcast && plNetClientApp::GetInstance()) + { + msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID()); + } + + plNetClientApp::GetInstance()->SendMsg(msg); + msg->UnRef(); + fSentOrRecvdState = true; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp index 2ff72f57..affd3489 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp @@ -437,34 +437,3 @@ int plNetClientMgr::SendMsg(plNetMessage* msg) return ret; } - - -void plNetClientMgr::StoreSDLState(const plStateDataRecord* sdRec, const plUoid& uoid, - uint32_t sendFlags, uint32_t writeOptions) -{ - // send to server - plNetMsgSDLState* msg = sdRec->PrepNetMsg(0, writeOptions); - msg->SetNetProtocol(kNetProtocolCli2Game); - msg->ObjectInfo()->SetUoid(uoid); - - if (sendFlags & plSynchedObject::kNewState) - msg->SetBit(plNetMessage::kNewSDLState); - - if (sendFlags & plSynchedObject::kUseRelevanceRegions) - msg->SetBit(plNetMessage::kUseRelevanceRegions); - - if (sendFlags & plSynchedObject::kDontPersistOnServer) - msg->SetPersistOnServer(false); - - if (sendFlags & plSynchedObject::kIsAvatarState) - msg->SetIsAvatarState(true); - - bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0; - if (broadcast && plNetClientApp::GetInstance()) - { - msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID()); - } - - SendMsg(msg); - delete msg; -}