Ok, I think I need a little help here ...
I want to give the ability to a specific leader to upgrade his units anywhere on the map, not only on his territory. I started with python, where I found the canUpgradeAnywhere function in CvGameUtils :
Which seemed to be the exact thing I needed. But all the changes I could make to the function seemed to have no effect. Even when I just made a popup test, it ever showed up. So I thought about going down to the game c++ core to see how the function is handled. Surprise : this function is NEVER called. So I decided to go for some c++ coding. It took me 24h before beeing able to settle an environement in linux (tanks CodeBlocks), but here I am.
So I made some tests, and the command supposed to handle the upgrade capacity is CvUnit::canUpgrade. First I made a call to the python "canUpgradeAnywhere" function that remove the "if (plot()->getTeam() != getTeam())" test if the result is positive. I also added a parameter for the palyer to the argsList so I can later restrict this in python based on the leader.
But I found out it was not enought. I started A LOT of tests to isolate the functions that are blocking the upgrade option to be presented. One way was in the function
But even if I bypass it, my units aren't given the possibility to upgrade outside my territory (in it on the contrary, they are given the full possibilities, even in animals), so I guess there is something elsewhere ... but I have no clue where.
So, anybody have an idea ? I suspect something in the functions that create the buttons interface, but i found nothing there linked to anything related to territory yet.
I want to give the ability to a specific leader to upgrade his units anywhere on the map, not only on his territory. I started with python, where I found the canUpgradeAnywhere function in CvGameUtils :
Code:
def canUpgradeAnywhere(self, argsList):
pUnit = argsList
bCanUpgradeAnywhere = 0
return bCanUpgradeAnywhere
Which seemed to be the exact thing I needed. But all the changes I could make to the function seemed to have no effect. Even when I just made a popup test, it ever showed up. So I thought about going down to the game c++ core to see how the function is handled. Surprise : this function is NEVER called. So I decided to go for some c++ coding. It took me 24h before beeing able to settle an environement in linux (tanks CodeBlocks), but here I am.
So I made some tests, and the command supposed to handle the upgrade capacity is CvUnit::canUpgrade. First I made a call to the python "canUpgradeAnywhere" function that remove the "if (plot()->getTeam() != getTeam())" test if the result is positive. I also added a parameter for the palyer to the argsList so I can later restrict this in python based on the leader.
But I found out it was not enought. I started A LOT of tests to isolate the functions that are blocking the upgrade option to be presented. One way was in the function
Code:
CvCity* CvUnit::getUpgradeCity(UnitTypes eUnit, bool bSearch, int* iSearchValue) const
But even if I bypass it, my units aren't given the possibility to upgrade outside my territory (in it on the contrary, they are given the full possibilities, even in animals), so I guess there is something elsewhere ... but I have no clue where.
So, anybody have an idea ? I suspect something in the functions that create the buttons interface, but i found nothing there linked to anything related to territory yet.