| 366 | } |
| 367 | |
| 368 | GameValue 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 | |
| 407 | GameValue ObjGetNearestBuilding(const GameState* state, GameValuePar oper1) |
| 408 | { |
nothing calls this directly
no test coverage detected