[SDK mod] Borders over Ocean

RogerBacon

King
Joined
Nov 16, 2003
Messages
649
Hello all,

Since version 1.0 it has bothered me that cultural borders didn't extend over ocean. Well now, thanks to the SDK, they can.

Download it here

The code is attached below if you want to compile it yourself. You can see the change on line 9334.

Enjoy,
Roger Bacon

 

Attachments

  • BordersOverWaterCode.zip
    37.5 KB · Views: 542
Very cool Roger :goodjob:
 
Hello again RogerBacon!

Could you post the dds for the Rising Sun flag? The version I downloaded (from another user) in November was a blank file. Thanks!!!

Spocko
 
Here is the flag. I renamed it to .txt because you can't attach .dds files. When you look at the file in a viewer it will appear blank. Actually, the entire image takes teh team color, I believe, and the alpha channel just blocks out the parts that are supposed to be white-- at least for thsi flag.

Roger Bacon
 

Attachments

  • FlagDECAL_RisingSun.txt
    21.5 KB · Views: 434
:goodjob:

I just pulled it out of your customassets post, and set <bWhiteFlag>0</bWhiteFlag> in CIV4ArtDefines_Civilizations.

Thanks!
 
Oh my, this is very interesting. I might just use it right away, do you know how it'll affect a game in progress?
 
I don't think you can add a DLL to a mod and play a game in progress... at least from my experience it causes the game to crash
 
TheLopez said:
I don't think you can add a DLL to a mod and play a game in progress... at least from my experience it causes the game to crash
Hehe, I'm gonna try it anyway... "Please assume crash positions." :D

Btw, I had an idea about these:

Is it possible to make it so that the culture growth over seas is slower than over land, i.e. some percentage of it? Again, this is with the idea of allowing mod makers to balance out this feature (that is if it's made available through XML). Because me for example, while I do think that borders should extend further over seas than 2-3 squares (which will also make navy more important), I don't think they should grow at the same speed.
 
Rabbit said:
Oh my, this is very interesting. I might just use it right away, do you know how it'll affect a game in progress?

It works fine with a game already in progress.

Roger Bacon
 
Really?? That's very wierd because when I updated one of my mods to use talchas Action Button Mod 2.0 my game in progress no longer worked...

Wierd.
 
TheLopez said:
Really?? That's very wierd because when I updated one of my mods to use talchas Action Button Mod 2.0 my game in progress no longer worked...

Wierd.

When I first tested this I used a saved game from a week earlier and it worked fine. When I tested my 3-square radius cities I couldn't use saved games. I'm pretty sure that is because that mod had arrays of a fixed size already initialized. For the Borders over Ocean mod it is very simple. I just commented out one line. ;)

Roger Bacon
 
currently "cannot enter oceans" doesn't apply to oceans within cultural borders, is there an easy way to change this?
 
I just found this. It sounds like a great mod. Any chance of having it uploaded again? Also, is it BTS-compatible? Thanks for doing this mod.
 
If it's SDK, it sure isn't compatible with BtS since in April 2006 the expansion wasn't out yet. ;)
 
I just found this. It sounds like a great mod. Any chance of having it uploaded again? Also, is it BTS-compatible? Thanks for doing this mod.

This was a one-line code change to make this mod work and I'm sure it is the same in the expansion. All I had to do to make borders expand over ocean squares was remove a condition that the square has to be a workable land tile. I changed the condition check to (true) so it would always work.
Just get the api for the expansion and search for something similar to the code I'll post below. It should be pretty easy to do. I never got the expansion so I can't do it.

Code:
void CvCity::doPlotCulture(bool bUpdate)
{
	CvPlot* pLoopPlot;
	int iDX, iDY;
	int iCultureRange;

	CyCity* pyCity = new CyCity(this);
	CyArgsList argsList;
	argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity));	// pass in city class
	argsList.add(bUpdate);
	long lResult=0;
	gDLL->getPythonIFace()->callFunction(PYGameModule, "doPlotCulture", argsList.makeFunctionArgs(), &lResult);
	delete pyCity;	// python fxn must not hold on to this pointer 
	if (lResult == 1)
	{
		return;
	}

	if (getCulture(getOwnerINLINE()) > 0)
	{
		if (getCultureLevel() != NO_CULTURELEVEL)
		{
			for (iDX = -getCultureLevel(); iDX <= getCultureLevel(); iDX++)
			{
				for (iDY = -getCultureLevel(); iDY <= getCultureLevel(); iDY++)
				{
					iCultureRange = cultureDistance(iDX, iDY);

					if (iCultureRange <= getCultureLevel())
					{
						pLoopPlot = plotXY(getX_INLINE(), getY_INLINE(), iDX, iDY);

						if (pLoopPlot != NULL)
						{
							if (true)//pLoopPlot->isPotentialCityWorkForArea(area())) // Borders over Water -RogerBacon
							{
								pLoopPlot->changeCulture(getOwnerINLINE(), (((getCultureLevel() - iCultureRange) * 20) + getCommerceRate(COMMERCE_CULTURE) + 1), (bUpdate || !(pLoopPlot->isOwned())));
							}
						}
					}
				}
			}
		}
	}
}
 
Hi Roger Bacon. So if I change the boolean to false, it'll nullify the changes? (I'm actually opting to go back to no ocean borders for my mod, though I've never experienced them cuz I've always been patched)
 
Top Bottom