MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / packConstraintNames

Method packConstraintNames

Engine/source/afx/afxConstraint.cpp:1188–1216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1186}
1187
1188void afxConstraintMgr::packConstraintNames(NetConnection* conn, BitStream* stream)
1189{
1190 // pack any named constraint names and ghost indices
1191 if (stream->writeFlag(mNames_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID?
1192 {
1193 stream->write(mNames_on_server.size());
1194 for (S32 i = 0; i < mNames_on_server.size(); i++)
1195 {
1196 stream->writeString(mNames_on_server[i]);
1197 NetObject* obj = dynamic_cast<NetObject*>(Sim::findObject(mNames_on_server[i]));
1198 if (!obj)
1199 {
1200 //Con::printf("CONSTRAINT-OBJECT %s does not exist.", names_on_server[i]);
1201 stream->write((S32)-1);
1202 }
1203 else
1204 {
1205 S32 ghost_id = conn->getGhostIndex(obj);
1206 /*
1207 if (ghost_id == -1)
1208 Con::printf("CONSTRAINT-OBJECT %s does not have a ghost.", names_on_server[i]);
1209 else
1210 Con::printf("CONSTRAINT-OBJECT %s name to server.", names_on_server[i]);
1211 */
1212 stream->write(ghost_id);
1213 }
1214 }
1215 }
1216}
1217
1218void afxConstraintMgr::unpackConstraintNames(BitStream* stream)
1219{

Callers 1

pack_constraint_infoMethod · 0.80

Calls 6

getGhostIndexMethod · 0.80
findObjectFunction · 0.50
writeFlagMethod · 0.45
sizeMethod · 0.45
writeMethod · 0.45
writeStringMethod · 0.45

Tested by

no test coverage detected