void CEngineOutHandler::UnitEnteredRadar(const CUnit& unit, int allyTeamId) { AI_EVT_MTH(); const int unitId = unit.id; const int unitAllyTeamId = unit.allyteam; DO_FOR_ALLIED_SKIRMISH_AIS(EnemyEnterRadar(unitId), allyTeamId, unitAllyTeamId) }
bool CSkirmishAIWrapper::LoadSkirmishAI(bool postLoad) { ai = new CSkirmishAI(skirmishAIId, teamId, key, GetCallback()); ai->Init(); // check if initialization went ok if (skirmishAIHandler.IsLocalSkirmishAIDieing(skirmishAIId)) { return false; } IAILibraryManager* libManager = IAILibraryManager::GetInstance(); libManager->FetchSkirmishAILibrary(key); const CSkirmishAILibraryInfo* infos = &*libManager->GetSkirmishAIInfos().find(key)->second; bool loadSupported = (infos->GetInfo(SKIRMISH_AI_PROPERTY_LOAD_SUPPORTED) == "yes"); libManager->ReleaseSkirmishAILibrary(key); if (postLoad && !loadSupported) { // fallback code to help the AI if it // doesn't implement load/save support Init(); for (size_t a = 0; a < unitHandler->MaxUnits(); a++) { if (!unitHandler->units[a]) continue; if (unitHandler->units[a]->team == teamId) { try { UnitCreated(a, -1); } CATCH_AI_EXCEPTION; if (!unitHandler->units[a]->beingBuilt) try { UnitFinished(a); } CATCH_AI_EXCEPTION; } else { if ((unitHandler->units[a]->allyteam == teamHandler->AllyTeam(teamId)) || teamHandler->Ally(teamHandler->AllyTeam(teamId), unitHandler->units[a]->allyteam)) { // do nothing } else { if (unitHandler->units[a]->losStatus[teamHandler->AllyTeam(teamId)] & (LOS_INRADAR | LOS_INLOS)) { try { EnemyEnterRadar(a); } CATCH_AI_EXCEPTION; } if (unitHandler->units[a]->losStatus[teamHandler->AllyTeam(teamId)] & LOS_INLOS) { try { EnemyEnterLOS(a); } CATCH_AI_EXCEPTION; } } } }
void cUnitManager::EnemyEnterLOS(int enemy,EnemyInfo *E) { EnemyEnterRadar(enemy,E); }