Numbered Steps to Reproduce Problem:
Using consts in multi-dimensional lists causes the const's variable name to be read instead of the value. For example, if you have a const named DUD for "Dudley", if read from a normal list, it will be read as "Dudley". But if that list is for example var/list/l=list(DUD=1), it will be read as 'DUD'.
Code Snippet (if applicable) to Reproduce Problem:
var
const
E_FIRE="Fire"
E_ICE="Ice"
var/list/l1=list(E_FIRE,E_ICE)
var/list/l2=list(E_FIRE=1,E_ICE=1)
var/list/l3=list("1"=E_FIRE,"2"=E_ICE)
mob
verb
test_list()
usr << "Testing l1."
for(var/X in l1)
usr << X // Will show the actual value of const.
usr << "Testing l2."
for(var/X in l2)
usr << X // Will wrongly show the const itself, ie E_FIRE
usr << "Testing l3."
for(var/X in l3)
usr << l3[X] // Will show the actual value of const.
This very simple example will show you the problem in any project with a text output.
Expected Results:
consts show their value instead of variable name in all types of lists.
Actual Results:
const variable name is shown in multi-dimensional lists instead.
Does the problem occur:
Every time? Or how often? Yes.
In other games? n/a
In other user accounts? n/a
On other computers? n/a
When does the problem NOT occur?
It seems that if you use the const as a value in the list instead of the index (see l3), it'll display fine. However it doesn't if used as the index of a list (see l2).
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Yes, I remember using consts in multi-dimensional lists before, and experiencing issues. I couldn't identify the source at the time, so I didn't report it, but having found it, I've decided to post this.
Workarounds: