5 posts
Custom Map_ID
Edited by CalPhorus on Reason: Initial post
Hello,

I know that there are the built-in values for Map_ID, but is it possible to create new ones using variables of type int32_t (since all of the functions/structs that make use of a Map_ID actually use int32_t)?

Thanks!
Allen Webster
473 posts / 4 projects
Heyo
Custom Map_ID
Yep!

You don't have to do anything special to register your own maps except you need to make sure it has a value not clashing with any of the other maps in use.
5 posts
Custom Map_ID
I just tried making a map with a custom value (the value that I am using for the custom map is 0x01000008 or (1<<24)+8), and 4coder crashes. I tried changing the value to one of the 4coder built-ins (mapid_file), and 4coder no longer crashes. Putting it in Visual Studio to debug my code, my code is reached and once it returns from get_bindings it crashes with an exception: "Exception thrown at 0x00007FF8BD6A2672 (4ed_app.dll) in 4ed.exe: 0xC0000005: Access violation reading location 0x0000000000000190". I am using the 4.0.25 version purchased from itch.io.
Allen Webster
473 posts / 4 projects
Heyo
Custom Map_ID
Edited by Allen Webster on
Why are you using "(1 << 24) + 8"? Values over (1 << 24) are reserved for built in maps like mapid_global, mapid_file, etc. You should just start at 0, or if you're trying to avoid conflicting with "default_code_map", just start at "default_maps_count". That isn't a map, it's there so you can start you enum from there.

However - that's not suppose to cause a crash. It's suppose to give you a warning and just not make the map... will take a look at that part.
5 posts
Custom Map_ID
I noticed the maps started at 1<<24, so I figured that all of the maps were supposed to start there (both built-in and custom).

Thanks for the help, changing the initial value in my enum to "default_maps_count" fixed all crashes!
Allen Webster
473 posts / 4 projects
Heyo
Custom Map_ID
Great!

There used to be better documentation on this in the custom code... I guess it got lost at some point while things were moving around because I don't see it anymore :/

Thanks for bringing this stuff to my attention.