Debian Codegraph @

terps/alan3/actor.c

raw symbols SCIP
1 /*----------------------------------------------------------------------*\
2
3 actor
4
5 \*----------------------------------------------------------------------*/
6 #include "actor.h"
7
8 /* IMPORTS */
9 #include "instance.h"
10 #include "memory.h"
11 #include "lists.h"
12 #include "inter.h"
13 #include "msg.h"
14 #include "Container.h"
15
16
17 /* CONSTANTS */
18
19
20 /* PUBLIC DATA */
21
22
23 /* PRIVATE TYPES & DATA */
24
25
26 /*+++++++++++++++++++++++++++++++++++++++++++++++++++*/
27
28 /*======================================================================*/
29 ScriptEntry *scriptOf(int actor) {
30 ScriptEntry *scr;
31
32 if (admin[actor].script != 0) {
33 for (scr = (ScriptEntry *) pointerTo(header->scriptTableAddress); !isEndOfArray(scr); scr++)
34 if (scr->code == admin[actor].script)
35 break;
36 if (!isEndOfArray(scr))
37 return scr;
38 }
39 return NULL;
40 }
41
42
43 /*======================================================================*/
44 StepEntry *stepOf(int actor) {
45 StepEntry *step;
46 ScriptEntry *scr = scriptOf(actor);
47
48 if (scr == NULL) return NULL;
49
50 step = (StepEntry*)pointerTo(scr->steps);
51 step = &step[admin[actor].step];
52
53 return step;
54 }
55
56
57 /*======================================================================*/
58 void describeActor(int actor)
59 {
60 ScriptEntry *script = scriptOf(actor);
61
62 if (script != NULL && script->description != 0)
63 interpret(script->description);
64 else if (hasDescription(actor))
65 describeAnything(actor);
66 else {
67 printMessageWithInstanceParameter(M_SEE_START, actor);
68 printMessage(M_SEE_END);
69 if (instances[actor].container != 0)
70 describeContainer(actor);
71 }
72 admin[actor].alreadyDescribed = true;
73 }