ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Correcting the signature for the GetMapInfo API (https://www.esoui.com/forums/showthread.php?t=9246)

ZOS_DanBatson 06/30/20 04:42 PM

Correcting the signature for the GetMapInfo API
 
We noticed that there was an error in the API for GetMapInfo:

Code:

* GetMapInfo(*luaindex* _index_)
** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *integer* _zoneId_, *string* _description_

should have been:

Code:

* GetMapInfo(*luaindex* _index_)
** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *luaindex* _zoneIndex_, *string* _description_

If we fix zoneId integer to be zoneIndex luaindex, any addons that happened to be using this function that had realized the mistake and corrected for it would suddenly break. However, it's possible no one was even using this API. So what I'd like to know is:

A: Is anyone using the API?
B: What would the community prefer in this situation? I can either correct it to be what it should be (potentially breaking any addon using the API) or I can deprecate the field (supporting it in the same broken way forever) and add a new corrected field on the end:

Code:

* GetMapInfo(*luaindex* _index_)
** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *integer* _deprecatedZoneIndex_, *string* _description_, *luaindex* _zoneIndex_

Thoughts?

sirinsidiator 06/30/20 04:47 PM


But that may just be my own preference. :D

Kyoma 06/30/20 05:13 PM

Wait but zoneId isn't always zoneIndex-1 (or +1), right? So does this mean up until now it hasn't been giving the right return value

ZOS_DanBatson 06/30/20 06:30 PM

Quote:

Originally Posted by Kyoma (Post 41674)
Wait but zoneId isn't always zoneIndex-1 (or +1), right? So does this mean up until now it hasn't been giving the right return value

Correct, it has been giving the wrong value this entire time. It was never a zone id, it was a zone index. But because it wasn't a luaindex type, it was an off by one zone index to boot.

Baertram 07/01/20 07:20 AM

Searched my addons folder in total and "GetMapInfo" was used in several of the addons I know/use.
e.g. CraftStore which is commonly used and wide spread, Votans Improved Locations, Survey the World (also wide spread and used), What pledges at my alts (also wide spread and used).
I did not check what variables they use from the returned values though.

Maybe, to keep it easy, and not break any existing addon:
Correct the function's description, and add the correct parameter at the end?

votan 07/01/20 12:14 PM

I use it in VotansImprovedLocations.
I like the idea sirinsidiator suggested in gitter.

ZOS_DanBatson 07/02/20 08:11 AM

We went with two new functions, GetMapInfoByIndex and GetMapInfoById, both with the correct zoneIndex param. Then we put a GetMapInfo function into the compat alias file with the "uncorrection" for existing addons to use until they update.

Thanks all!

Kyoma 07/02/20 12:33 PM

Does that mean GetMapInfoById will use mapIds as returned from GetCurrentMapId() and such?

ZOS_DanBatson 07/02/20 06:38 PM

Yes. We've added a variety of mapId specific APIs to make maps easier to use. They'll be in the next major update after the one coming up.


All times are GMT -6. The time now is 07:54 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI