Changes for v1.09

Well, this is an error that makes self-made maps unplayable unless you play the AoD mod, and I enjoy the game both ways - pure and modded, yet I can't play it unmodded, cause I don't know how to cope with the issue :-( (though I tried but without success). Would be very grateful for your help :).

I think this is all that's needed:

Code:
void CvPlayer::doTurnUnits()
{
	PROFILE_FUNC();

	CvSelectionGroup* pLoopSelectionGroup;
	int iLoop;

	AI_doTurnUnitsPre();

	for (pLoopSelectionGroup = firstSelectionGroup(&iLoop); pLoopSelectionGroup != NULL; pLoopSelectionGroup = nextSelectionGroup(&iLoop))
	{
		pLoopSelectionGroup->doDelayedDeath();
	}


	for (pLoopSelectionGroup = firstSelectionGroup(&iLoop); pLoopSelectionGroup != NULL; pLoopSelectionGroup = nextSelectionGroup(&iLoop))
	{
		pLoopSelectionGroup->doTurn();
	}
	

	if (getParent() != NO_PLAYER)
	{
		CvPlayer& kEurope = GET_PLAYER(getParent());
		if (kEurope.isAlive() && kEurope.isEurope() && !::atWar(getTeam(), kEurope.getTeam()))
		{
			int iLowestCost = MAX_INT;
			UnitTypes eCheapestShip = NO_UNIT;
			for (int iUnitClass = 0; iUnitClass < GC.getNumUnitClassInfos(); ++iUnitClass)
			{
				UnitTypes eLoopUnit = (UnitTypes) GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(iUnitClass);
				if (eLoopUnit != NO_UNIT)
				{
					if (GC.getUnitInfo(eLoopUnit).getDomainType() == DOMAIN_SEA)
					{
						int iCost = getEuropeUnitBuyPrice(eLoopUnit);
						if (iCost < iLowestCost && iCost >= 0)
						{
							iLowestCost = iCost;
							eCheapestShip = eLoopUnit;
						}
					}
				}
			}
			if (eCheapestShip != NO_UNIT && getGold() < getEuropeUnitBuyPrice(eCheapestShip))
			{
[b]				// PatchMod: Randomise spawn spot START
				CvPlot* pBestPlot = getStartingPlot();
				CvPlot* pLoopPlot = NULL;
				int iBestPlotRand = 0;
				int iPlotRand = 0;
				for (int iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
				{
					gDLL->callUpdater();
					pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
					if (pLoopPlot->isRevealed(getTeam(), false) && pBestPlot->getEurope() == pLoopPlot->getEurope())
					{
						if (pLoopPlot->getX_INLINE() > (GC.getMapINLINE().getGridWidthINLINE() / 2) && pLoopPlot->isEurope())
						{
							iPlotRand = (1 + GC.getGameINLINE().getSorenRandNum(1000, "Starting Plot"));
							if (iPlotRand > iBestPlotRand)
							{
								iBestPlotRand = iPlotRand;
								pBestPlot = pLoopPlot;
							}
						}
					}
				}
				setStartingPlot(pBestPlot, true);
				// PatchMod: Randomise spawn spot END[/b]

				bool bHasShip = false;
				int iLoop;
				for (CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
				{
					if (pLoopUnit->getDomainType() == DOMAIN_SEA)
					{
						bHasShip = true;
						break;
					}
				}

				if (!bHasShip)
				{
					for (uint i = 0; i < m_aEuropeUnits.size(); ++i)
					{
						CvUnit* pLoopUnit = m_aEuropeUnits[i];
						if (pLoopUnit->getDomainType() == DOMAIN_SEA)
						{
							bHasShip = true;
							break;
						}
					}
				}

				if (!bHasShip)
				{
					buyEuropeUnit(eCheapestShip, 0);

					//change taxrate
					int iOldTaxRate = getTaxRate();
					int iNewTaxRate = std::min(99, iOldTaxRate + 1 + GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("TAX_RATE_MAX_INCREASE"), "Tax Rate Increase for ship"));
					int iChange = iNewTaxRate - iOldTaxRate;
					changeTaxRate(iChange);

					if (isHuman())
					{
						CvDiploParameters* pDiplo = new CvDiploParameters(kEurope.getID());
						pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_KING_GIFT_SHIP"));
						pDiplo->addDiploCommentVariable(iNewTaxRate);
						pDiplo->setAIContact(true);
						gDLL->beginDiplomacy(pDiplo, getID());
					}
				}
			}
		}
	}

	if (getID() == GC.getGameINLINE().getActivePlayer())
	{
		gDLL->getFAStarIFace()->ForceReset(&GC.getInterfacePathFinder());

		gDLL->getInterfaceIFace()->setDirty(Waypoints_DIRTY_BIT, true);
		gDLL->getInterfaceIFace()->setDirty(SelectionButtons_DIRTY_BIT, true);
	}

	gDLL->getInterfaceIFace()->setDirty(UnitInfo_DIRTY_BIT, true);

	AI_doTurnUnitsPost();
}
 
hey, like this MOD of yours Dale, but trying to use it to play Chinese with 1.09b on patchmod - western hemisphere (huge) map, worked fine until i bought my first galleon and it will not leave china? :(

only using this 1.09b and latest patch, so what can i do to fix this?
 
hey, like this MOD of yours Dale, but trying to use it to play Chinese with 1.09b on patchmod - western hemisphere (huge) map, worked fine until i bought my first galleon and it will not leave china? :(

only using this 1.09b and latest patch, so what can i do to fix this?

I'll test this. I haven't tried this combo, but I'm suspecting that the map doesn't like western arrival nations.
 
Thank you for the code Dale. I am not a bit a programmer so I won't say I'm getting to analisis and getting to understand the changes (though I tried, but it's all greek to me). I only located the part of code within the appropriate file and tried the simple copy & paste method but it wouldn't work. Well it looks like it's not that simple afterall :-(
 
Hell, that's enough of studying for at least 100 years. I'll never learn it, grrr... You know Dale I'm a kind ov programming illiterate heh. Never mind... getting to knowledge exploration. At least i'll give it a shot...

... btw, while creating Cheasapeake map I found a bug (though I saw it mentioned somewher before): the territory rights are not saved, no matter how vast you set it it's always those 9 plots around natives' villages :-/ (like in original)

.. the other one is that computer never uses it's soldiers to explore & gather some experiance, it's focused way too much on improving it's land right from the beginning (like in original)

.. another one: computer A.I. does very little of exploring before founding a settlement, one simple bonus like e.g. single BONUS_FISH makes it enough to estabilish it's colony nearby (like in original)

.. hardly ever any conflicts result in wars (not like in original)

.. computer A.I. far too less focused on recruting founding fathers (not like in original)

.. no diplomacy between A.Is.
 
Changes I would like to see for 1.10:

1) Improved AI. I know this is much harder to implement so no rush but it would really help the game if the AI would actually grow its cities, expand its territory and be a threat to the player. This might be simpler to implement as a production bonus for the AI at harder difficulties. For instance an expert farmer grows 8 food instead of 6. Lowering the threshold for new colonist from 200 food to say 100 food at revolutionary might also improve the AI's growth rate.

I just played two test games where the AI economic victoried me. :mischief:

AI creates bigger empires (and more productive empires) in 1.10 (see screenie).
 
It scales to handicap. Basically, the AI gets restricted the lower the level. Revolutionary is just full open unrestricted AI. :)
 
Top Bottom