a Map working in html5 but not other targets

Monkey Forums/Monkey Programming/a Map working in html5 but not other targets

4mat(Posted 2013) [#1]
I've been updating an old game engine to work with the newer versions of Monkey. It's still working fine in html5, but I'm getting odd behaviour in flash and glfw with the map module.

I'm using it to fast sort an array, probably a weird use for it, but I used a similar thing with List in Blitzmax.

In OnUpdate I'm making the map each cycle like this:

	map.Clear

	for i = 1 to 128

		' adding 64 to the values so they don't go negative
	
	map.Set(ZDepth[i]+64+","+i,Null)

	next


Then In OnRender I do this:

	
	For Local a:=Eachin map.Keys
							
	    Local s$ = a
	    Local v:=s.Split(",")
	    Local p=Int(v[1].Trim())

	' Draw up Sprite[p] 
	
	Next	


This works fine in html5, but on the other targets I only get the first item only. (Doing a count in the render loop shows me the same)

Has anyone had similar problems? Again I'm probably not using map as it should be used so maybe that's it, but was wondering why it's ok in html5 and not the others now.

thanks


Samah(Posted 2013) [#2]
ZDepth[i]+64+","+i

I'm wondering if this is being evaluated in a weird way on different platforms. Try wrapping the integer addition to make sure it's not converting 64 to a string.

[monkeycode](ZDepth[i]+64)+","+i[/monkeycode]


4mat(Posted 2013) [#3]
ah, just tried that but have the same result unfortunately. thanks for the suggestion, I'll keep looking.