Commerce by Conquest Mod (BTS 3.19)

stolenrays

Deity
Joined
Aug 2, 2009
Messages
2,061
Commerce by Conquest Mod v1.3 (BTS 3.19)

This mod was created by isolating the source code from Dom Pedro II's Conqueror's Delight Mod. Conquering Cities now provides any of the possible commerce's and/or a Technology. It is mostly a very small SDK Modcomp.

--------Details--------------
-Conquering new cities now gives you :espionage: pts, :gold:, :food:, :culture:, :science:, a Tech, and/or :hammers: instantly.
-You cannot gain :culture: or :food: from recaptured cities
-:culture: and :hammers: are sent to the nearest city
-Surplus food is sent to your most needy city.

-------For Modmakers-------
-SDK Changes are commented as Commerce by Conquest
-Modify the Espionage or Tech conquest bonus via the GlobalDefines.xml file

-------Version History------------------
Spoiler :
Version 1.3
-Capture Cultural Artifacts
-Made text messages more consistent

Version 1.1
-Add Updates From Test of Time (no espionage captured)
-Add check for production > 0
-Test production code
-Added Report No Commerce/Yield text messages
-Added Smeagolhearts SDK/Text additions
-Fixed CTDs via SDK Debugging

-------Version 1.0-----------
-Standalone Ported from Conqueror's Delight


Download
 

Attachments

  • CbC.jpg
    CbC.jpg
    140.5 KB · Views: 186
Nice thing :).

I see that culture is already excluded. How are the hammers balanced and applied? Because theoretically you could get enough hammers to directly get a culture building and to end the riot after a shorter amount of turns...if the building is directly build in the riot...er...does that happen?
 
Looking at the code, commerce is sent to the city that most needs it.

In addition, I've fixed a few CTD problems, but there is still 1. Can't figure it out, but it happens when a city's last order is to construct a building and the assert that triggers is eNumBuilding > -1. I think that is why the CTD is not always occuring on conquest.
 
Well, I tried fixing it as much as possible, but I still get an eLastOrder is being used without having been defined. I made a null check so that you can't try and collect for an order if there is none because this causes a CTD.

Any suggestions?

Spoiler :
Code:
    UnitTypes eTrainingUnit;
    BuildingTypes eConstructingBuilding;
    ProjectTypes eCreatingProject;
    ProcessTypes eProcess;
    int iCurrentProduction;
    int iCurrentFood;
    OrderTypes eLastOrder;

	CLLNode<OrderData>* pOrderNode = pOldCity->headOrderQueueNode();

	[B]eLastOrder = (OrderTypes)pOrderNode->m_data.eOrderType;[/B]
    iCurrentProduction = pOldCity->getProduction();
    iCurrentFood = pOldCity->getFood();

    if (eLastOrder != NULL)
	{
		switch (eLastOrder)
		{
		case ORDER_TRAIN:
			eTrainingUnit = pOldCity->getProductionUnit();
			break;
		case ORDER_CONSTRUCT:
			eConstructingBuilding = pOldCity->getProductionBuilding();
			break;
		case ORDER_CREATE:
			eCreatingProject = pOldCity->getProductionProject();
			break;
		case ORDER_MAINTAIN:
			eProcess = pOldCity->getProductionProcess();
			break;
		}
	}
 
I think that I've fixed this mod. I'm debugging it now. What I did to get it working:

1. Production can be captured only after making sure the Order queue is not NULL.
2. Replaced the variable eLastOrder with OrderNode
3. Moved some definitions around to eliminate runtime failures.
4. Now the game won't CTD if a city has no production orders or is a new city.
 
Actually this can be done easier on python if it is giving you so much headaches
 
Really? Ugh, head i've spent way too much time trying to fix it.

The production code you capture is kind of akward as well. You only capture the production if you have a similar tech advancement. I was thinking that it probably should be capture general production so as not to be a waste. No wonder it was ditched in Test of Time.

The Commerce part is pretty stable. I did get one CTD recently though. Although, the code for Culture was never finished.

So it is on city conquest in python? That doesn't sound like it'd cause any gameplay slowdowns.
 
onCityAcquired will do.

Things you want like:
1) Espionage
2) Tech
3) Gold
can be granted easily.

Others like:
1) Culture
2) Production
would have to look for the nearest city then.
 
You can still get the culture of the previous owner.
Not for production though, production wise you might assign a fixed value or based it on other factors.
 
Yeah, I can't get production to work in the sdk. I set it as if getproduction() > 0, but then it gives me a CTD at this last line:

Code:
int CvCity::getProduction() const
{
	CLLNode<OrderData>* pOrderNode = headOrderQueueNode();

	if (pOrderNode != NULL)
	{
		switch (pOrderNode->m_data.eOrderType)

Something fixed might be better. Tried my best to fix it though.
 
Good news, I've fixed the mod. I'm just tidying it up now and making sure the texts are correct.

I've changed the production capture to just capture any production in the new city. I've also added several checks to ensure there are no CTDs from 0/Null values. The conquest report has been improved thanks to SmeagolHeart & I've added several Report changes to display the result. There is a random chance of how much food or production is captured now.
 
I'm working on capture culture from conquering cities. I get a CTD though. Can somebody please take a look at this code and give me a suggestion.
Spoiler :
Code:
				case COMMERCE_CULTURE:									
					//don't capture culture from your old cities 
					if (bConquest && !bRecapture)
					{
						if (pOldCity->getCultureLevel() != NO_CULTURELEVEL || pOldCity != NULL)	
						{
							int iCapturedCulture = GC.getGameINLINE().getSorenRandNum(pOldCity->getCultureLevel(), "Captured Culture");					
							iTotalCommerce = (GC.getDefineINT("CONQUEST_CULTURE_PERCENT") * iCapturedCulture) / 100;
							//Conquest Promotion
							iTotalCommerce *= (100 + pLoopUnit->getConquestPillage())/100;
							if (pNearestCity != NULL)
							{
								if (iTotalCommerce > 0)
								{
									pNearestCity->changeCulture(getID(), iTotalCommerce, true, true);
									szTempBuffer += gDLL->getText("TXT_KEY_CONQUEST_REPORT_ACQUIRED_CULTURE", iTotalCommerce, GC.getCommerceInfo(COMMERCE_CULTURE).getChar(), GET_PLAYER(pOldCity->getOwnerINLINE()).getNameKey());
									szTempBuffer += NEWLINE;
								}
								else
								{
									szTempBuffer += gDLL->getText("TXT_KEY_CONQUEST_REPORT_NO_CULTURE", GET_PLAYER(pOldCity->getOwnerINLINE()).getNameKey());					
									szTempBuffer += NEWLINE;	
								}	
							}
						}
					}
					break;
 
Top Bottom