an old bug seems to raise it ugly head again .
I reported this quite a long time ago, and it was already fixed. I still have to check if it happens with the last core version before POL 097 2008-02-26:
In certain cases the assignment of an ItemRef to a struct element inside a struct initializer causes the struct and the ItemRef both to become invalid!
How to repeat:
Consider the following small program: It works as a command. Start it and select any item, it does not matter.
If the line marked as 'Bug' is active and the next two lines are commented out, the bug is seen: The print statements in the program print:
<appobj:ItemRef>
<uninitialized object>
<uninitialized object>
If the line marked as 'Bug' is commented out and the next two lines are active, the script runs as it should. Both sets of lines do exactly the same thing. The output as it is expected:
<appobj:ItemRef>
struct{ cmd = 10, field = <appobj:ItemRef>, type = 12 }
<appobj:ItemRef>
Code: Select all
// Ecompile Bug Test
use os;
use uo;
program test(who)
var testitem := Target(who, 0); // select any item
print(testitem); // print an itemref
var ev;
if (testitem.serial)
ev := struct {type := 12, cmd := 10, field := testitem}; // Bug !
// ev := struct {type := 12, cmd := 10, field}; // No Bug
// ev.field := testitem; // No Bug endif
print(ev);
print(testitem);
endprogram