394:27: error: No entry in dictionary for key: 3400295406U
song_name = SONG_INFO[song]["Title"]
^~~~
This error disappears when any of the key values are updated, elements are removed from the list, or elements are re-ordered in the list (it is not affected by the values of the dictionary changing though).
This stems from the IntegerConstantExpression comparison between DictionaryEntrys comparing the difference between the values in ReplaceVariables() (as the keys are formerly variables). However, this doesn't correctly sort the list because some values are x - y > int.MaxValue, so in this case, SONG_DO_IT_AGAIN is sorted to the wrong end of the list, which means future BinarySearch()s fail for this entry.
The fix is to replace this with the int.CompareTo(), which correctly handles this case.
There's an edge case involving dictionaries which keys use a mixture of positive and negative integers. For example:
(a full working example can be found at Guitar Hero World Tour.rascript.txt)
This causes an error:
This error disappears when any of the key values are updated, elements are removed from the list, or elements are re-ordered in the list (it is not affected by the values of the dictionary changing though).
This stems from the
IntegerConstantExpression
comparison betweenDictionaryEntry
s comparing the difference between the values inReplaceVariables()
(as the keys are formerly variables). However, this doesn't correctly sort the list because some values arex - y > int.MaxValue
, so in this case,SONG_DO_IT_AGAIN
is sorted to the wrong end of the list, which means futureBinarySearch()
s fail for this entry.The fix is to replace this with the
int.CompareTo()
, which correctly handles this case.