Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of compiletime structures in TooltipGenerator resulted in unused data in war3map.j #926

Open
rolandc85 opened this issue Jan 22, 2020 · 3 comments

Comments

@rolandc85
Copy link

rolandc85 commented Jan 22, 2020

@compiletime function createFeedback()
let tgen = new LotsAbilityTooltipGenerator("Burns an opponent's mana on each attack, dealing mana burned as damage to the target.", Targettype.PASSIVE)
new AbilityDefinitionFeedback(FEEDBACK_ABIL_ID)
..registerTooltipGenerator(tgen)
..tooltipStartListen()
..preset("Feedback", Hotkey.E)
..addTooltipProperty("Mana Burned per Hit", (int lvl) -> (MANA_DRAINED_PER_LVL * lvl).toString())
..tooltipStopListen() //endoftooltip

In this case, the "Mana Burned per Hit" is used for tooltip generation. After which, during compile time, it is stored in a

private var propMap = new IterableMap<string, StringLevelClosure>

The tooltip generator was like the one in this thread

https://www.hiveworkshop.com/threads/wurst-ability-tooltip-generator.253389/

I notice that in the war3map.j

The string was initialised like this.

call SaveStr(cS,2,523856396,"Mana Burned per Hit")

However, this string is not required at all. It's only used for generating the tooltip for the ability. Will the -opt flag be able check if 523856396 is not accessed, then exclude it from the compiled script.

Just to add, I have also made attempts to destroy the propMap after using it but to no avail.

@rolandc85 rolandc85 changed the title Usage of TooltipGenerator resulted in unused data in war3map.j Usage of IterableMap in TooltipGenerator resulted in unused data in war3map.j Jan 22, 2020
@rolandc85 rolandc85 changed the title Usage of IterableMap in TooltipGenerator resulted in unused data in war3map.j Usage of compiletime structures in TooltipGenerator resulted in unused data in war3map.j Jan 22, 2020
@peq
Copy link
Collaborator

peq commented Jan 22, 2020

@Frotty I guess we need to remove the compiletime support from the StdLib Hastables again (and provide different data structures for transferring values.

@Frotty
Copy link
Member

Frotty commented Jan 22, 2020

I think the migration should not be the default, tbh.
Do you propose a specific class that has to be used, or what?

@peq
Copy link
Collaborator

peq commented Jan 22, 2020

The problem is the static hashtable. Is the number of hashtables still so limited that we need this optimization? If it was a normal field, Wurst could figure out which hashtables to transfer.

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

No branches or pull requests

3 participants