How do I Allow invisible units to capture cities?

CvUnit::setXY

Code:
	if (pNewPlot != NULL)
	{
		pNewCity = pNewPlot->getPlotCity();

		if (pNewCity != NULL)
		{
/*************************************************************************************************/
/**	InvisAlign								04/04/09								Xienwolf	**/
/**																								**/
/**					Invisible Units and other oddities can take undefended cities				**/
/*************************************************************************************************/
/**								---- Start Original Code ----									**
			if (isEnemy(pNewCity->getTeam()) && !canCoexistWithEnemyUnit(pNewCity->getTeam()) && canFight())
/**								----  End Original Code  ----									**/
			if (isEnemy(pNewCity->getTeam()) && pNewPlot->getNumVisibleEnemyDefenders(this) == 0 && canFight())
/*************************************************************************************************/
/**	InvisAlign								END													**/
/*************************************************************************************************/
			{
				GET_TEAM(getTeam()).changeWarWeariness(pNewCity->getTeam(), *pNewPlot, GC.getDefineINT("WW_CAPTURED_CITY"));
				GET_TEAM(getTeam()).AI_changeWarSuccess(pNewCity->getTeam(), GC.getDefineINT("WAR_SUCCESS_CITY_CAPTURING"));

				PlayerTypes eNewOwner = GET_PLAYER(getOwnerINLINE()).pickConqueredCityOwner(*pNewCity);

				if (NO_PLAYER != eNewOwner)
				{
					GET_PLAYER(eNewOwner).acquireCity(pNewCity, true, false, true); // will delete the pointer
					pNewCity = NULL;
				}
			}
		}


This is how I had set it up. Though as I recall I have still had reports on occasion of people not capturing cities if their units are invisible, so it might not actually be working the way I intended it to. Note that this method prevents the invisible unit from capturing the city unless it is undefended.
 
Yeah, that does it. I was looking in the right area of the code (CvUnit::setXY) but I wouldn't have known that line was what I was looking for, or what to do with it.
 
Top Bottom