* Set in a safe way the new value for variable4. * @param o The Object to set variable4 for. * @param index The encoded index to set it to. */
| 52 | * @param index The encoded index to set it to. |
| 53 | */ |
| 54 | void Object_Script_Variable4_Set(Object *o, uint16 encoded) |
| 55 | { |
| 56 | StructureInfo *si; |
| 57 | Structure *s; |
| 58 | |
| 59 | if (o == NULL) return; |
| 60 | |
| 61 | o->script.variables[4] = encoded; |
| 62 | |
| 63 | if (o->flags.s.isUnit) return; |
| 64 | |
| 65 | si = &g_table_structureInfo[o->type]; |
| 66 | if (!si->o.flags.busyStateIsIncoming) return; |
| 67 | |
| 68 | s = (Structure *)o; |
| 69 | if (Structure_GetLinkedUnit(s) != NULL) return; |
| 70 | |
| 71 | Structure_SetState(s, (encoded == 0) ? STRUCTURE_STATE_IDLE : STRUCTURE_STATE_BUSY); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Clear variable4 in a safe (and recursive) way from an object. |
no test coverage detected