• 📚 A new project from the admin: Check out PictureBooks.io, an AI storyteller that lets you create personalized picture books for kids in seconds. Let me know what you think here!

Preventing Lakes near Start Location ?

Refar

Deity
Joined
Apr 10, 2005
Messages
4,608
Is there a way to prevent the Map Generator from putting lakes near the Start location ?

I know it is because it wants to give you fresh water... But it looks just silly on many maps. I would rather start without fresh water sometimes, than having - for example - this:

Spoiler :
civ4screenshot0003kg8.jpg


I think it happesn after the Map generation, while assigning start plots... Can i get rid of this without completely rewriting the AssignStartingPlot routine ?
 
you should take a look at CvMapScriptInterface.py to see all normalize functions . These functions are called from CvGame.cpp::normalizeStartingPlots() that call the serial of normalize python functions after the starting plots assignment . Note that the normalization first try to create a river to give fresh water , and after call normalizeAddLakes that try to add a lake if the plot is still not fresh water . You just have to rewrite the code for normalizeAddLakes (or just return None ) , the default implementation is :

Spoiler :
Code:
void CvGame::normalizeAddLakes()
{
	CvPlot* pStartingPlot;
	CvPlot* pLoopPlot;
	bool bStartingPlot;
	int iI, iJ, iK;

	for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
	{
		if (GET_PLAYER((PlayerTypes)iI).isAlive())
		{
			pStartingPlot = GET_PLAYER((PlayerTypes)iI).getStartingPlot();

			if (pStartingPlot != NULL)
			{
				if (!(pStartingPlot->isFreshWater()))
				{
					for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
					{
						pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);

						if (pLoopPlot != NULL)
						{
							if (!(pLoopPlot->isWater()))
							{
								if (!(pLoopPlot->isCoastalLand()))
								{
									if (!(pLoopPlot->isRiver()))
									{
										if (pLoopPlot->getBonusType() == NO_BONUS)
										{
											bStartingPlot = false;

											for (iK = 0; iK < MAX_CIV_PLAYERS; iK++)
											{
												if (GET_PLAYER((PlayerTypes)iK).isAlive())
												{
													if (GET_PLAYER((PlayerTypes)iK).getStartingPlot() == pLoopPlot)
													{
														bStartingPlot = true;
														break;
													}
												}
											}

											if (!bStartingPlot)
											{
												pLoopPlot->setPlotType(PLOT_OCEAN);
												break;

Tcho !
 
Thanks.

{The message is too short...}
 
If you want to stay out of the DLL you can add this to the mapscript(s) in question:

Code:
def normalizeAddLakes():
    return

That will make it skip the process. The normalize functions go right below the def getDescription() lines, I think all map scrips have that line but not all will have their own normalize function.
 
Back
Top Bottom