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

Method TransferMsg

engine/Poseidon/World/Simulation/Simul.cpp:1783–1889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781}
1782
1783TMError Entity::TransferMsg(NetworkMessageContext& ctx)
1784{
1785 switch (ctx.GetClass())
1786 {
1787 case NMCCreate:
1788 TMCHECK(NetworkObject::TransferMsg(ctx))
1789 if (ctx.IsSending())
1790 {
1791 PoseidonAssert(dynamic_cast<const IndicesCreateVehicle*>(ctx.GetIndices()))
1792 const IndicesCreateVehicle* indices = static_cast<const IndicesCreateVehicle*>(ctx.GetIndices());
1793
1794 RString type = GetName() ? GetName() : "";
1795 TMCHECK(ctx.IdxTransfer(indices->type, type))
1796 RString shape = _shape ? _shape->Name() : "";
1797 TMCHECK(ctx.IdxTransfer(indices->shape, shape))
1798 Vector3& position = const_cast<Vector3&>(Position());
1799 TMCHECK(ctx.IdxTransfer(indices->position, position))
1800 TMCHECK(ctx.IdxTransferRef(indices->hierParent, _hierParent))
1801 }
1802 break;
1803 case NMCUpdateGeneric:
1804 TMCHECK(base::TransferMsg(ctx))
1805 {
1806 PoseidonAssert(dynamic_cast<const IndicesUpdateVehicle*>(ctx.GetIndices()))
1807 const IndicesUpdateVehicle* indices = static_cast<const IndicesUpdateVehicle*>(ctx.GetIndices());
1808 ITRANSF_ENUM(targetSide)
1809 if (ctx.IsSending())
1810 {
1811 AUTO_STATIC_ARRAY(float, animations, 32);
1812 animations.Resize(_animations.Size());
1813 for (int i = 0; i < _animations.Size(); i++)
1814 {
1815 animations[i] = _animations[i].GetPhaseWanted();
1816 }
1817 TMCHECK(ctx.IdxTransfer(indices->animations, animations))
1818 }
1819 else
1820 {
1821 AUTO_STATIC_ARRAY(float, animations, 32);
1822 TMCHECK(ctx.IdxTransfer(indices->animations, animations))
1823 for (int i = 0; i < _animations.Size(); i++)
1824 {
1825 if (i < animations.Size())
1826 {
1827 _animations[i].SetPhaseWanted(animations[i]);
1828 }
1829 }
1830 }
1831 }
1832 break;
1833 case NMCUpdatePosition:
1834 TMCHECK(base::TransferMsg(ctx))
1835 {
1836 PoseidonAssert(dynamic_cast<const IndicesUpdatePositionVehicle*>(ctx.GetIndices()))
1837 const IndicesUpdatePositionVehicle* indices =
1838 static_cast<const IndicesUpdatePositionVehicle*>(ctx.GetIndices());
1839 if (ctx.IsSending())
1840 {

Callers

nothing calls this directly

Calls 15

TMCHECKFunction · 0.85
IsInLandscapeFunction · 0.85
GetClassMethod · 0.80
IsSendingMethod · 0.80
IdxTransferRefMethod · 0.80
IdxSendRawMethod · 0.80
IdxGetRawMethod · 0.80
SquareFunction · 0.50
GetIndicesMethod · 0.45
IdxTransferMethod · 0.45
NameMethod · 0.45
EncodeMethod · 0.45

Tested by

no test coverage detected