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

Method TransferMsg

engine/Poseidon/AI/AIUnit.cpp:1086–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1084}
1085
1086TMError AIUnit::TransferMsg(NetworkMessageContext& ctx)
1087{
1088 switch (ctx.GetClass())
1089 {
1090 case NMCCreate:
1091 {
1092 TMCHECK(NetworkObject::TransferMsg(ctx))
1093 {
1094 AI_ERROR(dynamic_cast<const IndicesCreateAIUnit*>(ctx.GetIndices()))
1095 const IndicesCreateAIUnit* indices = static_cast<const IndicesCreateAIUnit*>(ctx.GetIndices());
1096
1097 if (ctx.IsSending())
1098 {
1099 ITRANSF_REF(person)
1100 ITRANSF_REF(subgroup)
1101 ITRANSF(id)
1102 }
1103 AIUnitInfo& info = GetPerson()->GetInfo();
1104 TMCHECK(ctx.IdxTransfer(indices->name, info._name))
1105 TMCHECK(ctx.IdxTransfer(indices->face, info._face))
1106 TMCHECK(ctx.IdxTransfer(indices->glasses, info._glasses))
1107 TMCHECK(ctx.IdxTransfer(indices->speaker, info._speaker))
1108 TMCHECK(ctx.IdxTransfer(indices->pitch, info._pitch))
1109 TMCHECK(ctx.IdxTransfer(indices->rank, (int&)info._rank))
1110 TMCHECK(ctx.IdxTransfer(indices->experience, info._experience))
1111 TMCHECK(ctx.IdxTransfer(indices->initExperience, info._initExperience))
1112 TMCHECK(ctx.IdxTransfer(indices->playable, _playable))
1113 // ADDED in 1.04
1114 TMCHECK(ctx.IdxTransfer(indices->squadTitle, info._squadTitle))
1115 if (ctx.IsSending())
1116 {
1117 // ADDED in 1.04
1118 RString picture;
1119 if (info._squadPicture)
1120 {
1121 picture = info._squadPicture->GetName();
1122 }
1123 TMCHECK(ctx.IdxTransfer(indices->squadPicture, picture))
1124 }
1125 else
1126 {
1127 // ADDED in 1.04
1128 RString picture;
1129 TMCHECK(ctx.IdxTransfer(indices->squadPicture, picture))
1130 if (picture.GetLength() > 0)
1131 {
1132 info._squadPicture = GlobLoadTexture(picture);
1133 }
1134
1135 GetPerson()->SetFace(info._face, info._name);
1136 GetPerson()->SetGlasses(info._glasses);
1137 SetSpeaker(info._speaker, info._pitch);
1138 }
1139 }
1140 }
1141 break;
1142 case NMCUpdateGeneric:
1143 TMCHECK(NetworkObject::TransferMsg(ctx))

Callers 1

CreateObjectMethod · 0.45

Calls 12

TMCHECKFunction · 0.85
GetClassMethod · 0.80
IsSendingMethod · 0.80
IdxTransferRefMethod · 0.80
SetInfoMethod · 0.80
RemoveSensorMethod · 0.80
SetBrainMethod · 0.80
GetIndicesMethod · 0.45
SetFaceMethod · 0.45
SetGlassesMethod · 0.45
IdxTransferMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected