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

Function ObjSetIdentity

engine/Poseidon/Game/Commands/GameStateExtUi.cpp:200–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200GameValue ObjSetIdentity(const GameState* state, GameValuePar oper1, GameValuePar oper2)
201{
202 Object* obj = GetObject(oper1);
203 if (!obj)
204 {
205 return NOTHING;
206 }
207
208 VehicleWithBrain* person = dyn_cast<VehicleWithBrain>(obj);
209 if (!person)
210 {
211 return NOTHING;
212 }
213
214 GameStringType name = oper2;
215 const ParamEntry* entry = FindIdentity(name);
216 if (entry)
217 {
218 AIUnitInfo& info = person->GetInfo();
219 info._identityContext = RString();
220 info._name = DecodeLegacyTextToRString((*entry) >> "name", GLanguage);
221 info._face = (*entry) >> "face";
222 info._glasses = (*entry) >> "glasses";
223 info._speaker = (*entry) >> "speaker";
224 info._pitch = (*entry) >> "pitch";
225
226 person->SetFace(info._face);
227 person->SetGlasses(info._glasses);
228 if (person->Brain())
229 {
230 person->Brain()->SetSpeaker(info._speaker, info._pitch);
231 }
232 }
233
234 return NOTHING;
235}
236
237GameValue ObjSetFace(const GameState* state, GameValuePar oper1, GameValuePar oper2)
238{

Callers

nothing calls this directly

Calls 8

FindIdentityFunction · 0.85
BrainMethod · 0.80
GetObjectFunction · 0.70
RStringClass · 0.50
SetFaceMethod · 0.45
SetGlassesMethod · 0.45
SetSpeakerMethod · 0.45

Tested by

no test coverage detected