@@ -209,12 +209,11 @@ void xPsyche::Amnesia(S32 i)
209209 while (g != NULL )
210210 {
211211 xGoal* thisg = g;
212- g = g->Next ();
213- // this->goallist = this->goallist->Next();
212+ g = thisg->Next ();
214213
215- if (i == 0 && this ->GIDInStack (thisg->GetID ()) != NULL )
214+ if ((i != 0 ) || ( this ->GIDInStack (thisg->GetID ()) == 0 ) )
216215 {
217- continue ;
216+ thisg-> Clear () ;
218217 }
219218 }
220219}
@@ -238,3 +237,145 @@ S32 xPsyche::IndexInStack(S32 gid) const
238237
239238 return da_idx;
240239}
240+
241+ S32 xPsyche::GoalPopToBase (S32 overpend)
242+ {
243+ if (this ->flg_psyche & 4 )
244+ {
245+ return 0 ;
246+ }
247+ else if (this ->staktop < 1 )
248+ {
249+ return 0 ;
250+ }
251+ else
252+ {
253+ xPsyche::GoalPop (this ->goalstak [0 ]->GetID (), overpend);
254+ if ((this ->pendtype != PEND_TRAN_NONE) && ((this ->flg_psyche & 1 )))
255+ {
256+ this ->ForceTran (0 .01f , NULL );
257+
258+ }
259+ return 1 ;
260+ }
261+ }
262+
263+ xGoal* xPsyche::GetCurGoal () const
264+ {
265+ if (this ->staktop < 0 )
266+ {
267+ return NULL ;
268+ }
269+ else
270+ {
271+ return this ->goalstak [this ->staktop ];
272+ }
273+ }
274+
275+ S32 xPsyche::GIDOfActive () const
276+ {
277+ if (this ->staktop < 0 )
278+ {
279+ return 0 ;
280+ }
281+ else
282+ {
283+ return this ->goalstak [this ->staktop ]->GetID ();
284+ }
285+ }
286+
287+ S32 xPsyche::GIDOfPending () const
288+ {
289+ if (this ->pendgoal != 0 )
290+ {
291+ return this ->pendgoal ->GetID ();
292+ }
293+ else
294+ {
295+ return 0 ;
296+ }
297+ }
298+
299+ xGoal* xPsyche::GetPrevRecovery (S32 gid)
300+ {
301+ S32 idx_start = -1 ;
302+ S32 i;
303+ xGoal* recgoal = NULL ;
304+ xGoal* tmpgoal = NULL ;
305+
306+ if (gid == 0 )
307+ {
308+ for (idx_start = this ->staktop ; idx_start >= 0 ; idx_start--)
309+ {
310+ tmpgoal = this ->goalstak [idx_start];
311+ if (tmpgoal->GetFlags () & 8 )
312+ {
313+ recgoal = tmpgoal;
314+ break ;
315+ }
316+ }
317+ }
318+ else
319+ {
320+ for (i = this ->staktop ; i >= 0 ; i--)
321+ {
322+ if (gid == this ->goalstak [i]->GetID ())
323+ {
324+ idx_start = i - 1 ;
325+ break ;
326+ }
327+ }
328+ if (idx_start > 0 )
329+ {
330+ for (int i = idx_start; i >= 0 ; i--)
331+ {
332+ tmpgoal = this ->goalstak [i];
333+ if (tmpgoal->GetFlags () & 8 )
334+ {
335+ recgoal = tmpgoal;
336+ break ;
337+ }
338+ }
339+ }
340+ }
341+ return recgoal;
342+ }
343+
344+ void xPsyche::SetTopState (en_GOALSTATE state)
345+ {
346+ if (this ->staktop >= 0 )
347+ {
348+ this ->goalstak [this ->staktop ]->SetState (state);
349+ }
350+ }
351+
352+ F32 xPsyche::TimerGet (en_xpsytime tymr)
353+ {
354+ if (this ->staktop < 0 )
355+ {
356+ return -1 .0f ;
357+ }
358+ return *(&this ->tmr_stack [0 ][this ->staktop ] + tymr); // ...what?
359+ }
360+
361+ void xPsyche::TimerClear ()
362+ {
363+ if (this ->staktop < 0 )
364+ {
365+ return ;
366+ }
367+ // Missing unreachable branch here. Otherwise functionally identical.
368+ this ->tmr_stack [0 ][this ->staktop ] = 0 .0f ;
369+ }
370+
371+ void xPsyche::TimerUpdate (F32 dt)
372+ {
373+ F32* p;
374+ if (this ->staktop < 0 )
375+ {
376+ return ;
377+ }
378+
379+ p = &this ->tmr_stack [0 ][this ->staktop ];
380+ *p += dt;
381+ }
0 commit comments