Slight improvement when selling goods

Discussion in 'Civ4 - Ancient Europe' started by Dertuek, Feb 14, 2021.

  1. Dertuek

    Dertuek Chieftain

    Joined:
    Aug 5, 2008
    Messages:
    55
    Location:
    France
    Hello,
    When we sell goods with a wagon unit, the goods are still displayed in the unit info panel (bottom left). It's refreshed only when we change the selected unit.

    You can force a refresh by adding at the end of doSellBonus in PAE_Trade.py :

    Code:
    CyInterface().setDirty(InterfaceDirtyBits.InfoPane_DIRTY_BIT, True)
     
  2. madboy77

    madboy77 Chieftain

    Joined:
    Jan 1, 2019
    Messages:
    60
    Gender:
    Male
    Where/how can one learn to code in Python ?
     
  3. Dertuek

    Dertuek Chieftain

    Joined:
    Aug 5, 2008
    Messages:
    55
    Location:
    France
    I learned by reading civ4 code. But I already knew other (easier) programming languages.
     
  4. pie_at

    pie_at PAE-Let's play ancient

    Joined:
    May 29, 2009
    Messages:
    1,766
    Gender:
    Male
    Location:
    Austria
    oh wow thx again Dertuek! those small upgrades are very useful!!

    does this also work with the unit overlay promotion icon, when a unit can be promoted? so can this be included into the eventmanager under onUnitPromoted() ?
     
  5. Dertuek

    Dertuek Chieftain

    Joined:
    Aug 5, 2008
    Messages:
    55
    Location:
    France
    I can't say, I don't understand what you talk about :o
     
  6. pie_at

    pie_at PAE-Let's play ancient

    Joined:
    May 29, 2009
    Messages:
    1,766
    Gender:
    Male
    Location:
    Austria
    ok, when a unit can be promoted (BTS unit promotions), the unit button (main interface) has an overlay icon in form of two arrow heads (similar to the symbol of a sergeant).
    when I know promote the unit and don't switch to another unit, I still see the overlay icon.

    but never mind, you helped me much with the code for PAE_Trade, I can now test it on my own
     
  7. Dertuek

    Dertuek Chieftain

    Joined:
    Aug 5, 2008
    Messages:
    55
    Location:
    France
    OK
    In this case, you can use:
    Code:
        def onUnitPromoted(self, argsList):
            'Unit Promoted'
            pUnit, iPromotion = argsList
    
            if not self.__LOG_UNITPROMOTED:
                player = PyPlayer(pUnit.getOwner())
                CvUtil.pyPrint('Unit Promotion Event: %s - %s' %(player.getCivilizationName(), pUnit.getName(),))
    
            CyInterface().setDirty(InterfaceDirtyBits.PlotListButtons_DIRTY_BIT, True)
    
     
  8. pie_at

    pie_at PAE-Let's play ancient

    Joined:
    May 29, 2009
    Messages:
    1,766
    Gender:
    Male
    Location:
    Austria
    aha ok! thx, I try it!
     

Share This Page