Annotation of 43BSDReno/games/monop/rent.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)rent.c     5.3 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: # include      "monop.ext"
        !            25: 
        !            26: /*
        !            27:  *     This routine has the player pay rent
        !            28:  */
        !            29: rent(sqp)
        !            30: reg SQUARE     *sqp; {
        !            31: 
        !            32:        reg int         rnt;
        !            33:        reg PROP        *pp;
        !            34:        PLAY            *plp;
        !            35: 
        !            36:        plp = &play[sqp->owner];
        !            37:        printf("Owned by %s\n", plp->name);
        !            38:        if (sqp->desc->morg) {
        !            39:                lucky("The thing is mortgaged.  ");
        !            40:                return;
        !            41:        }
        !            42:        switch (sqp->type) {
        !            43:          case PRPTY:
        !            44:                pp = sqp->desc;
        !            45:                if (pp->monop)
        !            46:                        if (pp->houses == 0)
        !            47:                                printf("rent is %d\n", rnt=pp->rent[0] * 2);
        !            48:                        else if (pp->houses < 5)
        !            49:                                printf("with %d houses, rent is %d\n",
        !            50:                                    pp->houses, rnt=pp->rent[pp->houses]);
        !            51:                        else
        !            52:                                printf("with a hotel, rent is %d\n",
        !            53:                                    rnt=pp->rent[pp->houses]);
        !            54:                else
        !            55:                        printf("rent is %d\n", rnt = pp->rent[0]);
        !            56:                break;
        !            57:          case RR:
        !            58:                rnt = 25;
        !            59:                rnt <<= (plp->num_rr - 1);
        !            60:                if (spec)
        !            61:                        rnt <<= 1;
        !            62:                printf("rent is %d\n", rnt);
        !            63:                break;
        !            64:          case UTIL:
        !            65:                rnt = roll(2, 6);
        !            66:                if (plp->num_util == 2 || spec) {
        !            67:                        printf("rent is 10 * roll (%d) = %d\n", rnt, rnt * 10);
        !            68:                        rnt *= 10;
        !            69:                }
        !            70:                else {
        !            71:                        printf("rent is 4 * roll (%d) = %d\n", rnt, rnt * 4);
        !            72:                        rnt *= 4;
        !            73:                }
        !            74:                break;
        !            75:        }
        !            76:        cur_p->money -= rnt;
        !            77:        plp->money += rnt;
        !            78: }

unix.superglobalmegacorp.com

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