Exemplo n.º 1
0
void GoalBombard::HookUp(AiMain *ai)
{
    Assert(0 <= m_foreign_player);
    Assert(m_foreign_player < k_MAX_PLAYERS);

    Assert(ai->m_foreigner[m_foreign_player]);

	if (!ai->m_foreigner[m_foreign_player])
		return;

	#ifdef _DEBUG

	if (m_target_type == AGENT_TYPE_ARMY)
		{
			BSet<ForeignAgent> *vc =
				ai->m_foreigner[m_foreign_player]->GetVisibleUnits();
			BSetID h_id;
			ForeignAgent *him=NULL;
			for (him = vc->First(h_id); vc->Last(); him =  vc->Next(h_id)) {
				if (him->GetID() == m_target_id) {

					return;
				}
			}
		}

	if (m_target_type == AGENT_TYPE_CITY)
		{
			BSet<ForeignCity> *vc =
				ai->m_foreigner[m_foreign_player]->GetKnownCities();
			BSetID h_id;
			ForeignCity *him=NULL;
			for (him = vc->First(h_id); vc->Last(); him =  vc->Next(h_id)) {
				if (him->GetID() == m_target_id) {

					return;
				}
			}
		}

    {
        BOOL COULD_NOT_FIND_BOMBARD_GOAL_TARGET=0;
        Assert(COULD_NOT_FIND_BOMBARD_GOAL_TARGET);
    }
	#endif _DEBUG
}
Exemplo n.º 2
0
ForeignAgent *GoalSally::GetTarget(AiMain *ai) 
{ 
    if (m_target_id.GetVal()) { 
		
		if (!ai->m_foreigner) return NULL;
		if (!ai->m_foreigner[m_foreign_player]) return NULL;

        BSet<ForeignAgent> *vua = ai->m_foreigner[m_foreign_player]->GetVisibleUnits();
        BSetID h_id; 
        ForeignAgent *his_agent=NULL; 
        for (his_agent = vua->First(h_id); vua->Last(); his_agent =  vua->Next(h_id)) { 
            if (his_agent->GetID().GetVal() == m_target_id.GetVal()) {  
                return his_agent;
            }
		}
	}
	return NULL;
} 
Exemplo n.º 3
0
void GoalSally::HookUp(AiMain *ai)
{ 
    Assert(0 <= m_foreign_player); 
    Assert(m_foreign_player < k_MAX_PLAYERS); 

    Assert(ai->m_foreigner[m_foreign_player]); 

    BSet<ForeignAgent> *vc = ai->m_foreigner[m_foreign_player]->GetVisibleUnits();
    BSetID h_id; 
    ForeignAgent *him=NULL; 
    for (him = vc->First(h_id); vc->Last(); him =  vc->Next(h_id)) { 
        if (him->GetID() == m_target_id) {  
			
            return; 
        }
    }

    {
        BOOL COULD_NOT_FIND_SALLY_GOAL_TARGET=0;
        Assert(COULD_NOT_FIND_SALLY_GOAL_TARGET);
    }
}