About automated trade routes

Dertuek

Chieftain
Joined
Aug 5, 2008
Messages
55
Location
France
Hello,

I took a look to the new automated trade route system. You're creative. It's interesting to see how it works ;)

I made some modifications:

1/ After choosing the first city, if I choose the resource "None", there is a python error. I fixed it.

2/ (after correcting point 1), if I choose "None", in the second city list, I see a selling price of -1 gold. I replaced it by 0.

3/ After choosing the first city, I cancel the process before the end. If I retry, I can't choose anymore the previous city in the first city list. I fixed it. (There's still the restriction "First city != Second city")

4/ When a merchant isn't in a city, if I start the process, in the first list, there are :
- Cancel
- Civ 1
- Civ 2
- ...
- Cancel
Not a bug but I deleted the first "Cancel" entry.

5/ Not a bug too. In the last panel (selection of the resource to buy in the second city). I added the profit the merchant will gain by selling it in the first city for indication.

In the file attached : 2 python files and 2 new tags in XML.
 

Attachments

  • automated_trade_routes.7z
    27.7 KB · Views: 58
Wow, two heads are better than one! ;)

about the Profit: I also thought of that to implement.... with this you confirmed that this should be implemented :)

you're just in a good proggin' spree, that I want to share a small problem I just found in a game: I attached the save.

if you want to have a look:
there is a trade wagon in Tegea and one in Memphis.

In Tegea: If I choose the Egyptian CIV, I see both revealed cities. If I first choose my city and then the Egyptians, I only see Abedju.

In Memphis: If I first choose the Egyptian CIV and this city, I see all my cities. If I choose "this city" and then my civ, I can't see Tegea.

this is a little bit strange....
 

Attachments

  • PieSpartaTradeCitiesNotInList.CivBeyondSwordSave
    437.6 KB · Views: 51
X coordinate of Memphis and Tegea are the same (19).

In getPossibleTradeCitiesForCiv, you can replace:
Code:
if loopCity.getX() != iX and loopCity.getY() != iY:
by
Code:
if not (loopCity.getX() == iX and loopCity.getY() == iY):
 
aaaah!!! you're right! so an easy bug...... thx Dertuek!

I thought AND is chaining...
so this could also work:
Code:
if loopCity.getX() != iX or loopCity.getY() != iY:
 
Last edited:
Top Bottom