Y_Less

foreach 0.1.6

Aug 9th, 2010
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 52.59 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*-
  2.                              ======================
  3.                               YSI - Master Include
  4.                              ======================
  5. Description:
  6.     Handles distribution of control of code segments across all running scripts
  7.     with YSI to avoid conflicts of checkpoint streamers etc and allow features
  8.     like "/commands" displaying all commands on the server.
  9.    
  10.     Now fully autonomous - to use the master system simply define which one you
  11.     want and include the script:
  12.    
  13.       #define MASTER 14
  14.       #include <YSI\Master>
  15.    
  16.     That will make the current script attempt to make itself the main master -
  17.     you don't need ANY other code for initialisation anywhere (which took a
  18.     while to figure out)...
  19.    
  20.     This is now over 2000 lines of repetitive and complex macros!
  21. Legal:
  22.     Copyright (C) 2007 Alex "Y_Less" Cole
  23.  
  24.     This program is free software; you can redistribute it and/or
  25.     modify it under the terms of the GNU General Public License
  26.     as published by the Free Software Foundation; either version 2
  27.     of the License, or (at your option) any later version.
  28.  
  29.     This program is distributed in the hope that it will be useful,
  30.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  31.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  32.     GNU General Public License for more details.
  33.  
  34.     You should have received a copy of the GNU General Public License
  35.     along with this program; if not, write to the Free Software
  36.     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  37.     MA 02110-1301, USA.
  38. Version:
  39.     0.2
  40. Changelog:
  41.     06/08/10:
  42.         Managed the ultimate - got completely transparent inclusion!
  43.     05/08/10:
  44.         Completed new master system, now does all syncing and clients.
  45.     06/10/09:
  46.         Rewrote using states.
  47.         Added remote function macros.
  48.         Reduced the number of masters to a single one.  It must have them all.
  49.         Vastly simplified the master model - ending the master ends everything.
  50.     06/01/08:
  51.         Added code to not pass data if no other script exists.
  52.     17/11/07:
  53.         Added code for a script to remove itself from the global list.
  54.     11/10/07:
  55.         Not first version but added documentation months late.
  56. Functions:
  57.     Public:
  58.         -
  59.     Core:
  60.         -
  61.     Stock:
  62.         -
  63.     Static:
  64.         -
  65.     Inline:
  66.         -
  67.     API:
  68.         -
  69.     Hooks:
  70.         -
  71. Callbacks:
  72.     -
  73. Definitions:
  74.     -
  75. Enums:
  76.     -
  77. Macros:
  78.     RF - Declare a function which may be remote.
  79.     RV - Declare a void function which may be remote.
  80.     RS - Declare an optional callback.
  81.     RFN - Declare an optional callback with no parameters.
  82.     RFC - Declare a slower but shorter function.
  83.     RFP - Declare a function with tags and give recall hints.
  84.     RFPC - Combination of P and C.
  85.     RFCP - Combination of P and C.
  86. Tags:
  87.     -
  88. Variables:
  89.     Global:
  90.         _@ - ID of this script.
  91.     Static:
  92.         -
  93. Commands:
  94.     -
  95. Compile options:
  96.     YSIM_USE - Use the master system.
  97.     YSIM_CLIENT - Act purely as a client.
  98.     YSIM_T_ENABLE - Temporarily enable the master system.
  99.     YSIM_T_DISABLE - Temporarily disable the master system.
  100.     YSIM_C_ENABLE - Temporarily enable the client system.
  101.     YSIM_C_DISABLE - Temporarily disable the client system.
  102.     YSIM_S_ENABLE - Temporarily enable the server system.
  103.     YSIM_S_DISABLE - Temporarily disable the server system.
  104. Operators:
  105.     -
  106. Natives:
  107.     -
  108. -*----------------------------------------------------------------------------*/
  109.  
  110. // ALWAYS!  The compiler defines this automatically, don't use it as this is
  111. // included multiple times to handle multiple master systems.
  112. #undef _inc_y_master
  113.  
  114. #if !defined MASTER
  115.     #tryinclude <YSI\internal\y_automasters>
  116.     #if !defined MASTER
  117.         #error "You must define a unique MASTER number from 0 to 25."
  118.     #endif
  119. #endif
  120.  
  121. #if MASTER > 25 || MASTER < 0
  122.     // There are some secret ones reserved purely for YSI!
  123.     #if !defined _YSIM_USED_AUTO || MASTER > 42
  124.         #error "Invalid MASTER value, must be between 0 and 25 (inclusive)."
  125.     #endif
  126. #endif
  127.  
  128. #if defined YSIM_HAS_MASTER
  129.     #undef YSIM_HAS_MASTER
  130. #endif
  131.  
  132. #if defined YSIM_IS_CLIENT
  133.     #undef YSIM_IS_CLIENT
  134. #endif
  135.  
  136. #if defined YSIM_IS_SERVER
  137.     #undef YSIM_IS_SERVER
  138. #endif
  139.  
  140. #if defined YSIM_CLOUD
  141.     #undef YSIM_CLOUD
  142. #endif
  143.  
  144. //#if defined YSIM_NOT_CLIENT
  145. //  #undef YSIM_NOT_CLIENT
  146. //#endif
  147.  
  148. #if defined YSIM_OVERRIDE
  149.     // Get stored settings for YSI libraries.  This allows the group system to
  150.     // use the same master settings as another library without being there at
  151.     // the time.
  152.     #if YSIM_STORED_SETTINGS & 1
  153.         #define YSIM_HAS_MASTER 1
  154.     #else
  155.         #define YSIM_HAS_MASTER 0
  156.     #endif
  157.    
  158.     #if YSIM_STORED_SETTINGS & 2
  159.         #define YSIM_IS_CLIENT 1
  160.     #else
  161.         #define YSIM_IS_CLIENT 0
  162.     #endif
  163.    
  164.     #if YSIM_STORED_SETTINGS & 4
  165.         #define YSIM_IS_SERVER 1
  166.     #else
  167.         #define YSIM_IS_SERVER 0
  168.     #endif
  169.    
  170.     #if YSIM_STORED_SETTINGS & 8
  171.         #define YSIM_CLOUD 1
  172.     #else
  173.         #define YSIM_CLOUD 0
  174.     #endif
  175. #else
  176.     // Set up simple quick macros to query different current capabilities.
  177.     #if (!defined YSI_NO_MASTER || defined YSIM_T_ENABLE) && !defined YSIM_T_DISABLE
  178.         #define YSIM_HAS_MASTER 1
  179.     #else
  180.         #define YSIM_HAS_MASTER 0
  181.     #endif
  182.    
  183.     #if (defined YSIM_CLIENT || defined YSIM_C_ENABLE) && !defined YSIM_C_DISABLE
  184.         #define YSIM_IS_CLIENT 1
  185.     #else
  186.         #define YSIM_IS_CLIENT 0
  187.     #endif
  188.    
  189.     #if (defined YSIM_SERVER || defined YSIM_S_ENABLE) && !defined YSIM_S_DISABLE
  190.         #define YSIM_IS_SERVER 1
  191.     #else
  192.         #define YSIM_IS_SERVER 0
  193.     #endif
  194.    
  195.     #if YSIM_HAS_MASTER && !YSIM_IS_CLIENT && !YSIM_IS_SERVER
  196.         #define YSIM_CLOUD 1
  197.     #else
  198.         #define YSIM_CLOUD 0
  199.     #endif
  200. #endif
  201.  
  202. #if defined _inc_y_masteronce
  203.  
  204. // Been included at least once, clean up from before.
  205. #undef RF
  206. #undef RF@p
  207. #undef RF@c
  208. #undef RF@v
  209. #undef RF@n
  210. #undef RF@pc
  211. #undef RF@pv
  212. #undef RF@pcv
  213. #undef RF@vc
  214. #undef RF@vn
  215.  
  216. #undef RC
  217. #undef RC@v
  218. #undef RC@n
  219. #undef RC@vn
  220.  
  221. #undef Master_Caller
  222. //#undef Master_Init
  223.  
  224. #else
  225.  
  226. // These parts should only be defined once ever.  This code is not dependent on
  227. // the current MASTER value, it's all generic.
  228.  
  229. #define _inc_y_masteronce
  230.  
  231. #include <YSI\y_utils>
  232. #include <YSI\y_debug>
  233.  
  234. #define YSIM_MASTER #M
  235.  
  236. #define YSIM_RETURN #R
  237.  
  238. #define YSIM_CALLER #C
  239.  
  240. #define YSIM_STRING (42)
  241.  
  242. // Public variable.
  243. public
  244.     _@ = -1;
  245.  
  246. #define YSIM_NOT_CLIENT (!YSIM_HAS_MASTER || !YSIM_IS_CLIENT)
  247.  
  248. //#if !defined MAX_MASTERS
  249. #define MAX_MASTERS 26
  250. //#else
  251. //  #if MAX_MASTERS > 32
  252. //      #undef MAX_MASTERS
  253. //      #define MAX_MASTERS 32
  254. //  #endif
  255. //#endif
  256.  
  257. forward Master_Reassert();
  258.  
  259. static
  260.     YSI_g_sMasterCount,
  261.     YSI_g_sMasterData[MAX_MASTERS];
  262.  
  263. native U@(id=0, const name[]="", value=cellmin, const string[]="") = setproperty;
  264. native V@(id=0, const name[]="", value=cellmin, string[]="") = getproperty;
  265. native W@(const function[], const format[], {Float,_}:...) = CallRemoteFunction;
  266.  
  267. stock X@(n)
  268. {
  269.     U@(8, YSIM_RETURN, n);
  270. }
  271.  
  272. stock Y@()
  273. {
  274.     return U@(8, YSIM_CALLER, _@);
  275. }
  276.  
  277. stock Z@()
  278. {
  279.     U@(8, YSIM_CALLER, -1);
  280.     return V@(8, YSIM_RETURN);
  281. }
  282.  
  283. stock T@()
  284. {
  285.     U@(8, YSIM_CALLER, -1);
  286. }
  287.  
  288. /*----------------------------------------------------------------------------*-
  289. Hook:
  290.     OnGameModeInit
  291. Notes:
  292.     Constructor.  Gets the script a master ID.  Now ALWAYS gets an ID, even if
  293.     the master system is disabled - doing otherwise is just too complicated.
  294. -*----------------------------------------------------------------------------*/
  295.  
  296. #if defined FILTERSCRIPT
  297.     public OnFilterScriptInit()
  298. #else
  299.     public OnGameModeInit()
  300. #endif
  301. {
  302.     P:1("Master_OGM");
  303.     if (!existproperty(8, YSIM_MASTER))
  304.     {
  305.         setproperty(8, YSIM_MASTER, 0);
  306.     }
  307.     // Properties get lost between script changes so we need to force a rebuild.
  308.     CallRemoteFunction("Master_Reassert", "");
  309.     new
  310.         masters = getproperty(8, YSIM_MASTER),
  311.         i = 0;
  312.     while (i != 32)
  313.     {
  314.         if (!(masters & (1 << i)))
  315.         {
  316.             _@ = i;
  317.             masters |= 1 << i;
  318.             break;
  319.         }
  320.         ++i;
  321.     }
  322.     if (i != 32)
  323.     {
  324.         setproperty(8, YSIM_MASTER, masters);
  325.     }
  326.     C:1(if (_@ == -1) printf("*** Internal Error! MasterID not assigned"););
  327.     // Just use one name...
  328.     CallLocalFunction("YSIM_OnScriptInit", "");
  329.     return 1;
  330. }
  331.  
  332. #if defined FILTERSCRIPT
  333.     #if defined _ALS_OnFilterScriptInit
  334.         #undef OnFilterScriptInit
  335.     #else
  336.         #define _ALS_OnFilterScriptInit
  337.     #endif
  338.     #define OnFilterScriptInit YSIM_OnScriptInit
  339. #else
  340.     #if defined _ALS_OnGameModeInit
  341.         #undef OnGameModeInit
  342.     #else
  343.         #define _ALS_OnGameModeInit
  344.     #endif
  345.     #define OnGameModeInit YSIM_OnScriptInit
  346. #endif
  347. forward YSIM_OnScriptInit();
  348.  
  349. /*----------------------------------------------------------------------------*-
  350. Hook:
  351.     OnGameModeExit
  352. Notes:
  353.     Destructor.
  354. -*----------------------------------------------------------------------------*/
  355.  
  356. #if defined FILTERSCRIPT
  357.     public OnFilterScriptExit()
  358. #else
  359.     public OnGameModeExit()
  360. #endif
  361. {
  362.     // Loop through everything this script is master for and call the remote
  363.     // function for it.  EXCEPT for this script itself!
  364.     new
  365.         func[4];
  366.     for (new i = 0; i != YSI_g_sMasterCount; ++i)
  367.     {
  368.         // This is slightly slower for ending and starting scripts, but uses far
  369.         // less heap space, and these values are rarely used, so may as well
  370.         // pack them (which is what has happened here).
  371.         func[0] = YSI_g_sMasterData[i] & 0xFF;
  372.         func[1] = (YSI_g_sMasterData[i] >> 8) & 0xFF;
  373.         func[2] = YSI_g_sMasterData[i] >> 16;
  374.         CallLocalFunction(func, "");
  375.         // The properties currently clear instantly, but that may not always be
  376.         // the case.
  377.         setproperty(8, YSIM_MASTER, getproperty(8, YSIM_MASTER) & ~(1 << _@));
  378.     }
  379.     CallLocalFunction("YSIM_OnScriptExit", "");
  380.     return 1;
  381. }
  382.  
  383. #if defined FILTERSCRIPT
  384.     #if defined _ALS_OnFilterScriptExit
  385.         #undef OnFilterScriptExit
  386.     #else
  387.         #define _ALS_OnFilterScriptExit
  388.     #endif
  389.     #define OnFilterScriptExit YSIM_OnScriptExit
  390. #else
  391.     #if defined _ALS_OnGameModeExit
  392.         #undef OnGameModeExit
  393.     #else
  394.         #define _ALS_OnGameModeExit
  395.     #endif
  396.     #define OnGameModeExit YSIM_OnScriptExit
  397. #endif
  398. forward YSIM_OnScriptExit();
  399.  
  400. /*----------------------------------------------------------------------------*-
  401. Function:
  402.     Master_Reassert
  403. Params:
  404.     -
  405. Return:
  406.     -
  407. Notes:
  408.     Rebuilds the collection of master data whenever a script is restarted.
  409. -*----------------------------------------------------------------------------*/
  410.  
  411. public Master_Reassert()
  412. {
  413.     // Make sure that the caller parameter is always -1 by default.
  414.     U@(8, YSIM_CALLER, -1);
  415.     if (_@ != -1)
  416.     {
  417.         // Readd this script's master value.
  418.         setproperty(8, YSIM_MASTER, getproperty(8, YSIM_MASTER) | (1 << _@));
  419.         // Readd this script's owned scripts.
  420.         new
  421.             func[4];
  422.         for (new i = 0; i != YSI_g_sMasterCount; ++i)
  423.         {
  424.             // This is slightly slower for ending and starting scripts, but uses far
  425.             // less heap space, and these values are rarely used, so may as well
  426.             // pack them (which is what has happened here).
  427.             func[0] = YSI_g_sMasterData[i] & 0xFF;
  428.             func[1] = (YSI_g_sMasterData[i] >> 8) & 0xFF;
  429.             func[2] = YSI_g_sMasterData[i] >> 16;
  430.             setproperty(8, func, _@);
  431.         }
  432.     }
  433. }
  434.  
  435. /*----------------------------------------------------------------------------*-
  436. Function:
  437.     _Master_Get
  438. Params:
  439.     library[] - The name of the library to try become master for.
  440. Return:
  441.     -
  442. Notes:
  443.     -
  444. -*----------------------------------------------------------------------------*/
  445.  
  446. stock bool:_Master_Get(library[])
  447. {
  448.     if (existproperty(8, library))
  449.     {
  450.         if (getproperty(8, library) != -1)
  451.         {
  452.             return false;
  453.         }
  454.     }
  455.     setproperty(8, library, _@);
  456.     // Add this library to the list.  The list is designed to only deal with
  457.     // two or three character master names now!
  458.     if (YSI_g_sMasterCount < MAX_MASTERS)
  459.     {
  460.         YSI_g_sMasterData[YSI_g_sMasterCount++] = library[0] | (library[1] << 8) | (library[2] << 16);
  461.     }
  462.     C:1(else printf("*** Internal Error! Too many master scripts"););
  463.     return true;
  464. }
  465.  
  466. // Define all the alternate spellings once.
  467. #define RF@cp  RF@pc
  468. #define RF@pvc RF@pcv
  469. #define RF@cpv RF@pcv
  470. #define RF@cvp RF@pcv
  471. #define RF@vpc RF@pcv
  472. #define RF@vcp RF@pcv
  473. #define RF@vp  RF@pv
  474. #define RF@cv  RF@vc
  475. #define RF@nv  RF@vn
  476.  
  477. #define RF@cpt  RF@pct
  478. #define RF@tcp  RF@pct
  479. #define RF@tpc  RF@pct
  480. #define RF@ctp  RF@pct
  481. #define RF@ptc  RF@pct
  482. #define RF@tp  RF@pt
  483. #define RF@tc  RF@ct
  484. #define RF@tn  RF@nt
  485.  
  486. /*
  487. #define RF:%1[%2](%3)
  488. #define RF@p:%1[%2](%3)<%4>
  489. #define RF@c:%1[%2](%3)
  490. #define RF@v:%1[%2](%3)
  491. #define RF@n:%1[]()
  492. #define RF@pc:%1[%2](%3)<%4>
  493. #define RF@pv:%1[%2](%3)<%4>
  494. #define RF@pcv:%1[%2](%3)<%4>
  495. #define RF@vc:%1[%2](%3)
  496. #define RF@vn:%1[]()
  497. */
  498.  
  499. // Define all the alternate spellings once.
  500. #define RC@nv  RC@vn
  501.  
  502. /*
  503. #define RC:%1[%2](%3)
  504. #define RC@v:%1[%2](%3)
  505. #define RC@n:%1[]()
  506. #define RC@vn:%1[]()
  507. */
  508.  
  509. #endif
  510.  
  511. // Clear up some artifacts
  512. #if defined YSIM_DEFINED
  513.     #undef YSIM_DEFINED
  514. #endif
  515.  
  516. #if defined _YCM
  517.     #undef _YCM
  518. #endif
  519.  
  520. // Now set the current script data.
  521. #if MASTER == 0
  522.     #if defined _YCM_a@
  523.         #define YSIM_DEFINED
  524.     #else
  525.         #define _YCM_a@
  526.     #endif
  527.     #define _YCM a@
  528. #endif
  529. #if MASTER == 1
  530.     #if defined _YCM_b@
  531.         #define YSIM_DEFINED
  532.     #else
  533.         #define _YCM_b@
  534.     #endif
  535.     #define _YCM b@
  536. #endif
  537. #if MASTER == 2
  538.     #if defined _YCM_c@
  539.         #define YSIM_DEFINED
  540.     #else
  541.         #define _YCM_c@
  542.     #endif
  543.     #define _YCM c@
  544. #endif
  545. #if MASTER == 3
  546.     #if defined _YCM_d@
  547.         #define YSIM_DEFINED
  548.     #else
  549.         #define _YCM_d@
  550.     #endif
  551.     #define _YCM d@
  552. #endif
  553. #if MASTER == 4
  554.     #if defined _YCM_e@
  555.         #define YSIM_DEFINED
  556.     #else
  557.         #define _YCM_e@
  558.     #endif
  559.     #define _YCM e@
  560. #endif
  561. #if MASTER == 5
  562.     #if defined _YCM_f@
  563.         #define YSIM_DEFINED
  564.     #else
  565.         #define _YCM_f@
  566.     #endif
  567.     #define _YCM f@
  568. #endif
  569. #if MASTER == 6
  570.     #if defined _YCM_g@
  571.         #define YSIM_DEFINED
  572.     #else
  573.         #define _YCM_g@
  574.     #endif
  575.     #define _YCM g@
  576. #endif
  577. #if MASTER == 7
  578.     #if defined _YCM_h@
  579.         #define YSIM_DEFINED
  580.     #else
  581.         #define _YCM_h@
  582.     #endif
  583.     #define _YCM h@
  584. #endif
  585. #if MASTER == 8
  586.     #if defined _YCM_i@
  587.         #define YSIM_DEFINED
  588.     #else
  589.         #define _YCM_i@
  590.     #endif
  591.     #define _YCM i@
  592. #endif
  593. #if MASTER == 9
  594.     #if defined _YCM_j@
  595.         #define YSIM_DEFINED
  596.     #else
  597.         #define _YCM_j@
  598.     #endif
  599.     #define _YCM j@
  600. #endif
  601. #if MASTER == 10
  602.     #if defined _YCM_k@
  603.         #define YSIM_DEFINED
  604.     #else
  605.         #define _YCM_k@
  606.     #endif
  607.     #define _YCM k@
  608. #endif
  609. #if MASTER == 11
  610.     #if defined _YCM_l@
  611.         #define YSIM_DEFINED
  612.     #else
  613.         #define _YCM_l@
  614.     #endif
  615.     #define _YCM l@
  616. #endif
  617. #if MASTER == 12
  618.     #if defined _YCM_m@
  619.         #define YSIM_DEFINED
  620.     #else
  621.         #define _YCM_m@
  622.     #endif
  623.     #define _YCM m@
  624. #endif
  625. #if MASTER == 13
  626.     #if defined _YCM_n@
  627.         #define YSIM_DEFINED
  628.     #else
  629.         #define _YCM_n@
  630.     #endif
  631.     #define _YCM n@
  632. #endif
  633. #if MASTER == 14
  634.     #if defined _YCM_o@
  635.         #define YSIM_DEFINED
  636.     #else
  637.         #define _YCM_o@
  638.     #endif
  639.     #define _YCM o@
  640. #endif
  641. #if MASTER == 15
  642.     #if defined _YCM_p@
  643.         #define YSIM_DEFINED
  644.     #else
  645.         #define _YCM_p@
  646.     #endif
  647.     #define _YCM p@
  648. #endif
  649. #if MASTER == 16
  650.     #if defined _YCM_q@
  651.         #define YSIM_DEFINED
  652.     #else
  653.         #define _YCM_q@
  654.     #endif
  655.     #define _YCM q@
  656. #endif
  657. #if MASTER == 17
  658.     #if defined _YCM_r@
  659.         #define YSIM_DEFINED
  660.     #else
  661.         #define _YCM_r@
  662.     #endif
  663.     #define _YCM r@
  664. #endif
  665. #if MASTER == 18
  666.     #if defined _YCM_s@
  667.         #define YSIM_DEFINED
  668.     #else
  669.         #define _YCM_s@
  670.     #endif
  671.     #define _YCM s@
  672. #endif
  673. #if MASTER == 19
  674.     #if defined _YCM_t@
  675.         #define YSIM_DEFINED
  676.     #else
  677.         #define _YCM_t@
  678.     #endif
  679.     #define _YCM t@
  680. #endif
  681. #if MASTER == 20
  682.     #if defined _YCM_u@
  683.         #define YSIM_DEFINED
  684.     #else
  685.         #define _YCM_u@
  686.     #endif
  687.     #define _YCM u@
  688. #endif
  689. #if MASTER == 21
  690.     #if defined _YCM_v@
  691.         #define YSIM_DEFINED
  692.     #else
  693.         #define _YCM_v@
  694.     #endif
  695.     #define _YCM v@
  696. #endif
  697. #if MASTER == 22
  698.     #if defined _YCM_w@
  699.         #define YSIM_DEFINED
  700.     #else
  701.         #define _YCM_w@
  702.     #endif
  703.     #define _YCM w@
  704. #endif
  705. #if MASTER == 23
  706.     #if defined _YCM_x@
  707.         #define YSIM_DEFINED
  708.     #else
  709.         #define _YCM_x@
  710.     #endif
  711.     #define _YCM x@
  712. #endif
  713. #if MASTER == 24
  714.     #if defined _YCM_y@
  715.         #define YSIM_DEFINED
  716.     #else
  717.         #define _YCM_y@
  718.     #endif
  719.     #define _YCM y@
  720. #endif
  721. #if MASTER == 25
  722.     #if defined _YCM_z@
  723.         #define YSIM_DEFINED
  724.     #else
  725.         #define _YCM_z@
  726.     #endif
  727.     #define _YCM z@
  728. #endif
  729. #if MASTER == 26
  730.     #if defined _YCM_A@
  731.         #define YSIM_DEFINED
  732.     #else
  733.         #define _YCM_A@
  734.         // Save the settings.
  735.         #if YSIM_HAS_MASTER
  736.             #if YSIM_IS_CLIENT
  737.                 #if YSIM_IS_SERVER
  738.                     #if YSIM_CLOUD
  739.                         #define YSIM_RECALL_26 15
  740.                     #else
  741.                         #define YSIM_RECALL_26 7
  742.                     #endif
  743.                 #else
  744.                     #if YSIM_CLOUD
  745.                         #define YSIM_RECALL_26 11
  746.                     #else
  747.                         #define YSIM_RECALL_26 3
  748.                     #endif
  749.                 #endif
  750.             #else
  751.                 #if YSIM_IS_SERVER
  752.                     #if YSIM_CLOUD
  753.                         #define YSIM_RECALL_26 13
  754.                     #else
  755.                         #define YSIM_RECALL_26 5
  756.                     #endif
  757.                 #else
  758.                     #if YSIM_CLOUD
  759.                         #define YSIM_RECALL_26 9
  760.                     #else
  761.                         #define YSIM_RECALL_26 1
  762.                     #endif
  763.                 #endif
  764.             #endif
  765.         #else
  766.             #if YSIM_IS_CLIENT
  767.                 #if YSIM_IS_SERVER
  768.                     #if YSIM_CLOUD
  769.                         #define YSIM_RECALL_26 14
  770.                     #else
  771.                         #define YSIM_RECALL_26 6
  772.                     #endif
  773.                 #else
  774.                     #if YSIM_CLOUD
  775.                         #define YSIM_RECALL_26 10
  776.                     #else
  777.                         #define YSIM_RECALL_26 2
  778.                     #endif
  779.                 #endif
  780.             #else
  781.                 #if YSIM_IS_SERVER
  782.                     #if YSIM_CLOUD
  783.                         #define YSIM_RECALL_26 12
  784.                     #else
  785.                         #define YSIM_RECALL_26 4
  786.                     #endif
  787.                 #else
  788.                     #if YSIM_CLOUD
  789.                         #define YSIM_RECALL_26 8
  790.                     #else
  791.                         #define YSIM_RECALL_26 0
  792.                     #endif
  793.                 #endif
  794.             #endif
  795.         #endif
  796.     #endif
  797.     #define _YCM A@
  798. #endif
  799. #if MASTER == 27
  800.     #if defined _YCM_B@
  801.         #define YSIM_DEFINED
  802.     #else
  803.         #define _YCM_B@
  804.         // Save the settings.
  805.         #if YSIM_HAS_MASTER
  806.             #if YSIM_IS_CLIENT
  807.                 #if YSIM_IS_SERVER
  808.                     #if YSIM_CLOUD
  809.                         #define YSIM_RECALL_27 15
  810.                     #else
  811.                         #define YSIM_RECALL_27 7
  812.                     #endif
  813.                 #else
  814.                     #if YSIM_CLOUD
  815.                         #define YSIM_RECALL_27 11
  816.                     #else
  817.                         #define YSIM_RECALL_27 3
  818.                     #endif
  819.                 #endif
  820.             #else
  821.                 #if YSIM_IS_SERVER
  822.                     #if YSIM_CLOUD
  823.                         #define YSIM_RECALL_27 13
  824.                     #else
  825.                         #define YSIM_RECALL_27 5
  826.                     #endif
  827.                 #else
  828.                     #if YSIM_CLOUD
  829.                         #define YSIM_RECALL_27 9
  830.                     #else
  831.                         #define YSIM_RECALL_27 1
  832.                     #endif
  833.                 #endif
  834.             #endif
  835.         #else
  836.             #if YSIM_IS_CLIENT
  837.                 #if YSIM_IS_SERVER
  838.                     #if YSIM_CLOUD
  839.                         #define YSIM_RECALL_27 14
  840.                     #else
  841.                         #define YSIM_RECALL_27 6
  842.                     #endif
  843.                 #else
  844.                     #if YSIM_CLOUD
  845.                         #define YSIM_RECALL_27 10
  846.                     #else
  847.                         #define YSIM_RECALL_27 2
  848.                     #endif
  849.                 #endif
  850.             #else
  851.                 #if YSIM_IS_SERVER
  852.                     #if YSIM_CLOUD
  853.                         #define YSIM_RECALL_27 12
  854.                     #else
  855.                         #define YSIM_RECALL_27 4
  856.                     #endif
  857.                 #else
  858.                     #if YSIM_CLOUD
  859.                         #define YSIM_RECALL_27 8
  860.                     #else
  861.                         #define YSIM_RECALL_27 0
  862.                     #endif
  863.                 #endif
  864.             #endif
  865.         #endif
  866.     #endif
  867.     #define _YCM B@
  868. #endif
  869. #if MASTER == 28
  870.     #if defined _YCM_C@
  871.         #define YSIM_DEFINED
  872.     #else
  873.         #define _YCM_C@
  874.         // Save the settings.
  875.         #if YSIM_HAS_MASTER
  876.             #if YSIM_IS_CLIENT
  877.                 #if YSIM_IS_SERVER
  878.                     #if YSIM_CLOUD
  879.                         #define YSIM_RECALL_28 15
  880.                     #else
  881.                         #define YSIM_RECALL_28 7
  882.                     #endif
  883.                 #else
  884.                     #if YSIM_CLOUD
  885.                         #define YSIM_RECALL_28 11
  886.                     #else
  887.                         #define YSIM_RECALL_28 3
  888.                     #endif
  889.                 #endif
  890.             #else
  891.                 #if YSIM_IS_SERVER
  892.                     #if YSIM_CLOUD
  893.                         #define YSIM_RECALL_28 13
  894.                     #else
  895.                         #define YSIM_RECALL_28 5
  896.                     #endif
  897.                 #else
  898.                     #if YSIM_CLOUD
  899.                         #define YSIM_RECALL_28 9
  900.                     #else
  901.                         #define YSIM_RECALL_28 1
  902.                     #endif
  903.                 #endif
  904.             #endif
  905.         #else
  906.             #if YSIM_IS_CLIENT
  907.                 #if YSIM_IS_SERVER
  908.                     #if YSIM_CLOUD
  909.                         #define YSIM_RECALL_28 14
  910.                     #else
  911.                         #define YSIM_RECALL_28 6
  912.                     #endif
  913.                 #else
  914.                     #if YSIM_CLOUD
  915.                         #define YSIM_RECALL_28 10
  916.                     #else
  917.                         #define YSIM_RECALL_28 2
  918.                     #endif
  919.                 #endif
  920.             #else
  921.                 #if YSIM_IS_SERVER
  922.                     #if YSIM_CLOUD
  923.                         #define YSIM_RECALL_28 12
  924.                     #else
  925.                         #define YSIM_RECALL_28 4
  926.                     #endif
  927.                 #else
  928.                     #if YSIM_CLOUD
  929.                         #define YSIM_RECALL_28 8
  930.                     #else
  931.                         #define YSIM_RECALL_28 0
  932.                     #endif
  933.                 #endif
  934.             #endif
  935.         #endif
  936.     #endif
  937.     #define _YCM C@
  938. #endif
  939. #if MASTER == 29
  940.     #if defined _YCM_D@
  941.         #define YSIM_DEFINED
  942.     #else
  943.         #define _YCM_D@
  944.         // Save the settings.
  945.         #if YSIM_HAS_MASTER
  946.             #if YSIM_IS_CLIENT
  947.                 #if YSIM_IS_SERVER
  948.                     #if YSIM_CLOUD
  949.                         #define YSIM_RECALL_29 15
  950.                     #else
  951.                         #define YSIM_RECALL_29 7
  952.                     #endif
  953.                 #else
  954.                     #if YSIM_CLOUD
  955.                         #define YSIM_RECALL_29 11
  956.                     #else
  957.                         #define YSIM_RECALL_29 3
  958.                     #endif
  959.                 #endif
  960.             #else
  961.                 #if YSIM_IS_SERVER
  962.                     #if YSIM_CLOUD
  963.                         #define YSIM_RECALL_29 13
  964.                     #else
  965.                         #define YSIM_RECALL_29 5
  966.                     #endif
  967.                 #else
  968.                     #if YSIM_CLOUD
  969.                         #define YSIM_RECALL_29 9
  970.                     #else
  971.                         #define YSIM_RECALL_29 1
  972.                     #endif
  973.                 #endif
  974.             #endif
  975.         #else
  976.             #if YSIM_IS_CLIENT
  977.                 #if YSIM_IS_SERVER
  978.                     #if YSIM_CLOUD
  979.                         #define YSIM_RECALL_29 14
  980.                     #else
  981.                         #define YSIM_RECALL_29 6
  982.                     #endif
  983.                 #else
  984.                     #if YSIM_CLOUD
  985.                         #define YSIM_RECALL_29 10
  986.                     #else
  987.                         #define YSIM_RECALL_29 2
  988.                     #endif
  989.                 #endif
  990.             #else
  991.                 #if YSIM_IS_SERVER
  992.                     #if YSIM_CLOUD
  993.                         #define YSIM_RECALL_29 12
  994.                     #else
  995.                         #define YSIM_RECALL_29 4
  996.                     #endif
  997.                 #else
  998.                     #if YSIM_CLOUD
  999.                         #define YSIM_RECALL_29 8
  1000.                     #else
  1001.                         #define YSIM_RECALL_29 0
  1002.                     #endif
  1003.                 #endif
  1004.             #endif
  1005.         #endif
  1006.     #endif
  1007.     #define _YCM D@
  1008. #endif
  1009. #if MASTER == 30
  1010.     #if defined _YCM_E@
  1011.         #define YSIM_DEFINED
  1012.     #else
  1013.         #define _YCM_E@
  1014.         // Save the settings.
  1015.         #if YSIM_HAS_MASTER
  1016.             #if YSIM_IS_CLIENT
  1017.                 #if YSIM_IS_SERVER
  1018.                     #if YSIM_CLOUD
  1019.                         #define YSIM_RECALL_30 15
  1020.                     #else
  1021.                         #define YSIM_RECALL_30 7
  1022.                     #endif
  1023.                 #else
  1024.                     #if YSIM_CLOUD
  1025.                         #define YSIM_RECALL_30 11
  1026.                     #else
  1027.                         #define YSIM_RECALL_30 3
  1028.                     #endif
  1029.                 #endif
  1030.             #else
  1031.                 #if YSIM_IS_SERVER
  1032.                     #if YSIM_CLOUD
  1033.                         #define YSIM_RECALL_30 13
  1034.                     #else
  1035.                         #define YSIM_RECALL_30 5
  1036.                     #endif
  1037.                 #else
  1038.                     #if YSIM_CLOUD
  1039.                         #define YSIM_RECALL_30 9
  1040.                     #else
  1041.                         #define YSIM_RECALL_30 1
  1042.                     #endif
  1043.                 #endif
  1044.             #endif
  1045.         #else
  1046.             #if YSIM_IS_CLIENT
  1047.                 #if YSIM_IS_SERVER
  1048.                     #if YSIM_CLOUD
  1049.                         #define YSIM_RECALL_30 14
  1050.                     #else
  1051.                         #define YSIM_RECALL_30 6
  1052.                     #endif
  1053.                 #else
  1054.                     #if YSIM_CLOUD
  1055.                         #define YSIM_RECALL_30 10
  1056.                     #else
  1057.                         #define YSIM_RECALL_30 2
  1058.                     #endif
  1059.                 #endif
  1060.             #else
  1061.                 #if YSIM_IS_SERVER
  1062.                     #if YSIM_CLOUD
  1063.                         #define YSIM_RECALL_30 12
  1064.                     #else
  1065.                         #define YSIM_RECALL_30 4
  1066.                     #endif
  1067.                 #else
  1068.                     #if YSIM_CLOUD
  1069.                         #define YSIM_RECALL_30 8
  1070.                     #else
  1071.                         #define YSIM_RECALL_30 0
  1072.                     #endif
  1073.                 #endif
  1074.             #endif
  1075.         #endif
  1076.     #endif
  1077.     #define _YCM E@
  1078. #endif
  1079. #if MASTER == 31
  1080.     #if defined _YCM_F@
  1081.         #define YSIM_DEFINED
  1082.     #else
  1083.         #define _YCM_F@
  1084.         // Save the settings.
  1085.         #if YSIM_HAS_MASTER
  1086.             #if YSIM_IS_CLIENT
  1087.                 #if YSIM_IS_SERVER
  1088.                     #if YSIM_CLOUD
  1089.                         #define YSIM_RECALL_31 15
  1090.                     #else
  1091.                         #define YSIM_RECALL_31 7
  1092.                     #endif
  1093.                 #else
  1094.                     #if YSIM_CLOUD
  1095.                         #define YSIM_RECALL_31 11
  1096.                     #else
  1097.                         #define YSIM_RECALL_31 3
  1098.                     #endif
  1099.                 #endif
  1100.             #else
  1101.                 #if YSIM_IS_SERVER
  1102.                     #if YSIM_CLOUD
  1103.                         #define YSIM_RECALL_31 13
  1104.                     #else
  1105.                         #define YSIM_RECALL_31 5
  1106.                     #endif
  1107.                 #else
  1108.                     #if YSIM_CLOUD
  1109.                         #define YSIM_RECALL_31 9
  1110.                     #else
  1111.                         #define YSIM_RECALL_31 1
  1112.                     #endif
  1113.                 #endif
  1114.             #endif
  1115.         #else
  1116.             #if YSIM_IS_CLIENT
  1117.                 #if YSIM_IS_SERVER
  1118.                     #if YSIM_CLOUD
  1119.                         #define YSIM_RECALL_31 14
  1120.                     #else
  1121.                         #define YSIM_RECALL_31 6
  1122.                     #endif
  1123.                 #else
  1124.                     #if YSIM_CLOUD
  1125.                         #define YSIM_RECALL_31 10
  1126.                     #else
  1127.                         #define YSIM_RECALL_31 2
  1128.                     #endif
  1129.                 #endif
  1130.             #else
  1131.                 #if YSIM_IS_SERVER
  1132.                     #if YSIM_CLOUD
  1133.                         #define YSIM_RECALL_31 12
  1134.                     #else
  1135.                         #define YSIM_RECALL_31 4
  1136.                     #endif
  1137.                 #else
  1138.                     #if YSIM_CLOUD
  1139.                         #define YSIM_RECALL_31 8
  1140.                     #else
  1141.                         #define YSIM_RECALL_31 0
  1142.                     #endif
  1143.                 #endif
  1144.             #endif
  1145.         #endif
  1146.     #endif
  1147.     #define _YCM F@
  1148. #endif
  1149. #if MASTER == 32
  1150.     #if defined _YCM_G@
  1151.         #define YSIM_DEFINED
  1152.     #else
  1153.         #define _YCM_G@
  1154.         // Save the settings.
  1155.         #if YSIM_HAS_MASTER
  1156.             #if YSIM_IS_CLIENT
  1157.                 #if YSIM_IS_SERVER
  1158.                     #if YSIM_CLOUD
  1159.                         #define YSIM_RECALL_32 15
  1160.                     #else
  1161.                         #define YSIM_RECALL_32 7
  1162.                     #endif
  1163.                 #else
  1164.                     #if YSIM_CLOUD
  1165.                         #define YSIM_RECALL_32 11
  1166.                     #else
  1167.                         #define YSIM_RECALL_32 3
  1168.                     #endif
  1169.                 #endif
  1170.             #else
  1171.                 #if YSIM_IS_SERVER
  1172.                     #if YSIM_CLOUD
  1173.                         #define YSIM_RECALL_32 13
  1174.                     #else
  1175.                         #define YSIM_RECALL_32 5
  1176.                     #endif
  1177.                 #else
  1178.                     #if YSIM_CLOUD
  1179.                         #define YSIM_RECALL_32 9
  1180.                     #else
  1181.                         #define YSIM_RECALL_32 1
  1182.                     #endif
  1183.                 #endif
  1184.             #endif
  1185.         #else
  1186.             #if YSIM_IS_CLIENT
  1187.                 #if YSIM_IS_SERVER
  1188.                     #if YSIM_CLOUD
  1189.                         #define YSIM_RECALL_32 14
  1190.                     #else
  1191.                         #define YSIM_RECALL_32 6
  1192.                     #endif
  1193.                 #else
  1194.                     #if YSIM_CLOUD
  1195.                         #define YSIM_RECALL_32 10
  1196.                     #else
  1197.                         #define YSIM_RECALL_32 2
  1198.                     #endif
  1199.                 #endif
  1200.             #else
  1201.                 #if YSIM_IS_SERVER
  1202.                     #if YSIM_CLOUD
  1203.                         #define YSIM_RECALL_32 12
  1204.                     #else
  1205.                         #define YSIM_RECALL_32 4
  1206.                     #endif
  1207.                 #else
  1208.                     #if YSIM_CLOUD
  1209.                         #define YSIM_RECALL_32 8
  1210.                     #else
  1211.                         #define YSIM_RECALL_32 0
  1212.                     #endif
  1213.                 #endif
  1214.             #endif
  1215.         #endif
  1216.     #endif
  1217.     #define _YCM G@
  1218. #endif
  1219. #if MASTER == 33
  1220.     #if defined _YCM_H@
  1221.         #define YSIM_DEFINED
  1222.     #else
  1223.         #define _YCM_H@
  1224.         // Save the settings.
  1225.         #if YSIM_HAS_MASTER
  1226.             #if YSIM_IS_CLIENT
  1227.                 #if YSIM_IS_SERVER
  1228.                     #if YSIM_CLOUD
  1229.                         #define YSIM_RECALL_33 15
  1230.                     #else
  1231.                         #define YSIM_RECALL_33 7
  1232.                     #endif
  1233.                 #else
  1234.                     #if YSIM_CLOUD
  1235.                         #define YSIM_RECALL_33 11
  1236.                     #else
  1237.                         #define YSIM_RECALL_33 3
  1238.                     #endif
  1239.                 #endif
  1240.             #else
  1241.                 #if YSIM_IS_SERVER
  1242.                     #if YSIM_CLOUD
  1243.                         #define YSIM_RECALL_33 13
  1244.                     #else
  1245.                         #define YSIM_RECALL_33 5
  1246.                     #endif
  1247.                 #else
  1248.                     #if YSIM_CLOUD
  1249.                         #define YSIM_RECALL_33 9
  1250.                     #else
  1251.                         #define YSIM_RECALL_33 1
  1252.                     #endif
  1253.                 #endif
  1254.             #endif
  1255.         #else
  1256.             #if YSIM_IS_CLIENT
  1257.                 #if YSIM_IS_SERVER
  1258.                     #if YSIM_CLOUD
  1259.                         #define YSIM_RECALL_33 14
  1260.                     #else
  1261.                         #define YSIM_RECALL_33 6
  1262.                     #endif
  1263.                 #else
  1264.                     #if YSIM_CLOUD
  1265.                         #define YSIM_RECALL_33 10
  1266.                     #else
  1267.                         #define YSIM_RECALL_33 2
  1268.                     #endif
  1269.                 #endif
  1270.             #else
  1271.                 #if YSIM_IS_SERVER
  1272.                     #if YSIM_CLOUD
  1273.                         #define YSIM_RECALL_33 12
  1274.                     #else
  1275.                         #define YSIM_RECALL_33 4
  1276.                     #endif
  1277.                 #else
  1278.                     #if YSIM_CLOUD
  1279.                         #define YSIM_RECALL_33 8
  1280.                     #else
  1281.                         #define YSIM_RECALL_33 0
  1282.                     #endif
  1283.                 #endif
  1284.             #endif
  1285.         #endif
  1286.     #endif
  1287.     #define _YCM H@
  1288. #endif
  1289. #if MASTER == 34
  1290.     #if defined _YCM_I@
  1291.         #define YSIM_DEFINED
  1292.     #else
  1293.         #define _YCM_I@
  1294.         // Save the settings.
  1295.         #if YSIM_HAS_MASTER
  1296.             #if YSIM_IS_CLIENT
  1297.                 #if YSIM_IS_SERVER
  1298.                     #if YSIM_CLOUD
  1299.                         #define YSIM_RECALL_34 15
  1300.                     #else
  1301.                         #define YSIM_RECALL_34 7
  1302.                     #endif
  1303.                 #else
  1304.                     #if YSIM_CLOUD
  1305.                         #define YSIM_RECALL_34 11
  1306.                     #else
  1307.                         #define YSIM_RECALL_34 3
  1308.                     #endif
  1309.                 #endif
  1310.             #else
  1311.                 #if YSIM_IS_SERVER
  1312.                     #if YSIM_CLOUD
  1313.                         #define YSIM_RECALL_34 13
  1314.                     #else
  1315.                         #define YSIM_RECALL_34 5
  1316.                     #endif
  1317.                 #else
  1318.                     #if YSIM_CLOUD
  1319.                         #define YSIM_RECALL_34 9
  1320.                     #else
  1321.                         #define YSIM_RECALL_34 1
  1322.                     #endif
  1323.                 #endif
  1324.             #endif
  1325.         #else
  1326.             #if YSIM_IS_CLIENT
  1327.                 #if YSIM_IS_SERVER
  1328.                     #if YSIM_CLOUD
  1329.                         #define YSIM_RECALL_34 14
  1330.                     #else
  1331.                         #define YSIM_RECALL_34 6
  1332.                     #endif
  1333.                 #else
  1334.                     #if YSIM_CLOUD
  1335.                         #define YSIM_RECALL_34 10
  1336.                     #else
  1337.                         #define YSIM_RECALL_34 2
  1338.                     #endif
  1339.                 #endif
  1340.             #else
  1341.                 #if YSIM_IS_SERVER
  1342.                     #if YSIM_CLOUD
  1343.                         #define YSIM_RECALL_34 12
  1344.                     #else
  1345.                         #define YSIM_RECALL_34 4
  1346.                     #endif
  1347.                 #else
  1348.                     #if YSIM_CLOUD
  1349.                         #define YSIM_RECALL_34 8
  1350.                     #else
  1351.                         #define YSIM_RECALL_34 0
  1352.                     #endif
  1353.                 #endif
  1354.             #endif
  1355.         #endif
  1356.     #endif
  1357.     #define _YCM I@
  1358. #endif
  1359. #if MASTER == 35
  1360.     #if defined _YCM_J@
  1361.         #define YSIM_DEFINED
  1362.     #else
  1363.         #define _YCM_J@
  1364.         // Save the settings.
  1365.         #if YSIM_HAS_MASTER
  1366.             #if YSIM_IS_CLIENT
  1367.                 #if YSIM_IS_SERVER
  1368.                     #if YSIM_CLOUD
  1369.                         #define YSIM_RECALL_35 15
  1370.                     #else
  1371.                         #define YSIM_RECALL_35 7
  1372.                     #endif
  1373.                 #else
  1374.                     #if YSIM_CLOUD
  1375.                         #define YSIM_RECALL_35 11
  1376.                     #else
  1377.                         #define YSIM_RECALL_35 3
  1378.                     #endif
  1379.                 #endif
  1380.             #else
  1381.                 #if YSIM_IS_SERVER
  1382.                     #if YSIM_CLOUD
  1383.                         #define YSIM_RECALL_35 13
  1384.                     #else
  1385.                         #define YSIM_RECALL_35 5
  1386.                     #endif
  1387.                 #else
  1388.                     #if YSIM_CLOUD
  1389.                         #define YSIM_RECALL_35 9
  1390.                     #else
  1391.                         #define YSIM_RECALL_35 1
  1392.                     #endif
  1393.                 #endif
  1394.             #endif
  1395.         #else
  1396.             #if YSIM_IS_CLIENT
  1397.                 #if YSIM_IS_SERVER
  1398.                     #if YSIM_CLOUD
  1399.                         #define YSIM_RECALL_35 14
  1400.                     #else
  1401.                         #define YSIM_RECALL_35 6
  1402.                     #endif
  1403.                 #else
  1404.                     #if YSIM_CLOUD
  1405.                         #define YSIM_RECALL_35 10
  1406.                     #else
  1407.                         #define YSIM_RECALL_35 2
  1408.                     #endif
  1409.                 #endif
  1410.             #else
  1411.                 #if YSIM_IS_SERVER
  1412.                     #if YSIM_CLOUD
  1413.                         #define YSIM_RECALL_35 12
  1414.                     #else
  1415.                         #define YSIM_RECALL_35 4
  1416.                     #endif
  1417.                 #else
  1418.                     #if YSIM_CLOUD
  1419.                         #define YSIM_RECALL_35 8
  1420.                     #else
  1421.                         #define YSIM_RECALL_35 0
  1422.                     #endif
  1423.                 #endif
  1424.             #endif
  1425.         #endif
  1426.     #endif
  1427.     #define _YCM J@
  1428. #endif
  1429. #if MASTER == 36
  1430.     #if defined _YCM_K@
  1431.         #define YSIM_DEFINED
  1432.     #else
  1433.         #define _YCM_K@
  1434.         // Save the settings.
  1435.         #if YSIM_HAS_MASTER
  1436.             #if YSIM_IS_CLIENT
  1437.                 #if YSIM_IS_SERVER
  1438.                     #if YSIM_CLOUD
  1439.                         #define YSIM_RECALL_36 15
  1440.                     #else
  1441.                         #define YSIM_RECALL_36 7
  1442.                     #endif
  1443.                 #else
  1444.                     #if YSIM_CLOUD
  1445.                         #define YSIM_RECALL_36 11
  1446.                     #else
  1447.                         #define YSIM_RECALL_36 3
  1448.                     #endif
  1449.                 #endif
  1450.             #else
  1451.                 #if YSIM_IS_SERVER
  1452.                     #if YSIM_CLOUD
  1453.                         #define YSIM_RECALL_36 13
  1454.                     #else
  1455.                         #define YSIM_RECALL_36 5
  1456.                     #endif
  1457.                 #else
  1458.                     #if YSIM_CLOUD
  1459.                         #define YSIM_RECALL_36 9
  1460.                     #else
  1461.                         #define YSIM_RECALL_36 1
  1462.                     #endif
  1463.                 #endif
  1464.             #endif
  1465.         #else
  1466.             #if YSIM_IS_CLIENT
  1467.                 #if YSIM_IS_SERVER
  1468.                     #if YSIM_CLOUD
  1469.                         #define YSIM_RECALL_36 14
  1470.                     #else
  1471.                         #define YSIM_RECALL_36 6
  1472.                     #endif
  1473.                 #else
  1474.                     #if YSIM_CLOUD
  1475.                         #define YSIM_RECALL_36 10
  1476.                     #else
  1477.                         #define YSIM_RECALL_36 2
  1478.                     #endif
  1479.                 #endif
  1480.             #else
  1481.                 #if YSIM_IS_SERVER
  1482.                     #if YSIM_CLOUD
  1483.                         #define YSIM_RECALL_36 12
  1484.                     #else
  1485.                         #define YSIM_RECALL_36 4
  1486.                     #endif
  1487.                 #else
  1488.                     #if YSIM_CLOUD
  1489.                         #define YSIM_RECALL_36 8
  1490.                     #else
  1491.                         #define YSIM_RECALL_36 0
  1492.                     #endif
  1493.                 #endif
  1494.             #endif
  1495.         #endif
  1496.     #endif
  1497.     #define _YCM K@
  1498. #endif
  1499. #if MASTER == 37
  1500.     #if defined _YCM_L@
  1501.         #define YSIM_DEFINED
  1502.     #else
  1503.         #define _YCM_L@
  1504.         // Save the settings.
  1505.         #if YSIM_HAS_MASTER
  1506.             #if YSIM_IS_CLIENT
  1507.                 #if YSIM_IS_SERVER
  1508.                     #if YSIM_CLOUD
  1509.                         #define YSIM_RECALL_37 15
  1510.                     #else
  1511.                         #define YSIM_RECALL_37 7
  1512.                     #endif
  1513.                 #else
  1514.                     #if YSIM_CLOUD
  1515.                         #define YSIM_RECALL_37 11
  1516.                     #else
  1517.                         #define YSIM_RECALL_37 3
  1518.                     #endif
  1519.                 #endif
  1520.             #else
  1521.                 #if YSIM_IS_SERVER
  1522.                     #if YSIM_CLOUD
  1523.                         #define YSIM_RECALL_37 13
  1524.                     #else
  1525.                         #define YSIM_RECALL_37 5
  1526.                     #endif
  1527.                 #else
  1528.                     #if YSIM_CLOUD
  1529.                         #define YSIM_RECALL_37 9
  1530.                     #else
  1531.                         #define YSIM_RECALL_37 1
  1532.                     #endif
  1533.                 #endif
  1534.             #endif
  1535.         #else
  1536.             #if YSIM_IS_CLIENT
  1537.                 #if YSIM_IS_SERVER
  1538.                     #if YSIM_CLOUD
  1539.                         #define YSIM_RECALL_37 14
  1540.                     #else
  1541.                         #define YSIM_RECALL_37 6
  1542.                     #endif
  1543.                 #else
  1544.                     #if YSIM_CLOUD
  1545.                         #define YSIM_RECALL_37 10
  1546.                     #else
  1547.                         #define YSIM_RECALL_37 2
  1548.                     #endif
  1549.                 #endif
  1550.             #else
  1551.                 #if YSIM_IS_SERVER
  1552.                     #if YSIM_CLOUD
  1553.                         #define YSIM_RECALL_37 12
  1554.                     #else
  1555.                         #define YSIM_RECALL_37 4
  1556.                     #endif
  1557.                 #else
  1558.                     #if YSIM_CLOUD
  1559.                         #define YSIM_RECALL_37 8
  1560.                     #else
  1561.                         #define YSIM_RECALL_37 0
  1562.                     #endif
  1563.                 #endif
  1564.             #endif
  1565.         #endif
  1566.     #endif
  1567.     #define _YCM L@
  1568. #endif
  1569. #if MASTER == 38
  1570.     #if defined _YCM_M@
  1571.         #define YSIM_DEFINED
  1572.     #else
  1573.         #define _YCM_M@
  1574.         // Save the settings.
  1575.         #if YSIM_HAS_MASTER
  1576.             #if YSIM_IS_CLIENT
  1577.                 #if YSIM_IS_SERVER
  1578.                     #if YSIM_CLOUD
  1579.                         #define YSIM_RECALL_38 15
  1580.                     #else
  1581.                         #define YSIM_RECALL_38 7
  1582.                     #endif
  1583.                 #else
  1584.                     #if YSIM_CLOUD
  1585.                         #define YSIM_RECALL_38 11
  1586.                     #else
  1587.                         #define YSIM_RECALL_38 3
  1588.                     #endif
  1589.                 #endif
  1590.             #else
  1591.                 #if YSIM_IS_SERVER
  1592.                     #if YSIM_CLOUD
  1593.                         #define YSIM_RECALL_38 13
  1594.                     #else
  1595.                         #define YSIM_RECALL_38 5
  1596.                     #endif
  1597.                 #else
  1598.                     #if YSIM_CLOUD
  1599.                         #define YSIM_RECALL_38 9
  1600.                     #else
  1601.                         #define YSIM_RECALL_38 1
  1602.                     #endif
  1603.                 #endif
  1604.             #endif
  1605.         #else
  1606.             #if YSIM_IS_CLIENT
  1607.                 #if YSIM_IS_SERVER
  1608.                     #if YSIM_CLOUD
  1609.                         #define YSIM_RECALL_38 14
  1610.                     #else
  1611.                         #define YSIM_RECALL_38 6
  1612.                     #endif
  1613.                 #else
  1614.                     #if YSIM_CLOUD
  1615.                         #define YSIM_RECALL_38 10
  1616.                     #else
  1617.                         #define YSIM_RECALL_38 2
  1618.                     #endif
  1619.                 #endif
  1620.             #else
  1621.                 #if YSIM_IS_SERVER
  1622.                     #if YSIM_CLOUD
  1623.                         #define YSIM_RECALL_38 12
  1624.                     #else
  1625.                         #define YSIM_RECALL_38 4
  1626.                     #endif
  1627.                 #else
  1628.                     #if YSIM_CLOUD
  1629.                         #define YSIM_RECALL_38 8
  1630.                     #else
  1631.                         #define YSIM_RECALL_38 0
  1632.                     #endif
  1633.                 #endif
  1634.             #endif
  1635.         #endif
  1636.     #endif
  1637.     #define _YCM M@
  1638. #endif
  1639. #if MASTER == 39
  1640.     #if defined _YCM_N@
  1641.         #define YSIM_DEFINED
  1642.     #else
  1643.         #define _YCM_N@
  1644.         // Save the settings.
  1645.         #if YSIM_HAS_MASTER
  1646.             #if YSIM_IS_CLIENT
  1647.                 #if YSIM_IS_SERVER
  1648.                     #if YSIM_CLOUD
  1649.                         #define YSIM_RECALL_39 15
  1650.                     #else
  1651.                         #define YSIM_RECALL_39 7
  1652.                     #endif
  1653.                 #else
  1654.                     #if YSIM_CLOUD
  1655.                         #define YSIM_RECALL_39 11
  1656.                     #else
  1657.                         #define YSIM_RECALL_39 3
  1658.                     #endif
  1659.                 #endif
  1660.             #else
  1661.                 #if YSIM_IS_SERVER
  1662.                     #if YSIM_CLOUD
  1663.                         #define YSIM_RECALL_39 13
  1664.                     #else
  1665.                         #define YSIM_RECALL_39 5
  1666.                     #endif
  1667.                 #else
  1668.                     #if YSIM_CLOUD
  1669.                         #define YSIM_RECALL_39 9
  1670.                     #else
  1671.                         #define YSIM_RECALL_39 1
  1672.                     #endif
  1673.                 #endif
  1674.             #endif
  1675.         #else
  1676.             #if YSIM_IS_CLIENT
  1677.                 #if YSIM_IS_SERVER
  1678.                     #if YSIM_CLOUD
  1679.                         #define YSIM_RECALL_39 14
  1680.                     #else
  1681.                         #define YSIM_RECALL_39 6
  1682.                     #endif
  1683.                 #else
  1684.                     #if YSIM_CLOUD
  1685.                         #define YSIM_RECALL_39 10
  1686.                     #else
  1687.                         #define YSIM_RECALL_39 2
  1688.                     #endif
  1689.                 #endif
  1690.             #else
  1691.                 #if YSIM_IS_SERVER
  1692.                     #if YSIM_CLOUD
  1693.                         #define YSIM_RECALL_39 12
  1694.                     #else
  1695.                         #define YSIM_RECALL_39 4
  1696.                     #endif
  1697.                 #else
  1698.                     #if YSIM_CLOUD
  1699.                         #define YSIM_RECALL_39 8
  1700.                     #else
  1701.                         #define YSIM_RECALL_39 0
  1702.                     #endif
  1703.                 #endif
  1704.             #endif
  1705.         #endif
  1706.     #endif
  1707.     #define _YCM N@
  1708. #endif
  1709. #if MASTER == 40
  1710.     #if defined _YCM_O@
  1711.         #define YSIM_DEFINED
  1712.     #else
  1713.         #define _YCM_O@
  1714.         // Save the settings.
  1715.         #if YSIM_HAS_MASTER
  1716.             #if YSIM_IS_CLIENT
  1717.                 #if YSIM_IS_SERVER
  1718.                     #if YSIM_CLOUD
  1719.                         #define YSIM_RECALL_40 15
  1720.                     #else
  1721.                         #define YSIM_RECALL_40 7
  1722.                     #endif
  1723.                 #else
  1724.                     #if YSIM_CLOUD
  1725.                         #define YSIM_RECALL_40 11
  1726.                     #else
  1727.                         #define YSIM_RECALL_40 3
  1728.                     #endif
  1729.                 #endif
  1730.             #else
  1731.                 #if YSIM_IS_SERVER
  1732.                     #if YSIM_CLOUD
  1733.                         #define YSIM_RECALL_40 13
  1734.                     #else
  1735.                         #define YSIM_RECALL_40 5
  1736.                     #endif
  1737.                 #else
  1738.                     #if YSIM_CLOUD
  1739.                         #define YSIM_RECALL_40 9
  1740.                     #else
  1741.                         #define YSIM_RECALL_40 1
  1742.                     #endif
  1743.                 #endif
  1744.             #endif
  1745.         #else
  1746.             #if YSIM_IS_CLIENT
  1747.                 #if YSIM_IS_SERVER
  1748.                     #if YSIM_CLOUD
  1749.                         #define YSIM_RECALL_40 14
  1750.                     #else
  1751.                         #define YSIM_RECALL_40 6
  1752.                     #endif
  1753.                 #else
  1754.                     #if YSIM_CLOUD
  1755.                         #define YSIM_RECALL_40 10
  1756.                     #else
  1757.                         #define YSIM_RECALL_40 2
  1758.                     #endif
  1759.                 #endif
  1760.             #else
  1761.                 #if YSIM_IS_SERVER
  1762.                     #if YSIM_CLOUD
  1763.                         #define YSIM_RECALL_40 12
  1764.                     #else
  1765.                         #define YSIM_RECALL_40 4
  1766.                     #endif
  1767.                 #else
  1768.                     #if YSIM_CLOUD
  1769.                         #define YSIM_RECALL_40 8
  1770.                     #else
  1771.                         #define YSIM_RECALL_40 0
  1772.                     #endif
  1773.                 #endif
  1774.             #endif
  1775.         #endif
  1776.     #endif
  1777.     #define _YCM O@
  1778. #endif
  1779. #if MASTER == 41
  1780.     #if defined _YCM_P@
  1781.         #define YSIM_DEFINED
  1782.     #else
  1783.         #define _YCM_P@
  1784.         // Save the settings.
  1785.         #if YSIM_HAS_MASTER
  1786.             #if YSIM_IS_CLIENT
  1787.                 #if YSIM_IS_SERVER
  1788.                     #if YSIM_CLOUD
  1789.                         #define YSIM_RECALL_41 15
  1790.                     #else
  1791.                         #define YSIM_RECALL_41 7
  1792.                     #endif
  1793.                 #else
  1794.                     #if YSIM_CLOUD
  1795.                         #define YSIM_RECALL_41 11
  1796.                     #else
  1797.                         #define YSIM_RECALL_41 3
  1798.                     #endif
  1799.                 #endif
  1800.             #else
  1801.                 #if YSIM_IS_SERVER
  1802.                     #if YSIM_CLOUD
  1803.                         #define YSIM_RECALL_41 13
  1804.                     #else
  1805.                         #define YSIM_RECALL_41 5
  1806.                     #endif
  1807.                 #else
  1808.                     #if YSIM_CLOUD
  1809.                         #define YSIM_RECALL_41 9
  1810.                     #else
  1811.                         #define YSIM_RECALL_41 1
  1812.                     #endif
  1813.                 #endif
  1814.             #endif
  1815.         #else
  1816.             #if YSIM_IS_CLIENT
  1817.                 #if YSIM_IS_SERVER
  1818.                     #if YSIM_CLOUD
  1819.                         #define YSIM_RECALL_41 14
  1820.                     #else
  1821.                         #define YSIM_RECALL_41 6
  1822.                     #endif
  1823.                 #else
  1824.                     #if YSIM_CLOUD
  1825.                         #define YSIM_RECALL_41 10
  1826.                     #else
  1827.                         #define YSIM_RECALL_41 2
  1828.                     #endif
  1829.                 #endif
  1830.             #else
  1831.                 #if YSIM_IS_SERVER
  1832.                     #if YSIM_CLOUD
  1833.                         #define YSIM_RECALL_41 12
  1834.                     #else
  1835.                         #define YSIM_RECALL_41 4
  1836.                     #endif
  1837.                 #else
  1838.                     #if YSIM_CLOUD
  1839.                         #define YSIM_RECALL_41 8
  1840.                     #else
  1841.                         #define YSIM_RECALL_41 0
  1842.                     #endif
  1843.                 #endif
  1844.             #endif
  1845.         #endif
  1846.     #endif
  1847.     #define _YCM P@
  1848. #endif
  1849. #if MASTER == 42
  1850.     #if defined _YCM_Q@
  1851.         #define YSIM_DEFINED
  1852.     #else
  1853.         #define _YCM_Q@
  1854.         // Save the settings.
  1855.         #if YSIM_HAS_MASTER
  1856.             #if YSIM_IS_CLIENT
  1857.                 #if YSIM_IS_SERVER
  1858.                     #if YSIM_CLOUD
  1859.                         #define YSIM_RECALL_42 15
  1860.                     #else
  1861.                         #define YSIM_RECALL_42 7
  1862.                     #endif
  1863.                 #else
  1864.                     #if YSIM_CLOUD
  1865.                         #define YSIM_RECALL_42 11
  1866.                     #else
  1867.                         #define YSIM_RECALL_42 3
  1868.                     #endif
  1869.                 #endif
  1870.             #else
  1871.                 #if YSIM_IS_SERVER
  1872.                     #if YSIM_CLOUD
  1873.                         #define YSIM_RECALL_42 13
  1874.                     #else
  1875.                         #define YSIM_RECALL_42 5
  1876.                     #endif
  1877.                 #else
  1878.                     #if YSIM_CLOUD
  1879.                         #define YSIM_RECALL_42 9
  1880.                     #else
  1881.                         #define YSIM_RECALL_42 1
  1882.                     #endif
  1883.                 #endif
  1884.             #endif
  1885.         #else
  1886.             #if YSIM_IS_CLIENT
  1887.                 #if YSIM_IS_SERVER
  1888.                     #if YSIM_CLOUD
  1889.                         #define YSIM_RECALL_42 14
  1890.                     #else
  1891.                         #define YSIM_RECALL_42 6
  1892.                     #endif
  1893.                 #else
  1894.                     #if YSIM_CLOUD
  1895.                         #define YSIM_RECALL_42 10
  1896.                     #else
  1897.                         #define YSIM_RECALL_42 2
  1898.                     #endif
  1899.                 #endif
  1900.             #else
  1901.                 #if YSIM_IS_SERVER
  1902.                     #if YSIM_CLOUD
  1903.                         #define YSIM_RECALL_42 12
  1904.                     #else
  1905.                         #define YSIM_RECALL_42 4
  1906.                     #endif
  1907.                 #else
  1908.                     #if YSIM_CLOUD
  1909.                         #define YSIM_RECALL_42 8
  1910.                     #else
  1911.                         #define YSIM_RECALL_42 0
  1912.                     #endif
  1913.                 #endif
  1914.             #endif
  1915.         #endif
  1916.     #endif
  1917.     #define _YCM Q@
  1918. #endif
  1919.  
  1920. // Check for non-unique masters here.
  1921. #if defined YSIM_DEFINED && !defined YSIM_OVERRIDE
  1922.     #error "Non-unique master used."
  1923. #endif
  1924.  
  1925. #if YSIM_CLOUD && !defined YSIM_DEFINED
  1926.     // FIRST declare the next callback in the chain.
  1927.     #if defined FILTERSCRIPT
  1928.         public OnFilterScriptInit()
  1929.     #else
  1930.         public OnGameModeInit()
  1931.     #endif
  1932.     {
  1933.         P:1(#_YCM "_OGM");
  1934.         // THEN rename the callbacks.
  1935.         #if defined _YCM_CALLBACK
  1936.             #undef _YCM_CALLBACK
  1937.         #endif
  1938.         #if MASTER == 0
  1939.             #define _YCM_CALLBACK a@OnScriptInit
  1940.         #endif
  1941.         #if MASTER == 1
  1942.             #define _YCM_CALLBACK b@OnScriptInit
  1943.         #endif
  1944.         #if MASTER == 2
  1945.             #define _YCM_CALLBACK c@OnScriptInit
  1946.         #endif
  1947.         #if MASTER == 3
  1948.             #define _YCM_CALLBACK d@OnScriptInit
  1949.         #endif
  1950.         #if MASTER == 4
  1951.             #define _YCM_CALLBACK e@OnScriptInit
  1952.         #endif
  1953.         #if MASTER == 5
  1954.             #define _YCM_CALLBACK f@OnScriptInit
  1955.         #endif
  1956.         #if MASTER == 6
  1957.             #define _YCM_CALLBACK g@OnScriptInit
  1958.         #endif
  1959.         #if MASTER == 7
  1960.             #define _YCM_CALLBACK h@OnScriptInit
  1961.         #endif
  1962.         #if MASTER == 8
  1963.             #define _YCM_CALLBACK i@OnScriptInit
  1964.         #endif
  1965.         #if MASTER == 9
  1966.             #define _YCM_CALLBACK j@OnScriptInit
  1967.         #endif
  1968.         #if MASTER == 10
  1969.             #define _YCM_CALLBACK k@OnScriptInit
  1970.         #endif
  1971.         #if MASTER == 11
  1972.             #define _YCM_CALLBACK l@OnScriptInit
  1973.         #endif
  1974.         #if MASTER == 12
  1975.             #define _YCM_CALLBACK m@OnScriptInit
  1976.         #endif
  1977.         #if MASTER == 13
  1978.             #define _YCM_CALLBACK n@OnScriptInit
  1979.         #endif
  1980.         #if MASTER == 14
  1981.             #define _YCM_CALLBACK o@OnScriptInit
  1982.         #endif
  1983.         #if MASTER == 15
  1984.             #define _YCM_CALLBACK p@OnScriptInit
  1985.         #endif
  1986.         #if MASTER == 16
  1987.             #define _YCM_CALLBACK q@OnScriptInit
  1988.         #endif
  1989.         #if MASTER == 17
  1990.             #define _YCM_CALLBACK r@OnScriptInit
  1991.         #endif
  1992.         #if MASTER == 18
  1993.             #define _YCM_CALLBACK s@OnScriptInit
  1994.         #endif
  1995.         #if MASTER == 19
  1996.             #define _YCM_CALLBACK t@OnScriptInit
  1997.         #endif
  1998.         #if MASTER == 20
  1999.             #define _YCM_CALLBACK u@OnScriptInit
  2000.         #endif
  2001.         #if MASTER == 21
  2002.             #define _YCM_CALLBACK v@OnScriptInit
  2003.         #endif
  2004.         #if MASTER == 22
  2005.             #define _YCM_CALLBACK w@OnScriptInit
  2006.         #endif
  2007.         #if MASTER == 23
  2008.             #define _YCM_CALLBACK x@OnScriptInit
  2009.         #endif
  2010.         #if MASTER == 24
  2011.             #define _YCM_CALLBACK y@OnScriptInit
  2012.         #endif
  2013.         #if MASTER == 25
  2014.             #define _YCM_CALLBACK z@OnScriptInit
  2015.         #endif
  2016.         #if MASTER == 26
  2017.             #define _YCM_CALLBACK A@OnScriptInit
  2018.         #endif
  2019.         #if MASTER == 27
  2020.             #define _YCM_CALLBACK B@OnScriptInit
  2021.         #endif
  2022.         #if MASTER == 28
  2023.             #define _YCM_CALLBACK C@OnScriptInit
  2024.         #endif
  2025.         #if MASTER == 29
  2026.             #define _YCM_CALLBACK D@OnScriptInit
  2027.         #endif
  2028.         #if MASTER == 30
  2029.             #define _YCM_CALLBACK E@OnScriptInit
  2030.         #endif
  2031.         #if MASTER == 31
  2032.             #define _YCM_CALLBACK F@OnScriptInit
  2033.         #endif
  2034.         #if MASTER == 32
  2035.             #define _YCM_CALLBACK G@OnScriptInit
  2036.         #endif
  2037.         #if MASTER == 33
  2038.             #define _YCM_CALLBACK H@OnScriptInit
  2039.         #endif
  2040.         #if MASTER == 34
  2041.             #define _YCM_CALLBACK I@OnScriptInit
  2042.         #endif
  2043.         #if MASTER == 35
  2044.             #define _YCM_CALLBACK J@OnScriptInit
  2045.         #endif
  2046.         #if MASTER == 36
  2047.             #define _YCM_CALLBACK K@OnScriptInit
  2048.         #endif
  2049.         #if MASTER == 37
  2050.             #define _YCM_CALLBACK L@OnScriptInit
  2051.         #endif
  2052.         #if MASTER == 38
  2053.             #define _YCM_CALLBACK M@OnScriptInit
  2054.         #endif
  2055.         #if MASTER == 39
  2056.             #define _YCM_CALLBACK N@OnScriptInit
  2057.         #endif
  2058.         #if MASTER == 40
  2059.             #define _YCM_CALLBACK O@OnScriptInit
  2060.         #endif
  2061.         #if MASTER == 41
  2062.             #define _YCM_CALLBACK P@OnScriptInit
  2063.         #endif
  2064.         #if MASTER == 42
  2065.             #define _YCM_CALLBACK Q@OnScriptInit
  2066.         #endif
  2067.         // Determine the next unique name,
  2068.         // See if this script should be master.
  2069.         if (_Master_Get(#_YCM))
  2070.         {
  2071.             P:2("Got master " #_YCM);
  2072.             state _YCM:y;
  2073.         }
  2074.         else
  2075.         {
  2076.             state _YCM:n;
  2077.         }
  2078.         // FINALLY call the new next one.
  2079.         CallLocalFunction(#_YCM_CALLBACK, "");
  2080.     }
  2081.    
  2082.     // Don't need extra checks here as we KNOW it is already defined.
  2083.     #if defined FILTERSCRIPT
  2084.         #undef OnFilterScriptInit
  2085.         #define OnFilterScriptInit _YCM_CALLBACK
  2086.     #else
  2087.         #undef OnGameModeInit
  2088.         #define OnGameModeInit _YCM_CALLBACK
  2089.     #endif
  2090.     forward _YCM_CALLBACK();
  2091. #endif
  2092.  
  2093. // Undefine this before the next call.
  2094. #undef MASTER
  2095.  
  2096. // There are the following remote function definitions:
  2097. //
  2098. // RF - A basic function.
  2099. // RF@p - A function with special parameters which need passing hints.
  2100. // RF@c - A function with lots of paramteres that needs special code.
  2101. // RF@v - A function with no return value.
  2102. // RF@n - A function with no parameters.
  2103. // RF@t - A function with a tag result.
  2104. // RC - A callback function.
  2105. // RF@p - A callback with special parameters which need passing hints.
  2106. // RF@c - A callback with lots of paramteres that needs special code.
  2107. // RF@v - A callback with no return value.
  2108. // RF@n - A callback with no parameters.
  2109. //
  2110. // Supported combinations:
  2111. //
  2112. // pc, cp
  2113. // pcv, pvc, cpv, cvp, vpc, vcp
  2114. // pv, vp
  2115. // cv, vc
  2116. // vn, nv
  2117. // cpt ctp pct ptc tcp tpc
  2118. // ct tc
  2119. // nt tn
  2120. // pt tp
  2121. //
  2122. // p and c are for special parameter sets, n is for no parameters, so those two
  2123. // groups can never be mixed together.  t is for tag result and v is for no
  2124. // return, so they can never be used together.
  2125. //
  2126. // Note that the callback thing won't work with OnPlayerCommandText as it has a
  2127. // different default return to everything else.
  2128. //
  2129.  
  2130. // These parts are redefined every time the master system is included.
  2131. #if YSIM_HAS_MASTER
  2132.     #if YSIM_IS_CLIENT
  2133.         // Defined the functions as remote calling stubs.  Then rename the
  2134.         // following code with a name unlikely to ever be used and define the
  2135.         // functions as stock so the compiler removes all the code quietly.
  2136.         #define RF:%1[%2](%3) stock %1(%3)return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);stock _@%1(%3)
  2137.         #define RF@p:%1[%2](%3)<%4> stock %1(%3)return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);stock _@%1(%3)
  2138.         #define RF@c RF
  2139.         #define RF@v:%1[%2](%3) stock %1(%3)U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1);stock _@%1(%3)
  2140.         #define RF@n:%1[]() stock %1()return U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);stock _@%1()
  2141.         #define RF@pc RF@p
  2142.         #define RF@pv:%1[%2](%3)<%4> stock %1(%3)U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1);stock _@%1(%3)
  2143.         #define RF@pcv RF@pv
  2144.         #define RF@vc RF@v
  2145.         #define RF@vn:%1[]() stock %1()U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1);stock _@%1()
  2146.        
  2147.         #define RF@t:%0:%1[%2](%3) stock %0:%1(%3)return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);stock %0:_@%1(%3)
  2148.         #define RF@pt:%0:%1[%2](%3)<%4> stock %0:%1(%3)return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);stock %0:_@%1(%3)
  2149.         #define RF@ct RF@t
  2150.         #define RF@nt:%0:%1[]() stock %0:%1()return U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);stock %0:_@%1()
  2151.         #define RF@pct RF@pt
  2152.        
  2153.         #define RC:%1[%2](%3) stock _@%1(%3)
  2154.         #define RC@v:%1[%2](%3) stock _@%1(%3)
  2155.         #define RC@n:%1[]() stock _@%1()
  2156.         #define RC@vn:%1[]() stock _@%1()
  2157.        
  2158.         #define Master_Caller() (_@)
  2159.     #else
  2160.         #if YSIM_IS_SERVER
  2161.             #define RF:%1[%2](%3) forward %1R(%3);public %1R(%3)U@(8,YSIM_RETURN,%1(%3));%1(%3)
  2162.             #define RF@p:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)U@(8,YSIM_RETURN,%1(%4));%1(%3)
  2163.             #define RF@c RF
  2164.             #define RF@v:%1[%2](%3) forward %1R(%3);public %1R(%3)
  2165.             #define RF@n:%1[]() forward %1R();public %1R()U@(8,YSIM_RETURN,%1());%1()
  2166.             #define RF@pc RF@p
  2167.             #define RF@pv:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)
  2168.             #define RF@pcv RF@pv
  2169.             #define RF@vc RF@v
  2170.             #define RF@vn:%1[]() forward %1R();public %1R()
  2171.            
  2172.             #define RF@t:%0:%1[%2](%3) forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)U@(8,YSIM_RETURN,_:%1(%3));%0:%1(%3)
  2173.             #define RF@pt:%0:%1[%2](%3)<%4> forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)U@(8,YSIM_RETURN,_:%1(%4));%0:%1(%3)
  2174.             #define RF@ct RF@t
  2175.             #define RF@nt:%0:%1[]() forward %0:%1();forward %0:%1R();public %0:%1R()U@(8,YSIM_RETURN,_:%1());%0:%1()
  2176.             #define RF@pct RF@pt
  2177.            
  2178.             #define RC:%1[%2](%3) public %1(%3)
  2179.             #define RC@v:%1[%2](%3) public %1(%3)
  2180.             #define RC@n:%1[]() public %1()
  2181.             #define RC@vn:%1[]() public %1()
  2182.            
  2183.             #define Master_Caller() \
  2184.                 (V@(8, YSIM_CALLER))
  2185.            
  2186.             //#define Master_Get(%1) state (_Master_Get(#%1)) ? (%1:y) : (%1:n)
  2187.             //#define Master_Init(%1); _Master_Get(#%1);
  2188.         #else
  2189.             // This is a normal system with the possibility of being the master.
  2190.             // This is the very complicated one to write!
  2191.             #define RF:%1[%2](%3) forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>U@(8,YSIM_RETURN,%1(%3));%1(%3)<>return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);%1(%3)<_YCM:y>
  2192.             #define RF@p:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>U@(8,YSIM_RETURN,%1(%4));%1(%3)<>return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);%1(%3)<_YCM:y>
  2193.             #define RF@c:%1[%2](%3) forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>X@(%1(%3));%1(%3)<>return Y@(),W@(#%1R,#%2,%3),Z@();%1(%3)<_YCM:y>
  2194.             #define RF@v:%1[%2](%3) forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>%1(%3);%1(%3)<>U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1);%1(%3)<_YCM:y>
  2195.             #define RF@n:%1[]() forward %1R();public %1R()<>{}public %1R()<_YCM:y>U@(8,YSIM_RETURN,%1());%1()<>return U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1),V@(8,YSIM_RETURN);%1()<_YCM:y>
  2196.             #define RF@pc:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>X@(%1(%4));%1(%3)<>return Y@(),W@(#%1R,#%2,%4),Z@();%1(%3)<_YCM:y>
  2197.             #define RF@pv:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>%1(%4);%1(%3)<>U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1);%1(%3)<_YCM:y>
  2198.             #define RF@pcv:%1[%2](%3)<%4> forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>%1(%4);%1(%3)<>Y@(),W@(#%1R,#%2,%4),T@();%1(%3)<_YCM:y>
  2199.             #define RF@vc:%1[%2](%3) forward %1R(%3);public %1R(%3)<>{}public %1R(%3)<_YCM:y>%1(%3);%1(%3)<>Y@(),W@(#%1R,#%2,%3),T@();%1(%3)<_YCM:y>
  2200.             #define RF@vn:%1[]() forward %1R();public %1R()<>{}public %1R()<_YCM:y>%1();%1()<>U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1);%1()<_YCM:y>
  2201.            
  2202.             #define RF@t:%0:%1[%2](%3) forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)<>{}public %0:%1R(%3)<_YCM:y>U@(8,YSIM_RETURN,_:%1(%3));%0:%1(%3)<>return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%3),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);%0:%1(%3)<_YCM:y>
  2203.             //#define RF@pt:%0:%1[%2](%3)<%4> forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)<>{}public %0:%1R(%3)<_YCM:y>U@(8,YSIM_RETURN,_:%1(%4));%0:%1(%3)<>return U@(8,YSIM_CALLER,_@),W@(#%1R,#%2,%4),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);%0:%1(%3)<_YCM:y>
  2204.             #define RF@ct:%0:%1[%2](%3) forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)<>{}public %0:%1R(%3)<_YCM:y>X@(_:%1(%3));%0:%1(%3)<>return Y@(),W@(#%1R,#%2,%3),%0:Z@();%0:%1(%3)<_YCM:y>
  2205.             //#define RF@nt:%0:%1[]() forward %0:%1();forward %0:%1R();public %0:%1R()<>{}public %0:%1R()<_YCM:y>U@(8,YSIM_RETURN,_:%1());%0:%1()<>return U@(8,YSIM_CALLER,_@),W@(#%1R,""),U@(8,YSIM_CALLER,-1),%0:V@(8,YSIM_RETURN);%0:%1()<_YCM:y>
  2206.             #define RF@pct:%0:%1[%2](%3)<%4> forward %0:%1(%3);forward %0:%1R(%3);public %0:%1R(%3)<>{}public %0:%1R(%3)<_YCM:y>X@(_:%1(%4));%0:%1(%3)<>return Y@(),W@(#%1R,#%2,%4),%0:Z@();%0:%1(%3)<_YCM:y>
  2207.            
  2208.             #define RC:%1[%2](%3) public %1(%3)<>return 1;public %1(%3)<_YCM:y>
  2209.             #define RC@v:%1[%2](%3) public %1(%3)<>{}public %1(%3)<_YCM:y>
  2210.             #define RC@n:%1[]() public %1()<>return 1;public %1()<_YCM:y>
  2211.             #define RC@vn:%1[]() public %1()<>{}public %1()<_YCM:y>
  2212.            
  2213.             #define Master_Caller() \
  2214.                 ((V@(8, YSIM_CALLER) == -1) ? (_@) : (V@(8, YSIM_CALLER)))
  2215.            
  2216.             //#define Master_Get(%1) state (_Master_Get(#%1)) ? (%1:y) : (%1:n)
  2217.             //#define Master_Init(%1); if (_Master_Get(#%1)) state %1:y; else state %1:n;
  2218.         #endif
  2219.     #endif
  2220. #else
  2221.     // Master system isn't used.
  2222.     #define RF:%1[%2](%3) stock %1(%3)
  2223.     #define RF@p RF
  2224.     #define RF@c RF
  2225.     #define RF@v RF
  2226.     #define RF@n RF
  2227.     #define RF@pc RF
  2228.     #define RF@pv RF
  2229.     #define RF@pcv RF
  2230.     #define RF@vc RF
  2231.     #define RF@vn RF
  2232.    
  2233.     #define RF@t:%0:%1[%2](%3) stock %0:%1(%3)
  2234.     #define RF@pt RF@t
  2235.     #define RF@ct RF@t
  2236.     #define RF@nt RF@t
  2237.     #define RF@pct RF@t
  2238.    
  2239.     #define RC:%1[%2](%3) public %1(%3)
  2240.     #define RC@v RC
  2241.     #define RC@n RC
  2242.     #define RC@vn RC
  2243.    
  2244.     #define Master_Caller() (_@)
  2245.    
  2246.     //#define Master_Init(%1);
  2247. #endif
  2248.  
  2249. #if YSIM_CLOUD && !defined YSIM_DEFINED
  2250.     // Define a load of fake functions to cater for the compiler's need to
  2251.     // know all the possible states.  y means master, n means not master, m
  2252.     // means master system missing, p means previous (ending master), u
  2253.     // means sort of uninitialised (though technically initialised).  This
  2254.     // also doubles as a handy call in function for resetting masters when a
  2255.     // script ends.  Just to clarify - this function is NOT called _YCM,
  2256.     // that is a macro which is expanded every time this file is included.
  2257.     forward _YCM();
  2258.     public _YCM() <_YCM:y>
  2259.     {
  2260.         P:2(#_YCM ":y called");
  2261.         // Disable the current mastership.
  2262.         state _YCM:p;
  2263.         setproperty(8, #_YCM, -1);
  2264.         // Called locally to begin the hand off process.
  2265.         CallRemoteFunction(#_YCM, "i", _@);
  2266.     }
  2267.    
  2268.     public _YCM() <_YCM:n>
  2269.     {
  2270.         P:2(#_YCM ":n called");
  2271.         // This has been called remotely from a script which owns the
  2272.         // library masterhood (that's the only way this can ever be called).
  2273.         if (_Master_Get(#_YCM))
  2274.         {
  2275.             P:2("Got master " #_YCM);
  2276.             state _YCM:y;
  2277.         }
  2278.     }
  2279.    
  2280.     public _YCM() <_YCM:m, _YCM:p, _YCM:u>
  2281.     {
  2282.         P:2(#_YCM ":mpu called");
  2283.         // Do nothing at all (just define states).
  2284.     }
  2285.    
  2286.     public _YCM() <>
  2287.     {
  2288.         P:2(#_YCM ":<> called");
  2289.         if (_Master_Get(#_YCM))
  2290.         {
  2291.             P:2("Got master " #_YCM);
  2292.             state _YCM:y;
  2293.         }
  2294.         else
  2295.         {
  2296.             state _YCM:n;
  2297.         }
  2298.         // Do nothing at all (just define states).
  2299.     }
  2300. #endif
  2301.  
  2302. #if defined YSIM_T_ENABLE
  2303.     #undef YSIM_T_ENABLE
  2304. #endif
  2305.  
  2306. #if defined YSIM_T_DISABLE
  2307.     #undef YSIM_T_DISABLE
  2308. #endif
  2309.  
  2310. #if defined YSIM_C_ENABLE
  2311.     #undef YSIM_C_ENABLE
  2312. #endif
  2313.  
  2314. #if defined YSIM_C_DISABLE
  2315.     #undef YSIM_C_DISABLE
  2316. #endif
  2317.  
  2318. #if defined YSIM_S_ENABLE
  2319.     #undef YSIM_S_ENABLE
  2320. #endif
  2321.  
  2322. #if defined YSIM_S_DISABLE
  2323.     #undef YSIM_S_DISABLE
  2324. #endif
  2325.  
  2326. // Allow YSI scripts to use the extended master system
  2327. #if defined _YSIM_USED_AUTO
  2328.     #undef _YSIM_USED_AUTO
  2329. #endif
  2330.  
  2331. #if defined YSIM_OVERRIDE
  2332.     #undef YSIM_OVERRIDE
  2333. #endif
  2334.  
  2335. #if defined YSIM_STORED_SETTINGS
  2336.     #undef YSIM_STORED_SETTINGS
  2337. #endif
Add Comment
Please, Sign In to add comment