|
|
So... The reason why my whole map was shifted by one tile was a problem
on my string[]-to-int[][] conversion. Apparently substr is 1-based. You
can notice it on the manual from the example:
substr("ABCDEFGHI",4,2) evaluates to the string "DE".
But it's not explicitly stated that P is 1-based.
#declare String = "abcd";
#declare I=0;
#while(I<strlen(String)+1)
#debug concat("Character ", str(I,0,0), " is '",
substr(String,I,1),"'\n")
#declare I=I+1;
#end
Passing 0 as P gives an empty string. 1-4 give the characters. Anything
outside that range is an error. Why P=0 -> empty string? If it's
one-based, shouldn't 0 give an error, just like -1 would in a zero-based
index? And why 1-based?
Post a reply to this message
|
|