home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / rozrywka / rpg / amigamud / src / basics / base.m next >
Text File  |  1997-06-15  |  36KB  |  1,236 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1997 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * base.m - standard MUD code for the basic activities and structures.
  9.  */
  10.  
  11. private tp_base CreateTable()$
  12. use tp_base
  13.  
  14. public MAX_CARRY 7$
  15.  
  16. /* These properties are made public, so that a non-builder can make code
  17.    to use them in the playpen. These are special in that they are
  18.    referenced by the automatically generated code. We want that code to
  19.    compile properly, even if the builder hasn't @use'd any tables such
  20.    as t_base. */
  21.  
  22. public p_rName CreateStringProp()$        /* the name of a room */
  23. public p_rContents CreateThingListProp()$    /* the room's contents */
  24. public p_pCarrying CreateThingListProp()$    /* player's inventory */
  25. public p_oName CreateStringProp()$        /* encoded name of object */
  26. public p_oCarryer CreateThingProp()$        /* who is carrying it */
  27. public p_oCreator CreateThingProp()$        /* who "created" it */
  28. public p_oContents CreateThingListProp()$    /* contents of an object */
  29.  
  30. define t_base p_Image CreateStringProp()$    /* name of image file */
  31.  
  32. /* some properties for rooms */
  33.  
  34. define t_base p_rBuyList CreateThingListProp()$ /* list of things for sale */
  35. define t_base p_rNameAction CreateActionProp()$ /* call proc instead */
  36. define t_base p_rDark CreateBoolProp()$     /* its dark in here */
  37. define t_base p_rNoMachines CreateBoolProp()$    /* keep the machines out */
  38. define t_base p_rLocked CreateBoolProp()$    /* only owner can go in */
  39. define t_base p_rDesc CreateStringProp()$    /* full description of room */
  40. define t_base p_rDescAction CreateActionProp()$ /* call proc instead */
  41. define t_base p_rScenery CreateStringProp()$    /* scenery names */
  42. define t_base p_rExits CreateIntListProp()$    /* list of obvious exits */
  43. define t_base p_rFurtherDesc CreateActionProp()$/* for any extra stuff */
  44. define t_base p_rLastVisit CreateIntProp()$    /* useful for timing things */
  45. define t_base p_rNoGoString CreateStringProp()$ /* print if cannot go */
  46. define t_base p_rNoGoAction CreateActionProp()$ /* call if cannot go */
  47. define t_base p_rBuyAction CreateActionProp()$    /* how to buy here */
  48.  
  49. /* the basic connections between rooms */
  50.  
  51. define t_base p_rNorth CreateThingProp()$    /* actual north connection */
  52. define t_base p_rSouth CreateThingProp()$
  53. define t_base p_rEast CreateThingProp()$
  54. define t_base p_rWest CreateThingProp()$
  55. define t_base p_rNorthEast CreateThingProp()$
  56. define t_base p_rNorthWest CreateThingProp()$
  57. define t_base p_rSouthEast CreateThingProp()$
  58. define t_base p_rSouthWest CreateThingProp()$
  59. define t_base p_rUp CreateThingProp()$
  60. define t_base p_rDown CreateThingProp()$
  61. define t_base p_rEnter CreateThingProp()$
  62. define t_base p_rExit CreateThingProp()$
  63.  
  64. define t_base p_rNorthDesc CreateStringProp()$    /* special description */
  65. define t_base p_rSouthDesc CreateStringProp()$
  66. define t_base p_rEastDesc CreateStringProp()$
  67. define t_base p_rWestDesc CreateStringProp()$
  68. define t_base p_rNorthEastDesc CreateStringProp()$
  69. define t_base p_rNorthWestDesc CreateStringProp()$
  70. define t_base p_rSouthEastDesc CreateStringProp()$
  71. define t_base p_rSouthWestDesc CreateStringProp()$
  72. define t_base p_rUpDesc CreateStringProp()$
  73. define t_base p_rDownDesc CreateStringProp()$
  74. define t_base p_rEnterDesc CreateStringProp()$
  75. define t_base p_rExitDesc CreateStringProp()$
  76.  
  77. define t_base p_rNorthMessage CreateStringProp()$ /* to player when go */
  78. define t_base p_rSouthMessage CreateStringProp()$
  79. define t_base p_rEastMessage CreateStringProp()$
  80. define t_base p_rWestMessage CreateStringProp()$
  81. define t_base p_rNorthEastMessage CreateStringProp()$
  82. define t_base p_rNorthWestMessage CreateStringProp()$
  83. define t_base p_rSouthEastMessage CreateStringProp()$
  84. define t_base p_rSouthWestMessage CreateStringProp()$
  85. define t_base p_rUpMessage CreateStringProp()$
  86. define t_base p_rDownMessage CreateStringProp()$
  87. define t_base p_rEnterMessage CreateStringProp()$
  88. define t_base p_rExitMessage CreateStringProp()$
  89.  
  90. define t_base p_rNorthOMessage CreateStringProp()$ /* to others when go */
  91. define t_base p_rSouthOMessage CreateStringProp()$
  92. define t_base p_rEastOMessage CreateStringProp()$
  93. define t_base p_rWestOMessage CreateStringProp()$
  94. define t_base p_rNorthEastOMessage CreateStringProp()$
  95. define t_base p_rNorthWestOMessage CreateStringProp()$
  96. define t_base p_rSouthEastOMessage CreateStringProp()$
  97. define t_base p_rSouthWestOMessage CreateStringProp()$
  98. define t_base p_rUpOMessage CreateStringProp()$
  99. define t_base p_rDownOMessage CreateStringProp()$
  100. define t_base p_rEnterOMessage CreateStringProp()$
  101. define t_base p_rExitOMessage CreateStringProp()$
  102.  
  103. define t_base p_rNorthEMessage CreateStringProp()$ /* to others when enter */
  104. define t_base p_rSouthEMessage CreateStringProp()$
  105. define t_base p_rEastEMessage CreateStringProp()$
  106. define t_base p_rWestEMessage CreateStringProp()$
  107. define t_base p_rNorthEastEMessage CreateStringProp()$
  108. define t_base p_rNorthWestEMessage CreateStringProp()$
  109. define t_base p_rSouthEastEMessage CreateStringProp()$
  110. define t_base p_rSouthWestEMessage CreateStringProp()$
  111. define t_base p_rUpEMessage CreateStringProp()$
  112. define t_base p_rDownEMessage CreateStringProp()$
  113. define t_base p_rEnterEMessage CreateStringProp()$
  114. define t_base p_rExitEMessage CreateStringProp()$
  115.  
  116. define t_base p_rNorthImage CreateStringProp()$ /* image of that dir */
  117. define t_base p_rSouthImage CreateStringProp()$
  118. define t_base p_rEastImage CreateStringProp()$
  119. define t_base p_rWestImage CreateStringProp()$
  120. define t_base p_rNorthEastImage CreateStringProp()$
  121. define t_base p_rNorthWestImage CreateStringProp()$
  122. define t_base p_rSouthEastImage CreateStringProp()$
  123. define t_base p_rSouthWestImage CreateStringProp()$
  124. define t_base p_rUpImage CreateStringProp()$
  125. define t_base p_rDownImage CreateStringProp()$
  126. define t_base p_rEnterImage CreateStringProp()$
  127. define t_base p_rExitImage CreateStringProp()$
  128.  
  129. /* The various 'checker' lists are private, since they are accessed only
  130.    via the supplied Add/Del Checker routines. */
  131.  
  132. define tp_base p_rNorthChecks CreateActionListProp()$
  133. define tp_base p_rSouthChecks CreateActionListProp()$
  134. define tp_base p_rEastChecks CreateActionListProp()$
  135. define tp_base p_rWestChecks CreateActionListProp()$
  136. define tp_base p_rNorthEastChecks CreateActionListProp()$
  137. define tp_base p_rNorthWestChecks CreateActionListProp()$
  138. define tp_base p_rSouthEastChecks CreateActionListProp()$
  139. define tp_base p_rSouthWestChecks CreateActionListProp()$
  140. define tp_base p_rUpChecks CreateActionListProp()$
  141. define tp_base p_rDownChecks CreateActionListProp()$
  142. define tp_base p_rEnterChecks CreateActionListProp()$
  143. define tp_base p_rExitChecks CreateActionListProp()$
  144. define tp_base p_rAnyEnterChecks CreateActionListProp()$
  145. define tp_base p_rAnyEnterActions CreateActionListProp()$
  146. define tp_base p_rAnyLeaveChecks CreateActionListProp()$
  147. define tp_base p_rAnyLeaveActions CreateActionListProp()$
  148.  
  149. define tp_base p_rGetChecks CreateActionListProp()$    /* passed the object */
  150. define tp_base p_rDropChecks CreateActionListProp()$    /* passed the object */
  151.  
  152. define tp_base p_rSayChecks CreateActionListProp()$    /* passed stuff said */
  153. define tp_base p_rLookChecks CreateActionListProp()$    /* instead of/with */
  154.  
  155. define tp_base p_rLightChecks CreateActionListProp()$    /* light introduced */
  156.  
  157. /* some properties for players */
  158.  
  159. define t_base p_pDesc CreateStringProp()$    /* the player's description */
  160. define t_base p_pDescCheck CreateActionProp()$    /* check to see if look OK */
  161. define t_base p_pDescAction CreateActionProp()$ /* call routine instead */
  162. define t_base p_pDescMore CreateActionListProp()$    /* more desc stuff */
  163. define t_base p_pMoney CreateIntProp()$     /* how much money player has */
  164. define t_base p_pVerbose CreateBoolProp()$    /* player wants verbose desc */
  165. define t_base p_pSuperBrief CreateBoolProp()$    /* player wants superbrief */
  166. define t_base p_pEchoPose CreateBoolProp()$    /* echo pose, say to them */
  167. define t_base p_pHidden CreateBoolProp()$    /* for special tricks */
  168. define t_base p_pStandard CreateBoolProp()$    /* not on fight monsters */
  169. define t_base p_pPosition CreateIntProp()$    /* special codes */
  170. define t_base p_pWhere CreateThingProp()$    /* e.g. the bench */
  171. define t_base p_pCursor CreateIntListProp()$    /* the chosen cursor */
  172. define t_base p_pCursorColour CreateIntProp()$    /* what colour they want */
  173. define t_base p_pIconColour CreateIntProp()$    /* what colour for these */
  174. define t_base p_pTextColours CreateIntListProp()$ /* colours for text window */
  175. define t_base p_pPrivileged CreateBoolProp()$
  176. define t_base p_pBuilder CreateBoolProp()$    /* used in the 'build' code */
  177. define t_base p_pGivePre CreateActionProp()$    /* before object check */
  178. define t_base p_pGivePost CreateActionProp()$    /* after object check */
  179. define t_base p_pEnterActions CreateActionListProp()$    /* do on startup */
  180. define t_base p_pExitActions CreateActionListProp()$    /* do on player idle */
  181. define t_base p_pHiddenList CreateThingListProp()$  /* whatever is needed */
  182. define t_base p_pAliases CreateThingListProp()$ /* top level aliases */
  183. define t_base p_sAliasKey CreateStringProp()$    /* the alias key */
  184. define t_base p_sAliasValue CreateStringProp()$ /* the aliased command */
  185. define t_base p_pFollowing CreateThingProp()$    /* who I am following */
  186. define t_base p_pFollowers CreateThingListProp()$/* those following me */
  187.  
  188. /* these are set by provided Add/Del routines, so can be private */
  189.  
  190. define tp_base p_pLeaveChecks CreateActionListProp()$
  191. define tp_base p_pEnterChecks CreateActionListProp()$
  192.  
  193. /* some properties for objects */
  194.  
  195. define t_base p_oDesc CreateStringProp()$    /* long description of it */
  196. define t_base p_oDescCheck CreateActionProp()$    /* check to see if look OK */
  197. define t_base p_oDescAction CreateActionProp()$ /* call proc instead */
  198. define t_base p_oInvisible CreateBoolProp()$    /* do not show up on look */
  199. define t_base p_oHome CreateThingProp()$    /* its home location */
  200. define t_base p_oWhere CreateThingProp()$    /* room it is now in */
  201. define t_base p_oLight CreateBoolProp()$    /* also on players/machines */
  202. define t_base p_oReadString CreateStringProp()$ /* stuff on a sign, etc. */
  203. define t_base p_oReadAction CreateActionProp()$
  204. define t_base p_pReadChecker CreateActionProp()$/* can he read? */
  205. define t_base p_oState CreateIntProp()$     /* handy for lots of things */
  206. define t_base p_oCanSitIn CreateIntProp()$    /* # + 1 who can sit in it */
  207. define t_base p_oCanSitOn CreateIntProp()$    /* # + 1 who can sit on it */
  208. define t_base p_oCanLieIn CreateIntProp()$    /* # + 1 who can lie in it */
  209. define t_base p_oCanLieOn CreateIntProp()$    /* # + 1 who can lie on it */
  210. define t_base p_oCanStandIn CreateIntProp()$    /* # + 1 who can stand in it */
  211. define t_base p_oCanStandOn CreateIntProp()$    /* # + 1 who can stand on it */
  212. define t_base p_oPositionChecker CreateActionProp()$/* checker for the above */
  213. define t_base p_oGiveChecker CreateActionProp()$/* when try to give it */
  214. define t_base p_oPutMeInChecker CreateActionProp()$
  215. define t_base p_oPutInMeChecker CreateActionProp()$
  216. define t_base p_oTakeMeFromChecker CreateActionProp()$
  217. define t_base p_oTakeFromMeChecker CreateActionProp()$
  218. define t_base p_oFillMeWithChecker CreateActionProp()$
  219. define t_base p_oFillWithMeChecker CreateActionProp()$
  220. define t_base p_oEmptyChecker CreateActionProp()$
  221. define t_base p_oLookInString CreateStringProp()$
  222. define t_base p_oLookInAction CreateActionProp()$
  223. define t_base p_oNotUnlockString CreateStringProp()$
  224. define t_base p_oNotLockString CreateStringProp()$
  225. define t_base p_oUnlockMeWithChecker CreateActionProp()$
  226. define t_base p_oUnlockWithMeChecker CreateActionProp()$
  227. define t_base p_oLockMeWithChecker CreateActionProp()$
  228. define t_base p_oLockWithMeChecker CreateActionProp()$
  229. define t_base p_oNotLockable CreateBoolProp()$
  230. define t_base p_oLocked CreateBoolProp()$
  231. define t_base p_oActWord CreateStringProp()$    /* word to 'act' an object */
  232. define t_base p_oActString CreateStringProp()$    /* simple string to print */
  233. define t_base p_oActAction CreateActionProp()$    /* routine to call */
  234. define t_base p_oSpecialGrammar CreateGrammarProp()$ /* for specials */
  235. define t_base p_oCapacity CreateIntProp()$    /* number of contents */
  236. define t_base p_oConsumer CreateThingProp()$    /* for potions */
  237.  
  238. define tp_misc POS_NONE 0$
  239. define tp_misc POS_SIT_IN 1$
  240. define tp_misc POS_SIT_ON 2$
  241. define tp_misc POS_LIE_IN 3$
  242. define tp_misc POS_LIE_ON 4$
  243. define tp_misc POS_STAND_IN 5$
  244. define tp_misc POS_STAND_ON 6$
  245.  
  246. define t_base p_oNotGettable CreateBoolProp()$    /* stop people getting it */
  247. define t_base p_oGetChecker CreateActionProp()$ /* passed the object */
  248. define t_base p_oDropChecker CreateActionProp()$/* passed the object */
  249. define t_base p_oUnGetChecker CreateActionProp()$/* passed the object */
  250. define t_base p_oBuyChecker CreateActionProp()$ /* how to buy item */
  251. define t_base p_oPrice CreateIntProp()$     /* price of it */
  252.  
  253. /* properties dealing with the simple graphics stuff */
  254.  
  255. define t_base p_rEnterRoomDraw CreateActionProp()$
  256. define t_base p_rLeaveRoomDraw CreateActionProp()$
  257. define t_base p_MapGroup CreateIntProp()$
  258.  
  259. /* kind codes for effects */
  260.  
  261. define t_base EFFECT_SOUND    0$
  262. define t_base EFFECT_SPEECH    1$
  263. define t_base EFFECT_MUSIC    2$
  264.  
  265. /* kind codes for EditString */
  266.  
  267. define t_base EDIT_COOKED    0$
  268. define t_base EDIT_RAW        1$
  269. define t_base EDIT_CODE     2$
  270.  
  271. /* comparison codes for FindIntOnList */
  272.  
  273. define t_base COMP_EQUAL        0$
  274. define t_base COMP_NOT_EQUAL        1$
  275. define t_base COMP_LESS_THAN        2$
  276. define t_base COMP_LESS_OR_EQUAL    3$
  277. define t_base COMP_GREATER_THAN     4$
  278. define t_base COMP_GREATER_OR_EQUAL    5$
  279.  
  280. /*
  281.  * define a unique-id generator for sound-effects id's
  282.  */
  283.  
  284. define tp_base EffectIdBase CreateThing(nil)$
  285. define tp_base eid_nextId CreateIntProp()$
  286. EffectIdBase@eid_nextId := 0$
  287.  
  288. define t_base proc NextSoundEffectId()int:
  289.  
  290.     EffectIdBase@eid_nextId := EffectIdBase@eid_nextId + 1;
  291.     EffectIdBase@eid_nextId
  292. corp;
  293.  
  294.  
  295. /* Properties, etc. that control the automated backups and other globally
  296.    settable things. */
  297.  
  298. define tp_misc GlobalThing CreateThing(nil)$
  299. define tp_misc p_FlushNeeded CreateBoolProp()$
  300. define tp_misc p_BackupInterval CreateIntProp()$
  301.  
  302. SetThingStatus(GlobalThing, ts_public)$ /* so parseInput can write it */
  303. GlobalThing@p_FlushNeeded := false$
  304. GlobalThing@p_BackupInterval := 0$
  305.  
  306. define tp_misc p_FreePoses CreateBoolProp()$
  307. GlobalThing@p_FreePoses := false$
  308.  
  309. define tp_misc p_FreeBuilding CreateBoolProp()$
  310. GlobalThing@p_FreeBuilding := false$
  311.  
  312.  
  313. /* now some general utility routines */
  314.  
  315. /*
  316.  * CharacterNameS - a standardized form of a specific character name.
  317.  */
  318.  
  319. define t_base proc utility public CharacterNameS(thing who)string:
  320.     string name;
  321.  
  322.     name := FormatName(who@p_pName);
  323.     if who@p_pStandard then
  324.     name
  325.     else
  326.     "the " + name
  327.     fi
  328. corp;
  329.  
  330. /*
  331.  * CharacterNameG - a standardized form of a generic character name.
  332.  */
  333.  
  334. define t_base proc utility public CharacterNameG(thing who)string:
  335.     string name;
  336.  
  337.     name := FormatName(who@p_pName);
  338.     if who@p_pStandard then
  339.     name
  340.     else
  341.     AAn("", name)
  342.     fi
  343. corp;
  344.  
  345. /*
  346.  * InsertCommand - do a command, but display it first.
  347.  */
  348.  
  349. define t_base proc utility public InsertCommand(string command)void:
  350.  
  351.     Print(">>> " + command + "\n");
  352.     GlobalThing@p_FlushNeeded := true;
  353.     ignore Parse(G, command);
  354. corp;
  355.  
  356. /*
  357.  * DoChecks - run through an action list, calling each one. Assume they
  358.  *    all return a status value. Stop if one returns other than continue,
  359.  *    and return the overall result. This will be:
  360.  *        fail - a checker returned fail, i.e. do not proceed
  361.  *        succeed - a checker returned succeed, i.e. this check
  362.  *            overrode all others, but proceed with action
  363.  *        continue - nothing special - proceed with action
  364.  *    The distinction between the last two is only needed if the caller
  365.  *    would also do something similar to the checkers (see the use of
  366.  *    'DoRoomLookChecks' in 'EnterRoom' in 'util.m'.) Otherwise, most
  367.  *    callers will treat the value as yes/no.
  368.  *    Note: we assume that none of the actions modifies the list.
  369.  */
  370.  
  371. /*
  372.  * Note that none of these routines use 'SetEffectiveToNone'. This is a
  373.  * part of the big security hole involving SysAdmin. SysAdmin should never
  374.  * be used to 'play' on a MUD where untrusted people have been given
  375.  * builder, apprentice or wizard status. Those characters can write code
  376.  * and attach it to rooms, objects, etc. That code, if triggered by
  377.  * SysAdmin, will run as SysAdmin. For this reason, SysAdmin should *never*
  378.  * go into the PlayPen!.
  379.  * Adding SetEffectiveToNone is a problem, because it prevents these
  380.  * routines from doing entirely legitimate activities on behalf of the
  381.  * active character. Character idle code for build description routines
  382.  * is an example. Even SysAdmin can't shut down correctly in that case!
  383.  */
  384.  
  385. define t_base proc utility public DoChecks(list action la)status:
  386.     int count, i;
  387.     status st;
  388.  
  389.     st := continue;
  390.     if la ~= nil then
  391.     count := Count(la);
  392.     i := 0;
  393.     while i < count and st = continue do
  394.         st := call(la[i], status)();
  395.         i := i + 1;
  396.     od;
  397.     fi;
  398.     st
  399. corp;
  400.  
  401. /*
  402.  * DoThingChecks - same, except a thing is passed to each action.
  403.  */
  404.  
  405. define t_base proc utility public DoThingChecks(list action la;
  406.     thing th)status:
  407.     int count, i;
  408.     status st;
  409.  
  410.     st := continue;
  411.     if la ~= nil then
  412.     count := Count(la);
  413.     i := 0;
  414.     while i < count and st = continue do
  415.         st := call(la[i], status)(th);
  416.         i := i + 1;
  417.     od;
  418.     fi;
  419.     st
  420. corp;
  421.  
  422. /*
  423.  * DoStringChecks - same, except each checker is passed a string argument.
  424.  */
  425.  
  426. define t_base proc utility public DoStringChecks(list action la;
  427.     string s)status:
  428.     int count, i;
  429.     status st;
  430.  
  431.     st := continue;
  432.     if la ~= nil then
  433.     count := Count(la);
  434.     i := 0;
  435.     while i < count and st = continue do
  436.         st := call(la[i], status)(s);
  437.         i := i + 1;
  438.     od;
  439.     fi;
  440.     st
  441. corp;
  442.  
  443. /*
  444.  * DoIntChecks - same, except each checker is passed an int argument.
  445.  */
  446.  
  447. define t_base proc utility public DoIntChecks(list action la; int n)status:
  448.     int count, i;
  449.     status st;
  450.  
  451.     st := continue;
  452.     if la ~= nil then
  453.     count := Count(la);
  454.     i := 0;
  455.     while i < count and st = continue do
  456.         st := call(la[i], status)(n);
  457.         i := i + 1;
  458.     od;
  459.     fi;
  460.     st
  461. corp;
  462.  
  463. /*
  464.  * DoList - run through a list of actions, doing all of them.
  465.  *    This routine specifically handles the case of the action
  466.  *    deleting itself from the list.
  467.  */
  468.  
  469. define t_base proc utility public DoList(list action la)void:
  470.     int i, count, newCount;
  471.  
  472.     if la ~= nil then
  473.     count := Count(la);
  474.     i := 0;
  475.     while i < count do
  476.         call(la[i], void)();
  477.         newCount := Count(la);
  478.         if newCount = count then
  479.         i := i + 1;
  480.         else
  481.         count := newCount;
  482.         fi;
  483.     od;
  484.     fi;
  485. corp;
  486.  
  487. /*
  488.  * DoThingActions - these are passed a thing, but return no result.
  489.  */
  490.  
  491. define t_base proc utility public DoThingActions(list action la; thing th)void:
  492.     int i;
  493.  
  494.     if la ~= nil then
  495.     for i from 0 upto Count(la) - 1 do
  496.         call(la[i], void)(th);
  497.     od;
  498.     fi;
  499. corp;
  500.  
  501. /*
  502.  * DoActionsString - do some actions, yielding a string.
  503.  */
  504.  
  505. define t_base proc utility public DoActionsString(list action la)string:
  506.     int i;
  507.     string s;
  508.  
  509.     s := "";
  510.     if la ~= nil then
  511.     for i from 0 upto Count(la) - 1 do
  512.         s := s + call(la[i], string)();
  513.     od;
  514.     fi;
  515.     s
  516. corp;
  517.  
  518. /*
  519.  * utility routines to yield direction properties, names, etc.
  520.  */
  521.  
  522. define t_base D_NORTH      0$
  523. define t_base D_NORTHEAST 1$
  524. define t_base D_EAST      2$
  525. define t_base D_SOUTHEAST 3$
  526. define t_base D_SOUTH      4$
  527. define t_base D_SOUTHWEST 5$
  528. define t_base D_WEST      6$
  529. define t_base D_NORTHWEST 7$
  530. define t_base D_UP      8$
  531. define t_base D_DOWN      9$
  532. define t_base D_ENTER     10$
  533. define t_base D_EXIT     11$
  534.  
  535. /*
  536.  * DirBack - return the 'reverse' direction for a given direction.
  537.  */
  538.  
  539. define t_base proc utility public DirBack(int dir)int:
  540.  
  541.     if dir < 4 then
  542.     dir + 4
  543.     elif dir < 8 then
  544.     dir - 4
  545.     else
  546.     dir >< 1
  547.     fi
  548. corp;
  549.  
  550. define t_base proc utility public DirName(int dir)string:
  551.     case dir
  552.     incase D_NORTH:
  553.     "the north"
  554.     incase D_NORTHEAST:
  555.     "the north-east"
  556.     incase D_EAST:
  557.     "the east"
  558.     incase D_SOUTHEAST:
  559.     "the south-east"
  560.     incase D_SOUTH:
  561.     "the south"
  562.     incase D_SOUTHWEST:
  563.     "the south-west"
  564.     incase D_WEST:
  565.     "the west"
  566.     incase D_NORTHWEST:
  567.     "the north-west"
  568.     incase D_UP:
  569.     "above"
  570.     incase D_DOWN:
  571.     "below"
  572.     incase D_ENTER:
  573.     "the inside"
  574.     incase D_EXIT:
  575.     "the outside"
  576.     default:
  577.     ""
  578.     esac
  579. corp;
  580.  
  581. define t_base proc utility public ExitName(int dir)string:
  582.     case dir
  583.     incase D_NORTH:
  584.     "north"
  585.     incase D_NORTHEAST:
  586.     "northeast"
  587.     incase D_EAST:
  588.     "east"
  589.     incase D_SOUTHEAST:
  590.     "southeast"
  591.     incase D_SOUTH:
  592.     "south"
  593.     incase D_SOUTHWEST:
  594.     "southwest"
  595.     incase D_WEST:
  596.     "west"
  597.     incase D_NORTHWEST:
  598.     "northwest"
  599.     incase D_UP:
  600.     "up"
  601.     incase D_DOWN:
  602.     "down"
  603.     incase D_ENTER:
  604.     "in"
  605.     incase D_EXIT:
  606.     "out"
  607.     default:
  608.     ""
  609.     esac
  610. corp;
  611.  
  612. define t_base proc utility public DirProp(int dir)property thing:
  613.     case dir
  614.     incase D_NORTH:
  615.     p_rNorth
  616.     incase D_NORTHEAST:
  617.     p_rNorthEast
  618.     incase D_EAST:
  619.     p_rEast
  620.     incase D_SOUTHEAST:
  621.     p_rSouthEast
  622.     incase D_SOUTH:
  623.     p_rSouth
  624.     incase D_SOUTHWEST:
  625.     p_rSouthWest
  626.     incase D_WEST:
  627.     p_rWest
  628.     incase D_NORTHWEST:
  629.     p_rNorthWest
  630.     incase D_UP:
  631.     p_rUp
  632.     incase D_DOWN:
  633.     p_rDown
  634.     incase D_ENTER:
  635.     p_rEnter
  636.     incase D_EXIT:
  637.     p_rExit
  638.     default:
  639.     Print("*** invalid direction number ");
  640.     IPrint(dir);
  641.     Print(" to 'DirProp' ***\n");
  642.     p_rNorth
  643.     esac
  644. corp;
  645.  
  646. define t_base proc utility DirChecks(int dir)property list action:
  647.     case dir
  648.     incase D_NORTH:
  649.     p_rNorthChecks
  650.     incase D_NORTHEAST:
  651.     p_rNorthEastChecks
  652.     incase D_EAST:
  653.     p_rEastChecks
  654.     incase D_SOUTHEAST:
  655.     p_rSouthEastChecks
  656.     incase D_SOUTH:
  657.     p_rSouthChecks
  658.     incase D_SOUTHWEST:
  659.     p_rSouthWestChecks
  660.     incase D_WEST:
  661.     p_rWestChecks
  662.     incase D_NORTHWEST:
  663.     p_rNorthWestChecks
  664.     incase D_UP:
  665.     p_rUpChecks
  666.     incase D_DOWN:
  667.     p_rDownChecks
  668.     incase D_ENTER:
  669.     p_rEnterChecks
  670.     incase D_EXIT:
  671.     p_rExitChecks
  672.     default:
  673.     Print("*** invalid direction number ");
  674.     IPrint(dir);
  675.     Print(" to 'DirChecks' ***\n");
  676.     p_rNorthChecks
  677.     esac
  678. corp;
  679.  
  680. define t_base proc utility public DirDesc(int dir)property string:
  681.     case dir
  682.     incase D_NORTH:
  683.     p_rNorthDesc
  684.     incase D_NORTHEAST:
  685.     p_rNorthEastDesc
  686.     incase D_EAST:
  687.     p_rEastDesc
  688.     incase D_SOUTHEAST:
  689.     p_rSouthEastDesc
  690.     incase D_SOUTH:
  691.     p_rSouthDesc
  692.     incase D_SOUTHWEST:
  693.     p_rSouthWestDesc
  694.     incase D_WEST:
  695.     p_rWestDesc
  696.     incase D_NORTHWEST:
  697.     p_rNorthWestDesc
  698.     incase D_UP:
  699.     p_rUpDesc
  700.     incase D_DOWN:
  701.     p_rDownDesc
  702.     incase D_ENTER:
  703.     p_rEnterDesc
  704.     incase D_EXIT:
  705.     p_rExitDesc
  706.     default:
  707.     Print("*** invalid direction number ");
  708.     IPrint(dir);
  709.     Print(" to 'DirDesc' ***\n");
  710.     p_rNorthDesc
  711.     esac
  712. corp;
  713.  
  714. define t_base proc utility public DirMessage(int dir)property string:
  715.     case dir
  716.     incase D_NORTH:
  717.     p_rNorthMessage
  718.     incase D_NORTHEAST:
  719.     p_rNorthEastMessage
  720.     incase D_EAST:
  721.     p_rEastMessage
  722.     incase D_SOUTHEAST:
  723.     p_rSouthEastMessage
  724.     incase D_SOUTH:
  725.     p_rSouthMessage
  726.     incase D_SOUTHWEST:
  727.     p_rSouthWestMessage
  728.     incase D_WEST:
  729.     p_rWestMessage
  730.     incase D_NORTHWEST:
  731.     p_rNorthWestMessage
  732.     incase D_UP:
  733.     p_rUpMessage
  734.     incase D_DOWN:
  735.     p_rDownMessage
  736.     incase D_ENTER:
  737.     p_rEnterMessage
  738.     incase D_EXIT:
  739.     p_rExitMessage
  740.     default:
  741.     Print("*** invalid direction number ");
  742.     IPrint(dir);
  743.     Print(" to 'DirMessage' ***\n");
  744.     p_rNorthMessage
  745.     esac
  746. corp;
  747.  
  748. define t_base proc utility public DirOMessage(int dir)property string:
  749.     case dir
  750.     incase D_NORTH:
  751.     p_rNorthOMessage
  752.     incase D_NORTHEAST:
  753.     p_rNorthEastOMessage
  754.     incase D_EAST:
  755.     p_rEastOMessage
  756.     incase D_SOUTHEAST:
  757.     p_rSouthEastOMessage
  758.     incase D_SOUTH:
  759.     p_rSouthOMessage
  760.     incase D_SOUTHWEST:
  761.     p_rSouthWestOMessage
  762.     incase D_WEST:
  763.     p_rWestOMessage
  764.     incase D_NORTHWEST:
  765.     p_rNorthWestOMessage
  766.     incase D_UP:
  767.     p_rUpOMessage
  768.     incase D_DOWN:
  769.     p_rDownOMessage
  770.     incase D_ENTER:
  771.     p_rEnterOMessage
  772.     incase D_EXIT:
  773.     p_rExitOMessage
  774.     default:
  775.     Print("*** invalid direction number ");
  776.     IPrint(dir);
  777.     Print(" to 'DirOMessage' ***\n");
  778.     p_rNorthOMessage
  779.     esac
  780. corp;
  781.  
  782. define t_base proc utility public DirEMessage(int dir)property string:
  783.     case dir
  784.     incase D_NORTH:
  785.     p_rNorthEMessage
  786.     incase D_NORTHEAST:
  787.     p_rNorthEastEMessage
  788.     incase D_EAST:
  789.     p_rEastEMessage
  790.     incase D_SOUTHEAST:
  791.     p_rSouthEastEMessage
  792.     incase D_SOUTH:
  793.     p_rSouthEMessage
  794.     incase D_SOUTHWEST:
  795.     p_rSouthWestEMessage
  796.     incase D_WEST:
  797.     p_rWestEMessage
  798.     incase D_NORTHWEST:
  799.     p_rNorthWestEMessage
  800.     incase D_UP:
  801.     p_rUpEMessage
  802.     incase D_DOWN:
  803.     p_rDownEMessage
  804.     incase D_ENTER:
  805.     p_rEnterEMessage
  806.     incase D_EXIT:
  807.     p_rExitEMessage
  808.     default:
  809.     Print("*** invalid direction number ");
  810.     IPrint(dir);
  811.     Print(" to 'DirEMessage' ***\n");
  812.     p_rNorthEMessage
  813.     esac
  814. corp;
  815.  
  816. define t_base proc utility public DirImage(int dir)property string:
  817.     case dir
  818.     incase D_NORTH:
  819.     p_rNorthImage
  820.     incase D_NORTHEAST:
  821.     p_rNorthEastImage
  822.     incase D_EAST:
  823.     p_rEastImage
  824.     incase D_SOUTHEAST:
  825.     p_rSouthEastImage
  826.     incase D_SOUTH:
  827.     p_rSouthImage
  828.     incase D_SOUTHWEST:
  829.     p_rSouthWestImage
  830.     incase D_WEST:
  831.     p_rWestImage
  832.     incase D_NORTHWEST:
  833.     p_rNorthWestImage
  834.     incase D_UP:
  835.     p_rUpImage
  836.     incase D_DOWN:
  837.     p_rDownImage
  838.     incase D_ENTER:
  839.     p_rEnterImage
  840.     incase D_EXIT:
  841.     p_rExitImage
  842.     default:
  843.     Print("*** invalid direction number ");
  844.     IPrint(dir);
  845.     Print(" to 'DirImage' ***\n");
  846.     p_rNorthImage
  847.     esac
  848. corp;
  849.  
  850. /*
  851.  * DirMatch - turn a string into a direction number. Return -1 if the string
  852.  *    is not a valid direction name.
  853.  */
  854.  
  855. define t_base proc utility public DirMatch(string name)int:
  856.  
  857.     MatchName(
  858.     "north,n.northeast,north-east,ne.east,e.southeast,south-east,se."
  859.     "south,s.southwest,south-west,sw.west,w.northwest,north-west,nw."
  860.     "up,u.down,d.enter,in,inside.exit,out,outside,leave", name)
  861. corp;
  862.  
  863. /*
  864.  * PairToDir - decode a character pair to a direction number.
  865.  */
  866.  
  867. define t_base proc utility public PairToDir(string ch)int:
  868.  
  869.     if ch == "n " then
  870.     D_NORTH
  871.     elif ch == "ne" then
  872.     D_NORTHEAST
  873.     elif ch == "e " then
  874.     D_EAST
  875.     elif ch == "se" then
  876.     D_SOUTHEAST
  877.     elif ch == "s " then
  878.     D_SOUTH
  879.     elif ch == "sw" then
  880.     D_SOUTHWEST
  881.     elif ch == "w " then
  882.     D_WEST
  883.     elif ch == "nw" then
  884.     D_NORTHWEST
  885.     elif ch == "u " then
  886.     D_UP
  887.     elif ch == "d " then
  888.     D_DOWN
  889.     elif ch == "in" then
  890.     D_ENTER
  891.     elif ch == "ex" then
  892.     D_EXIT
  893.     else
  894.     -1
  895.     fi
  896. corp;
  897.  
  898. /*
  899.  * addChecker - utility for adding checkers to checker lists.
  900.  */
  901.  
  902. define tp_base proc utility addChecker(thing th; property list action pla;
  903.                        action a; bool front)void:
  904.     list action la;
  905.  
  906.     la := th@pla;
  907.     if la = nil then
  908.     /* there was no list yet - create one */
  909.     la := CreateActionList();
  910.     th@pla := la;
  911.     AddTail(la, a);
  912.     else
  913.     if front then
  914.         AddHead(la, a);
  915.     else
  916.         AddTail(la, a);
  917.     fi;
  918.     fi;
  919. corp;
  920.  
  921. /*
  922.  * delChecker - utility for deleting checkers and removing the list if
  923.  *    it is now empty.
  924.  */
  925.  
  926. define tp_base proc utility delChecker(thing th; property list action pla;
  927.                        action a)void:
  928.     list action la;
  929.  
  930.     la := th@pla;
  931.     if la ~= nil then
  932.     DelElement(la, a);
  933.     if Count(la) = 0 then
  934.         th -- pla;
  935.     fi;
  936.     fi;
  937. corp;
  938.  
  939. /* Routines for adding direction checkers. Note that there could easily be
  940.    routines to delete the checkers, but I don't believe there should be any
  941.    checkers on rooms that need to be deleted. The checker can check some
  942.    state somewhere to make its effects conditional. It is NOT a good idea
  943.    to have to modify and write out rooms as people wander through them.
  944.    Later: people want them via the build facilites, so I've added them. */
  945.  
  946. define t_base proc utility AddNorthChecker(thing room; action a;
  947.     bool front)void:
  948.     addChecker(room, p_rNorthChecks, a, front);
  949. corp;
  950.  
  951. define t_base proc utility DelNorthChecker(thing room; action a)void:
  952.     delChecker(room, p_rNorthChecks, a);
  953. corp;
  954.  
  955. define t_base proc utility AddSouthChecker(thing room; action a;
  956.     bool front)void:
  957.     addChecker(room, p_rSouthChecks, a, front);
  958. corp;
  959.  
  960. define t_base proc utility DelSouthChecker(thing room; action a)void:
  961.     delChecker(room, p_rSouthChecks, a);
  962. corp;
  963.  
  964. define t_base proc utility AddEastChecker(thing room; action a;
  965.     bool front)void:
  966.     addChecker(room, p_rEastChecks, a, front);
  967. corp;
  968.  
  969. define t_base proc utility DelEastChecker(thing room; action a)void:
  970.     delChecker(room, p_rEastChecks, a);
  971. corp;
  972.  
  973. define t_base proc utility AddWestChecker(thing room; action a;
  974.     bool front)void:
  975.     addChecker(room, p_rWestChecks, a, front);
  976. corp;
  977.  
  978. define t_base proc utility DelWestChecker(thing room; action a)void:
  979.     delChecker(room, p_rWestChecks, a);
  980. corp;
  981.  
  982. define t_base proc utility AddNorthEastChecker(thing room; action a;
  983.     bool front)void:
  984.     addChecker(room, p_rNorthEastChecks, a, front);
  985. corp;
  986.  
  987. define t_base proc utility DelNorthEastChecker(thing room; action a)void:
  988.     delChecker(room, p_rNorthEastChecks, a);
  989. corp;
  990.  
  991. define t_base proc utility AddNorthWestChecker(thing room; action a;
  992.     bool front)void:
  993.     addChecker(room, p_rNorthWestChecks, a, front);
  994. corp;
  995.  
  996. define t_base proc utility DelNorthWestChecker(thing room; action a)void:
  997.     delChecker(room, p_rNorthWestChecks, a);
  998. corp;
  999.  
  1000. define t_base proc utility AddSouthEastChecker(thing room; action a;
  1001.     bool front)void:
  1002.     addChecker(room, p_rSouthEastChecks, a, front);
  1003. corp;
  1004.  
  1005. define t_base proc utility DelSouthEastChecker(thing room; action a)void:
  1006.     delChecker(room, p_rSouthEastChecks, a);
  1007. corp;
  1008.  
  1009. define t_base proc utility AddSouthWestChecker(thing room; action a;
  1010.     bool front)void:
  1011.     addChecker(room, p_rSouthWestChecks, a, front);
  1012. corp;
  1013.  
  1014. define t_base proc utility DelSouthWestChecker(thing room; action a)void:
  1015.     delChecker(room, p_rSouthWestChecks, a);
  1016. corp;
  1017.  
  1018. define t_base proc utility AddUpChecker(thing room; action a; bool front)void:
  1019.     addChecker(room, p_rUpChecks, a, front);
  1020. corp;
  1021.  
  1022. define t_base proc utility DelUpChecker(thing room; action a)void:
  1023.     delChecker(room, p_rUpChecks, a);
  1024. corp;
  1025.  
  1026. define t_base proc utility AddDownChecker(thing room; action a;bool front)void:
  1027.     addChecker(room, p_rDownChecks, a, front);
  1028. corp;
  1029.  
  1030. define t_base proc utility DelDownChecker(thing room; action a)void:
  1031.     delChecker(room, p_rDownChecks, a);
  1032. corp;
  1033.  
  1034. define t_base proc utility AddEnterChecker(thing room; action a;
  1035.     bool front)void:
  1036.     addChecker(room, p_rEnterChecks, a, front);
  1037. corp;
  1038.  
  1039. define t_base proc utility DelEnterChecker(thing room; action a)void:
  1040.     delChecker(room, p_rEnterChecks, a);
  1041. corp;
  1042.  
  1043. define t_base proc utility AddExitChecker(thing room; action a;bool front)void:
  1044.     addChecker(room, p_rExitChecks, a, front);
  1045. corp;
  1046.  
  1047. define t_base proc utility DelExitChecker(thing room; action a)void:
  1048.     delChecker(room, p_rExitChecks, a);
  1049. corp;
  1050.  
  1051. define t_base proc utility AddDirChecker(thing room; int dir; action a;
  1052.     bool front)void:
  1053.     addChecker(room, DirChecks(dir), a, false);
  1054. corp;
  1055.  
  1056. define t_base proc utility DelDirChecker(thing room; int dir; action a)void:
  1057.     delChecker(room, DirChecks(dir), a);
  1058. corp;
  1059.  
  1060. /* routines for inserting checkers in rooms for specific verbs */
  1061.  
  1062. define t_base proc utility AddAnyEnterChecker(thing room; action a;
  1063.     bool front)void:
  1064.     addChecker(room, p_rAnyEnterChecks, a, front);
  1065. corp;
  1066.  
  1067. define t_base proc utility DelAnyEnterChecker(thing room; action a)void:
  1068.     delChecker(room, p_rAnyEnterChecks, a);
  1069. corp;
  1070.  
  1071. define t_base proc utility AddAnyEnterAction(thing room; action a;
  1072.     bool front)void:
  1073.     addChecker(room, p_rAnyEnterActions, a, front);
  1074. corp;
  1075.  
  1076. define t_base proc utility DelAnyEnterAction(thing room; action a)void:
  1077.     delChecker(room, p_rAnyEnterActions, a);
  1078. corp;
  1079.  
  1080. define t_base proc utility AddAnyLeaveChecker(thing room; action a;
  1081.     bool front)void:
  1082.     addChecker(room, p_rAnyLeaveChecks, a, front);
  1083. corp;
  1084.  
  1085. define t_base proc utility DelAnyLeaveChecker(thing room; action a)void:
  1086.     delChecker(room, p_rAnyLeaveChecks, a);
  1087. corp;
  1088.  
  1089. define t_base proc utility AddAnyLeaveAction(thing room; action a;
  1090.     bool front)void:
  1091.     addChecker(room, p_rAnyLeaveActions, a, front);
  1092. corp;
  1093.  
  1094. define t_base proc utility DelAnyLeaveAction(thing room; action a)void:
  1095.     delChecker(room, p_rAnyLeaveActions, a);
  1096. corp;
  1097.  
  1098. define t_base proc utility AddRoomGetChecker(thing room; action a;
  1099.     bool front)void:
  1100.     addChecker(room, p_rGetChecks, a, front);
  1101. corp;
  1102.  
  1103. define t_base proc utility DelRoomGetChecker(thing room; action a)void:
  1104.     delChecker(room, p_rGetChecks, a);
  1105. corp;
  1106.  
  1107. define t_base proc utility AddRoomDropChecker(thing room; action a;
  1108.     bool front)void:
  1109.     addChecker(room, p_rDropChecks, a, front);
  1110. corp;
  1111.  
  1112. define t_base proc utility DelRoomDropChecker(thing room; action a)void:
  1113.     delChecker(room, p_rDropChecks, a);
  1114. corp;
  1115.  
  1116. define t_base proc utility AddRoomSayChecker(thing room; action a;
  1117.     bool front)void:
  1118.     addChecker(room, p_rSayChecks, a, front);
  1119. corp;
  1120.  
  1121. define t_base proc utility DelRoomSayChecker(thing room; action a)void:
  1122.     delChecker(room, p_rSayChecks, a);
  1123. corp;
  1124.  
  1125. define t_base proc utility AddRoomLookChecker(thing room; action a;
  1126.     bool front)void:
  1127.     addChecker(room, p_rLookChecks, a, front);
  1128. corp;
  1129.  
  1130. define t_base proc utility DelRoomLookChecker(thing room; action a)void:
  1131.     delChecker(room, p_rLookChecks, a);
  1132. corp;
  1133.  
  1134. define t_base proc utility AddRoomLightChecker(thing room; action a;
  1135.     bool front)void:
  1136.     addChecker(room, p_rLightChecks, a, front);
  1137. corp;
  1138.  
  1139. define t_base proc utility DelRoomLightChecker(thing room; action a)void:
  1140.     delChecker(room, p_rLightChecks, a);
  1141. corp;
  1142.  
  1143. /* routines to add/delete checkers on players */
  1144.  
  1145. define t_base proc utility AddPlayerEnterChecker(thing player;
  1146.     action a; bool front)void:
  1147.     addChecker(player, p_pEnterChecks, a, front);
  1148. corp;
  1149.  
  1150. define t_base proc utility DelPlayerEnterChecker(thing player; action a)void:
  1151.     delChecker(player, p_pEnterChecks, a);
  1152. corp;
  1153.  
  1154. define t_base proc utility AddPlayerLeaveChecker(thing player;
  1155.     action a; bool front)void:
  1156.     addChecker(player, p_pLeaveChecks, a, front);
  1157. corp;
  1158.  
  1159. define t_base proc utility DelPlayerLeaveChecker(thing player; action a)void:
  1160.     delChecker(player, p_pLeaveChecks, a);
  1161. corp;
  1162.  
  1163. /* Some routines to actually do some special room checks. These are here
  1164.    so that the properties holding the checkers can be private */
  1165.  
  1166. define t_base proc utility DoDirChecks(thing room; int dir)status:
  1167.     DoChecks(room@DirChecks(dir))
  1168. corp;
  1169.  
  1170. define t_base proc utility DoRoomAnyEnterChecks(thing room)status:
  1171.     DoChecks(room@p_rAnyEnterChecks)
  1172. corp;
  1173.  
  1174. define t_base proc utility DoRoomAnyEnterActions(thing dest)void:
  1175.     DoThingActions(dest@p_rAnyEnterActions, dest);
  1176. corp;
  1177.  
  1178. define t_base proc utility DoRoomAnyLeaveChecks(thing room)status:
  1179.     DoChecks(room@p_rAnyLeaveChecks)
  1180. corp;
  1181.  
  1182. define t_base proc utility DoRoomAnyLeaveActions(thing here, dest)void:
  1183.     DoThingActions(here@p_rAnyLeaveActions, dest);
  1184. corp;
  1185.  
  1186. define t_base proc utility DoRoomSayChecks(thing room; string said)status:
  1187.     DoStringChecks(room@p_rSayChecks, said)
  1188. corp;
  1189.  
  1190. define t_base proc utility DoRoomLookChecks(thing room)status:
  1191.     DoChecks(room@p_rLookChecks)
  1192. corp;
  1193.  
  1194. define t_base proc utility DoRoomLightChecks(thing room)status:
  1195.     DoChecks(room@p_rLightChecks)
  1196. corp;
  1197.  
  1198. define t_base proc utility DoRoomGetChecks(thing room, object)status:
  1199.     DoThingChecks(room@p_rGetChecks, object)
  1200. corp;
  1201.  
  1202. define t_base proc utility DoRoomDropChecks(thing room, object)status:
  1203.     DoThingChecks(room@p_rDropChecks, object)
  1204. corp;
  1205.  
  1206. /* routines to do some of the private player checks */
  1207.  
  1208. define t_base proc utility DoPlayerLeaveChecks(thing who; int dir)status:
  1209.     DoIntChecks(who@p_pLeaveChecks, dir)
  1210. corp;
  1211.  
  1212. define t_base proc utility DoPlayerEnterChecks(thing who)status:
  1213.     DoChecks(who@p_pEnterChecks)
  1214. corp;
  1215.  
  1216. /* This is used to allow creation of a carrying list on machines - it does
  1217.    it carefully. */
  1218.  
  1219. define t_base proc utility public SetupMachine(thing machine)void:
  1220.  
  1221.     if machine@p_pCarrying = nil then
  1222.     machine@p_pCarrying := CreateThingList();
  1223.     fi;
  1224.     if machine@p_pHiddenList = nil then
  1225.     machine@p_pHiddenList := CreateThingList();
  1226.     fi;
  1227.     if machine@p_pEnterActions = nil then
  1228.     machine@p_pEnterActions := CreateActionList();
  1229.     fi;
  1230.     if machine@p_pExitActions = nil then
  1231.     machine@p_pExitActions := CreateActionList();
  1232.     fi;
  1233. corp;
  1234.  
  1235. unuse tp_base
  1236.