SDK onUnitMove Question

Jeckel

Great Reverend
Joined
Nov 16, 2005
Messages
1,637
Location
Peoria, IL
Hey all, I'm making some good progress on my JUnitSpace SDK mod, but I am wanting to apply/remove promotions when units move. In the CvEventManager.py file there is a event method, onUnitMove. Can anyone tell me where this python method is called from the SDK?
 
Hey all, I'm making some good progress on my JUnitSpace SDK mod, but I am wanting to apply/remove promotions when units move. In the CvEventManager.py file there is a event method, onUnitMove. Can anyone tell me where this python method is called from the SDK?

I think its called everytime the unit enters a plot (so if he passes through 3 plots in a turn it would be called 3 times) but I dont have the sdk here to check for sure.

One thing I know for sure it is an incrediably expensive function to use. In fact I requested the onUnitMove function be added back in the BtS design days and it just about killed or playtesting until Alex put in the ability to disable it.
 
I think its called everytime the unit enters a plot (so if he passes through 3 plots in a turn it would be called 3 times) but I dont have the sdk here to check for sure.

One thing I know for sure it is an incrediably expensive function to use. In fact I requested the onUnitMove function be added back in the BtS design days and it just about killed or playtesting until Alex put in the ability to disable it.

I hear ya on that one. The only function I would bet is called more is the GameUtils cannontUnitMoveInto, that is called ALL the time. :lol:

But I am not putting any code in python on this one. I need to apply a "Crowded" promo to units when the tile they are in is full. The fullness and openness of tiles changes each time a unit moves.

So my question is, where would be the best place in the SDK to put this check?

The cloest thing I can find is groupMove() in CvSelectionGroup.cpp. Is this the function that is called each time a unit (or more technically the Selection Group it belongs to) moves?
 
Umm, nevermind, I'm dumb, CvUnit.cpp move(). It was so obvious I guess I just missed it. :crazyeye:
 
Back
Top Bottom