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

Function ObjSetTexture

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

Source from the content-addressed store, hash-verified

366}
367
368GameValue ObjSetTexture(const GameState* state, GameValuePar oper1, GameValuePar oper2)
369{
370 const GameArrayType& array = oper2;
371 if (array.Size() != 2)
372 {
373 state->SetError(EvalDim, array.Size(), 2);
374 return NOTHING;
375 }
376 if (array[0].GetType() != GameScalar)
377 {
378 state->TypeError(GameScalar, array[0].GetType());
379 return NOTHING;
380 }
381 if (array[1].GetType() != GameString)
382 {
383 state->TypeError(GameString, array[1].GetType());
384 return NOTHING;
385 }
386
387 Object* obj = GetObject(oper1);
388 if (!obj)
389 {
390 return NOTHING;
391 }
392
393 EntityAI* veh = dyn_cast<EntityAI>(obj);
394 if (!veh)
395 {
396 return NOTHING;
397 }
398
399 int index = toInt((float)array[0]);
400 RString name = array[1];
401
402 Ref<Texture> texture = GlobLoadTexture(Poseidon::FindPicture(name));
403 veh->SetObjectTexture(index, texture);
404 return NOTHING;
405}
406
407GameValue ObjGetNearestBuilding(const GameState* state, GameValuePar oper1)
408{

Callers

nothing calls this directly

Calls 9

GlobLoadTextureFunction · 0.85
FindPictureFunction · 0.85
TypeErrorMethod · 0.80
SetObjectTextureMethod · 0.80
GetObjectFunction · 0.70
toIntFunction · 0.50
SizeMethod · 0.45
SetErrorMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected