/* sim.h: Main include file
*
* Micropolis, Unix Version. This game was released for the Unix platform
* in or about 1990 and has been modified for inclusion in the One Laptop
* Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
* you need assistance with this program, you may contact:
* http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. You should have received a
* copy of the GNU General Public License along with this program. If
* not, see .
*
* ADDITIONAL TERMS per GNU GPL Section 7
*
* No trademark or publicity rights are granted. This license does NOT
* give you any right, title or interest in the trademark SimCity or any
* other Electronic Arts trademark. You may not distribute any
* modification of this program using the trademark SimCity or claim any
* affliation or association with Electronic Arts Inc. or its employees.
*
* Any propagation or conveyance of this program must include this
* copyright notice and these terms.
*
* If you convey this program (or any modifications of it) and assume
* contractual liability for the program to recipients of it, you agree
* to indemnify Electronic Arts for any liability that those contractual
* assumptions impose on Electronic Arts.
*
* You may not misrepresent the origins of this program; modified
* versions of the program must be marked as such and not identified as
* the original program.
*
* This disclaimer supplements the one included in the General Public
* License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
* PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
* OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
* SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
* DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
* FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
* RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
* USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
* INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
* MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
* UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
* WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
* CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
* ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
* JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
* WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
* CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
* NOT APPLY TO YOU.
*/
/* workaround sun c compiler junk */
#ifdef sun
#define _TTYCHARS_
#define CTRL(c) (#c[0]&037)
#ifndef SOLARIS2
#define __sys_ioccom_h
#define _IOCPARM_MASK 0xff /* parameters must be < 256 bytes */
#define _IOC_VOID 0x20000000 /* no parameters */
#define _IOC_OUT 0x40000000 /* copy out parameters */
#define _IOC_IN 0x80000000 /* copy in parameters */
#define _IOC_INOUT (_IOC_IN|_IOC_OUT)
#define _IO(x,y) (_IOC_VOID|(#x[0]<<8)|y)
#define _IOR(x,y,t) (_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#define _IORN(x,y,t) (_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#define _IOW(x,y,t) (_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#define _IOWR(x,y,t) (_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#define _IOWRN(x,y,t) (_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|(#x[0]<<8)|y)
#endif
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifndef MSDOS
#ifndef HPUX
#include
#endif
#include
#include
#include
#endif
#ifdef sun
#ifdef SOLARIS2
#include
#else
#include
#endif
#endif
#ifdef sgi
#if 0
#include
#endif
#endif
#include
#include
#include
#include
#include
#include
//#include
#include
/* gcc compat workaround! */
#define _STDDEF_H
#include "tclxtend.h"
#include "tclint.h"
#include "tclunix.h"
#include "tkconfig.h"
#include "tkint.h"
#include "mac.h"
#include "view.h"
#include "macros.h"
/* Constants */
#define TRUE 1
#define FALSE 0
#ifdef MEGA
#define SimWidth (120 * MEGA)
#define SimHeight (100 * MEGA)
#else
#define SimWidth 120
#define SimHeight 100
#endif
#define WORLD_X SimWidth
#define WORLD_Y SimHeight
#define HWLDX (SimWidth >>1)
#define HWLDY (SimHeight >>1)
#define QWX (SimWidth >>2)
#define QWY (SimHeight >>2)
#define SmX (SimWidth >>3)
#define SmY ((SimHeight + 7) >>3)
#define EDITOR_W (WORLD_X * 16)
#define EDITOR_H (WORLD_Y * 16)
#define MAP_W (WORLD_X * 3)
#define MAP_H (WORLD_Y * 3)
#define NIL 0
#define HORIZ 1
#define VERT 0
#define PROBNUM 10
#define HISTLEN 480
#define MISCHISTLEN 240
#define POWERMAPROW ((WORLD_X + 15) / 16)
#ifdef MEGA
#define POWERMAPLEN ((QUAD)(2 * POWERMAPROW * WORLD_Y))
#define POWERWORD(x, y) ((((QUAD)(x)) >>4) + (((QUAD)(y)) * POWERMAPROW))
#else
#define POWERMAPLEN 1700 /* ??? PWRMAPSIZE */
#define POWERWORD(x, y) (((x) >>4) + ((y) <<3))
#endif
#define SETPOWERBIT(x, y) PowerMap[POWERWORD((x), (y))] |= 1 << ((x) & 15)
#define PWRMAPSIZE (POWERMAPROW * WORLD_Y)
#define PWRSTKSIZE ((WORLD_X * WORLD_Y) / 4)
#define ALMAP 0 /* all */
#define REMAP 1 /* residential */
#define COMAP 2 /* commercial */
#define INMAP 3 /* industrial */
#define PRMAP 4 /* power */
#define RDMAP 5 /* road */
#define PDMAP 6 /* population density */
#define RGMAP 7 /* rate of growth */
#define TDMAP 8 /* traffic density */
#define PLMAP 9 /* pollution */
#define CRMAP 10 /* crime */
#define LVMAP 11 /* land value */
#define FIMAP 12 /* fire radius */
#define POMAP 13 /* police radius */
#define DYMAP 14 /* dynamic */
#define NMAPS 15
/* These adjust frequency in Simulate() */
#define VALVERATE 2
#define CENSUSRATE 4
#define TAXFREQ 48
/* These are names of the 16 colors */
#define COLOR_WHITE 0
#define COLOR_YELLOW 1
#define COLOR_ORANGE 2
#define COLOR_RED 3
#define COLOR_DARKRED 4
#define COLOR_DARKBLUE 5
#define COLOR_LIGHTBLUE 6
#define COLOR_BROWN 7
#define COLOR_LIGHTGREEN 8
#define COLOR_DARKGREEN 9
#define COLOR_OLIVE 10
#define COLOR_LIGHTBROWN 11
#define COLOR_LIGHTGRAY 12
#define COLOR_MEDIUMGRAY 13
#define COLOR_DARKGRAY 14
#define COLOR_BLACK 15
/* Status Bits */
#define PWRBIT 32768 /*20 bit 15 */
#define CONDBIT 16384 /*10 bit 14 */
#define BURNBIT 8192 /*8 bit 13 */
#define BULLBIT 4096 /*4 bit 12 */
#define ANIMBIT 2048 /*2 bit 11 */
#define ZONEBIT 1024 /*1 bit 10 */
#define ALLBITS 64512 /* mask for upper 6 bits */
#define LOMASK 1023 /* mask for low 10 bits */
#define BLBNBIT (BULLBIT+BURNBIT)
#define BLBNCNBIT (BULLBIT+BURNBIT+CONDBIT)
#define BNCNBIT (BURNBIT+CONDBIT)
/* Object & Sound Numbers */
#define TRA 1
#define COP 2
#define AIR 3
#define SHI 4
#define GOD 5
#define TOR 6
#define EXP 7
#define BUS 8
/* Max # of Objects */
#define OBJN 9
/* Graph Histories */
#define RES_HIST 0
#define COM_HIST 1
#define IND_HIST 2
#define MONEY_HIST 3
#define CRIME_HIST 4
#define POLLUTION_HIST 5
#define HISTORIES 6
#define ALL_HISTORIES ((1 <