Thread Tools Display Modes
06/30/20, 04:42 PM   #1
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
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?
  Reply With Quote
06/30/20, 04:47 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566

But that may just be my own preference.
  Reply With Quote
06/30/20, 05:13 PM   #3
Kyoma
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 125
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

Last edited by Kyoma : 06/30/20 at 05:40 PM.
  Reply With Quote
06/30/20, 06:30 PM   #4
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
Originally Posted by Kyoma View Post
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.
  Reply With Quote
07/01/20, 07:20 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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?
  Reply With Quote
07/01/20, 12:14 PM   #6
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
I use it in VotansImprovedLocations.
I like the idea sirinsidiator suggested in gitter.
  Reply With Quote
07/02/20, 08:11 AM   #7
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
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!
  Reply With Quote
07/02/20, 12:33 PM   #8
Kyoma
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 125
Does that mean GetMapInfoById will use mapIds as returned from GetCurrentMapId() and such?
  Reply With Quote
07/02/20, 06:38 PM   #9
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
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.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Correcting the signature for the GetMapInfo API

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off