Picking a plot from a specific selection

migck

Señor de la guerra
Joined
Apr 6, 2009
Messages
197
I'm intending to code a tweak for the Global Warming mod, so that instead of selecting a totally random plot as per:
Code:
CvPlot* pPlot = GC.getMapINLINE().syncRandPlot(RANDPLOT_NOT_CITY);
it will instead use syncRandPlot or something similar to pick a random plot of a selection made before, so it would exclude water tiles with no ice, peaks, and such tiles in which nothing pertaining the GW effects can happen.

I don't know how to make that selection though. I imagine it involves making an array of the plots that interest me and picking from it, but I have no idea how to set that up.


Also, a more simple question, if I wanted to keep an manipulate a simple counter every time a tile is affected by GW, how would I do that?
 
I'm intending to code a tweak for the Global Warming mod, so that instead of selecting a totally random plot as per:
Code:
CvPlot* pPlot = GC.getMapINLINE().syncRandPlot(RANDPLOT_NOT_CITY);
it will instead use syncRandPlot or something similar to pick a random plot of a selection made before, so it would exclude water tiles with no ice, peaks, and such tiles in which nothing pertaining the GW effects can happen.

I don't know how to make that selection though. I imagine it involves making an array of the plots that interest me and picking from it, but I have no idea how to set that up.

I have several functions that deal with plots in OGI. This one looks to see if a specified unit is on an adjacent plot to a city.

Spoiler :

Code:
def isAdjacentCityPlot(pUnit):
	# Orion's Grand Inquisition Mod
	# Returns True if the unit is on a plot adjacent to a city
	# Returns False if the unit is Not on a plot adjacent to a city
	isAdjacentPlot = False
	iOwner = pUnit.getOwner()
	pPlayer = gc.getPlayer(iOwner)
	pTeam = gc.getTeam(iOwner)
	iPlotX = pUnit.getX()
	iPlotY = pUnit.getY()
	pUnitPlot = CyMap().plot(iPlotX, iPlotY)
		
	for iDirection in range(DirectionTypes.NUM_DIRECTION_TYPES):
		pLoopPlot = plotDirection( iPlotX, iPlotY, DirectionTypes(iDirection))
		iLoopPlotOwner = pLoopPlot.getOwner()
		LoopPlotOwner = gc.getPlayer(iLoopPlotOwner)
						
		# make sure it is not None
		if not pLoopPlot.isNone():
			if iLoopPlotOwner != iOwner:
				if pLoopPlot != pUnitPlot:
					if pLoopPlot.isCity():
						# Must be at war to attack
						if pTeam.isAtWar(LoopPlotOwner.getTeam()):
							#CyInterface().addImmediateMessage("Found Adjacent Plot", "")
							isAdjacentPlot = True
							break

	return isAdjacentPlot


This function might give you a few ideas.
 
Back
Top Bottom