Results 1 to 3 of 3

Thread: trade route calculation?

  1. #1
    c2chanka
    Settler
    Join Date
    27 Jan 2005
    Posts
    2
    Country
    This is c2chanka's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 20, 2013
    Local Time
    02:38

    trade route calculation?

    Hello, I've seen some Trade Route formulas posted under the CIV2 forum, I'm just wondering if anyone knows the trade route formula for CTP2. Or maybe a hint on which cpp file I should search under

  2. #2
    J Bytheway
    Emperor J Bytheway's Avatar
    Join Date
    02 Jul 2001
    Location
    England
    Posts
    3,826
    Country
    This is J Bytheway's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 20, 2013
    Local Time
    03:38
    Cursory investigation suggests that it's pretty simple. From TradeRouteData.cpp:

    Code:
    sint32 TradeRouteData::GetValue() const
    {
    	if(m_sourceRouteType != ROUTE_TYPE_RESOURCE)
    		return 0;
    
    	
    	double baseValue = g_theWorld->GetGoodValue(m_sourceResource);
    	double distance = double(m_destinationCity->GetCityData()->GetDistanceToGood(m_sourceResource));
    	return sint32(baseValue * distance);
    }
    That GetDistanceToGood is in terms of least movement cost to the good (I'm not sure if this gets recalculated as more roads, etc. are built).

    I guess this may be processed further (taking into account city populations, or something like that). I suggest you investigate - I guess you'd either want to look for calls to the above function or else work the other way from wherever the values get used (e.g. the trade screen).

  3. #3
    c2chanka
    Settler
    Join Date
    27 Jan 2005
    Posts
    2
    Country
    This is c2chanka's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 20, 2013
    Local Time
    02:38
    Wow, what a fast reply!!! Thank you very much for your help. I will look into that file =)

Similar Threads

  1. newbie here: how to establish trade route and trade goods
    By jamesyao in forum Civ3-General-Archive
    Replies: 5
    Last Post: May 23, 2004, 12:22
  2. Minister of Trade: First trade route?
    By MrWhereItsAt in forum Civ2-Democracy Game
    Replies: 5
    Last Post: May 19, 2004, 09:54
  3. Need Sea Route to Trade!
    By Imran Siddiqui in forum Civ3-General-Archive
    Replies: 4
    Last Post: November 2, 2001, 23:17
  4. How Do I get Rid of a Trade Route?
    By Rufus T. Firefly in forum Civ2-Strategy-Archive
    Replies: 10
    Last Post: June 27, 2001, 08:27
  5. Max Trade Receieved from Trade Route
    By Eli in forum Civ2-Strategy-Archive
    Replies: 3
    Last Post: April 7, 2001, 19:15

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!

Bookmarks

Posting Permissions