monop.def 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* $NetBSD: monop.def,v 1.9 2004/01/27 20:30:30 jsm Exp $ */
  2. /*-
  3. * Copyright (c) 1980, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of the University nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * @(#)monop.def 5.5 (Berkeley) 5/31/93
  31. */
  32. #include "deck.h"
  33. #include "monop.h"
  34. bool fixing, /* set if fixing up debt */
  35. trading, /* set if in process of trading */
  36. told_em, /* set if told user he's out of debt */
  37. spec; /* set if moving by card to RR or UTIL */
  38. const char *name_list[MAX_PL+2], /* list of players' names */
  39. *const comlist[] = { /* list of normal commands */
  40. "quit", /* 0 */ "print", /* 1 */
  41. "where", /* 2 */ "own holdings", /* 3 */
  42. "holdings", /* 4 */ "mortgage", /* 5 */
  43. "unmortgage", /* 6 */ "buy houses", /* 7 */
  44. "sell houses", /* 8 */ "card", /* 9 */
  45. "pay", /* 10 */ "trade", /* 11 */
  46. "resign", /* 12 */ "save", /* 13 */
  47. "restore", /* 14 */ "roll", /* 15 */
  48. "", /* 16 */
  49. 0
  50. },
  51. *const yncoms[] = { /* list of commands for yes/no answers */
  52. "yes", /* 0 */ "no", /* 1 */
  53. "quit", /* 2 */ "print", /* 3 */
  54. "where", /* 4 */ "own holdings", /* 5 */
  55. "holdings", /* 6 */
  56. 0
  57. },
  58. *const lucky_mes[] = { /* "got lucky" messages */
  59. "You lucky stiff", "You got lucky",
  60. "What a lucky person!", "You must have a 4-leaf clover",
  61. "My, my! Aren't we lucky!", "Luck smiles upon you",
  62. "You got lucky this time", "Lucky person!",
  63. "Your karma must certainly be together",
  64. "How beautifully Cosmic", "Wow, you must be really with it"
  65. /* "I want your autograph", -- Save for later */
  66. };
  67. int player, /* current player number */
  68. num_play, /* current number of players */
  69. num_doub, /* # of doubles current player rolled */
  70. /* # of "got lucky" messages */
  71. num_luck = sizeof lucky_mes / sizeof (char *);
  72. /* list of command functions */
  73. void (*const func[])(void) = { /* array of function calls for commands */
  74. quit, /* quit game |* 0 *| */
  75. printboard, /* print board |* 1 *| */
  76. where, /* where players are |* 2 *| */
  77. list, /* own holdings |* 3 *| */
  78. list_all, /* holdings list |* 4 *| */
  79. mortgage, /* mortgage property |* 5 *| */
  80. unmortgage, /* unmortgage property |* 6 *| */
  81. buy_houses, /* buy houses |* 7 *| */
  82. sell_houses, /* sell houses |* 8 *| */
  83. card, /* card for jail |* 9 *| */
  84. pay, /* pay for jail |* 10 *| */
  85. trade, /* trade |* 11 *| */
  86. resign, /* resign |* 12 *| */
  87. save, /* save game |* 13 *| */
  88. restore, /* restore game |* 14 *| */
  89. do_move, /* roll |* 15 *| */
  90. do_move /* "" |* 16 *| */
  91. };
  92. DECK deck[2]; /* Chance and Community Chest */
  93. PLAY *play, /* player structure array ("calloc"ed) */
  94. *cur_p; /* pointer to current player's struct */
  95. RR_S rr[N_RR]; /* raildroad descriptions */
  96. UTIL_S util[2]; /* utility descriptions */
  97. MON mon[N_MON] = { /* monopoly descriptions */
  98. # include "mon.dat"
  99. };
  100. PROP prop[N_PROP] = { /* typical properties */
  101. # include "prop.dat"
  102. };
  103. SQUARE board[N_SQRS+1] = { /* board itself (+1 for Jail) */
  104. # include "brd.dat"
  105. };