Menu

#2844 Trade with AIEuropeanPlayer only evaluate gold price of one elemnt cargo

Fixed_0.11.4
closed-fixed
nobody
Trade (5)
5
2015-08-01
2015-04-20
Bernat
No

Hello!! Sorry for my little English!!

I tried change the code, I wished offer myself solution to this problem, but is more complex to resolve that I supposed

SYNTOMS
When I tried to sell, for example 100 silver to an AI European Nation, this buys for me for 1600 gold.
But when I tried to sell 166 silver for 1601 gold (and this nation have really enough money !!!), rejects my offer.

WHAT I THINK
It happens even with different types of cargos rum + silver, it seems that AIEuropeanPlayer ONLY evaluate ONE of the multiple cargos, and sell all the cargos if my offer les or equal to this only ¿first? element cargo (that correspond to the max European Market price for this).

PD.- Upps (Is this another bug ? why the Eurpean Nation offer me the 100% of value? This AI European Nation are losing money: because when sells silver in Main Country is losing his tax margin!)

PD.- Is possible to debug freecol with netbeans? I wish see the value of the variables etc...

Version 11.3
Sys Op windows 8.1 :(

Discussion

  • Mike Pope

    Mike Pope - 2015-04-26

    Do you have a saved game where the problem occurs?

    It happens even with different types of cargos rum + silver, it seems that AIEuropeanPlayer ONLY evaluate ONE of the multiple cargos,

    It looks like EuropeanAIPlayer.acceptDiplomaticTrade loops through all offered items to me.

    why the Eurpean Nation offer me the 100% of value?

    Either the European AI is really foolish (probably true anyway) or the silver price is different for that player.

    Is possible to debug freecol with netbeans?

    Yes. If you have downloaded the source code, look in doc/developer.tex. There are instructions in there written by a netbeans user.

     
  • Mike Pope

    Mike Pope - 2015-04-26
    • status: open --> open-needs-info
     
  • Bernat

    Bernat - 2015-04-27

    Upssss

    PROBLEM WITH MY SAVEGAME
    The problem is that: I changed the XML savegame, production tiles parameters (i don't like some production changes on 11.x), and i put some very personal and stupid names to the cities, and other terrific things, I also reanabled European Panel after Independence etc...
    But I'm pretty sure that the problem is in the logic of game and not in the xml
    After this explanation....

    QUESTION
    Can i send this savegame in somwhere that are not "public" visible? (if exist something like "private attachment")??

    THE LOG FILE
    What I can do at this moment is attach the log file
    Watch lines 410 (rejected), and 270 (accepted).
    English rejects 166 silver for 1601 gold, while they accept to pay (when i reload the game) 1600 gold for 100 silver
    Notice in the screenshot that I am trading with Jamestown from my Galeon and English have a lot of gold
    I tried the same with Dutch and de behaviour is the same

    In the log trade are described as

    TRANSLATE LOG FILE
    ("plata" is silver) ("La quantitat de 1601 monedes d'or" means-> the amount of 1601 golden)

    LOG FILE IMPORTANT LINES
    INFO: Evaluate trade offer from Berni: 100 Plata = 1600 66 Plata = 1056 La quantitat de 1601 monedes d'or = -1601, Agreement unsalvageable => REJECT_TRADE

    INFO: Evaluate trade offer from Berni: La quantitat de 1600 monedes d'or = -1600 100 Plata = 1600, Value = 0 => ACCEPT_TRADE
    

    Thanks for your great answers and for your support to this awesome game
    I will improve my Java knowlage, and of course, my little English

     

    Last edit: Bernat 2015-04-27
  • Bernat

    Bernat - 2015-04-27

    OK!!!!
    I found a savegame (see in attachments) that not shame me and that i don't patch the xml

    You can see the in the log the same issue, i offer 100 lumber (fusta) + and 100 musquets.
    AI accepts to pay 100 gold for one (lumber) or 100 gold for the other (musquets) but rejects to pay 200

    (and AIEuropean accepts 100 for all togheter cargos)
    You can tried it in curacao

     

    Last edit: Bernat 2015-04-27
  • Mike Pope

    Mike Pope - 2015-04-28

    I found a savegame (see in attachments) that not shame me and that i don't patch the xml

    Cool. However in that saved game you are at war with the English, so I can not trade with them. Do you have any earlier auto-saves? We almost always need to reproduce a bug to be able to fix it.

    Thanks for your great answers and for your support to this awesome game I will improve my Java knowlage, and of course, my little English

    Glad you like FreeCol, no need to apologize for language issues.

     
  • Bernat

    Bernat - 2015-04-28

    If you catch the savegame above...
    Can you trade with my pirate Ship with Dutch (holland) in Curacao?
    There are some others ships next in Manu Chao Colony wich you can trade with Dutch

    very very thank you for your dedication
    thanks in advance!!

     

    Last edit: Bernat 2015-04-28
  • Mike Pope

    Mike Pope - 2015-04-30

    Can you trade with my pirate Ship with Dutch (holland) in Curacao?

    Yes, that worked. I can now see the bug. Actually there are three bugs here.

    The first bug is that GoodsTradeItems do not have distinct hash codes, which means when you use them as Map keys, they collide, which is why FreeCol only appears to consider one of the goods as you correctly noticed. This is fixed in git.43bb904.

    The second bug is that in the code that tries to create a counter offer from the AI player, the order of items to be considered is reversed. This is fixed in git.e825c6c.

    The third bug is a crash when redisplaying the negotiation dialog. I am still working on this.

     
    • Mike Pope

      Mike Pope - 2015-05-02

      The third bug was two more separate graphics issues, now fixed. Then there was another one when accepting a trade counter offer. So, five bugs down, I can now offer the Dutch at Curacao the goods on the privateer for 250 gold, they offer 150 gold, I accept, and the goods are transferred correctly. Hooray! That was a pretty epic bug hunt. Setting to Pending until next release.

      I am happy to contribute to this game

      Good bug reports are a very valuable contribution. Thank you for your support.

       
  • Bernat

    Bernat - 2015-05-01

    I am happy to contribute to this game !!! I look forward to helping my measure. thank you very much again. I am pleased to see how this game has improved every year.

    Pd.- because I haven't enough level of Java I will wait to see the final code to understand everything you told me :)

     

    Last edit: Bernat 2015-05-01
  • Mike Pope

    Mike Pope - 2015-05-02
    • status: open-needs-info --> pending-fixed
    • Group: Current --> Fixed_trunk
     
  • Mike Pope

    Mike Pope - 2015-08-01
    • Group: Fixed_trunk --> Fixed_0.11.4
     
  • Mike Pope

    Mike Pope - 2015-08-01
    • Status: pending-fixed --> closed-fixed
     

Log in to post a comment.