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

Method CreateObject

engine/Poseidon/Network/NetworkClientActions.cpp:179–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177 CheckLocalObjects();
178#endif
179
180 return id;
181}
182
183bool NetworkClient::CreateObject(NetworkObject* object)
184{
185 if (!object)
186 {
187 return false;
188 }
189 if (_state < NGSLoadIsland)
190 {
191 return false;
192 }
193
194 NetworkId id = CreateLocalObject(object);
195
196 // send message to center
197 NetworkMessageType msgType = object->GetNMType(NMCCreate);
198 NetworkMessageFormatBase* format = GetFormat(/*LOCAL_PLAYER, */ msgType);
199
200 // create message
201 Ref<NetworkMessage> msg = new NetworkMessage();
202 msg->time = Glob.time;
203 NetworkMessageContext ctx(msg, format, this, TO_SERVER, MSG_SEND);
204 ctx.SetClass(NMCCreate);
205 if (object->TransferMsg(ctx) != TMOK)
206 {
207 return false;
208 }
209
210 // send message
211 DWORD dwMsgId = NetworkComponent::SendMsg(TO_SERVER, msg, msgType, NMFGuaranteed);
212 return dwMsgId != 0xFFFFFFFF;

Callers

nothing calls this directly

Calls 3

SetClassMethod · 0.80
GetNMTypeMethod · 0.45
TransferMsgMethod · 0.45

Tested by

no test coverage detected