Help: Adding and implementing new commerce types?

MrUnderhill

Civ-loving Hobbit
Joined
Dec 6, 2005
Messages
655
Hi, I'm trying to add a new commerce type (like Research and Culture) but I can't find any tutorials on how to do it. My plan was to have priests and religious buildings provide a "Piety" commerce type that would affect how quickly your state religion spreads, among other things. Has anyone done this before who could give me advice on where to get started?
 
Commerce and Yield Types are hard-coded in the SDK (DLL), so you'll need to do some C++ work to add a new one. Start by adding your new type to CvEnums.h:

Code:
enum CommerceTypes					// Exposed to Python
{
	NO_COMMERCE = -1,

	COMMERCE_GOLD,
	COMMERCE_RESEARCH,
	COMMERCE_CULTURE,
	COMMERCE_ESPIONAGE,
	[B]COMMERCE_PIETY,[/B]

#ifdef _USRDLL
	NUM_COMMERCE_TYPES
#endif
};

You'll want to expose the new value to Python in CyEnumInterface.cpp as well. There will most likely be other C++ changes you'll need to make to handle it.

Finally, I believe you'll also need to modify all the XML files (e.g. buildings and techs) which specify commerce values.
 
Okay, so far so good. I added the enums to the SDK, tweaked a few XML files so that priests give Piety as a commerce type, then compiled and ran with no problems. It even shows up in the 'pedia as a plain number, but for the life of me I can't tell where icons are loaded for each commerce type. There's a setChar function under CvCommerce infos but it doesn't look like it's being used anywhere. How do you set a commerce type to an icon?
 
All the commerce/yield icons are in the two font files (Res/Fonts). I would guess that you need to place your new icon in the cell to the right of the :commerce: icon. DXTBmp is a program that will let you modify the files. Make sure you place the little green dot using exactly the same color as the others to mark the cell as active.
 
Top Bottom