#include <gCycle.h>
Public Member Functions | |
gCycleMemoryEntry * | Remember (const gCycle *cycle) |
int | Len () const |
gCycleMemoryEntry * | operator() (int i) const |
gCycleMemoryEntry * | Latest (int side) const |
gCycleMemoryEntry * | Earliest (int side) const |
void | Clear () |
gCycleMemory () | |
~gCycleMemory () | |
Private Attributes | |
tList< gCycleMemoryEntry > | memory |
Friends | |
class | gCycleMemoryEntry |
Definition at line 67 of file gCycle.h.
gCycleMemory::gCycleMemory | ( | ) |
gCycleMemory::~gCycleMemory | ( | ) |
Definition at line 930 of file gAIBase.cpp.
References Clear().
00931 { 00932 Clear(); 00933 }
gCycleMemoryEntry * gCycleMemory::Remember | ( | const gCycle * | cycle | ) |
Definition at line 916 of file gAIBase.cpp.
References GrowingArrayBase::Len(), memory, and tNEW.
00917 { 00918 for (int i=memory.Len()-1; i>=0; i--) 00919 if (memory(i)->cycle == cycle) 00920 return memory(i); 00921 00922 return tNEW(gCycleMemoryEntry)(this, cycle); 00923 }
int gCycleMemory::Len | ( | void | ) | const [inline] |
Definition at line 75 of file gCycle.h.
References GrowingArrayBase::Len(), and memory.
Referenced by operator()().
gCycleMemoryEntry * gCycleMemory::operator() | ( | int | i | ) | const |
gCycleMemoryEntry * gCycleMemory::Latest | ( | int | side | ) | const |
Definition at line 886 of file gAIBase.cpp.
References gCycleMemoryEntry::cycle, gCycleTouchEvent::dist, GrowingArrayBase::Len(), gCycleMemoryEntry::max, memory, and NULL.
Referenced by CheckLoop().
00887 { 00888 side = (side > 0 ? 1 : 0); 00889 gCycleMemoryEntry* ret = NULL; 00890 for (int i=memory.Len()-1; i>=0; i--) 00891 { 00892 gCycleMemoryEntry* m = memory(i); 00893 if ((!ret || (m->max[side].dist > ret->max[side].dist) 00894 && bool( m->cycle ) && m->cycle->Alive() )) 00895 ret = memory(i); 00896 } 00897 00898 return ret; 00899 }
gCycleMemoryEntry * gCycleMemory::Earliest | ( | int | side | ) | const |
Definition at line 901 of file gAIBase.cpp.
References gCycleMemoryEntry::cycle, gCycleTouchEvent::dist, GrowingArrayBase::Len(), memory, gCycleMemoryEntry::min, and NULL.
Referenced by CheckLoop().
00902 { 00903 side = (side > 0 ? 1 : 0); 00904 gCycleMemoryEntry* ret = NULL; 00905 for (int i=memory.Len()-1; i>=0; i--) 00906 { 00907 gCycleMemoryEntry* m = memory(i); 00908 if ((!ret || (m->min[side].dist < ret->min[side].dist) 00909 && bool( m->cycle ) && m->cycle->Alive())) 00910 ret = memory(i); 00911 } 00912 return ret; 00913 }
void gCycleMemory::Clear | ( | void | ) |
Definition at line 935 of file gAIBase.cpp.
References GrowingArrayBase::Len(), and memory.
Referenced by ~gCycleMemory().
friend class gCycleMemoryEntry [friend] |
tList<gCycleMemoryEntry> gCycleMemory::memory [private] |
Definition at line 70 of file gCycle.h.
Referenced by Clear(), Earliest(), Latest(), Len(), operator()(), and Remember().