Upgrading high-xp units

Noyyau

Privateer Captain
Joined
Jun 9, 2012
Messages
1,446
Location
Italy
Recently I upgraded some high-xp units and noticed an odd behavior:

My Noble Knights, all with xp in the range 120-140, when upgraded (to Cuirassiers) had their xp bumped down to 100, as I expected would happen.

However when I upgraded three more high-xp units (all Warlord-led), with xp from a low of 200+ up to a staggering 500+ (my starting Warrior, who was lucky to survive, got a Warlord, and became a one-unit army who eliminated a civilization on his own), none of them lost a single xp point.

What's the reason for this different behaviour?

Is it some subtle difference in the coding between "Starts with the promotion "Led by Warlord" (the Noble Knights) rather than attaching a Great General through the normal ingame actions (my other units), meaning that a unit starting with the Led by Warlord promo doesn't get some other flag checked/value flipped from 0 to 1, and for the upgrades counts as a normal unit?
 
Recently I upgraded some high-xp units and noticed an odd behavior:

My Noble Knights, all with xp in the range 120-140, when upgraded (to Cuirassiers) had their xp bumped down to 100, as I expected would happen.

However when I upgraded three more high-xp units (all Warlord-led), with xp from a low of 200+ up to a staggering 500+ (my starting Warrior, who was lucky to survive, got a Warlord, and became a one-unit army who eliminated a civilization on his own), none of them lost a single xp point.

What's the reason for this different behaviour?

Is it some subtle difference in the coding between "Starts with the promotion "Led by Warlord" (the Noble Knights) rather than attaching a Great General through the normal ingame actions (my other units), meaning that a unit starting with the Led by Warlord promo doesn't get some other flag checked/value flipped from 0 to 1, and for the upgrades counts as a normal unit?

I read through the source code, and only units without a leader get their XP totals reduced after upgrading. The Great General is the only leader unit we have, but other units could be defined as leaders.

This is from CvUnit.cpp, lines 11716 - 11722.
Code:
if (pUpgradeUnit->getLeaderUnitType() == NO_UNIT)
{
	if (pUpgradeUnit->getExperience() > GC.getDefineINT("MAX_EXPERIENCE_AFTER_UPGRADE"))
	{
		pUpgradeUnit->setExperience(GC.getDefineINT("MAX_EXPERIENCE_AFTER_UPGRADE"));
	}
}
 
So the solution would be to set the Noble Knights to also be defined as leaders?
 
So the solution would be to set the Noble Knights to also be defined as leaders?

No, that would only allow the Noble Knight to join another unit as a leader. What we would have to do is somehow define the Noble Knight as having a leader already attached. This is beyond my abilities, and I don't think it it important to do for just one unit.
 
I'll leave to Vokarya the decision if the Noble Knights should maintain their xp at upgrading or not.
He's the master balancer around here!
(I would of course vote for letting them keep the xp. Hurray for one-unit armies!)
 
Top Bottom