Page 1 of 1

When/why to use setargs()?

PostPosted: Sat Aug 12, 2017 8:35 pm
by Jsosnowski
Using the AEC_MODL macro code as an example I discovered a small mystery. In the 'function door_main(act, precord, parguments)' menu the code assigns 'd: pdoor_type' as 'd := addr (g_d);' where 'g_d' is an interface level global record variable. All calls to other menus are activated using a call procedure such as:

Code: Select allprocedure call_door_unit_data(pw: pdoor_type; var iwant : wanttype);
begin
  setargs(pw);
  iwant := XdoorUnitData;
end;
 

and assign 'd' with the code 'd := pdoortype (parguments);

My question is why is setargs() used to call each successor menu rather than doing a direct assignment using 'd := addr (g_d);' as inthe first level menu?

Re: When/why to use setargs()?

PostPosted: Mon Sep 11, 2017 2:39 pm
by Jsosnowski
I think I've got it. I added an explanation and example for using setargs() in D4D Tutorial PART THREE.