Skip to content

Conversation

lostsquirrel1
Copy link
Collaborator

@lostsquirrel1 lostsquirrel1 commented Oct 7, 2025

Make udWeaponCounts length set to unit def count rather than a fix length.

The passing of unitDefHandler as an argument (rather than globally) is to clearly show that there is a dependency in the initialization order.

Copy link
Collaborator

@sprunk sprunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the array even useful? It seems to only ever be used here

if ((n = udWeaponCounts.at(unitDef->id)) > MAX_WEAPONS_PER_UNIT)
n = (udWeaponCounts.at(unitDef->id) = unitDef->NumWeapons());

so the weapon count could just be cached in the unit def itself.

That said, that would be a bit of a rewrite to this looks good too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants