NumTradeRouteBonus and NoLimit buildings

Machiavelli24

Mod creator
Joined
May 9, 2012
Messages
818
Here is an annoying little corner case for anyone who wants to use a NoLimit building to provide extra trade routes. It doesn't matter how many copies of the NoLimit building a city has, only the first one will provide the extra trade routes. So if you give a city 3 copies of BUILDING_DUMMY_TWO_EXTRA_TRADE_ROUTES the player only ends up with +2 Trade Routes, not +6. Why?

From CvTradeClasses.cpp:
Code:
...
if (pLoopCity->GetCityBuildings()->GetNumBuilding((BuildingTypes)pBuildingEntry->GetID()))
{
	int iNumRouteBonus = pBuildingEntry->GetNumTradeRouteBonus();
	if (iNumRouteBonus != 0)
	{
		iNumRoutes += iNumRouteBonus;
	}
}
...
 
The thing that really surprises me about that code is that it allows buildings to take away trade routes, ie it hasn't been written as

Code:
if (iNumRouteBonus > 0)
 
The thing that really surprises me about that code is that it allows buildings to take away trade routes, ie it hasn't been written as

Code:
if (iNumRouteBonus > 0)

Iiiiinteresting... I can potentially make use of this.
Thanks for bringing that up!
 
Back
Top Bottom