It looks like the crux of this bug is that the LOADPICT command doesn't call the turtle setup code before loading the graphics file. After adding that block, the code behaves as expected:
Additional Changes
I noticed this issue while working on cleaning up some of the warning messages for issue #20 :
graphics.c: In function ‘restore_palette’:
graphics.c:1196:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(&nslots, sizeof(int), 1, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:1199:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(colors, sizeof(int), 3, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c: In function ‘lloadpict’:
graphics.c:2092:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(&rec_idx, sizeof(FIXNUM), 1, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2099:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
(void)fread(&next, One, 1, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2130:6: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
(void)fread(&next, One, 1, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2148:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(&bg, sizeof(int), 1, fp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I've included the warning message cleanup specific to this method in this PR; but, I can also split them out into a separate PR if that makes it easier to review.
resolves #134
Summary
It looks like the crux of this bug is that the
LOADPICT
command doesn't call the turtle setup code before loading the graphics file. After adding that block, the code behaves as expected:Additional Changes
I noticed this issue while working on cleaning up some of the warning messages for issue #20 :
I've included the warning message cleanup specific to this method in this PR; but, I can also split them out into a separate PR if that makes it easier to review.
Test Environment