* Check if a Unit/Structure is a friend. * * Stack: 1 - An encoded index. * * @param script The script engine to operate on. * @return Either 1 (friendly) or -1 (enemy). */
| 344 | * @return Either 1 (friendly) or -1 (enemy). |
| 345 | */ |
| 346 | uint16 Script_General_IsFriendly(ScriptEngine *script) |
| 347 | { |
| 348 | uint16 index; |
| 349 | Object *o; |
| 350 | uint16 res; |
| 351 | |
| 352 | index = STACK_PEEK(1); |
| 353 | |
| 354 | o = Tools_Index_GetObject(index); |
| 355 | |
| 356 | if (o == NULL || o->flags.s.isNotOnMap || !o->flags.s.used) return 0; |
| 357 | |
| 358 | res = Script_General_IsEnemy(script); |
| 359 | |
| 360 | return (res == 0) ? 1 : -1; |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * Check if a Unit/Structure is an enemy. |
nothing calls this directly
no test coverage detected