View Single Post
Old 08-6-2016, 06:12 PM   #935
Velocity
Doing the wrong thing the right way since 2010.
Site and Game Administrator
AdministratorRetired StaffDeveloperFFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
Velocity's Avatar
 
Join Date: Jul 2007
Posts: 1,812
Default Re: Bugs that don't deserve their own thread

Quote:
Originally Posted by Zapmeister View Post
well done to the velocity engine for rendering 0x69 as "105"

(for those who don't get it, 0x before a number in compsci-speak means you want the number to be hexadecimal, and 69 in hex is 105 in decimal. but how did the engine confuse the string "0x69" with int(0x69) ?! )

pic
It's a common issue with the engine.

It mostly comes from the parsing of the playlist where certain things are strings and certain things are numbers. But because flashvars doesn't contain the type and I was really bad at writing simple stuff long ago, all song variables are passed though a isNaN() then either Number() or nothing to convert the correct strings to numbers.

Code:
var songData = new Array();
for (var x = 0; x < songnodes.childNodes[a].childNodes.length; ++x) {
	var songnode = songnodes.childNodes[a].childNodes[x];
	songData[songnode.nodeName] = (isNaN(songnode.firstChild.nodeValue) ? String(songnode.firstChild.nodeValue) : Number(songnode.firstChild.nodeValue));
}
		
songData.songname = String(songData.songname);


This fails on song names as some happen to be perfectly valid numbers, and Number() can interpret "0x" enough to determine it's hex and display "correctly".

TL;DR:
I check things too basically and doesn't stop edge cases. Woops.

Last edited by Velocity; 08-6-2016 at 06:17 PM..
Velocity is offline   Reply With Quote