Caravans hurrying Food - for DH, TB or alberts2

Joined
Jun 7, 2008
Messages
6,149
Location
Just wonder...
As I said to DH, here's a slight correction I've made to AND code to make it possible for Trade Caravans to hurry food and not just hammers. Code was there since a long time but wasn't used; I've simply enabled it and corrected a bug in displaying quantity of food being added to a city. Here's what I've done (note that xml part could already be there in C2C, I don't know)
I've added a tag in Unitinfos to Trade Caravan and Freight:
<iBaseFoodChange>
Of course I've also added it in UnitSchema, both the main one and schema file for those using Formations

<element type="iHurryMultiplier" minOccurs="0"/>
<element type="iBaseFoodChange" minOccurs="0"/>
<element type="iBaseTrade" minOccurs="0"/>

<ElementType name="iHurryMultiplier" content="textOnly" dt:type="int"/>
<ElementType name="iBaseFoodChange" content="textOnly" dt:type="int"/>
<ElementType name="iBaseTrade" content="textOnly" dt:type="int"/>

also I've corrected in the dll in CvDLLWidgetData::parseActionHelp that part in red

Code:
						if (pSelectedUnit->canHurryFood(pMissionPlot))
						{
							const wchar* pcKey = (pMissionCity->getNameKey());
							if (pSelectedUnit->getHurryFood(pMissionPlot) >= (pMissionCity->growthThreshold() - pMissionCity->getFood()))
							{
								szBuffer.append(NEWLINE);
								szBuffer.append(gDLL->getText("TXT_KEY_ACTION_FINISH_FOOD", pcKey));
							}
							else
							{
								szBuffer.append(NEWLINE);
								szBuffer.append(gDLL->getText("TXT_KEY_ACTION_EXTRA_FOOD", pSelectedUnit->[COLOR="Red"]getHurryFood[/COLOR](pMissionPlot), pcKey));
							}
							break;
						}
						pSelectedUnitNode = gDLL->getInterfaceIFace()->nextSelectionListNode(pSelectedUnitNode);

In original code it was getHurryProduction, which is clearly wrong, hence displaying the wrong amount of food (although the correct amount was added to the city). I guess the code is the same in C2C. Hope it helps! :)
 
Back
Top Bottom