Annotation of 42BSD/games/monop/x.c, revision 1.1.1.1

1.1       root        1: char   xstr[];
                      2: #line 1 "trade.c"
                      3: 
                      4: #line 1 "./monop.ext"
                      5: 
                      6: #line 1 "./monop.h"
                      7: 
                      8: #line 1 "/usr/include/stdio.h"
                      9: 
                     10: 
                     11: 
                     12: 
                     13: extern struct  _iobuf {
                     14:        int     _cnt;
                     15:        char    *_ptr;
                     16:        char    *_base;
                     17:        int     _bufsiz;
                     18:        short   _flag;
                     19:        char    _file;
                     20: } _iob[20];
                     21: 
                     22: 
                     23: 
                     24: 
                     25: 
                     26: 
                     27: 
                     28: 
                     29: 
                     30: 
                     31: 
                     32: 
                     33: 
                     34: 
                     35: 
                     36: 
                     37: 
                     38: 
                     39: 
                     40: 
                     41: 
                     42: 
                     43: 
                     44: 
                     45: 
                     46: 
                     47: struct _iobuf  *fopen();
                     48: struct _iobuf  *fdopen();
                     49: struct _iobuf  *freopen();
                     50: long   ftell();
                     51: char   *fgets();
                     52: 
                     53: char   *sprintf();             
                     54: 
                     55: #line 2 "./monop.h"
                     56: 
                     57: 
                     58: 
                     59: 
                     60: 
                     61: 
                     62: 
                     63: 
                     64: 
                     65: 
                     66: 
                     67: 
                     68: 
                     69: 
                     70: 
                     71: 
                     72: 
                     73:                                
                     74: 
                     75: 
                     76: 
                     77: 
                     78: 
                     79: 
                     80: 
                     81: 
                     82: 
                     83: 
                     84: 
                     85: 
                     86: 
                     87: 
                     88: 
                     89: 
                     90: 
                     91: 
                     92: 
                     93: struct sqr_st {                        
                     94:        char    *name;                  
                     95:        char    owner;                  
                     96:        char    type;                   
                     97:        char    *desc;                  
                     98:        int     cost;                   
                     99: };
                    100: 
                    101: typedef struct sqr_st  SQUARE;
                    102: 
                    103: struct mon_st {                        
                    104:        char    *name;                  
                    105:        char    owner;                  
                    106:        char    num_in;                 
                    107:        char    num_own;                
                    108:        char    h_cost;                 
                    109:        char    *not_m;                 
                    110:        char    *mon_n;                 
                    111:        SQUARE  *sq[3];                 
                    112: };
                    113: 
                    114: typedef struct mon_st  MON;
                    115: 
                    116: struct prp_st {                        
                    117:        char    morg;                   
                    118:        char    monop;                  
                    119:        char    square;                 
                    120:        char    houses;                 
                    121:        MON     *mon_desc;              
                    122:        int     rent[6];                
                    123: };
                    124: 
                    125: struct own_st {                        
                    126:        SQUARE  *sqr;                   
                    127:        struct own_st   *next;          
                    128: };
                    129: 
                    130: typedef struct own_st  OWN;
                    131: 
                    132: struct plr_st {                        
                    133:        char    *name;                  
                    134:        char    num_gojf;               
                    135:        char    num_rr;                 
                    136:        char    num_util;               
                    137:        char    loc;                    
                    138:        char    in_jail;                
                    139:        int     money;                  
                    140:        OWN     *own_list;              
                    141: };
                    142: 
                    143: struct rr_st {                 
                    144:        char    morg;                   
                    145: };
                    146: 
                    147: typedef struct plr_st  PLAY;
                    148: typedef struct prp_st  PROP;
                    149: typedef struct rr_st   RR_S;
                    150: typedef struct rr_st   UTIL_S;
                    151: 
                    152: int    cc(), chance(), lux_tax(), goto_jail(), inc_tax();
                    153: #line 2 "./monop.ext"
                    154: 
                    155: #line 1 "./deck.h"
                    156: 
                    157: 
                    158: 
                    159: 
                    160: 
                    161: struct dk_st {                 
                    162:        int     num_cards;              
                    163:        int     last_card;              
                    164:        char    gojf_used;              
                    165:        long    *offsets;               
                    166: };
                    167: 
                    168: typedef struct dk_st   DECK;
                    169: #line 3 "./monop.ext"
                    170: 
                    171: extern char    trading, spec, fixing, told_em;
                    172: 
                    173: extern char    *yn[], *comlist[], *name_list[], *lucky_mes[];
                    174: 
                    175: extern int     num_play, player, num_doub, num_luck, (*func[])();
                    176: 
                    177: extern DECK    deck[2];
                    178: 
                    179: extern MON     mon[];
                    180: 
                    181: extern PLAY    *play, *cur_p;
                    182: 
                    183: extern PROP    prop[];
                    184: 
                    185: extern RR_S    rr[];
                    186: 
                    187: extern SQUARE  board[];
                    188: 
                    189: extern UTIL_S  util[];
                    190: #line 2 "trade.c"
                    191: 
                    192: static struct  trd_st {        
                    193:        int     trader;                 
                    194:        int     cash;                   
                    195:        int     gojf;                   
                    196:        OWN     *prop_list;             
                    197: };
                    198: 
                    199: typedef        struct trd_st   TRADE;
                    200: 
                    201: static char    *list[(22       +4      +2      ) +2];
                    202: 
                    203: static int     used[(22        +4      +2      ) ];
                    204: 
                    205: static TRADE   trades[2];
                    206: 
                    207: trade() {
                    208: 
                    209:        register int    tradee, i;
                    210: 
                    211:        trading = (1);
                    212:        for (i = 0; i < 2; i++) {
                    213:                trades[i].cash = 0;
                    214:                trades[i].gojf = (0);
                    215:                trades[i].prop_list = 0;
                    216:        }
                    217: over:
                    218:        if (num_play == 1) {
                    219:                printf((&xstr[4876]));
                    220:                return;
                    221:        }
                    222:        if (num_play > 2) {
                    223:                tradee = getinp((&xstr[4919]),
                    224:                    name_list);
                    225:                if (tradee == num_play)
                    226:                        return;
                    227:                if (tradee == player) {
                    228:                        printf((&xstr[4960]));
                    229:                        goto over;
                    230:                }
                    231:        }
                    232:        else
                    233:                tradee = 1 - player;
                    234:        get_list(0, player);
                    235:        get_list(1, tradee);
                    236:        if (getyn((&xstr[4992])) == 0)
                    237:                summate();
                    238:        if (getyn((&xstr[5016])) == 0)
                    239:                do_trade();
                    240: }
                    241: 
                    242: 
                    243: 
                    244: 
                    245: get_list(struct_no, play_no)
                    246: int    struct_no, play_no; {
                    247: 
                    248:        register int            sn, pn;
                    249:        register PLAY   *pp;
                    250:        int             numin, prop, num_prp;
                    251:        OWN             *op;
                    252:        TRADE           *tp;
                    253: 
                    254:        for (numin = 0; numin < (22     +4      +2      ) ; numin++)
                    255:                used[numin] = (0);
                    256:        sn = struct_no, pn = play_no;
                    257:        pp = &play[pn];
                    258:        tp = &trades[sn];
                    259:        tp->trader = pn;
                    260:        printf((&xstr[5034]), pp->name, pn+1);
                    261:        if (pp->own_list) {
                    262:                numin = set_list(pp->own_list);
                    263:                for (num_prp = numin; num_prp; ) {
                    264:                        prop = getinp((&xstr[5051]),
                    265:                            list);
                    266:                        if (prop == numin)
                    267:                                break;
                    268:                        else if (used[prop])
                    269:                                printf((&xstr[5089]));
                    270:                        else {
                    271:                                num_prp--;
                    272:                                used[prop] = (1);
                    273:                                for (op = pp->own_list; prop--; op = op->next)
                    274:                                        continue;
                    275:                                add_list(pn, &(tp->prop_list),  (op->sqr - board));
                    276:                        }
                    277:                }
                    278:        }
                    279:        if (pp->money > 0) {
                    280:                printf((&xstr[5121]), pp->money);
                    281:                tp->cash = get_int((&xstr[5137]));
                    282:        }
                    283:        if (pp->num_gojf > 0) {
                    284: once_more:
                    285:                printf((&xstr[5164]),pp->num_gojf);
                    286:                tp->gojf = get_int((&xstr[5205]));
                    287:                if (tp->gojf > pp->num_gojf) {
                    288:                        printf((&xstr[5232]));
                    289:                        goto once_more;
                    290:                }
                    291:        }
                    292: }
                    293: 
                    294: 
                    295: 
                    296: set_list(the_list)
                    297: register OWN   *the_list; {
                    298: 
                    299:        register int    i;
                    300:        register OWN    *op;
                    301: 
                    302:        i = 0;
                    303:        for (op = the_list; op; op = op->next)
                    304:                if (!used[i])
                    305:                        list[i++] = op->sqr->name;
                    306:        list[i++] = (&xstr[1245]);
                    307:        list[i--] = 0;
                    308:        return i;
                    309: }
                    310: 
                    311: 
                    312: 
                    313: summate() {
                    314: 
                    315:        register char   some;
                    316:        register int            i;
                    317:        register TRADE  *tp;
                    318:        OWN     *op;
                    319: 
                    320:        for (i = 0; i < 2; i++) {
                    321:                tp = &trades[i];
                    322:                some = (0);
                    323:                printf((&xstr[5271]), play[tp->trader].name,
                    324:                        tp->trader+1);
                    325:                if (tp->cash > 0)
                    326:                        printf((&xstr[5294]), tp->cash), some++;
                    327:                if (tp->gojf > 0)
                    328:                        printf((&xstr[5300]), tp->gojf),
                    329:                        some++;
                    330:                if (tp->prop_list) {
                    331:                        for (op = tp->prop_list; op; op = op->next)
                    332:                                         (--((&_iob[1]))->_cnt>=0? ((int)(*((&_iob[1]))->_ptr++=(unsigned)('\t'))):_flsbuf((unsigned)('\t'),(&_iob[1]))), printsq(      (op->sqr - board), (1));
                    333:                        some++;
                    334:                }
                    335:                if (!some)
                    336:                        printf((&xstr[5334]));
                    337:        }
                    338: }
                    339: 
                    340: 
                    341: 
                    342: do_trade() {
                    343: 
                    344:        move_em(&trades[0], &trades[1]);
                    345:        move_em(&trades[1], &trades[0]);
                    346: }
                    347: 
                    348: 
                    349: 
                    350: move_em(from, to)
                    351: TRADE  *from, *to; {
                    352: 
                    353:        register PLAY   *pl_fr, *pl_to;
                    354:        register OWN            *op;
                    355: 
                    356:        pl_fr = &play[from->trader];
                    357:        pl_to = &play[to->trader];
                    358: 
                    359:        pl_fr->money -= from->cash;
                    360:        pl_to->money += from->cash;
                    361:        pl_fr->num_gojf -= from->gojf;
                    362:        pl_to->num_gojf += from->gojf;
                    363:        for (op = from->prop_list; op; op = op->next) {
                    364:                add_list(to->trader, &(pl_to->own_list),        (op->sqr - board));
                    365:                op->sqr->owner = to->trader;
                    366:                del_list(from->trader, &(pl_fr->own_list),      (op->sqr - board));
                    367:        }
                    368:        set_ownlist(to->trader);
                    369: }
                    370: 
                    371: 
                    372: 
                    373: resign() {
                    374: 
                    375:        register int    i, new_own;
                    376:        register OWN    *op;
                    377:        SQUARE  *sqp;
                    378: 
                    379:        if (cur_p->money <= 0) {
                    380:                switch (board[cur_p->loc].type) {
                    381:                  case 2        :
                    382:                  case 1        :
                    383:                  case 0        :
                    384:                        new_own = board[cur_p->loc].owner;
                    385:                        break;
                    386:                  case 6        :
                    387:                  case 4        :
                    388:                  case 5        :
                    389:                        new_own = num_play;
                    390:                        break;
                    391:                }
                    392:                if (new_own == num_play)
                    393:                        printf((&xstr[5350]));
                    394:                else
                    395:                        printf((&xstr[5380]), name_list[new_own]);
                    396:        }
                    397:        else if (num_play == 1) {
                    398:                new_own = num_play;
                    399:                printf((&xstr[5350]));
                    400:        }
                    401:        else {
                    402:                name_list[num_play] = (&xstr[5404]);
                    403:                do {
                    404:                        new_own = getinp((&xstr[5409]),
                    405:                            name_list);
                    406:                        if (new_own == player)
                    407:                                printf((&xstr[5440]));
                    408:                } while (new_own == player);
                    409:                name_list[num_play] = (&xstr[1245]);
                    410:        }
                    411:        if (getyn((&xstr[5472]), yn) != 0)
                    412:                return;
                    413:        if (num_play == 1) {
                    414:                printf((&xstr[5503]));
                    415:                exit(0);
                    416:        }
                    417:        if (new_own < num_play) {       
                    418:                printf((&xstr[5537]));
                    419:                trades[0].trader = new_own;
                    420:                trades[0].cash = trades[0].gojf = 0;
                    421:                trades[0].prop_list = 0;
                    422:                trades[1].trader = player;
                    423:                trades[1].cash = cur_p->money > 0 ? cur_p->money : 0;
                    424:                trades[1].gojf = cur_p->num_gojf;
                    425:                trades[1].prop_list = cur_p->own_list;
                    426:                do_trade();
                    427:        }
                    428:        else {                          
                    429:                printf((&xstr[5558]));
                    430:                for (op = cur_p->own_list; op; op = op->next) {
                    431:                        sqp = op->sqr;
                    432:                        sqp->owner = -1;
                    433:                        sqp->desc->morg = (0);
                    434:                        if (op->type == 0       ) {
                    435:                                isnot_monop(sqp->desc->mon_desc);
                    436:                                sqp->desc->houses = 0;
                    437:                        }
                    438:                }
                    439:                if (cur_p->num_gojf)
                    440:                        ret_card(cur_p);
                    441:        }
                    442:        for (i = player; i < num_play; i++) {
                    443:                name_list[i] = name_list[i+1];
                    444:                if (i + 1 < num_play)
                    445:                        cpy_st(&play[i], &play[i+1], sizeof (PLAY));
                    446:        }
                    447:        name_list[num_play--] = 0;
                    448:        for (i = 0; i < 40      ; i++)
                    449:                if (board[i].owner > player)
                    450:                        --board[i].owner;
                    451:        player = --player < 0 ? num_play - 1 : player;
                    452:        next_play();
                    453:        if (num_play < 2) {
                    454:                printf((&xstr[5577]), play[0].name);
                    455:                printhold(0);
                    456:                printf((&xstr[5597]),
                    457:                        play[0].money+prop_worth(&play[0]));
                    458:                exit(0);
                    459:        }
                    460: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.