MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_Structure_SetState

Function Script_Structure_SetState

src/script/structure.c:54–77  ·  view source on GitHub ↗

* Set the state for the current structure. * * Stack: 1 - The state. * * @param script The script engine to operate on. * @return The value 0. Always. */

Source from the content-addressed store, hash-verified

52 * @return The value 0. Always.
53 */
54uint16 Script_Structure_SetState(ScriptEngine *script)
55{
56 Structure *s;
57 int16 state;
58
59 s = g_scriptCurrentStructure;
60 state = STACK_PEEK(1);
61
62 if (state == STRUCTURE_STATE_DETECT) {
63 if (s->o.linkedID == 0xFF) {
64 state = STRUCTURE_STATE_IDLE;
65 } else {
66 if (s->countDown == 0) {
67 state = STRUCTURE_STATE_READY;
68 } else {
69 state = STRUCTURE_STATE_BUSY;
70 }
71 }
72 }
73
74 Structure_SetState(s, state);
75
76 return 0;
77}
78
79/**
80 * Remove fog around the current structure.

Callers

nothing calls this directly

Calls 1

Structure_SetStateFunction · 0.85

Tested by

no test coverage detected