src/game/TacticalAI/Knowledge.cc
FOR_EACH_MERC(i)
	{
		const SOLDIERTYPE* const pTemp = *i;

		// if this merc is inactive, at base, on assignment, or dead
		if (!pTemp->bLife) continue; // next merc

		// if this merc is neutral/on same side, he's not an opponent
		if ( CONSIDERED_NEUTRAL( pSoldier, pTemp ) || (pSoldier->bSide == pTemp->bSide))
			continue;          // next merc

		pbPersOL = pSoldier->bOppList + pTemp->ubID;
		pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pTemp->ubID;
		psLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pTemp->ubID;
		pbLastLevel = gbLastKnownOppLevel[pSoldier->ubID] + pTemp->ubID;

		// if this guy's been personally heard within last 3 turns
		if (*pbPersOL < NOT_HEARD_OR_SEEN)
		{
			// calculate how far this noise was, and its relative "importance"
			iDistAway = SpacesAway(pSoldier->sGridNo,*psLastLoc);
			iNoiseValue = (*pbPersOL) * iDistAway;               // always a negative number!

			if (iNoiseValue > iBestValue)
			{
				iBestValue = iNoiseValue;
				sBestGridNo = *psLastLoc;
				bBestLevel = *pbLastLevel;
			}
		}

		// if this guy's been publicly heard within last 3 turns
		if (*pbPublOL < NOT_HEARD_OR_SEEN)
		{
			// calculate how far this noise was, and its relative "importance"
			iDistAway = SpacesAway(pSoldier->sGridNo,gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID]);
			iNoiseValue = (*pbPublOL) * iDistAway;               // always a negative number!

			if (iNoiseValue > iBestValue)
			{
				iBestValue = iNoiseValue;
				sBestGridNo = gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID];
				bBestLevel = gbPublicLastKnownOppLevel[pSoldier->bTeam][pTemp->ubID];
			}
		}

	}
// look through this man's personal & public opplists for opponents heard
look through this man's personal & public opplists for opponents heard
look through this man ' s personal & public opplists for opponents heard
FOR_EACH_MERC(i)
	{
		const SOLDIERTYPE* const pTemp = *i;
		if (!pTemp->bLife) continue; 
		if ( CONSIDERED_NEUTRAL( pSoldier, pTemp ) || (pSoldier->bSide == pTemp->bSide))
			continue;          
		pbPersOL = pSoldier->bOppList + pTemp->ubID;
		pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pTemp->ubID;
		psLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pTemp->ubID;
		pbLastLevel = gbLastKnownOppLevel[pSoldier->ubID] + pTemp->ubID;
		if (*pbPersOL < NOT_HEARD_OR_SEEN)
		{
			iDistAway = SpacesAway(pSoldier->sGridNo,*psLastLoc);
			iNoiseValue = (*pbPersOL) * iDistAway;               
			if (iNoiseValue > iBestValue)
			{
				iBestValue = iNoiseValue;
				sBestGridNo = *psLastLoc;
				bBestLevel = *pbLastLevel;
			}
		}
		if (*pbPublOL < NOT_HEARD_OR_SEEN)
		{
			iDistAway = SpacesAway(pSoldier->sGridNo,gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID]);
			iNoiseValue = (*pbPublOL) * iDistAway;               
			if (iNoiseValue > iBestValue)
			{
				iBestValue = iNoiseValue;
				sBestGridNo = gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID];
				bBestLevel = gbPublicLastKnownOppLevel[pSoldier->bTeam][pTemp->ubID];
			}
		}
	}
FOR_EACH_MERC ( i ) { const SOLDIERTYPE * const pTemp = * i ; if ( ! pTemp -> bLife ) continue ; if ( CONSIDERED_NEUTRAL ( pSoldier , pTemp ) || ( pSoldier -> bSide == pTemp -> bSide ) ) continue ; pbPersOL = pSoldier -> bOppList + pTemp -> ubID ; pbPublOL = gbPublicOpplist [ pSoldier -> bTeam ] + pTemp -> ubID ; psLastLoc = gsLastKnownOppLoc [ pSoldier -> ubID ] + pTemp -> ubID ; pbLastLevel = gbLastKnownOppLevel [ pSoldier -> ubID ] + pTemp -> ubID ; if ( * pbPersOL < NOT_HEARD_OR_SEEN ) { iDistAway = SpacesAway ( pSoldier -> sGridNo , * psLastLoc ) ; iNoiseValue = ( * pbPersOL ) * iDistAway ; if ( iNoiseValue > iBestValue ) { iBestValue = iNoiseValue ; sBestGridNo = * psLastLoc ; bBestLevel = * pbLastLevel ; } } if ( * pbPublOL < NOT_HEARD_OR_SEEN ) { iDistAway = SpacesAway ( pSoldier -> sGridNo , gsPublicLastKnownOppLoc [ pSoldier -> bTeam ] [ pTemp -> ubID ] ) ; iNoiseValue = ( * pbPublOL ) * iDistAway ; if ( iNoiseValue > iBestValue ) { iBestValue = iNoiseValue ; sBestGridNo = gsPublicLastKnownOppLoc [ pSoldier -> bTeam ] [ pTemp -> ubID ] ; bBestLevel = gbPublicLastKnownOppLevel [ pSoldier -> bTeam ] [ pTemp -> ubID ] ; } } }
look through this man's personal & public opplists for opponents heard
look through this man ' s personal & public opplists for opponents heard
// if this merc is inactive, at base, on assignment, or dead // next merc // if this merc is neutral/on same side, he's not an opponent // next merc // if this guy's been personally heard within last 3 turns // calculate how far this noise was, and its relative "importance" // always a negative number! // if this guy's been publicly heard within last 3 turns // calculate how far this noise was, and its relative "importance" // always a negative number!