wow-rp-addons / LibMSP

The “Mary Sue Protocol” (“MSP” for short) is a simple challenge/response protocol for RP UI add-ons within WoW to communicate with each other and publish text information to other clients (such as RP character names and descriptions).
Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

Ensure AddFieldsToTooltip only adds fields once #35

Closed Meorawr closed 3 years ago

Meorawr commented 3 years ago

If AddFieldsToTooltip is called with any field names already registered in the ttList table, the AddTTField function would insert the field again into the list.

This would then manifest in a later Update call by and cause the duplicated fields to appear twice in the canned ttContents/ttCache responses needlessly.

Checking if the table contains the field prior to adding ensures we don't duplicate the field and keeps the size of TT field responses down.

Before, we can see that if AddFieldsToTooltip is called with some fields they'll be duplicated in the cache - see the "VA" field near the start and end:

image

With the change applied, the same test won't cause a duplicate "VA" field to be present in the cached string:

image