|
|
1.1 ! root 1: # include "monop.ext" ! 2: ! 3: static char buf[80], /* output buffer */ ! 4: *header = "Name Own Price Mg # Rent"; ! 5: ! 6: /* ! 7: * This routine prints out the current board ! 8: */ ! 9: printboard() { ! 10: ! 11: reg int i; ! 12: ! 13: printf("%s\t%s\n", header, header); ! 14: for (i = 0; i < N_SQRS/2; i++) { ! 15: printsq(i, FALSE); ! 16: putchar('\t'); ! 17: printsq(i+N_SQRS/2, TRUE); ! 18: } ! 19: } ! 20: /* ! 21: * This routine lists where each player is. ! 22: */ ! 23: where() { ! 24: ! 25: reg int i; ! 26: char *bsp; ! 27: ! 28: printf("%s Player\n", header); ! 29: for (i = 0; i < num_play; i++) { ! 30: printsq(play[i].loc, FALSE); ! 31: printf(" %s (%d)", play[i].name, i+1); ! 32: if (cur_p == &play[i]) ! 33: printf(" *"); ! 34: putchar('\n'); ! 35: } ! 36: } ! 37: /* ! 38: * This routine prints out an individual square ! 39: */ ! 40: printsq(sqn, eoln) ! 41: int sqn; ! 42: reg bool eoln; { ! 43: ! 44: reg int rnt; ! 45: reg PROP *pp; ! 46: reg SQUARE *sqp; ! 47: int i; ! 48: ! 49: sqp = &board[sqn]; ! 50: printf("%-10.10s", sqp->name); ! 51: if (sqn == JAIL) ! 52: goto spec; ! 53: switch (sqp->type) { ! 54: case SAFE: ! 55: case CC: ! 56: case CHANCE: ! 57: case SPEC: ! 58: spec: ! 59: if (!eoln) ! 60: printf(" "); ! 61: break; ! 62: case PRPTY: ! 63: pp = sqp->desc; ! 64: if (sqp->owner < 0) { ! 65: printf(" - %-8.8s %3d", pp->mon_desc->name, sqp->cost); ! 66: if (!eoln) ! 67: printf(" "); ! 68: break; ! 69: } ! 70: printf(" %d %-8.8s %3d", sqp->owner+1, pp->mon_desc->name, ! 71: sqp->cost); ! 72: printmorg(sqp); ! 73: if (pp->monop) { ! 74: if (pp->houses < 5) ! 75: if (pp->houses > 0) ! 76: printf("%d %4d", pp->houses, ! 77: pp->rent[pp->houses]); ! 78: else ! 79: printf("0 %4d", pp->rent[0] * 2); ! 80: else ! 81: printf("H %4d", pp->rent[5]); ! 82: } ! 83: else ! 84: printf(" %4d", pp->rent[0]); ! 85: break; ! 86: case UTIL: ! 87: if (sqp->owner < 0) { ! 88: printf(" - 150"); ! 89: if (!eoln) ! 90: printf(" "); ! 91: break; ! 92: } ! 93: printf(" %d 150", sqp->owner+1); ! 94: printmorg(sqp); ! 95: printf("%d", play[sqp->owner].num_util); ! 96: if (!eoln) ! 97: printf(" "); ! 98: break; ! 99: case RR: ! 100: if (sqp->owner < 0) { ! 101: printf(" - Railroad 200"); ! 102: if (!eoln) ! 103: printf(" "); ! 104: break; ! 105: } ! 106: printf(" %d Railroad 200", sqp->owner+1); ! 107: printmorg(sqp); ! 108: rnt = 25; ! 109: rnt <<= play[sqp->owner].num_rr - 1; ! 110: printf("%d %4d", play[sqp->owner].num_rr, 25 << (play[sqp->owner].num_rr - 1)); ! 111: break; ! 112: } ! 113: if (eoln) ! 114: putchar('\n'); ! 115: } ! 116: /* ! 117: * This routine prints out the mortgage flag. ! 118: */ ! 119: printmorg(sqp) ! 120: reg SQUARE *sqp; { ! 121: ! 122: if (sqp->desc->morg) ! 123: printf(" * "); ! 124: else ! 125: printf(" "); ! 126: } ! 127: /* ! 128: * This routine lists the holdings of the player given ! 129: */ ! 130: printhold(pl) ! 131: reg int pl; { ! 132: ! 133: reg OWN *op; ! 134: reg PLAY *pp; ! 135: char *bsp; ! 136: ! 137: pp = &play[pl]; ! 138: printf("%s's (%d) holdings (Total worth: $%d):\n", name_list[pl], pl+1, ! 139: pp->money + prop_worth(pp)); ! 140: printf("\t$%d", pp->money); ! 141: if (pp->num_gojf) { ! 142: printf(", %d get-out-of-jail-free card", pp->num_gojf); ! 143: if (pp->num_gojf > 1) ! 144: putchar('s'); ! 145: } ! 146: putchar('\n'); ! 147: if (pp->own_list) { ! 148: printf("\t%s\n", header); ! 149: for (op = pp->own_list; op; op = op->next) { ! 150: putchar('\t'); ! 151: printsq(sqnum(op->sqr), TRUE); ! 152: } ! 153: } ! 154: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.