@@ -32,20 +32,20 @@ int main()
3232
3333 /* The event_loop function can be resumed later, and can execute work
3434 that has been preemptively handed to it from other machines. */
35- auto events = Script (" events" , " scripts/gameplay.elf" , debug);
35+ Script events (" events" , " scripts/gameplay.elf" , debug);
3636 /* A VM function call. The function is looked up in the symbol table
3737 of the program binary. Without an entry in the table, we cannot
3838 know the address of the function, even if it exists in the code. */
3939 assert (events.address_of (" event_loop" ) != 0x0 );
4040 events.call (" event_loop" );
4141
4242 /* Create the gameplay machine by cloning 'events' (same binary, but new instance) */
43- auto gameplay = events.clone (" gameplay" );
43+ Script gameplay = events.clone (" gameplay" );
4444
4545 /* This is the main start function, which would be something like the
4646 starting function for the current levels script. You can find the
4747 implementation in scripts/src/level1.cpp. */
48- auto level1 = Script (" level1" , " scripts/level1.elf" , debug);
48+ Script level1 (" level1" , " scripts/level1.elf" , debug);
4949 /* level1 make remote calls to the gameplay program. */
5050 level1.setup_remote_calls_to (gameplay);
5151
@@ -55,7 +55,7 @@ int main()
5555 }
5656
5757 /* Use strict remote calls for level2 */
58- auto level2 = Script (" level2" , " scripts/level2.elf" , debug);
58+ Script level2 (" level2" , " scripts/level2.elf" , debug);
5959 /* level2 can make remote calls to the gameplay program. */
6060 level2.setup_strict_remote_calls_to (gameplay);
6161 /* Allow calling *only* this function remotely, when in strict mode */
@@ -142,15 +142,18 @@ int main()
142142 " Calling '" , gameplay.symbol_name (obj.onDeath ), " ' in '" ,
143143 gameplay.name (), " ' for object at 0x" ,
144144 strf::hex (guest_objs.address (0 )), " \n " );
145- assert (obj.alive == true );
146145 gameplay.call (obj.onDeath , guest_objs.address (0 ));
147146 assert (obj.alive == false );
148147
149148 /* Guest-allocated objects can be moved */
150- auto other_guest_objs = std::move (guest_objs);
151- other_guest_objs.at (0 ).alive = true ;
152- gameplay.call (other_guest_objs.at (0 ).onDeath , other_guest_objs.address (0 ));
153- assert (other_guest_objs.at (0 ).alive == false );
149+ auto other_guest_objs = std::move (guest_objs);
150+
151+ GameObject& other_object = other_guest_objs.at (0 );
152+ other_object.alive = true ;
153+ other_object.name = " otherobject" ;
154+ other_object.onDeath = gameplay.address_of (" myobject_death" );
155+ gameplay.call (other_object.onDeath , other_guest_objs.address (0 ));
156+ assert (other_object.alive == false );
154157
155158 strf::to (stdout)(" ...\n " );
156159
0 commit comments