Jump to content

Bug: elite and advanced unit stats are the same if both are present


WhiteTreePaladin
 Share

Recommended Posts

I've noticed something interesting (It's a problem Michael mentioned earlier.)

If there are both advanced and elite units on a map, the elite units will have the same stats as the advanced version. The elite version will have the correct icon though - which is referenced in the elite template.

On the Latium map, there are only elite (and basic if you train them) units available. They both have the correct stats there.

Link to comment
Share on other sites

I noticed another bug with under-construction buildings starting with full HP, and it turns out it's the same as this. When an entity template first gets used by a script, the engine caches the result of converting the template to a JS object, and it assumed templates were never modified so it was safe to cache that forever. It's true that templates aren't modified directly, but with inheritance they are copied and then modified (adding the child's data to the parent's) and it was copying and reusing the old cached JS object. So if an entity inherited from another entity which was loaded earlier, it would get the old entity's stats.

Fixed locally; I'll commit soonish.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...