|
|
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[] = "@(#)make_level.c 5.4 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: # include "robots.h" ! 25: ! 26: /* ! 27: * make_level: ! 28: * Make the current level ! 29: */ ! 30: make_level() ! 31: { ! 32: register int i; ! 33: register COORD *cp; ! 34: register WINDOW *wp; ! 35: register int x, *endp; ! 36: ! 37: reset_count(); ! 38: for (i = 1; i < Y_FIELDSIZE; i++) ! 39: for (x = 1; x < X_FIELDSIZE; x++) ! 40: if (Field[i][x] != 0) ! 41: mvaddch(i, x, ' '); ! 42: if (My_pos.y > 0) ! 43: mvaddch(My_pos.y, My_pos.x, ' '); ! 44: ! 45: Waiting = FALSE; ! 46: Wait_bonus = 0; ! 47: leaveok(stdscr, FALSE); ! 48: for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) ! 49: cp->y = -1; ! 50: My_pos.y = -1; ! 51: ! 52: bzero(Field, sizeof Field); ! 53: Min.y = Y_FIELDSIZE; ! 54: Min.x = X_FIELDSIZE; ! 55: Max.y = 0; ! 56: Max.x = 0; ! 57: if ((i = Level * 10) > MAXROBOTS) ! 58: i = MAXROBOTS; ! 59: Num_robots = i; ! 60: while (i-- > 0) { ! 61: cp = rnd_pos(); ! 62: Robots[i] = *cp; ! 63: Field[cp->y][cp->x]++; ! 64: if (cp->y < Min.y) ! 65: Min.y = cp->y; ! 66: if (cp->x < Min.x) ! 67: Min.x = cp->x; ! 68: if (cp->y > Max.y) ! 69: Max.y = cp->y; ! 70: if (cp->x > Max.x) ! 71: Max.x = cp->x; ! 72: } ! 73: My_pos = *rnd_pos(); ! 74: refresh(); ! 75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.