|
|
@@ -22,6 +22,7 @@ CStrategyLoop::~CStrategyLoop(void)
|
|
22
|
22
|
CAgent* CStrategyLoop::_locateAgent( CAgentGroup& AgentGroup )
|
|
23
|
23
|
{
|
|
24
|
24
|
CAgent* pAgent = NULL;
|
|
|
25
|
+ bool t_b_has_jump = false;
|
|
25
|
26
|
|
|
26
|
27
|
for(int i=0; i<AgentGroup.GetCount(); ++i) // 保证遍历一轮
|
|
27
|
28
|
{
|
|
|
@@ -29,9 +30,23 @@ CAgent* CStrategyLoop::_locateAgent( CAgentGroup& AgentGroup )
|
|
29
|
30
|
m_Index = 0;
|
|
30
|
31
|
|
|
31
|
32
|
pAgent = AgentGroup[m_Index++];
|
|
|
33
|
+ if (pAgent->queueJump()) {
|
|
|
34
|
+ t_b_has_jump = true;
|
|
|
35
|
+ continue;
|
|
|
36
|
+ }
|
|
32
|
37
|
if(pAgent->isFree())
|
|
33
|
38
|
return pAgent;
|
|
34
|
39
|
} // end if
|
|
35
|
|
-
|
|
|
40
|
+ if (t_b_has_jump == true) {
|
|
|
41
|
+ for (int i = 0; i<AgentGroup.GetCount(); ++i) // 保证遍历一轮
|
|
|
42
|
+ {
|
|
|
43
|
+ if (m_Index >= AgentGroup.GetCount())
|
|
|
44
|
+ m_Index = 0;
|
|
|
45
|
+
|
|
|
46
|
+ pAgent = AgentGroup[m_Index++];
|
|
|
47
|
+ if (pAgent->isFree())
|
|
|
48
|
+ return pAgent;
|
|
|
49
|
+ } // end if
|
|
|
50
|
+ }
|
|
36
|
51
|
return NULL;
|
|
37
|
52
|
}
|