1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
|
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>nevrax.org : docs</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD>
</TR>
</TABLE>
<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>
<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
<TR>
<TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!------ Begin Box ------>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
<TABLE cellspacing=0 cellpadding=1 border=0>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
<!-- block -->
<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
<TD><B>Documentation</B></TD>
<TD ALIGN=RIGHT> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.2 on Thu Feb 15 22:00:31 2001 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>actor_script.cpp</h1><a href="actor_script_cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="preprocessor">#include "<a class="code" href="actor_script_h.html">nel/ai/agent/actor_script.h</a>"</font>
00002 <font class="preprocessor">#include "<a class="code" href="agent_script_h.html">nel/ai/agent/agent_script.h</a>"</font>
00003 <font class="preprocessor">#include "<a class="code" href="object_type_h.html">nel/ai/agent/object_type.h</a>"</font>
00004 <font class="preprocessor">#include "<a class="code" href="codage_h.html">nel/ai/script/codage.h</a>"</font>
00005
00006 <font class="keyword">namespace</font> NLAIAGENT
00007 {
00008 <font class="keyword">static</font> CGroupType listBidon;
00009
<a name="l00010"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a1">00010</a> CActorScript::CActorScript(<font class="keyword">const</font> CActorScript &a) : CAgentScript(a)
00011 {
00012 _IsActivated = a._IsActivated;
00013 _OnActivateIndex = -1;
00014 }
00015
<a name="l00016"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a2">00016</a> CActorScript::CActorScript(IAgentManager *manager,
00017 IBasicAgent *father,
00018 std::list<IObjectIA *> &components,
00019 <a class="code" href="class_NLAISCRIPT__CActorClass.html">NLAISCRIPT::CActorClass</a> *actor_class )
00020 : CAgentScript(manager, father, components, actor_class )
00021 {
00022 _IsActivated = <font class="keyword">false</font>;
00023 }
00024
<a name="l00025"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a0">00025</a> CActorScript::CActorScript(IAgentManager *manager, <font class="keywordtype">bool</font> stay_alive) : CAgentScript( manager )
00026 {
00027 _IsActivated = <font class="keyword">false</font>;
00028 }
00029
<a name="l00030"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a3">00030</a> CActorScript::~CActorScript()<font class="keyword">
</font>00031 <font class="keyword"> </font>{
00032 }
00033
<a name="l00035"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a4">00035</a> <font class="keywordtype">bool</font> CActorScript::isActivated()<font class="keyword">
</font>00036 <font class="keyword"> </font>{
00037 <font class="keywordflow">return</font> _IsActivated;
00038 }
00039
<a name="l00041"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a5">00041</a> <font class="keywordtype">void</font> CActorScript::activate()<font class="keyword">
</font>00042 <font class="keyword"> </font>{
00043 <font class="keywordflow">if</font> ( !_IsActivated )
00044 {
00045 onActivate();
00046 _IsActivated = <font class="keyword">true</font>;
00047 }
00048 }
00049
<a name="l00051"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a7">00051</a> <font class="keywordtype">void</font> CActorScript::unActivate()<font class="keyword">
</font>00052 <font class="keyword"> </font>{
00053 <font class="keywordflow">if</font> ( _IsActivated )
00054 {
00055 onUnActivate();
00056 _IsActivated = <font class="keyword">false</font>;
00057 }
00058 }
00059
<a name="l00063"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#b0">00063</a> <font class="keywordtype">void</font> CActorScript::switchActor(CActorScript *receiver, <font class="keywordtype">bool</font> stay_active)<font class="keyword">
</font>00064 <font class="keyword"> </font>{
00065 receiver->activate();
00066
00067 <font class="keywordflow">if</font> ( !stay_active )
00068 unActivate();
00069 }
00070
<a name="l00074"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#b1">00074</a> <font class="keywordtype">void</font> CActorScript::switchActor(std::vector<CActorScript *> &actors, <font class="keywordtype">bool</font> stay_active)<font class="keyword">
</font>00075 <font class="keyword"> </font>{
00076 std::vector<CActorScript *>::iterator it_act = actors.begin();
00077 <font class="keywordflow">while</font> ( it_act != actors.end() )
00078 {
00079 ( *it_act )->activate();
00080 it_act++;
00081 }
00082 <font class="comment">// TODO: Envoi de message "activate" </font>
00083 <font class="keywordflow">if</font> ( !stay_active )
00084 unActivate();
00085 }
00086
<a name="l00090"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#b2">00090</a> <font class="keywordtype">void</font> CActorScript::switchActor(std::vector<CComponentHandle *> &handles, <font class="keywordtype">bool</font> stay_active)<font class="keyword">
</font>00091 <font class="keyword"> </font>{
00092 std::vector<CComponentHandle *>::iterator it_handle = handles.begin();
00093 <font class="keywordflow">while</font> ( it_handle != handles.end() )
00094 {
00095 ( (CActorScript *)( *it_handle )->getValue() )->activate();
00096 it_handle++;
00097 }
00098 <font class="comment">// TODO: Envoi de message "activate" </font>
00099 <font class="keywordflow">if</font> ( !stay_active )
00100 unActivate();
00101 }
00102
00103
<a name="l00105"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a6">00105</a> <font class="keywordtype">void</font> CActorScript::onActivate()<font class="keyword">
</font>00106 <font class="keyword"> </font>{
00107 <font class="comment">// Default behaviour: do nothing</font>
00108 }
00109
<a name="l00111"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a8">00111</a> <font class="keywordtype">void</font> CActorScript::onUnActivate()<font class="keyword">
</font>00112 <font class="keyword"> </font>{
00113 <font class="comment">// default behaviour: do nothing</font>
00114 }
00115
<a name="l00116"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a10">00116</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__IBasicType.html">NLAIC::IBasicType</a> *CActorScript::clone()<font class="keyword"> const
</font>00117 <font class="keyword"> </font>{
00118 CActorScript *m = <font class="keyword">new</font> CActorScript(*<font class="keyword">this</font>);
00119 <font class="keywordflow">return</font> m;
00120 }
00121
<a name="l00122"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a11">00122</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__IBasicType.html">NLAIC::IBasicType</a> *CActorScript::newInstance()<font class="keyword"> const
</font>00123 <font class="keyword"> </font>{
00124 CActorScript *instance;
00125 <font class="keywordflow">if</font> ( _AgentClass )
00126 {
00127 instance = (CActorScript *) _AgentClass->buildNewInstance();
00128 }
00129 <font class="keywordflow">else</font>
00130 {
00131 instance = <font class="keyword">new</font> CActorScript(NULL);
00132 }
00133 <font class="keywordflow">return</font> instance;
00134 }
00135
<a name="l00136"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a12">00136</a> <font class="keywordtype">void</font> CActorScript::getDebugString(<font class="keywordtype">char</font> *t)<font class="keyword"> const
</font>00137 <font class="keyword"> </font>{
00138 strcpy(t,<font class="stringliteral">"CActorScript "</font>);
00139 <font class="keywordflow">if</font> ( _IsActivated )
00140 strcat(t, <font class="stringliteral">"<active>"</font>);
00141 <font class="keywordflow">else</font>
00142 strcat(t, <font class="stringliteral">"<idle>"</font>);
00143 }
00144
<a name="l00145"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a13">00145</a> <font class="keywordtype">bool</font> CActorScript::isEqual(<font class="keyword">const</font> IBasicObjectIA &a)<font class="keyword"> const
</font>00146 <font class="keyword"> </font>{
00147 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00148 }
00149
<a name="l00150"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a16">00150</a> IObjectIA::CProcessResult CActorScript::sendMessage(IObjectIA *m)<font class="keyword">
</font>00151 <font class="keyword"> </font>{
00152 <font class="keywordflow">return</font> CAgentScript::sendMessage(m);
00153 }
00154
<a name="l00155"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a14">00155</a> <font class="keywordtype">void</font> CActorScript::processMessages()<font class="keyword">
</font>00156 <font class="keyword"> </font>{
00157 <font class="keywordflow">if</font> ( _IsActivated )
00158 CAgentScript::processMessages();
00159 }
00160
<a name="l00161"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a15">00161</a> <font class="keyword">const</font> IObjectIA::CProcessResult &CActorScript::run()<font class="keyword">
</font>00162 <font class="keyword"> </font>{
00163 <font class="keywordflow">if</font> ( _IsActivated )
00164 {
00165 <font class="keywordflow">return</font> CAgentScript::run();
00166 }
00167 <font class="keywordflow">else</font>
00168 <font class="keywordflow">return</font> IObjectIA::ProcessRun;
00169 }
00170
00171 <font class="comment">/* IObjectIA *CActorScript::run(const IMessageBase &msg)
</font>00172 <font class="comment"> {
</font>00173 <font class="comment"> return CAgentScript::run( msg );
</font>00174 <font class="comment"> }
</font>00175 <font class="comment">*/</font>
<a name="l00176"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a17">00176</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a> &CActorScript::getType()<font class="keyword"> const
</font>00177 <font class="keyword"> </font>{
00178 <font class="keywordflow">return</font> IdActorScript;
00179 }
00180
<a name="l00181"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a18">00181</a> <font class="keywordtype">void</font> CActorScript::save(<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a> &os)<font class="keyword">
</font>00182 <font class="keyword"> </font>{
00183 CAgentScript::save(os);
00184 sint32 b = (_IsActivated == <font class="keyword">false</font>);
00185 os.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( b );
00186 }
00187
<a name="l00188"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a19">00188</a> <font class="keywordtype">void</font> CActorScript::load(<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a> &is)<font class="keyword">
</font>00189 <font class="keyword"> </font>{
00190 CAgentScript::load(is);
00191 sint32 b;
00192 is.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( b );
00193 _IsActivated = !b ;
00194 }
00195
<a name="l00196"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a23">00196</a> sint32 CActorScript::getMethodIndexSize()<font class="keyword"> const
</font>00197 <font class="keyword"> </font>{
00198
00199 <font class="keywordflow">return</font> CAgentScript::getBaseMethodCount() + fid_switch;
00200 }
00201
00202 <font class="comment">// virtual IObjectIA::CProcessResult runMethodBase(int heritance, int index,IObjectIA *);</font>
00203
00204
<a name="l00205"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a20">00205</a> IObjectIA::CProcessResult CActorScript::runMethodBase(<font class="keywordtype">int</font> index,<font class="keywordtype">int</font> heritance, IObjectIA *params)<font class="keyword">
</font>00206 <font class="keyword"> </font>{
00207 IObjectIA::CProcessResult r;
00208
00209 <font class="keywordflow">if</font> ( index == fid_activate )
00210 {
00211 activate();
00212 IObjectIA::CProcessResult r;
00213 r.ResultState = NLAIAGENT::processIdle;
00214 r.Result = NULL;
00215 }
00216
00217 <font class="keywordflow">if</font> ( index == fid_onActivate )
00218 {
00219 onActivate();
00220 IObjectIA::CProcessResult r;
00221 r.ResultState = NLAIAGENT::processIdle;
00222 r.Result = NULL;
00223 }
00224
00225 <font class="keywordflow">if</font> ( index == fid_unActivate )
00226 {
00227 unActivate();
00228 IObjectIA::CProcessResult r;
00229 r.ResultState = NLAIAGENT::processIdle;
00230 r.Result = NULL;
00231 }
00232
00233 <font class="keywordflow">if</font> ( index == fid_onUnActivate )
00234 {
00235 onUnActivate();
00236 IObjectIA::CProcessResult r;
00237 r.ResultState = NLAIAGENT::processIdle;
00238 r.Result = NULL;
00239 }
00240
00241 <font class="keywordflow">if</font> ( index == fid_switch )
00242 {
00243 std::vector<CStringType *> handles;
00244 <font class="keywordflow">if</font> ( ( (<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *) params)->size() )
00245 {
00246 IBaseGroupType *fw = (IBaseGroupType *) ( ((<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)params) )->getFront();
00247 ( ((<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)params))->popFront();
00248 <font class="keywordflow">while</font> ( fw->size() )
00249 {
00250 handles.push_back( (CStringType *) fw->getFront() );
00251 fw->popFront();
00252 }
00253 std::vector<CComponentHandle *> switched;
00254 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < (<font class="keywordtype">int</font>) handles.size(); i++)
00255 switched.push_back( <font class="keyword">new</font> CComponentHandle( handles[ i ]->getStr() , (IAgent *) getParent() ) );
00256
00257 switchActor( switched, <font class="keyword">false</font> );
00258 }
00259 IObjectIA::CProcessResult r;
00260 r.ResultState = NLAIAGENT::processIdle;
00261 r.Result = NULL;
00262 }
00263 <font class="keywordflow">return</font> CAgentScript::runMethodeMember(heritance,index,params);
00264 }
00265
00266
00267
<a name="l00268"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a21">00268</a> IObjectIA::CProcessResult CActorScript::runMethodBase(<font class="keywordtype">int</font> index,IObjectIA *params)<font class="keyword">
</font>00269 <font class="keyword"> </font>{
00270
00271 index = index - IAgent::getMethodIndexSize();
00272 <font class="comment">/*
</font>00273 <font class="comment">
</font>00274 <font class="comment"> if ( index < getBaseMethodCount() )
</font>00275 <font class="comment"> return CAgentScript::runMethodeMember(index, params);
</font>00276 <font class="comment">*/</font>
00277 IObjectIA::CProcessResult r;
00278
00279 <font class="keywordtype">char</font> buf[1024];
00280 getDebugString(buf);
00281
00282 <font class="comment">// index = index - getBaseMethodCount();</font>
00283
00284 <font class="keywordflow">if</font> ( index == fid_activate )
00285 {
00286 activate();
00287 IObjectIA::CProcessResult r;
00288 r.ResultState = NLAIAGENT::processIdle;
00289 r.Result = NULL;
00290 }
00291
00292 <font class="keywordflow">if</font> ( index == fid_onActivate )
00293 {
00294 onActivate();
00295 IObjectIA::CProcessResult r;
00296 r.ResultState = NLAIAGENT::processIdle;
00297 r.Result = NULL;
00298 }
00299
00300 <font class="keywordflow">if</font> ( index == fid_unActivate )
00301 {
00302 unActivate();
00303 IObjectIA::CProcessResult r;
00304 r.ResultState = NLAIAGENT::processIdle;
00305 r.Result = NULL;
00306 }
00307
00308 <font class="keywordflow">if</font> ( index == fid_onUnActivate )
00309 {
00310 onUnActivate();
00311 IObjectIA::CProcessResult r;
00312 r.ResultState = NLAIAGENT::processIdle;
00313 r.Result = NULL;
00314 }
00315
00316 <font class="keywordflow">if</font> ( index == fid_switch )
00317 {
00318 std::vector<CStringType *> handles;
00319 <font class="keywordflow">if</font> ( ( (<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *) params)->size() )
00320 {
00321 <font class="preprocessor">#ifdef _DEBUG
</font>00322 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_param_type = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) params->getType();
00323 <font class="keywordtype">char</font> dbg_param_string[1024 * 8];
00324 params->getDebugString(dbg_param_string);
00325 <font class="preprocessor">#endif
</font>00326 <font class="preprocessor"></font> <font class="keyword">const</font> IObjectIA *fw = ( ((<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)params) )->getFront();
00327 <font class="preprocessor">#ifdef _DEBUG
</font>00328 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_param_front_type = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) fw->getType();
00329 <font class="preprocessor">#endif
</font>00330 <font class="preprocessor"></font>
00331 ( ((<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)params))->popFront();
00332 <font class="comment">// while ( fw->size() )</font>
00333 <font class="comment">// {</font>
00334 handles.push_back( (CStringType *) fw);
00335 <font class="comment">// fw->popFront();</font>
00336 <font class="comment">// }</font>
00337
00338 std::vector<CComponentHandle *> switched;
00339 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < (<font class="keywordtype">int</font>) handles.size(); i++)
00340 switched.push_back( <font class="keyword">new</font> CComponentHandle( handles[ i ]->getStr(), (IAgent *) getParent() ) );
00341 switchActor( switched, <font class="keyword">false</font> );
00342 }
00343 IObjectIA::CProcessResult r;
00344 r.ResultState = NLAIAGENT::processIdle;
00345 r.Result = NULL;
00346 }
00347 <font class="keywordflow">return</font> r;
00348 }
00349
<a name="l00350"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a9">00350</a> <font class="keywordtype">int</font> CActorScript::getBaseMethodCount()<font class="keyword"> const
</font>00351 <font class="keyword"> </font>{
00352 <font class="keywordflow">return</font> CAgentScript::getBaseMethodCount() + fid_last;
00353 }
00354
00355
<a name="l00356"></a><a class="code" href="class_NLAIAGENT__CActorScript.html#a22">00356</a> tQueue CActorScript::isMember(<font class="keyword">const</font> IVarName *className,<font class="keyword">const</font> IVarName *name,<font class="keyword">const</font> IObjectIA &param)<font class="keyword"> const
</font>00357 <font class="keyword"> </font>{
00358
00359 <font class="keyword">const</font> <font class="keywordtype">char</font> *txt = name->getString();
00360
00361 tQueue result = CAgentScript::isMember( className, name, param);
00362
00363 <font class="keywordflow">if</font> ( result.size() )
00364 <font class="keywordflow">return</font> result;
00365
00366 <font class="keywordflow">if</font> ( *name == CStringVarName(<font class="stringliteral">"activate"</font>) )
00367 {
00368 <a class="code" href="class_NLAIAGENT__CObjectType.html">NLAIAGENT::CObjectType</a> *r_type = <font class="keyword">new</font> NLAIAGENT::CObjectType( <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>( NLAIC::CIdentType::VoidType ) );
00369 result.push( <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a>( IAgent::getMethodIndexSize() + fid_activate, 0.0,NULL, r_type ) );
00370 }
00371
00372 <font class="keywordflow">if</font> ( *name == CStringVarName(<font class="stringliteral">"onActivate"</font>) )
00373 {
00374 <a class="code" href="class_NLAIAGENT__CObjectType.html">NLAIAGENT::CObjectType</a> *r_type = <font class="keyword">new</font> NLAIAGENT::CObjectType( <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>( NLAIC::CIdentType::VoidType ) );
00375 result.push( <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a>( IAgent::getMethodIndexSize() + fid_onActivate , 0.0,NULL, r_type ) );
00376 }
00377
00378
00379 <font class="keywordflow">if</font> ( *name == CStringVarName(<font class="stringliteral">"unActivate"</font>) )
00380 {
00381 CObjectType *r_type = <font class="keyword">new</font> CObjectType( <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>( NLAIC::CIdentType::VoidType ) );
00382 result.push( <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a>( IAgent::getMethodIndexSize() + fid_onUnActivate, 0.0,NULL, r_type ) );
00383 }
00384
00385 <font class="keywordflow">if</font> ( *name == CStringVarName(<font class="stringliteral">"onUnActivate"</font>) )
00386 {
00387 CObjectType *r_type = <font class="keyword">new</font> CObjectType( <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>( NLAIC::CIdentType::VoidType ) );
00388 result.push( <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a>( IAgent::getMethodIndexSize() + fid_unActivate, 0.0,NULL, r_type ) );
00389 }
00390
00391 <font class="keywordflow">if</font> ( *name == CStringVarName(<font class="stringliteral">"switch"</font>) )
00392 {
00393 CObjectType *r_type = <font class="keyword">new</font> CObjectType( <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>( NLAIC::CIdentType::VoidType ) );
00394 result.push( <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a>( IAgent::getMethodIndexSize() + fid_switch, 0.0, NULL, r_type ) );
00395 }
00396
00397 <font class="keywordflow">if</font>(_AgentClass != NULL)
00398 {
00399 tQueue r = _AgentClass->isMember(className, name, param);
00400 <font class="keywordflow">if</font>(r.size() != 0) <font class="keywordflow">return</font> r;
00401 }
00402 <font class="keywordflow">return</font> result;
00403 }
00404 }
</div></pre>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|