--- micropolis-activity-0.0.20071228.orig/debian/micropolis.install +++ micropolis-activity-0.0.20071228/debian/micropolis.install @@ -0,0 +1,3 @@ +src/sim/sim /usr/lib/games/micropolis/ +debian/micropolis.desktop usr/share/applications +Micropolis.png usr/share/icons --- micropolis-activity-0.0.20071228.orig/debian/micropolis-data.dirs +++ micropolis-activity-0.0.20071228/debian/micropolis-data.dirs @@ -0,0 +1,3 @@ +usr/share/pixmaps +usr/share/games/micropolis +usr/share/doc/micropolis --- micropolis-activity-0.0.20071228.orig/debian/control +++ micropolis-activity-0.0.20071228/debian/control @@ -0,0 +1,39 @@ +Source: micropolis-activity +Section: games +Priority: extra +Maintainer: Debian Games Team +Uploaders: Miriam Ruiz , + Kenshi Muto , + Clint Adams , + Christoph Egger , + Bruno "Fuddl" Kleinert +Build-Depends: debhelper (>= 7), quilt, libx11-dev, libxpm-dev, bison, x11proto-xext-dev, libxext-dev, libsdl-mixer1.2-dev +Standards-Version: 3.8.3 +Homepage: http://www.donhopkins.com/home/micropolis/ +Vcs-Git: git://git.debian.org/git/pkg-games/micropolis-activity.git +Vcs-Browser: http://git.debian.org/?p=pkg-games +DM-Upload-Allowed: yes + +Package: micropolis +Architecture: any +Depends: micropolis-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: real-time city management simulator + This games simulates building and managing a whole city. The goal of the + game is to build and design a city. The player can mark land as being + zoned as commercial, industrial, or residential, add buildings, change + the tax rate, build a power grid, build transportation systems and many + other actions, in order to enhance the city. + . + Micropolis is the GPL-licensed version of SimCity. + +Package: micropolis-data +Architecture: all +Depends: ${misc:Depends}, ttf-dejavu-core +Description: real-time city management simulator - data + This games simulates building and managing a whole city. The goal of the + game is to build and design a city. The player can mark land as being + zoned as commercial, industrial, or residential, add buildings, change + the tax rate, build a power grid, build transportation systems and many + other actions, in order to enhance the city. + . + This package installs the data, like graphics and sounds, for the game. --- micropolis-activity-0.0.20071228.orig/debian/compat +++ micropolis-activity-0.0.20071228/debian/compat @@ -0,0 +1 @@ +5 --- micropolis-activity-0.0.20071228.orig/debian/micropolis-data.links +++ micropolis-activity-0.0.20071228/debian/micropolis-data.links @@ -0,0 +1,7 @@ +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSans.ttf +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSerif-Bold.ttf +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSerif.ttf +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSansMono-Bold.ttf +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSansMono.ttf +/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf /usr/share/games/micropolis/res/dejavu-lgc/DejaVuLGCSans-Bold.ttf +/usr/share/games/micropolis/manual /usr/share/doc/micropolis/manual --- micropolis-activity-0.0.20071228.orig/debian/micropolis.desktop +++ micropolis-activity-0.0.20071228/debian/micropolis.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Exec=/usr/games/micropolis +Icon=/usr/share/icons/Micropolis.png +Terminal=false +Name=Micropolis +Comment=A real-time city management simulator +Comment[de_DE]=Eine Stadt-Simulation in Echtzeit +Categories=Game;Simulation; +StartupNotify=true --- micropolis-activity-0.0.20071228.orig/debian/micropolis.dirs +++ micropolis-activity-0.0.20071228/debian/micropolis.dirs @@ -0,0 +1,4 @@ +usr/games +usr/lib/games/micropolis +usr/share/icons +usr/share/applications --- micropolis-activity-0.0.20071228.orig/debian/README.source +++ micropolis-activity-0.0.20071228/debian/README.source @@ -0,0 +1,6 @@ +This package uses 'quilt' to manage Debian specific patches against the original +upstream sources. + +Please install the package 'quilt' on your System and read +/usr/share/doc/quilt/README.source how to obtain the actual compiled source code +of micropolis. --- micropolis-activity-0.0.20071228.orig/debian/changelog +++ micropolis-activity-0.0.20071228/debian/changelog @@ -0,0 +1,90 @@ +micropolis-activity (0.0.20071228-5) unstable; urgency=low + + * Update zerfleddert patch fixing the sparc issue (Closes: #564319) + (LP: #505080), thanks to Kamal Mostafa for the report and the patch + + -- Christoph Egger Sat, 09 Jan 2010 19:09:30 +0100 + +micropolis-activity (0.0.20071228-4) unstable; urgency=low + + [ Christoph Egger ] + * Update Vcs-* fields to follow reality + * Update my E-Mail Address + * Replace dh_clean -k by dh_prep, bump dependency on debhelper accordingly + * Update zerfleddert patch to .20091012 (Fixes for the Monster + SDL builds) + + [ Bruno "Fuddl" Kleinert ] + * Drop obsolete patch macosx-patch.patch. Its changes got overwritten by + another patch anyway ;-) + * Refresh and modify micropolis-path.patch. Micropolis uses X Shared Memory, + now. The usage of X Shared Memory was originally disabled because it was + buggy but Michael Gernoth's patch fixes the use of X Shared Memory. + * Enable sound via SDL. Add build dependency on libsdl-mixer1.2-dev. + Micropolis picks it up automatically if it's there and links against + libsdl-mixer. Using SDL is much nicer than fork()ing for each sound file + that should be played. + + -- Christoph Egger Sat, 12 Dec 2009 13:30:40 +0100 + +micropolis-activity (0.0.20071228-3) unstable; urgency=low + + * Apply latest patch from Michael Gernoth against the original source tree + (zerfleddert.20080115.patch ist replaced by zerfleddert.20090908.patch) + (Closes: #521194). Thanks for the work! + * Refresh makefile.patch + * Remove fix-crash.patch, because Micheal's patch addresses this problem + * Add myself to Uploaders + * Update to standards version 3.8.3. No changes were necessary + * Add debian/REAMDE.source to document that we're using a patch management + system + * Install Micropolis.png so we have an icon for desktop menus + * Fix installation of micropolis.menu. We have it, but dh_installmenu wasn't + called + * Add micropolis.desktop for desktop environments (Closes: #522330) + * Hopefully improved the package description (Closes: #522271) + + -- Bruno "Fuddl" Kleinert Tue, 08 Sep 2009 18:10:37 +0200 + +micropolis-activity (0.0.20071228-2) unstable; urgency=low + + * Fix crash when loading the game (Closes: #522529) + Thanks to "Ying-Chun Liu (PaulLiu)" for the patch + * Bump Standards Version (No changes needed) + * Add myself to uploaders + * Get rid of Dejavu-LGC embedded fonts, depend on ttf-dejavu-core instead + + -- Christoph Egger Wed, 24 Jun 2009 22:47:01 +0200 + +micropolis-activity (0.0.20071228-1) unstable; urgency=low + + [ Miriam Ruiz ] + * Separate packages in arch-dependent program and arch-indep data. + * Changed package descriptions. + * Added DM-Upload-Allowed tag to debian/control + * Fixed optimization flags. + * First release of the package. Closes: #460674 + + [ Clint Adams ] + * Add build dependencies on x11proto-xext-dev and libxext-dev. + * Add copyright/license text for src/tcl, src/tclx, src/tk. + + -- Clint Adams Sun, 28 Dec 2008 00:18:24 -0500 + +micropolis-activity (0.0-3) unstable; urgency=low + + * Satisfy the build dependency: bison + + -- Kenshi Muto Mon, 14 Jan 2008 21:24:30 +0900 + +micropolis-activity (0.0-2) unstable; urgency=low + + * chdir before running micropolis. + + -- Kenshi Muto Mon, 14 Jan 2008 18:36:00 +0900 + +micropolis-activity (0.0-1) unstable; urgency=low + + * Initial release + + -- Kenshi Muto Mon, 14 Jan 2008 17:06:19 +0900 + --- micropolis-activity-0.0.20071228.orig/debian/micropolis.menu +++ micropolis-activity-0.0.20071228/debian/micropolis.menu @@ -0,0 +1,2 @@ +?package(micropolis):needs="X11" section="Games/Simulation"\ + title="Micropolis" command="/usr/games/micropolis" --- micropolis-activity-0.0.20071228.orig/debian/rules +++ micropolis-activity-0.0.20071228/debian/rules @@ -0,0 +1,71 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +OPTFLAGS= -Wall -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + OPTFLAGS += -O0 +else + OPTFLAGS += -O2 +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + $(MAKE) -f /usr/share/quilt/quilt.make patch + touch $@ + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + $(MAKE) OPTFLAGS="$(OPTFLAGS)" -C src + find res -name "*.wav" | while read a; do chmod -x $$a; done + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + $(MAKE) -C src clean + find res -name "*.wav" | while read a; do chmod +x $$a; done + $(MAKE) -f /usr/share/quilt/quilt.make unpatch + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + install -o root -g root -m 0755 Micropolis \ + $(CURDIR)/debian/micropolis/usr/games/micropolis + + chmod +x $(CURDIR)/res/sounds/player + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + rm -f debian/micropolis-data/usr/share/games/micropolis/res/dejavu-lgc/* + dh_installmenu + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- micropolis-activity-0.0.20071228.orig/debian/copyright +++ micropolis-activity-0.0.20071228/debian/copyright @@ -0,0 +1,128 @@ +This package was debianized by Kenshi Muto on +Mon, 14 Jan 2008 17:06:19 +0900. + +It was downloaded from http://www.donhopkins.com/home/micropolis/ + +Upstream Authors: + + Electronic Arts Inc. + Don Hopkins + +Copyright: + + Copyright © 1989-2007 Electronic Arts Inc. + + According to the README file, the copyright notice applies to the original + source code of Micropolis (in src/sim/) as well as to the X11 Tk port of + Micropolis (in res/*.tcl), and to all of the non-text files in this source + code release, including: + + cities/* All loadable city images + images/* All graphical images + activity/activity-micropolis.svg Icon for Micropolis in Sugar + res/hexa.* Map Graphics + res/snro.* Scenarios + res/sounds/* Sounds played by the game + res/stri.* Text strings displayed by the game + + According to manual/README, the same copyright and license applies to: + + manual/* documentation for Micropolis + +License: + + This package 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 package 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. + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + + +src/tcl: + + * Copyright 1987-1991 Regents of the University of California + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + +src/tclx: + +# Copyright 1992 Karl Lehenbauer and Mark Diekhans. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee is hereby granted, provided +# that the above copyright notice appear in all copies. Karl Lehenbauer +# and +# Mark Diekhans make no representations about the suitability of this +# software for any purpose. It is provided "as is" without express or +# implied warranty. + +src/tk: + + * Copyright 1989-1992 Regents of the University of California. + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + +The Debian packaging is © 2008, Kenshi Muto and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. --- micropolis-activity-0.0.20071228.orig/debian/micropolis-data.install +++ micropolis-activity-0.0.20071228/debian/micropolis-data.install @@ -0,0 +1,6 @@ +Micropolis.png /usr/share/pixmaps +activity /usr/share/games/micropolis +cities /usr/share/games/micropolis +images /usr/share/games/micropolis +manual /usr/share/games/micropolis +res /usr/share/games/micropolis \ No newline at end of file --- micropolis-activity-0.0.20071228.orig/debian/patches/zerfleddert.20100109.patch +++ micropolis-activity-0.0.20071228/debian/patches/zerfleddert.20100109.patch @@ -0,0 +1,8177 @@ +# Copyright (C) 2009 Michael Gernoth +# Obtained from GIT Repository at git://git.zerfleddert.de/micropolis +# Last change: Mon, 14 Jan 2008 22:57:53 +0000 +# Distributed under the same license as the game. See debian/copyright. +# +# Fixes: allow overriding $CC for tclx + Fix the last warning on x86_64 + Enable warnings and fix them, all of them + prevent forking a huge number of player processes by limiting them to a maximum of 10 per second + exit child when exec fails + explicitly start sdl_helper with /bin/sh + use old forking player when SDL_mixer is not available + add ugly sdl_helper to automagically find and enable SDL_mixer + reenable ui sounds played by UIMakeSound + encapsulate sdl_mixer stuff in #ifdef WITH_SDL_MIXER + Fix SDL includes for OS X. + Zap unused vars. + Linux pkg-config needs double dashes. + Add an SDL sound backend and use it instead of spawning an external player. SDL and SDL_mixer are now required. You may get them from: + add "uninstall" target + add .desktop-file from Ian Darwin, forwarded by Deanna Phillips This adds integration into various desktops + DESTDIR support for Makefile + add "install" target to Makefile + remove executable bit from sounds + search sounds and player in $ResourceDir + target "all" should be phony + add simple Makefile in top directory + add .gitignore to ignore build-products + do not include unused alloca.h (from Deanna Phillips' OpenBSD repository) + include xpm.h from X11/ (from Deanna Phillips' OpenBSD repository) + Optimize redrawing so that the mouse is more responsive, from Marc Espie. Fixes sluggish mouse behavior. Forwarded by Deanna Phillips. + avoid black flashing on scenario description + cleanup UILoseGame + don't wreck ships when disasters are disabled + don't quit immediately when the user loses a scenario, instead present a message + show description (including time limit) when hovering over a scenario + fix fire coverage overlay by iterating over the whole map + still more NumLock fixes, this time for scrollbars and sliders + handle spaces in path-names, too + handle spaces in filenames + Add "Pause" to Priority menu + fix power grid overlay on big endian X servers + fix remaining NumLock problems by teaching tk to detect the Alt modifier + re-add (disabled) air crash disaster edit src/sim/makefile and remove -DNO_AIRCRASH from DEFINES to enable it + draw a solid overlay, when requested + allow scenario window to be closed + make double click work on OS X + fix modifier problems (like NumLock) by ignoring hateMods + fix typo in crime alert + fix real cause of crash when falling back to wire mode + fix for crash when falling back from shared memory to wired mode. (the big_tile_pixmap is inaccessible while it is recreated, so do not try to access it) + fix multiplayer mode + add missing break in switch + implement shared memory for 24bpp + Fix for shared memory leak by Kurt Miller. Thanks to Deanna Phillips for forwarding it. + shrink game window to fit on screen if necessary + more big endian fixes (overlays on minimaps) + add /usr/X11R6/lib to libpath + replace call to setpgrp with setpgid, as setpgrp is defined different on OS X Tiger + rename setenv and unsetenv to not clash with functions provided by libc + fix colors on BGR displays + fix dependencies for simulator binary + correctly differentiate between solaris and SunOS + use bash builtin to detect player + enable swapping for 8 bit on big endian machines + sh compatibility fixes + better search for matching visual + fix 15 bit mode + initialize HostName + fix height of windows in column 1 + correctly resize editor window to be in sync with the ... + resize editor when resizing window + allow window to be resized + add afplay to player script + inform user, when no audio player is found + search for available audioplayer + disable image translation until a case is found where ... + fix for main window not appearing on all window managers + +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..a6b6907 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,19 @@ ++*.o ++lib*.a ++made.tmp ++res/sim ++src/tclx/runtcl ++src/tclx/runwish ++src/tclx/src/tclxgdat.c ++src/tclx/tcl ++src/tclx/tcldef ++src/tclx/tcllib/tcl.tlb ++src/tclx/tcllib/tk.tcl ++src/tclx/tcllib/wishx.tcl ++src/tclx/tkucbsrc/main.c ++src/tclx/tkucbsrc/tkevent.c ++src/tclx/ucbsrc/tclbasic.c ++src/tclx/ucbsrc/tclexpr.c ++src/tclx/wish ++src/tk/wish ++src/sim/sim +diff --git a/Makefile b/Makefile +new file mode 100644 +index 0000000..3f55dcc +--- /dev/null ++++ b/Makefile +@@ -0,0 +1,124 @@ ++PREFIX=/usr/local ++DATADIR=$(PREFIX)/share/micropolis ++LIBEXECDIR=$(PREFIX)/libexec ++BINDIR=$(PREFIX)/bin ++DOCDIR=$(PREFIX)/share/doc/micropolis ++PIXMAPDIR=$(PREFIX)/share/pixmaps ++APPLICATIONSDIR=$(PREFIX)/share/applications ++ ++INSTALL=install ++ ++DIRS= $(DESTDIR)/$(DATADIR)/res/sounds $(DESTDIR)/$(DATADIR)/res/dejavu-lgc \ ++ $(DESTDIR)/$(DATADIR)/images $(DESTDIR)/$(DATADIR)/cities \ ++ $(DESTDIR)/$(LIBEXECDIR) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(DOCDIR) \ ++ $(DESTDIR)/$(PIXMAPDIR) $(DESTDIR)/$(APPLICATIONSDIR) ++ ++RES= res/buildidx.tcl res/button.tcl res/entry.tcl res/help.tcl res/hexa.112 \ ++ res/hexa.232 res/hexa.384 res/hexa.385 res/hexa.386 res/hexa.387 \ ++ res/hexa.388 res/hexa.456 res/hexa.544 res/hexa.563 res/hexa.999 \ ++ res/init.tcl res/listbox.tcl res/menu.tcl res/micropolis.tcl \ ++ res/mkindex.tcl res/parray.tcl res/snro.111 res/snro.222 res/snro.333 \ ++ res/snro.444 res/snro.555 res/snro.666 res/snro.777 res/snro.888 \ ++ res/sound.tcl res/stri.202 res/stri.219 res/stri.301 res/stri.356 \ ++ res/tcl.tdx res/tcl.tlb res/tclindex res/tclinit.tcl res/text.tcl \ ++ res/tk.tcl res/tk.tdx res/tk.tlb res/tkerror.tcl res/wask.tcl \ ++ res/wbudget.tcl res/weditor.tcl res/weval.tcl res/wfile.tcl \ ++ res/wfrob.tcl res/wgraph.tcl res/whead.tcl res/whelp.tcl res/wish.tcl \ ++ res/wishx.tcl res/wmap.tcl res/wnotice.tcl res/wplayer.tcl \ ++ res/wscen.tcl res/wsplash.tcl ++ ++all: res/sim ++ ++res/sim: src/sim/sim ++ cp src/sim/sim $@ ++ strip $@ ++ ++src/sim/sim: tcl tk tclx sim ++ @# ++ ++tcl: ++ cd src/tcl && $(MAKE) MAKEFLAGS= ++ ++tk: ++ cd src/tk && $(MAKE) MAKEFLAGS= ++ ++tclx: ++ cd src/tclx && $(MAKE) MAKEFLAGS= ++ ++sim: ++ cd src/sim && $(MAKE) MAKEFLAGS= ++ ++clean: ++ cd src/sim && $(MAKE) MAKEFLAGS= $@ ++ cd src/tcl && $(MAKE) MAKEFLAGS= $@ ++ cd src/tk && $(MAKE) MAKEFLAGS= $@ ++ cd src/tclx && $(MAKE) MAKEFLAGS= $@ ++ rm -f res/sim ++ ++install: res/sim install-dirs install-bin install-res install-images \ ++ install-cities install-doc install-desktop ++ ++install-dirs: ++ $(INSTALL) -d $(DIRS) ++ ++install-bin: ++ $(INSTALL) -m 0755 res/sim $(DESTDIR)/$(LIBEXECDIR)/sim ++ $(INSTALL) -m 0755 res/sounds/player $(DESTDIR)/$(DATADIR)/res/sounds/player ++ echo "SIMHOME=$(DATADIR); export SIMHOME" >$(DESTDIR)/$(BINDIR)/micropolis ++ echo "echo \"Starting Micropolis in \$${SIMHOME} ... \"" >>$(DESTDIR)/$(BINDIR)/micropolis ++ echo "cd $(DATADIR) && $(LIBEXECDIR)/sim \$$*" >>$(DESTDIR)/$(BINDIR)/micropolis ++ chmod 755 $(DESTDIR)/$(BINDIR)/micropolis ++ ++install-res: install-res-sounds install-res-dejavu-lgc ++ for file in $(RES); do \ ++ install -m 0644 $$file $(DESTDIR)/$(DATADIR)/$$file; \ ++ done ++ ++install-res-sounds: ++ find res/sounds -type f -name \*.wav -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/sounds/ \; ++ ++install-res-dejavu-lgc: ++ find res/dejavu-lgc -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/ \; ++ ++install-images: ++ find images -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/images/ \; ++ ++install-cities: ++ find cities -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/cities/ \; ++ ++install-doc: ++ find manual -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DOCDIR)/ \; ++ ++install-desktop: ++ $(INSTALL) -m 0644 Micropolis.desktop $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop ++ $(INSTALL) -m 0644 Micropolis.png $(DESTDIR)/$(PIXMAPDIR)/micropolis.png ++ ++uninstall: ++ rm -f $(DESTDIR)/$(BINDIR)/micropolis ++ rm -f $(DESTDIR)/$(LIBEXECDIR)/sim ++ -rmdir $(DESTDIR)/$(LIBEXECDIR) ++ rm -f $(DESTDIR)/$(DATADIR)/res/sounds/player ++ rm -f $(DESTDIR)/$(DATADIR)/res/sounds/*.wav ++ -rmdir $(DESTDIR)/$(DATADIR)/res/sounds ++ rm -f $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/*ttf \ ++ $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.alias \ ++ $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.dir \ ++ $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.scale ++ -rmdir $(DESTDIR)/$(DATADIR)/res/dejavu-lgc ++ for file in $(RES); do \ ++ rm $(DESTDIR)/$(DATADIR)/$$file; \ ++ done ++ -rmdir $(DESTDIR)/$(DATADIR)/res ++ rm -f $(DESTDIR)/$(DATADIR)/images/*.xpm ++ -rmdir $(DESTDIR)/$(DATADIR)/images ++ rm -f $(DESTDIR)/$(DATADIR)/cities/*.cty ++ -rmdir $(DESTDIR)/$(DATADIR)/cities ++ -rmdir $(DESTDIR)/$(DATADIR) ++ rm -f $(DESTDIR)/$(DOCDIR)/*.html $(DESTDIR)/$(DOCDIR)/README ++ -rmdir $(DESTDIR)/$(DOCDIR) ++ rm -f $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop ++ rm -f $(DESTDIR)/$(PIXMAPDIR)/micropolis.png ++ ++.PHONY: all clean install install-dirs install-bin install-res \ ++ install-res-sounds install-res-dejavu-lgc install-images \ ++ install-cities install-doc install-desktop uninstall tcl tk tclx sim +diff --git a/Micropolis.desktop b/Micropolis.desktop +new file mode 100644 +index 0000000..acab8e2 +--- /dev/null ++++ b/Micropolis.desktop +@@ -0,0 +1,12 @@ ++[Desktop Entry] ++Type=Application ++Version=1.0 ++Encoding=UTF-8 ++Name=Micropolis ++GenericName=Micropolis City Simulation Game ++Comment=City simulation game, open sourced from original SimCity(tm) ++Icon=micropolis.png ++Exec=micropolis ++Terminal=false ++StartupNotify=false ++Categories=Game;Simulation; +diff --git a/res/micropolis.tcl b/res/micropolis.tcl +index b1379c1..5704330 100644 +--- a/res/micropolis.tcl ++++ b/res/micropolis.tcl +@@ -97,6 +97,7 @@ set DemandCom 0 + set DemandInd 0 + set Priority 2 + set Time 3 ++set Pause 0 + set AutoGoto 1 + set AutoBudget 1 + set Disasters 1 +@@ -412,8 +413,12 @@ sim ResetDynamic + # the font in res (because it's already in the system fonts). These lines + # are for other systems that lack the font. + set FontPath "[pwd]/res/dejavu-lgc" +-system "xset -fp $FontPath >&/dev/null" +-system "xset +fp $FontPath >&/dev/null" ++system "xset -fp \"$FontPath\" >/dev/null 2>&1" ++system "xset +fp \"$FontPath\" >/dev/null 2>&1" ++ ++# Ignore SIGCHLD for spawned sound-player childs, this should lead to them ++# being reaped by init ++signal ignore SIGCHLD + + + ######################################################################## +@@ -484,7 +489,7 @@ Either clean up your act or open a gas mask concession at city hall.} \ + {{view {PanView $v [sim PolMaxX] [sim PolMaxY]}}} + + Message 11 #ff4f4f {CRIME ALERT!} \ +-{Crime in your city is our of hand. Angry mobs are looting and vandalizing the central city. The president will send in the national guard soon if you cannot control the problem.} \ ++{Crime in your city is out of hand. Angry mobs are looting and vandalizing the central city. The president will send in the national guard soon if you cannot control the problem.} \ + {{view {PanView $v [sim CrimeMaxX] [sim CrimeMaxY]}}} + + Message 12 #ff4f4f {TRAFFIC WARNING!} \ +@@ -937,19 +942,11 @@ proc UISetChannelVolume {win chan vol} { + + + proc EchoPlaySound {soundspec} { +- # Temporary workaround to tell Python Sugar app to play sound. +- global Sound +- if {$Sound} { +- echo PlaySound [lindex $soundspec 0] +- } + } + + + proc UIMakeSoundOn {win chan sound {opts ""}} { +- # Send message to Python to play sound. +- EchoPlaySound $sound +- +- #UIDoSoundOn $win "play $sound -replay -channel $chan $opts" ++ playsound $chan $sound $opts + } + + +@@ -961,16 +958,8 @@ proc UIStartSoundOn {win chan sound {opts ""}} { + } + + +-proc UIStopSoundOn {win chan sound {opts ""}} { +- UIDoSoundOn $win "stop $sound" +-} +- +- + proc UIMakeSound {chan sound {opts ""}} { +- # Send message to Python to play sound. +- EchoPlaySound $sound +- +- #UIDoSound "sound play $sound -replay -channel $chan $opts" ++ playsound $chan $sound $opts + } + + +@@ -982,11 +971,6 @@ proc UIStartSound {chan sound {opts ""}} { + } + + +-proc UIStopSound {chan sound {opts ""}} { +- UIDoSound "sound stop $sound" +-} +- +- + proc SetupSoundServer {win} { + AddSoundServer $win + } +@@ -2041,13 +2025,13 @@ proc DoFileDialog {win Message Path Pattern FileName ActionOk ActionCancel} { + wm withdraw $win" + bind $win.files.files "" "\ + FileSelectDouble $win %W %y $Pattern \" +- $ActionOk \[$win.file.file get\] \[$win.path.path get\]\"" ++ $ActionOk {\[$win.file.file get\]} {\[$win.path.path get\]}\"" + bind $win.path.path " + ShowFileDialog $win \[$win.path.path get\] $Pattern + $win.file.file cursor 0 + focus $win.file.file" + bind $win.file.file "\ +- $ActionOk \[$win.file.file get\] \[$win.path.path get] ++ $ActionOk \[$win.file.file get\] \[$win.path.path get\] + wm withdraw $win" + } + +@@ -2283,18 +2267,18 @@ proc NameComplete {win Type} { + + proc ShowFileDialog {win Path Pattern} { + busy $win { +- set Path [lindex [split $Path] 0] ++ #set Path [lindex [split $Path] 0] + if {[$win.files.files size] > 0} { + $win.files.files delete 0 end + } + # read directory +- if {[catch "exec ls -F $Path" Result]} { ++ if {[catch "exec ls -F \"$Path\"" Result]} { + set ElementList {} + } + if {[string match $Result "* not found"]} { + set ElementList {} + } +- set ElementList [lsort $Result] ++ set ElementList [lsort [split $Result "\n"]] + + # insert .. + if {[string compare $Path "/"]} { +@@ -2534,7 +2518,7 @@ proc EditorToolUp {w x y} { + + case [$w ToolState] in \ + 7 { # bulldozer +- UIStopSoundOn $w edit 1 ++ stopdozer + } \ + 10 { # chalk + StopChalk $w +@@ -3099,8 +3083,10 @@ proc ShowSplashOf {head} { + + + proc WithdrawSplashOf {head} { +- set win WindowLink $head.splash] +- wm withdraw $win ++ set win [WindowLink $head.splash] ++ if {$win != {}} { ++ wm withdraw $win ++ } + } + + +@@ -3150,8 +3136,10 @@ proc ShowScenarioOf {head} { + + + proc WithdrawScenarioOf {head} { +- set win WindowLink $head.scenario] +- wm withdraw $win ++ set win [WindowLink $head.scenario] ++ if {$win != {}} { ++ wm withdraw $win ++ } + } + + +@@ -3303,12 +3291,33 @@ proc UpdateScenarioButtonID {win id} { + + + proc UpdateScenarioButton {win data} { ++ global Messages ++ + set type [lindex $data 0] + set id [lindex $data 1] + set over [WindowLink $win.$id.over] + set enabled [WindowLink $win.$id.enabled] + set checked [WindowLink $win.$id.checked] + #echo "WIN $win TYPE $type ID $id OVER $over ENABLED $enabled CHECKED $checked" ++ if {$over} { ++ if {[lindex ${data} 2] == "DoPickScenario"} { ++ catch {text $win.desc \ ++ -borderwidth 2 \ ++ -relief flat \ ++ -wrap word \ ++ -state normal \ ++ -font [Font $win Large]} ++ ++ $win.desc configure -state normal ++ $win.desc delete 0.0 end ++ $win.desc insert end "[lindex $Messages([lindex ${data} 3]) 1]\n\n[lindex $Messages([lindex ${data} 3]) 2]" ++ $win.desc configure -state disabled ++ ++ place $win.desc -x 232 -y 170 -width 280 -height 285 ++ } ++ } else { ++ catch {destroy $win.desc} ++ } + if {$enabled} { + if {$checked} { + if {$over} { +@@ -3542,6 +3551,10 @@ proc DoPickScenario {win param} { + UILoadScenario $param + } + ++proc DeleteScenarioWindow {win} { ++ UIQuit $win ++} ++ + + ######################################################################## + # Undo/Redo Facility +@@ -4907,12 +4920,14 @@ proc oops {} { + + + proc TogglePause {} { +- global State ++ global State Pause + + if {"$State" != "play" || [sim Speed]} { + sim Speed 0 ++ set Pause 1 + } else { + sim Speed 3 ++ set Pause 0 + } + MakeRunningSound + } +@@ -5119,7 +5134,7 @@ proc UIDoLoadCity {name path} { + if {![string match *.cty $name]} { + set name $name.cty + } +- MakeHistory "DoLoadCity $path/$name" ++ MakeHistory "DoLoadCity {$path/$name}" + } + + +@@ -5214,8 +5229,14 @@ proc DoLeaveGame {head} { + + + proc UILoseGame {} { +- UIPickScenarioMode ++ global Messages + UIShowPicture 200 ++ sim Pause ++ AskQuestion [Color . #ff0000 #ffffff] [lindex $Messages(200) 1] \ ++ [lindex $Messages(200) 2] \ ++ ""\ ++ ""\ ++ "{Ok} SelectCity.Yes {UIPickScenarioMode}" + } + + +diff --git a/res/sounds/a.wav b/res/sounds/a.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/aaah.wav b/res/sounds/aaah.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/airport.wav b/res/sounds/airport.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/beep.wav b/res/sounds/beep.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/boing.wav b/res/sounds/boing.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/bop.wav b/res/sounds/bop.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/build.wav b/res/sounds/build.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/bulldozer.wav b/res/sounds/bulldozer.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/chalk.wav b/res/sounds/chalk.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/coal.wav b/res/sounds/coal.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/com.wav b/res/sounds/com.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/computer.wav b/res/sounds/computer.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/cuckoo.wav b/res/sounds/cuckoo.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/e.wav b/res/sounds/e.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/eraser.wav b/res/sounds/eraser.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/explosion-hi.wav b/res/sounds/explosion-hi.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/explosion-high.wav b/res/sounds/explosion-high.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/explosion-low.wav b/res/sounds/explosion-low.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/fire.wav b/res/sounds/fire.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/heavytraffic.wav b/res/sounds/heavytraffic.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/honkhonk-hi.wav b/res/sounds/honkhonk-hi.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/honkhonk-high.wav b/res/sounds/honkhonk-high.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/honkhonk-low.wav b/res/sounds/honkhonk-low.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/honkhonk-med.wav b/res/sounds/honkhonk-med.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/ignition.wav b/res/sounds/ignition.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/ind.wav b/res/sounds/ind.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/monster.wav b/res/sounds/monster.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/nuclear.wav b/res/sounds/nuclear.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/o.wav b/res/sounds/o.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/oop.wav b/res/sounds/oop.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/park.wav b/res/sounds/park.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/player b/res/sounds/player +new file mode 100755 +index 0000000..48e05d7 +--- /dev/null ++++ b/res/sounds/player +@@ -0,0 +1,25 @@ ++#!/bin/bash ++ ++PLAYER= ++ ++if type -a aplay &>/dev/null; then ++ PLAYER=aplay ++elif type -a afplay &>/dev/null; then ++ #afplay is shipped with OS X Leopard ++ PLAYER=afplay ++elif type -a play &>/dev/null; then ++ PLAYER=play ++elif type -a mplayer &>/dev/null; then ++ PLAYER="mplayer -nogui -nocache" ++fi ++ ++if [ "x${PLAYER}" = "x" ]; then ++ echo "Can't find audio player!" ++ echo "Please make sure you have aplay, play or mplayer in your path." ++ if [ "`uname`" = "Darwin" ]; then ++ echo "A working play for OS X is available from:" ++ echo "http://www.hieper.nl/html/play.html" ++ fi ++else ++ exec ${PLAYER} "$@" >/dev/null 2>&1 ++fi +diff --git a/res/sounds/police.wav b/res/sounds/police.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/quack.wav b/res/sounds/quack.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/quackquack.wav b/res/sounds/quackquack.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/query.wav b/res/sounds/query.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/rail.wav b/res/sounds/rail.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/res.wav b/res/sounds/res.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/road.wav b/res/sounds/road.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/rumble.wav b/res/sounds/rumble.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/seaport.wav b/res/sounds/seaport.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/siren.wav b/res/sounds/siren.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/skid.wav b/res/sounds/skid.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/sorry.wav b/res/sounds/sorry.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/stadium.wav b/res/sounds/stadium.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/uhuh.wav b/res/sounds/uhuh.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/whip.wav b/res/sounds/whip.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/wire.wav b/res/sounds/wire.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/woosh.wav b/res/sounds/woosh.wav +old mode 100755 +new mode 100644 +diff --git a/res/sounds/zone.wav b/res/sounds/zone.wav +old mode 100755 +new mode 100644 +diff --git a/res/weditor.tcl b/res/weditor.tcl +index 0d407d2..36f2571 100644 +--- a/res/weditor.tcl ++++ b/res/weditor.tcl +@@ -120,7 +120,7 @@ if {0} { + -relief flat + tk_bindForTraversal $win.topframe.controls.update + bind $win.topframe.controls.update {tk_firstMenu %W} +- bind $win.topframe.controls.update {tk_traverseToMenu %W %A} ++ bind $win.topframe.controls.update {tk_traverseToMenu %W %A} + tk_menus $win $win.topframe.controls.update + + SetHelp $win.topframe.controls.update Editor.Display +@@ -129,7 +129,7 @@ if {0} { + -font [Font $win Medium] + tk_bindForTraversal $win.topframe.controls.update.m + bind $win.topframe.controls.update.m {tk_firstMenu %W} +- bind $win.topframe.controls.update.m {tk_traverseToMenu %W %A} ++ bind $win.topframe.controls.update.m {tk_traverseToMenu %W %A} + $win.topframe.controls.update.m add radiobutton\ + -label {Always}\ + -variable Skip.$win\ +@@ -166,7 +166,7 @@ menubutton $win.topframe.controls.options\ + -relief flat + tk_bindForTraversal $win.topframe.controls.options + bind $win.topframe.controls.options {tk_firstMenu %W} +-bind $win.topframe.controls.options {tk_traverseToMenu %W %A} ++bind $win.topframe.controls.options {tk_traverseToMenu %W %A} + tk_menus $win $win.topframe.controls.options + + SetHelp $win.topframe.controls.options Editor.Options +@@ -175,7 +175,7 @@ menu $win.topframe.controls.options.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.topframe.controls.options.m + bind $win.topframe.controls.options.m {tk_firstMenu %W} +-bind $win.topframe.controls.options.m {tk_traverseToMenu %W %A} ++bind $win.topframe.controls.options.m {tk_traverseToMenu %W %A} + $win.topframe.controls.options.m add checkbutton\ + -label {Auto Goto}\ + -variable AutoGoto.$win\ +diff --git a/res/whead.tcl b/res/whead.tcl +index d437925..5432324 100644 +--- a/res/whead.tcl ++++ b/res/whead.tcl +@@ -78,10 +78,19 @@ global NoticePanelHeight + + set visual [winfo screenvisual $win] + set depth [winfo screendepth $win] +-#set screenwidth [winfo screenwidth $win] +-#set screenheight [winfo screenheight $win] +-set screenwidth 1200 +-set screenheight 900 ++set screenwidth [winfo screenwidth $win] ++set screenheight [winfo screenheight $win] ++set initialwidth 1200 ++set initialheight 900 ++ ++if {$screenwidth < $initialwidth} { ++ set initialwidth $screenwidth ++} ++ ++if {$screenheight < $initialheight} { ++ set initialheight $screenheight ++} ++ + + if {!(("$visual" == "pseudocolor") || + ("$visual" == "truecolor") || +@@ -112,15 +121,15 @@ LinkWindow $win.ask {} + + tk_bindForTraversal $win + bind $win {tk_firstMenu %W} +-bind $win {tk_traverseToMenu %W %A} ++bind $win {tk_traverseToMenu %W %A} + + wm title $win "Micropolis Controls" + wm iconname $win {Micropolis Controls} +-wm geometry $win 1200x900+0+0 ++wm geometry $win ${initialwidth}x${initialheight}+0+0 + #wm positionfrom $win user + wm withdraw $win +-#wm maxsize $win $screenwidth $screenheight +-#wm minsize $win 100 100 ++wm maxsize $win $screenwidth $screenheight ++wm minsize $win 100 100 + wm protocol $win delete "DeleteHeadWindow $win ;" + wm fullscreen $win on + +@@ -142,7 +151,7 @@ frame $win.col1.w1.f1\ + -relief raised + tk_bindForTraversal $win.col1.w1.f1 + bind $win.col1.w1.f1 {tk_firstMenu %W} +-bind $win.col1.w1.f1 {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1 {tk_traverseToMenu %W %A} + + SetHelp $win.col1.w1.f1.micropolis Head.MicropolisMenu + +@@ -153,7 +162,7 @@ menubutton $win.col1.w1.f1.micropolis\ + -variable $win.postedMenu + tk_bindForTraversal $win.col1.w1.f1.micropolis + bind $win.col1.w1.f1.micropolis {tk_firstMenu %W} +-bind $win.col1.w1.f1.micropolis {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.micropolis {tk_traverseToMenu %W %A} + + tk_menus $win $win.col1.w1.f1.micropolis + +@@ -161,7 +170,7 @@ menu $win.col1.w1.f1.micropolis.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.col1.w1.f1.micropolis.m + bind $win.col1.w1.f1.micropolis.m {tk_firstMenu %W} +-bind $win.col1.w1.f1.micropolis.m {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.micropolis.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.micropolis.m add command\ + -label {About...}\ + -command "UIShowPicture 300" +@@ -192,7 +201,7 @@ menubutton $win.col1.w1.f1.options\ + -variable $win.postedMenu + tk_bindForTraversal $win.col1.w1.f1.options + bind $win.col1.w1.f1.options {tk_firstMenu %W} +-bind $win.col1.w1.f1.options {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.options {tk_traverseToMenu %W %A} + + tk_menus $win $win.col1.w1.f1.options + +@@ -200,7 +209,7 @@ menu $win.col1.w1.f1.options.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.col1.w1.f1.options.m + bind $win.col1.w1.f1.options.m {tk_firstMenu %W} +-bind $win.col1.w1.f1.options.m {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.options.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.options.m add checkbutton\ + -label {Auto Budget}\ + -variable AutoBudget\ +@@ -239,7 +248,7 @@ menubutton $win.col1.w1.f1.disasters\ + -variable $win.postedMenu + tk_bindForTraversal $win.col1.w1.f1.disasters + bind $win.col1.w1.f1.disasters {tk_firstMenu %W} +-bind $win.col1.w1.f1.disasters {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.disasters {tk_traverseToMenu %W %A} + + tk_menus $win $win.col1.w1.f1.disasters + +@@ -247,7 +256,7 @@ menu $win.col1.w1.f1.disasters.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.col1.w1.f1.disasters.m + bind $win.col1.w1.f1.disasters.m {tk_firstMenu %W} +-bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.disasters.m add command\ + -label {Monster}\ + -command "UIDisaster $win \"UIMakeMonster\" \"release a monster?\"" +@@ -260,6 +269,11 @@ bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.disasters.m add command\ + -label {Meltdown}\ + -command "UIDisaster $win \"sim MakeMeltdown\" \"have a nuclear meltdown?\"" ++ if {[sim HasAirCrash]} { ++ $win.col1.w1.f1.disasters.m add command\ ++ -label {Air Crash}\ ++ -command "UIDisaster $win \"sim MakeAirCrash\" \"crash an airplane?\"" ++ } + $win.col1.w1.f1.disasters.m add command\ + -label {Tornado}\ + -command "UIDisaster $win \"sim MakeTornado\" \"spin up a tornado?\"" +@@ -276,7 +290,7 @@ menubutton $win.col1.w1.f1.priority\ + -variable $win.postedMenu + tk_bindForTraversal $win.col1.w1.f1.priority + bind $win.col1.w1.f1.priority {tk_firstMenu %W} +-bind $win.col1.w1.f1.priority {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.priority {tk_traverseToMenu %W %A} + + tk_menus $win $win.col1.w1.f1.priority + +@@ -284,7 +298,7 @@ menu $win.col1.w1.f1.priority.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.col1.w1.f1.priority.m + bind $win.col1.w1.f1.priority.m {tk_firstMenu %W} +-bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.priority.m add radiobutton\ + -label {Super Fast}\ + -command {SetPriority 4}\ +@@ -310,6 +324,10 @@ bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} + -command {SetPriority 0}\ + -value {0}\ + -variable Priority ++ $win.col1.w1.f1.priority.m add checkbutton\ ++ -label {Pause}\ ++ -command {TogglePause}\ ++ -variable Pause + + SetHelp $win.col1.w1.f1.windows Head.WindowsMenu + +@@ -320,7 +338,7 @@ menubutton $win.col1.w1.f1.windows\ + -variable $win.postedMenu + tk_bindForTraversal $win.col1.w1.f1.windows + bind $win.col1.w1.f1.windows {tk_firstMenu %W} +-bind $win.col1.w1.f1.windows {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.windows {tk_traverseToMenu %W %A} + + tk_menus $win $win.col1.w1.f1.windows + +@@ -328,7 +346,7 @@ menu $win.col1.w1.f1.windows.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.col1.w1.f1.windows.m + bind $win.col1.w1.f1.windows.m {tk_firstMenu %W} +-bind $win.col1.w1.f1.windows.m {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f1.windows.m {tk_traverseToMenu %W %A} + $win.col1.w1.f1.windows.m add command\ + -label {Budget}\ + -command "UIShowBudgetAndWait" +@@ -516,7 +534,7 @@ frame $win.col1.w1.f2.f2\ + -relief flat + tk_bindForTraversal $win.col1.w1.f2.f2 + bind $win.col1.w1.f2.f2 {tk_firstMenu %W} +-bind $win.col1.w1.f2.f2 {tk_traverseToMenu %W %A} ++bind $win.col1.w1.f2.f2 {tk_traverseToMenu %W %A} + + SetHelp $win.col1.w1.f2.f2 Head.Log + +@@ -558,7 +576,7 @@ if {[sim MultiPlayerMode]} { + -relief flat + tk_bindForTraversal $win.col1.w1.f2.f3 + bind $win.col1.w1.f2.f3 {tk_firstMenu %W} +- bind $win.col1.w1.f2.f3 {tk_traverseToMenu %W %A} ++ bind $win.col1.w1.f2.f3 {tk_traverseToMenu %W %A} + + button $win.col1.w1.f2.f3.chat \ + -font [Font $win Large] \ +@@ -581,7 +599,7 @@ if {[sim MultiPlayerMode]} { + set $win.col1.w1.f2.f3.entry.value "" + tk_bindForTraversal $win.col1.w1.f2.f3.entry + bind $win.col1.w1.f2.f3.entry {tk_firstMenu %W} +- bind $win.col1.w1.f2.f3.entry {tk_traverseToMenu %W %A} ++ bind $win.col1.w1.f2.f3.entry {tk_traverseToMenu %W %A} + bind $win.col1.w1.f2.f3.entry "DoEnterMessage %W %W.value" + bind $win.col1.w1.f2.f3.entry "DoEvalMessage %W %W.value" + bind $win.col1.w1.f2.f3.entry {focus %W} +@@ -656,7 +674,7 @@ place configure $win.col1\ + -x 0\ + -y 0\ + -width $HeadPanelWidth\ +- -height $screenheight ++ -relheight 1.0 + + pack append $win.col1\ + $win.col1.w1 {top frame nw fillx} \ +@@ -684,8 +702,17 @@ pack append $win.col1\ + place configure $win.col2\ + -x [expr "$HeadPanelWidth + 5"]\ + -y 0\ +- -width [expr "($screenwidth - $HeadPanelWidth) - 5"]\ +- -height $screenheight ++ -relheight 1.0\ ++ -width [expr "($screenwidth - $HeadPanelWidth) - 5"] ++ ++proc resizeeditor {win width} { ++ global HeadPanelWidth ++ ++ place configure $win.col2\ ++ -width [expr "($width - $HeadPanelWidth) - 5"] ++} ++ ++bind $win "resizeeditor $win %w" + + #pack append $win.col2\ + # $win.col2.x1 {top frame nw fillx} \ +diff --git a/res/wmap.tcl b/res/wmap.tcl +index 73e7d6f..b497c35 100644 +--- a/res/wmap.tcl ++++ b/res/wmap.tcl +@@ -124,7 +124,7 @@ menubutton $win.topframe.zones\ + LinkWindow $win.zones $win.topframe.zones + tk_bindForTraversal $win.topframe.zones + bind $win.topframe.zones {tk_firstMenu %W} +-bind $win.topframe.zones {tk_traverseToMenu %W %A} ++bind $win.topframe.zones {tk_traverseToMenu %W %A} + tk_menus $win $win.topframe.zones + + SetHelp $win.topframe.zones Map.Zones +@@ -133,7 +133,7 @@ menu $win.topframe.zones.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.topframe.zones.m + bind $win.topframe.zones.m {tk_firstMenu %W} +-bind $win.topframe.zones.m {tk_traverseToMenu %W %A} ++bind $win.topframe.zones.m {tk_traverseToMenu %W %A} + $win.topframe.zones.m add radiobutton\ + -label {All}\ + -variable MapState.$win\ +@@ -176,7 +176,7 @@ menubutton $win.topframe.overlays\ + LinkWindow $win.overlays $win.topframe.overlays + tk_bindForTraversal $win.topframe.overlays + bind $win.topframe.overlays {tk_firstMenu %W} +-bind $win.topframe.overlays {tk_traverseToMenu %W %A} ++bind $win.topframe.overlays {tk_traverseToMenu %W %A} + tk_menus $win $win.topframe.overlays + + SetHelp $win.topframe.overlays Map.Overlays +@@ -185,7 +185,7 @@ menu $win.topframe.overlays.m\ + -font [Font $win Medium] + tk_bindForTraversal $win.topframe.overlays.m + bind $win.topframe.overlays.m {tk_firstMenu %W} +-bind $win.topframe.overlays.m {tk_traverseToMenu %W %A} ++bind $win.topframe.overlays.m {tk_traverseToMenu %W %A} + $win.topframe.overlays.m add radiobutton\ + -label {Population Density}\ + -variable MapState.$win\ +diff --git a/res/wscen.tcl b/res/wscen.tcl +index 7b2af7d..4ccc862 100644 +--- a/res/wscen.tcl ++++ b/res/wscen.tcl +@@ -89,7 +89,7 @@ SetHelp $win Scenario + canvas $win.canvas \ + -scrollincrement 0 \ + -borderwidth 0 \ +- -background #000000 \ ++ -background #BFBFBF \ + -width 1200 -height 900 + LinkWindow $win.canvas $win.canvas + LinkWindow $win.canvas.w $win +diff --git a/src/sim/g_ani.c b/src/sim/g_ani.c +index b5a9e49..a272d6b 100644 +--- a/src/sim/g_ani.c ++++ b/src/sim/g_ani.c +@@ -64,6 +64,7 @@ + + + /* comefrom: moveWorld doEditWindow scoreDoer doMapInFront graphDoer */ ++void + animateTiles(void) + { + unsigned short tilevalue, tileflags; +diff --git a/src/sim/g_bigmap.c b/src/sim/g_bigmap.c +index 695cd88..55bb06f 100644 +--- a/src/sim/g_bigmap.c ++++ b/src/sim/g_bigmap.c +@@ -63,14 +63,15 @@ + + + int dynamicFilter(int c, int r); +-int WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h); + ++void + drawBeegMaps() + { + sim_update_editors(); + } + + ++void + MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h) + { + int lineBytes = view->line_bytes; +@@ -169,6 +170,15 @@ MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h) + #define ROW8_16(n) ROW4_16(n) ROW4_16(n+4) + #define ROW16_16() ROW8_16(0) ROW8_16(8) + ++#define ROW1_32(n) \ ++ memcpy((char *)image, (char *)mem + (4 * 16 * (n)), 4 * 16); \ ++ image = (unsigned QUAD *)(((unsigned char *)image) + lineBytes); ++ ++#define ROW2_32(n) ROW1_32(n) ROW1_32(n+1) ++#define ROW4_32(n) ROW2_32(n) ROW2_32(n+2) ++#define ROW8_32(n) ROW4_32(n) ROW4_32(n+4) ++#define ROW16_32() ROW8_32(0) ROW8_32(8) ++ + switch (view->x->depth) { + + case 8: +@@ -182,6 +192,9 @@ MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h) + + case 24: + case 32: ++ ROW16_32(); ++ break; ++ + default: + /* XXX: handle different depths */ + break; +@@ -252,6 +265,7 @@ MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h) + } + + ++void + WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h) + { + unsigned short *map; +diff --git a/src/sim/g_cam.c b/src/sim/g_cam.c +index c2f1b12..139da46 100644 +--- a/src/sim/g_cam.c ++++ b/src/sim/g_cam.c +@@ -1083,39 +1083,45 @@ cam_load_rule(Cam *cam, char *filename) + FILE *fp; + QUAD magic, neighborhood, rule_size; + Byte *rule; ++ int test = 1; + + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "cam: Can't open rule file \"%s\"\n", filename); + return; + } + +-/* XXX: Make this byte order independent!!! */ +- +-#if defined(MSDOS) || defined(OSF1) || defined(IS_INTEL) + + #define SWAPQUAD(x) ((x = ((x <<24) & 0xff000000) | \ + ((x <<8) & 0x00ff0000) | \ + ((x >>8) & 0x0000ff00) | \ + ((x >>24) & 0x000000ff)), 0) + +-#else +- +-#define SWAPQUAD(x) 0 +- +-#endif +- +- if ((fread(&magic, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || +- SWAPQUAD(magic) || +- (magic != 0xcac0cac0) || +- (fread(&neighborhood, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || +- SWAPQUAD(neighborhood) || +- (fread(&rule_size, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || +- SWAPQUAD(rule_size) || +- ((rule = (Byte *)malloc(rule_size)) == NULL) || +- (fread(rule, 1, rule_size, fp) != rule_size)) { +- fprintf(stderr, "cam: Bad rule file \"%s\"\n", filename); +- fclose(fp); +- return; ++/* XXX: Make this byte order independent!!! */ ++ if ((*(unsigned char*) (&test))) { ++ if ((fread(&magic, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ SWAPQUAD(magic) || ++ (magic != 0xcac0cac0) || ++ (fread(&neighborhood, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ SWAPQUAD(neighborhood) || ++ (fread(&rule_size, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ SWAPQUAD(rule_size) || ++ ((rule = (Byte *)malloc(rule_size)) == NULL) || ++ (fread(rule, 1, rule_size, fp) != rule_size)) { ++ fprintf(stderr, "cam: Bad rule file \"%s\"\n", filename); ++ fclose(fp); ++ return; ++ } ++ } else { ++ if ((fread(&magic, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ (magic != 0xcac0cac0) || ++ (fread(&neighborhood, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ (fread(&rule_size, 1, sizeof(QUAD), fp) != sizeof(QUAD)) || ++ ((rule = (Byte *)malloc(rule_size)) == NULL) || ++ (fread(rule, 1, rule_size, fp) != rule_size)) { ++ fprintf(stderr, "cam: Bad rule file \"%s\"\n", filename); ++ fclose(fp); ++ return; ++ } + } + + fclose(fp); +diff --git a/src/sim/g_map.c b/src/sim/g_map.c +index 4b0fe5f..5a65e00 100644 +--- a/src/sim/g_map.c ++++ b/src/sim/g_map.c +@@ -83,23 +83,21 @@ short valGrayMap[] = { + }; + + +-int (*mapProcs[NMAPS])(); +- +-int drawAll(SimView *view); +-int drawRes(SimView *view); +-int drawCom(SimView *view); +-int drawInd(SimView *view); +-int drawPower(SimView *view); +-int drawLilTransMap(SimView *view); +-int drawPopDensity(SimView *view); +-int drawRateOfGrowth(SimView *view); +-int drawTrafMap(SimView *view); +-int drawPolMap(SimView *view); +-int drawCrimeMap(SimView *view); +-int drawLandMap(SimView *view); +-int drawFireRadius(SimView *view); +-int drawPoliceRadius(SimView *view); +-int drawDynamic(SimView *view); ++void (*mapProcs[NMAPS])(); ++ ++void drawPopDensity(SimView *view); ++void drawRateOfGrowth(SimView *view); ++void drawTrafMap(SimView *view); ++void drawPolMap(SimView *view); ++void drawCrimeMap(SimView *view); ++void drawLandMap(SimView *view); ++void drawFireRadius(SimView *view); ++void drawPoliceRadius(SimView *view); ++void ditherMap(SimView *view); ++void drawRect(SimView *view, int pixel, int solid, ++ int x, int y, int w, int h); ++void maybeDrawRect(SimView *view, int val, ++ int x, int y, int w, int h); + + + short GetCI(short x) +@@ -112,6 +110,7 @@ short GetCI(short x) + } + + ++void + drawPopDensity(SimView *view) + { + short x, y; +@@ -126,6 +125,7 @@ drawPopDensity(SimView *view) + } + + ++void + drawRateOfGrowth(SimView *view) + { + short x, y; +@@ -153,6 +153,7 @@ drawRateOfGrowth(SimView *view) + } + + ++void + drawTrafMap(SimView *view) + { + short x; +@@ -169,6 +170,7 @@ drawTrafMap(SimView *view) + } + + ++void + drawPolMap(SimView *view) + { + short x, y; +@@ -184,6 +186,7 @@ drawPolMap(SimView *view) + } + + ++void + drawCrimeMap(SimView *view) + { + short x, y; +@@ -199,6 +202,7 @@ drawCrimeMap(SimView *view) + } + + ++void + drawLandMap(SimView *view) + { + short x, y; +@@ -214,12 +218,13 @@ drawLandMap(SimView *view) + } + + ++void + drawFireRadius(SimView *view) + { + short x, y; + + drawAll(view); +- for (x = 0; x < SmY; x++) { ++ for (x = 0; x < SmX; x++) { + for (y = 0; y < SmY; y++) { + maybeDrawRect(view, GetCI(FireRate[x][y]), + x * 24, y * 24, 24, 24); +@@ -228,6 +233,7 @@ drawFireRadius(SimView *view) + } + + ++void + drawPoliceRadius(SimView *view) + { + short x, y; +@@ -242,6 +248,7 @@ drawPoliceRadius(SimView *view) + } + + ++void + setUpMapProcs(void) + { + mapProcs[ALMAP] = drawAll; +@@ -262,6 +269,7 @@ setUpMapProcs(void) + } + + ++void + MemDrawMap(SimView *view) + { + (*mapProcs[view->map_state])(view); +@@ -275,6 +283,7 @@ MemDrawMap(SimView *view) + } + + ++void + ditherMap(SimView *view) + { + int i, x, y, width, height; +@@ -346,6 +355,7 @@ ditherMap(SimView *view) + } + + ++void + maybeDrawRect(SimView *view, int val, + int x, int y, int w, int h) + { +@@ -359,6 +369,7 @@ maybeDrawRect(SimView *view, int val, + } + + ++void + drawRect(SimView *view, int pixel, int solid, + int x, int y, int w, int h) + { +@@ -385,8 +396,10 @@ drawRect(SimView *view, int pixel, int solid, + + if (w && h) { + int i, j, stipple = (x ^ y) & 1; ++#if 0 + unsigned char *data = + view->x->color ? view->data : view->data8; ++#endif + + /* In the case of black and white, we use an 8 bit buffer and dither it. */ + int pixelBytes = +@@ -394,8 +407,10 @@ drawRect(SimView *view, int pixel, int solid, + QUAD line = + view->x->color ? view->line_bytes : view->line_bytes8; + ++#if 0 + unsigned char *image = + &(data[(line * y) + (x * pixelBytes)]); ++#endif + + switch (pixelBytes) { + +@@ -406,25 +421,15 @@ drawRect(SimView *view, int pixel, int solid, + unsigned char *image = + &data[(line * y) + (x * pixelBytes)]; + +- if (solid) { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { ++ for (i = h; i > 0; i--) { ++ for (j = w; j > 0; j--) { ++ if (solid || stipple++ & 1) + *image = pixel; +- image++; +- } +- image += line - w; +- } +- } else { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { +- if (stipple++ & 1) +- *image = pixel; +- image++; +- } +- if (!(w & 1)) +- stipple++; +- image += line - w; ++ image++; + } ++ if (!(w & 1)) ++ stipple++; ++ image += line - w; + } + } + break; +@@ -438,26 +443,22 @@ drawRect(SimView *view, int pixel, int solid, + image = + &data[(line * y) + x]; + +- if (solid) { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { +- *image = pixel; +- image++; +- } +- image += line - w; +- } +- } else { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { +- if (stipple++ & 1) +- *image = pixel; +- image++; ++ for (i = h; i > 0; i--) { ++ for (j = w; j > 0; j--) { ++ if (solid || stipple++ & 1) { ++ if (view->x->x_big_endian) { ++ *image = ((pixel & 0xff) << 8) | ((pixel & 0xff00) >> 8); ++ } else { ++ *image = pixel; ++ } + } +- if (!(w & 1)) +- stipple++; +- image += line - w; ++ image++; + } ++ if (!(w & 1)) ++ stipple++; ++ image += line - w; + } ++ + } + break; + +@@ -467,41 +468,39 @@ drawRect(SimView *view, int pixel, int solid, + unsigned char *data = + (unsigned char *)view->data; + unsigned char *image; +- int bitmapPad = view->x->small_tile_image->bitmap_pad; +- int rowBytes = view->x->small_tile_image->bytes_per_line; +- line = rowBytes >> 1; /* Convert from byte offset to short offset */ + image = +- &data[(line * y) + x]; ++ &data[(line * y) + x * pixelBytes]; + +- if (solid) { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { +- *(image++) = (pixel >> 0) & 0xff; +- *(image++) = (pixel >> 8) & 0xff; +- *(image++) = (pixel >> 16) & 0xff; +- if (bitmapPad == 32) { ++ for (i = h; i > 0; i--) { ++ for (j = w; j > 0; j--) { ++ if (view->x->x_big_endian) { ++ if (pixelBytes == 4) { + image++; + } +- } +- image += line - w; +- } +- } else { +- for (i = h; i > 0; i--) { +- for (j = w; j > 0; j--) { +- if (stipple++ & 1) { +- *(image++) = (pixel >> 0) & 0xff; +- *(image++) = (pixel >> 8) & 0xff; +- *(image++) = (pixel >> 16) & 0xff; +- if (bitmapPad == 32) { +- image++; +- } ++ if (solid || stipple++ & 1) { ++ *(image++) = (pixel >> 16) & 0xff; ++ *(image++) = (pixel >> 8) & 0xff; ++ *(image++) = (pixel >> 0) & 0xff; ++ } else { ++ image += 3; ++ } ++ } else { ++ if (solid || stipple++ & 1) { ++ *(image++) = (pixel >> 0) & 0xff; ++ *(image++) = (pixel >> 8) & 0xff; ++ *(image++) = (pixel >> 16) & 0xff; ++ } else { ++ image += 3; ++ } ++ if (pixelBytes == 4) { ++ image++; + } + } +- if (!(w & 1)) { +- stipple++; +- } +- image += line - w; + } ++ if (!(w & 1)) { ++ stipple++; ++ } ++ image += line - w * pixelBytes; + } + } + break; +diff --git a/src/sim/g_setup.c b/src/sim/g_setup.c +index 61204fe..8cd13ba 100644 +--- a/src/sim/g_setup.c ++++ b/src/sim/g_setup.c +@@ -70,7 +70,7 @@ + + #define gray25_width 16 + #define gray25_height 16 +-static unsigned char gray25_bits[] = { ++static char gray25_bits[] = { + 0x77, 0x77, + 0xdd, 0xdd, + 0x77, 0x77, +@@ -92,7 +92,7 @@ static unsigned char gray25_bits[] = { + + #define gray50_width 16 + #define gray50_height 16 +-static unsigned char gray50_bits[] = { ++static char gray50_bits[] = { + 0x55, 0x55, + 0xaa, 0xaa, + 0x55, 0x55, +@@ -114,7 +114,7 @@ static unsigned char gray50_bits[] = { + + #define gray75_width 16 + #define gray75_height 16 +-static unsigned char gray75_bits[] = { ++static char gray75_bits[] = { + 0x88, 0x88, + 0x22, 0x22, + 0x88, 0x88, +@@ -135,7 +135,7 @@ static unsigned char gray75_bits[] = { + + #define vert_width 16 + #define vert_height 16 +-static unsigned char vert_bits[] = { ++static char vert_bits[] = { + 0xaa, 0xaa, + 0xaa, 0xaa, + 0xaa, 0xaa, +@@ -157,7 +157,7 @@ static unsigned char vert_bits[] = { + + #define horiz_width 16 + #define horiz_height 16 +-static unsigned char horiz_bits[] = { ++static char horiz_bits[] = { + 0xff, 0xff, + 0x00, 0x00, + 0xff, 0xff, +@@ -179,7 +179,7 @@ static unsigned char horiz_bits[] = { + + #define diag_width 16 + #define diag_height 16 +-static unsigned char diag_bits[] = { ++static char diag_bits[] = { + 0x55, 0x55, + 0xee, 0xee, + 0x55, 0x55, +@@ -239,6 +239,7 @@ GetObjectXpms(XDisplay *xd, int id, int frames) + } + + ++void + GetPixmaps(XDisplay *xd) + { + if (xd->gray25_stipple == None) { +@@ -286,6 +287,7 @@ GetPixmaps(XDisplay *xd) + } + + ++void + GetViewTiles(SimView *view) + { + char name[256]; +@@ -363,10 +365,9 @@ GetViewTiles(SimView *view) + } + } + +- { int x, y, b, tile; ++ { int x, y, tile; + unsigned char *from, *to; + int pixelBytes = view->pixel_bytes; +- int rowBytes = view->x->small_tile_image->bytes_per_line; + + if (pixelBytes == 0) { + /* handle the case of monochrome display (8 bit map) */ +diff --git a/src/sim/g_smmaps.c b/src/sim/g_smmaps.c +index ed8c075..e66ad40 100644 +--- a/src/sim/g_smmaps.c ++++ b/src/sim/g_smmaps.c +@@ -84,63 +84,67 @@ int DynamicData[32]; + if (tile >= TILE_COUNT) tile -= TILE_COUNT; + + +-#if defined(MSDOS) || defined(OSF1) || defined(IS_INTEL) +- +-#define ROW1_8(n) \ ++#define LE_ROW1_8(n) \ + l = mem[n]; \ + image[0] = l; \ + image[1] = l >>8; \ + image[2] = l >>16; \ + image += lineBytes; + +-#define ROW1_16(n) \ ++#define LE_ROW1_16(n) \ + memcpy((char *)image, ((char *)mem) + (n * 4 * 2), (3 * 2)); \ + image += lineBytes; + +-#define ROW1_24(n) \ ++#define LE_ROW1_24(n) \ + memcpy((char *)image, ((char *)mem) + (n * 4 * 3), (3 * 3)); \ + image += lineBytes; + +-#define ROW1_32(n) \ ++#define LE_ROW1_32(n) \ + memcpy((char *)image, ((char *)mem) + (n * 4 * 4), (3 * 4)); \ + image += lineBytes; + +-#else +- +-#define ROW1_8(n) \ ++#define BE_ROW1_8(n) \ + l = mem[n]; \ + image[0] = l >>24; \ + image[1] = l >>16; \ + image[2] = l >>8; \ + image += lineBytes; + +-#define ROW1_16(n) \ ++#define BE_ROW1_16(n) \ + l = mem[n]; /* XXX: WRONG. handle depth */ \ + image[0] = l >>24; \ + image[1] = l >>16; \ + image[2] = l >>8; \ + image += lineBytes; + +-#define ROW1_24(n) \ ++#define BE_ROW1_24(n) \ + l = mem[n]; /* XXX: WRONG. handle depth */ \ + image[0] = l >>24; \ + image[1] = l >>16; \ + image[2] = l >>8; \ + image += lineBytes; + +-#define ROW1_32(n) \ ++#define BE_ROW1_32(n) \ + l = mem[n]; /* XXX: WRONG. handle depth */ \ + image[0] = l >>24; \ + image[1] = l >>16; \ + image[2] = l >>8; \ + image += lineBytes; + +-#endif ++#define LE_ROW3_8 LE_ROW1_8(0) LE_ROW1_8(1) LE_ROW1_8(2) ++#define LE_ROW3_16 LE_ROW1_16(0) LE_ROW1_16(1) LE_ROW1_16(2) ++#define LE_ROW3_24 LE_ROW1_24(0) LE_ROW1_24(1) LE_ROW1_24(2) ++#define LE_ROW3_32 LE_ROW1_32(0) LE_ROW1_32(1) LE_ROW1_32(2) + +-#define ROW3_8 ROW1_8(0) ROW1_8(1) ROW1_8(2) +-#define ROW3_16 ROW1_16(0) ROW1_16(1) ROW1_16(2) +-#define ROW3_24 ROW1_24(0) ROW1_24(1) ROW1_24(2) +-#define ROW3_32 ROW1_32(0) ROW1_32(1) ROW1_32(2) ++#define BE_ROW3_8 BE_ROW1_8(0) BE_ROW1_8(1) BE_ROW1_8(2) ++#define BE_ROW3_16 BE_ROW1_16(0) BE_ROW1_16(1) BE_ROW1_16(2) ++#define BE_ROW3_24 BE_ROW1_24(0) BE_ROW1_24(1) BE_ROW1_24(2) ++#define BE_ROW3_32 BE_ROW1_32(0) BE_ROW1_32(1) BE_ROW1_32(2) ++ ++#define ROW3_8 if (view->x->needs_swap) { BE_ROW3_8 } else { LE_ROW3_8 } ++#define ROW3_16 LE_ROW3_16 ++#define ROW3_24 LE_ROW3_24 ++#define ROW3_32 LE_ROW3_32 + + #define ROW3 \ + switch (view->x->depth) { \ +@@ -153,8 +157,6 @@ int DynamicData[32]; + ROW3_16 \ + break; \ + case 24: \ +- ROW3_24 \ +- break; \ + case 32: \ + ROW3_32 \ + break; \ +@@ -293,14 +295,26 @@ void drawPower(SimView *view) + case 16: + { + unsigned short *p; +- p = (short *)image; +- p[0] = p[1] = p[2] = pix; ++ p = (unsigned short *)image; ++ if (view->x->x_big_endian) { ++ p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); ++ } else { ++ p[0] = p[1] = p[2] = pix; ++ } + image += lineBytes; +- p = (short *)image; +- p[0] = p[1] = p[2] = pix; ++ p = (unsigned short *)image; ++ if (view->x->x_big_endian) { ++ p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); ++ } else { ++ p[0] = p[1] = p[2] = pix; ++ } + image += lineBytes; +- p = (short *)image; +- p[0] = p[1] = p[2] = pix; ++ p = (unsigned short *)image; ++ if (view->x->x_big_endian) { ++ p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); ++ } else { ++ p[0] = p[1] = p[2] = pix; ++ } + image += lineBytes; + } + break; +@@ -313,12 +327,21 @@ void drawPower(SimView *view) + unsigned char *img = + image; + for (x = 0; x < 4; x++) { +- *(img++) = (pix >> 0) & 0xff; +- *(img++) = (pix >> 8) & 0xff; +- *(img++) = (pix >> 16) & 0xff; +- if (pixelBytes == 4) { +- img++; +- } // if ++ if (view->x->x_big_endian) { ++ if (pixelBytes == 4) { ++ img++; ++ } // if ++ *(img++) = (pix >> 16) & 0xff; ++ *(img++) = (pix >> 8) & 0xff; ++ *(img++) = (pix >> 0) & 0xff; ++ } else { ++ *(img++) = (pix >> 0) & 0xff; ++ *(img++) = (pix >> 8) & 0xff; ++ *(img++) = (pix >> 16) & 0xff; ++ if (pixelBytes == 4) { ++ img++; ++ } // if ++ } + } // for x + image += lineBytes; + } // for y +@@ -344,29 +367,29 @@ int dynamicFilter(int col, int row) + c = col >>1; + + if (((DynamicData[0] > DynamicData[1]) || +- ((x = PopDensity[c][r]) >= DynamicData[0]) && +- (x <= DynamicData[1])) && ++ (((x = PopDensity[c][r]) >= DynamicData[0]) && ++ (x <= DynamicData[1]))) && + ((DynamicData[2] > DynamicData[3]) || +- ((x = RateOGMem[c>>2][r>>2]) >= ((2 * DynamicData[2]) - 256)) && +- (x <= ((2 * DynamicData[3]) - 256))) && ++ (((x = RateOGMem[c>>2][r>>2]) >= ((2 * DynamicData[2]) - 256)) && ++ (x <= ((2 * DynamicData[3]) - 256)))) && + ((DynamicData[4] > DynamicData[5]) || +- ((x = TrfDensity[c][r]) >= DynamicData[4]) && +- (x <= DynamicData[5])) && ++ (((x = TrfDensity[c][r]) >= DynamicData[4]) && ++ (x <= DynamicData[5]))) && + ((DynamicData[6] > DynamicData[7]) || +- ((x = PollutionMem[c][r]) >= DynamicData[6]) && +- (x <= DynamicData[7])) && ++ (((x = PollutionMem[c][r]) >= DynamicData[6]) && ++ (x <= DynamicData[7]))) && + ((DynamicData[8] > DynamicData[9]) || +- ((x = CrimeMem[c][r]) >= DynamicData[8]) && +- (x <= DynamicData[9])) && ++ (((x = CrimeMem[c][r]) >= DynamicData[8]) && ++ (x <= DynamicData[9]))) && + ((DynamicData[10] > DynamicData[11]) || +- ((x = LandValueMem[c][r]) >= DynamicData[10]) && +- (x <= DynamicData[11])) && ++ (((x = LandValueMem[c][r]) >= DynamicData[10]) && ++ (x <= DynamicData[11]))) && + ((DynamicData[12] > DynamicData[13]) || +- ((x = PoliceMapEffect[c>>2][r>>2]) >= DynamicData[12]) && +- (x <= DynamicData[13])) && ++ (((x = PoliceMapEffect[c>>2][r>>2]) >= DynamicData[12]) && ++ (x <= DynamicData[13]))) && + ((DynamicData[14] > DynamicData[15]) || +- ((x = FireRate[c>>2][r>>2]) >= DynamicData[14]) && +- (x <= DynamicData[15]))) { ++ (((x = FireRate[c>>2][r>>2]) >= DynamicData[14]) && ++ (x <= DynamicData[15])))) { + return 1; + } else { + return 0; +diff --git a/src/sim/headers/sim.h b/src/sim/headers/sim.h +index d6a31a1..4529a38 100644 +--- a/src/sim/headers/sim.h ++++ b/src/sim/headers/sim.h +@@ -91,7 +91,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -103,16 +102,13 @@ + #include + #include + #ifndef MSDOS +-#ifndef HPUX +-#include +-#endif + #include + #include + #include + #endif + + #ifdef sun +-#ifdef SOLARIS2 ++#ifdef __SVR4 + #include + #else + #include +@@ -683,9 +679,243 @@ extern SimSprite *GetSprite(); + extern SimSprite *MakeSprite(); + extern SimSprite *MakeNewSprite(); + +-extern int setSpeed(short speed); +-extern int setSkips(int skips); +-extern int SetGameLevel(short level); +-extern int SetGameLevelFunds(short level); +- + extern struct XDisplay *XDisplays; ++ ++/* Functions referenced from other files */ ++/* g_ani.c */ ++void animateTiles(void); ++/* g_bigmap.c */ ++void WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h); ++void MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h); ++/* g_map.c */ ++void setUpMapProcs(void); ++void MemDrawMap(SimView *view); ++/* g_setup.c */ ++void GetViewTiles(SimView *view); ++void GetPixmaps(XDisplay *xd); ++/* g_smmaps.c */ ++void drawAll(SimView *view); ++void drawRes(SimView *view); ++void drawCom(SimView *view); ++void drawInd(SimView *view); ++void drawLilTransMap(SimView *view); ++void drawPower(SimView *view); ++void drawDynamic(SimView *view); ++/* rand.c */ ++int sim_rand(void); ++void sim_srand(u_int seed); ++/* sim.c */ ++void sim_exit(int val); ++void sim_update_editors(void); ++void sim_update(void); ++void sim_init(void); ++void sim_really_exit(int val); ++void sim_loop(int doSim); ++/* s_alloc.c */ ++void initMapArrays(void); ++/* s_disast.c */ ++void DoDisasters(void); ++void DoFlood(void); ++void MakeFlood(void); ++void MakeEarthquake(void); ++void MakeMeltdown(void); ++void MakeFire(void); ++void FireBomb(void); ++/* s_eval.c */ ++void EvalInit(void); ++void CityEvaluation(void); ++int GetFire(void); ++int GetUnemployment(void); ++int AverageTrf(void); ++/* s_fileio.c */ ++int LoadCity(char *filename); ++void SaveCity(void); ++void SaveCityAs(char *filename); ++void LoadScenario(short s); ++/* s_gen.c */ ++void ClearMap(void); ++void SmoothTrees(void); ++void SmoothRiver(void); ++void GenerateSomeCity(int r); ++void ClearUnnatural(void); ++void SmoothWater(void); ++void GenerateNewCity(void); ++/* s_init.c */ ++void ResetMapState(void); ++void ResetEditorState(void); ++void InitWillStuff(void); ++/* s_msg.c */ ++void SendMessages(void); ++void SendMesAt(short Mnum, short x, short y); ++void ClearMes(void); ++int SendMes(int Mnum); ++void SendMesAt(short Mnum, short x, short y); ++void doMessage(void); ++/* s_power.c */ ++void PushPowerStack(void); ++void DoPowerScan(void); ++int MoveMapSim (short MDir); ++/* s_scan.c */ ++void FireAnalysis(void); ++void PopDenScan(void); ++void CrimeScan(void); ++void PTLScan(void); ++/* s_sim.c */ ++void SimFrame(void); ++void DoSimInit(void); ++void SeedRand(int seed); ++void DoMeltdown(int SX, int SY); ++void FireZone(int Xloc, int Yloc, int ch); ++int Rand16(void); ++int Rand16Signed(void); ++void RandomlySeedRand(); ++void RepairZone(short ZCent, short zsize); ++void DoSPZone(short PwrOn); ++void UpdateFundEffects(void); ++/* s_traf.c */ ++int FindPRoad(void); ++int MakeTraf(int Zt); ++/* s_zone.c */ ++void DoZone(void); ++int SetZPower(void); ++int RZPop(int Ch9); ++int CZPop(int Ch9); ++int IZPop(int Ch9); ++int DoFreePop (void); ++/* w_budget.c */ ++void UpdateBudgetWindow(void); ++void InitFundingLevel(void); ++void drawCurrPercents(void); ++void DoBudget(void); ++void drawBudgetWindow(void); ++void DoBudgetFromMenu(void); ++void UpdateBudget(void); ++/* w_con.c */ ++int ConnecTile(short x, short y, short *TileAdrPtr, short Command); ++/* w_date.c */ ++void date_command_init(void); ++/* w_editor.c */ ++void DoUpdateEditor(SimView *view); ++void editor_command_init(void); ++void DoNewEditor(SimView *view); ++/* w_eval.c */ ++void scoreDoer(void); ++void ChangeEval(void); ++/* w_graph.c */ ++void graphDoer(void); ++void initGraphs(void); ++void ChangeCensus(void); ++void doAllGraphs(void); ++void DestroyGraph(SimGraph *graph); ++void InitGraphMax(void); ++void graph_command_init(void); ++int ConfigureSimGraph(Tcl_Interp *interp, SimGraph *graph, int argc, char **argv, int flags); ++/* w_keys.c */ ++void ResetLastKeys(void); ++void doKeyUp(SimView *view, short charCode); ++void doKeyDown(SimView *view, short charCode); ++/* w_map.c */ ++int DoUpdateMap(SimView *view); ++void map_command_init(void); ++void DoNewMap(SimView *view); ++/* w_resrc.c */ ++void GetIndString(char *str, int id, short num); ++/* w_sim.c */ ++void sim_command_init(void); ++/* w_sound.c */ ++void InitializeSound(void); ++void MakeSound(char *channel, char *id); ++void MakeSoundOn(SimView *view, char *channel, char *id); ++void SoundOff(void); ++void StartBulldozer(void); ++void StopBulldozer(void); ++void sound_command_init(void); ++/* w_sprite.c */ ++void MoveObjects(void); ++void MakeExplosion(int x, int y); ++void MakeExplosionAt(int x, int y); ++void GenerateShip(void); ++void GeneratePlane(int x, int y); ++void GenerateCopter(int x, int y); ++void GenerateTrain(int x, int y); ++void MakeMonster(void); ++void MakeTornado(void); ++void MakeAirCrash(void); ++void DestroyAllSprites(void); ++void DrawObjects(SimView *view); ++void sprite_command_init(void); ++/* w_stubs.c */ ++void SetFunds(int dollars); ++void Spend(int dollars); ++void DropFireBombs(void); ++QUAD TickCount(void); ++void GameStarted(void); ++void InitGame(void); ++void ReallyQuit(void); ++/* w_tk.c */ ++void tk_main(void); ++void StopEarthquake(void); ++void CancelRedrawView(SimView *view); ++void RedrawMaps(void); ++void EventuallyRedrawView(SimView *view); ++void StopToolkit(void); ++void InvalidateEditors(void); ++int Eval(char *buf); ++void DoEarthQuake(void); ++void Kick(void); ++void InvalidateMaps(void); ++int ConfigureTileView(Tcl_Interp *interp, SimView *view, int argc, char **argv, int flags); ++void DidStopPan(SimView *view); ++void RedrawEditors(void); ++void StartMicropolisTimer(void); ++void StopMicropolisTimer(void); ++/* w_tool.c */ ++void ToolDrag(SimView *view, int px, int py); ++void ToolUp(SimView *view, int x, int y); ++void ChalkTo(SimView *view, int x, int y); ++void ChalkStart(SimView *view, int x, int y, int color); ++short tally(short tileValue); ++int bulldozer_tool(SimView *view, short x, short y); ++void setWandState(SimView *view, short state); ++void ToolDown(SimView *view, int x, int y); ++void DoTool(SimView *view, short tool, short x, short y); ++/* w_update.c */ ++void DoUpdateHeads(void); ++void UpdateFunds(void); ++void UpdateEvaluation(void); ++void UpdateGraphs(void); ++void UpdateEditors(void); ++void UpdateMaps(void); ++void UpdateHeads(void); ++void doTimeStuff(void); ++/* w_util.c */ ++void DoNewGame(void); ++void setCityName(char *name); ++void setAnyCityName(char *name); ++void DoSetMapState(SimView *view, short state); ++void makeDollarDecimalStr(char *numStr, char *dollarStr); ++int CurrentYear(void); ++void SetYear(int year); ++void Pause(void); ++void Resume(void); ++void setSpeed(short speed); ++void setSkips(int skips); ++void SetGameLevel(short level); ++void SetGameLevelFunds(short level); ++/* w_x.c */ ++void DoTimeoutListen(void); ++void DoStopMicropolis(void); ++void UpdateFlush(void); ++void DoPanTo(struct SimView *view, int x, int y); ++void DoResizeView(SimView *view, int w, int h); ++void DestroyView(SimView *view); ++void ViewToPixelCoords(SimView *view, int x, int y, int *outx, int *outy); ++void FreeInk(Ink *ink); ++void AddInk(Ink *ink, int x, int y); ++void StartInk(Ink *ink, int x, int y); ++void DoPanBy(struct SimView *view, int dx, int dy); ++void ViewToTileCoords(SimView *view, int x, int y, int *outx, int *outy); ++void EraseOverlay(void); ++SimView *InitNewView(SimView *view, char *title, int class, int w, int h); ++void IncRefDisplay(XDisplay *xd); ++void DecRefDisplay(XDisplay *xd); +diff --git a/src/sim/headers/view.h b/src/sim/headers/view.h +index 39931a5..744e0b3 100644 +--- a/src/sim/headers/view.h ++++ b/src/sim/headers/view.h +@@ -113,6 +113,8 @@ typedef struct XDisplay { + Pixmap vert_stipple; + Pixmap horiz_stipple; + Pixmap diag_stipple; ++ int needs_swap; ++ int x_big_endian; + } XDisplay; + + +diff --git a/src/sim/makefile b/src/sim/makefile +index 3497eb2..bdf5847 100644 +--- a/src/sim/makefile ++++ b/src/sim/makefile +@@ -5,17 +5,27 @@ TCLXHOME = ../tclx + TCLLIBRARY = /usr/local/lib/tcl + TKLIBRARY = /usr/local/lib/tk + ++SDLINCLUDE = $$(/bin/sh ./sdl_helper cflags) ++SDLLIBS = $$(/bin/sh ./sdl_helper libs) ++ + CC = gcc + + OPTFLAGS = -O3 + #OPTFLAGS = -g + +-#DEFINES = -DIS_LINUX -DIS_INTEL -DCAM -DNET +-DEFINES = -DIS_LINUX -DIS_INTEL ++#Possible defines: ++#ORIGINAL_MONSTER_BEHAVIOUR: The monster is able to walk over water and not die ++#NO_AIRCRASH: The Aircrash-Disaster is disables completely ++#CAM: ? ++#NET: ? ++ ++#DEFINES = -DIS_LINUX -DCAM -DNET ++DEFINES = -DIS_LINUX -DORIGINAL_MONSTER_BEHAVIOUR #-DNO_AIRCRASH + +-CFLAGS = $(OPTFLAGS) $(DEFINES) ++CFLAGS += $(OPTFLAGS) $(DEFINES) -Wall + + #LDFLAGS = -Bstatic ++LDFLAGS=-L/usr/X11/lib -L/usr/X11R6/lib + + INSTALL = install -s + +@@ -25,7 +35,8 @@ INCLUDES = \ + -I$(XINCLUDE) \ + -I$(TCLHOME) \ + -I$(TCLXHOME)/src \ +- -I$(TKHOME) ++ -I$(TKHOME) \ ++ $(SDLINCLUDE) + + CPPFLAGS = $(INCLUDES) + +@@ -34,7 +45,8 @@ LIBS = $(TCLXHOME)/libtk.a \ + -lm \ + -lX11 \ + -lXext \ +- -lXpm ++ -lXpm \ ++ $(SDLLIBS) + + SRCS = \ + sim.c \ +@@ -96,7 +108,7 @@ all: sim + lint: + alint $(INCLUDES) $(SRCS) > LINT + +-sim: $(ALLOBJS) ++sim: $(ALLOBJS) $(TCLXHOME)/libtk.a $(TCLXHOME)/libtcl.a + $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) $(ALLOBJS) $(LIBS) -o sim + + clean: +diff --git a/src/sim/rand.c b/src/sim/rand.c +index 6311526..54dc9e8 100644 +--- a/src/sim/rand.c ++++ b/src/sim/rand.c +@@ -41,15 +41,14 @@ + static unsigned QUAD next = 1; + + int +-sim_rand() ++sim_rand(void) + { + next = next * 1103515245 + 12345; + return ((next % ((SIM_RAND_MAX + 1) <<8)) >>8); + } + + void +-sim_srand(seed) +-u_int seed; ++sim_srand(u_int seed) + { + next = seed; + } +diff --git a/src/sim/s_alloc.c b/src/sim/s_alloc.c +index 25be874..24b9b4b 100644 +--- a/src/sim/s_alloc.c ++++ b/src/sim/s_alloc.c +@@ -147,7 +147,7 @@ short *MiscHis; + short *PowerMap; + + +-int initMapArrays(void) ++void initMapArrays(void) + { + short i; + unsigned short *auxPtr, *temp1; +diff --git a/src/sim/s_disast.c b/src/sim/s_disast.c +index 691e4f3..65b914d 100644 +--- a/src/sim/s_disast.c ++++ b/src/sim/s_disast.c +@@ -69,8 +69,12 @@ short ShakeNow; + short FloodCnt; + short FloodX, FloodY; + ++void SetFire(void); ++int Vunerable(int tem); ++void ScenarioDisaster(void); + + /* comefrom: Simulate */ ++void + DoDisasters(void) + { + /* Chance of disasters at lev 0 1 2 */ +@@ -97,6 +101,7 @@ DoDisasters(void) + MakeFlood(); + break; + case 4: ++ MakeAirCrash(); + break; + case 5: + MakeTornado(); +@@ -114,10 +119,9 @@ DoDisasters(void) + + + /* comefrom: DoDisasters */ ++void + ScenarioDisaster(void) + { +- int x, y; +- + switch (DisasterEvent) { + case 1: /* Dullsville */ + break; +@@ -147,6 +151,7 @@ ScenarioDisaster(void) + + + /* comefrom: ScenarioDisaster */ ++void + MakeMeltdown(void) + { + short x, y; +@@ -163,7 +168,8 @@ MakeMeltdown(void) + } + + +-FireBomb() ++void ++FireBomb(void) + { + CrashX = Rand(WORLD_X - 1); + CrashY = Rand(WORLD_Y - 1); +@@ -174,6 +180,7 @@ FireBomb() + + + /* comefrom: DoDisasters ScenarioDisaster */ ++void + MakeEarthquake(void) + { + register short x, y, z; +@@ -201,6 +208,7 @@ MakeEarthquake(void) + + + /* comefrom: DoDisasters */ ++void + SetFire(void) + { + register short x, y, z; +@@ -221,6 +229,7 @@ SetFire(void) + + + /* comefrom: DoDisasters */ ++void + MakeFire(void) + { + short t, x, y, z; +@@ -242,6 +251,7 @@ MakeFire(void) + + + /* comefrom: MakeEarthquake */ ++int + Vunerable(int tem) + { + register int tem2; +@@ -256,6 +266,7 @@ Vunerable(int tem) + + + /* comefrom: DoDisasters ScenarioDisaster */ ++void + MakeFlood(void) + { + static short Dx[4] = { 0, 1, 0,-1}; +@@ -289,6 +300,7 @@ MakeFlood(void) + + + /* comefrom: MapScan */ ++void + DoFlood(void) + { + static short Dx[4] = { 0, 1, 0,-1}; +diff --git a/src/sim/s_eval.c b/src/sim/s_eval.c +index acbb6ed..e308229 100644 +--- a/src/sim/s_eval.c ++++ b/src/sim/s_eval.c +@@ -77,8 +77,16 @@ short CityClass; /* 0..5 */ + short CityScore, deltaCityScore, AverageCityScore; + short TrafficAverage; + ++void DoVotes(void); ++void GetScore(void); ++void VoteProblems(void); ++void DoProblems(void); ++void DoPopNum(void); ++void GetAssValue(void); ++ + + /* comefrom: SpecialInit Simulate */ ++void + CityEvaluation(void) + { + EvalValid = 0; +@@ -98,6 +106,7 @@ CityEvaluation(void) + + + /* comefrom: CityEvaluation SetCommonInits */ ++void + EvalInit(void) + { + register short x, z; +@@ -120,6 +129,7 @@ EvalInit(void) + + + /* comefrom: CityEvaluation */ ++void + GetAssValue(void) + { + QUAD z; +@@ -139,6 +149,7 @@ GetAssValue(void) + + + /* comefrom: CityEvaluation */ ++void + DoPopNum(void) + { + QUAD OldCityPop; +@@ -160,10 +171,11 @@ DoPopNum(void) + + + /* comefrom: CityEvaluation */ ++void + DoProblems(void) + { + register short x, z; +- short ThisProb, Max; ++ short ThisProb = 0, Max; + + for (z = 0; z < PROBNUM; z++) + ProblemTable[z] = 0; +@@ -198,9 +210,10 @@ DoProblems(void) + + + /* comefrom: DoProblems */ ++void + VoteProblems(void) + { +- register x, z, count; ++ register int x, z, count; + + for (z = 0; z < PROBNUM; z++) + ProblemVotes[z] = 0; +@@ -221,6 +234,7 @@ VoteProblems(void) + + + /* comefrom: DoProblems */ ++int + AverageTrf(void) + { + QUAD TrfTotal; +@@ -241,6 +255,7 @@ AverageTrf(void) + + + /* comefrom: DoProblems */ ++int + GetUnemployment(void) + { + float r; +@@ -260,6 +275,7 @@ GetUnemployment(void) + + + /* comefrom: DoProblems GetScore */ ++int + GetFire(void) + { + short z; +@@ -273,9 +289,10 @@ GetFire(void) + + + /* comefrom: CityEvaluation */ ++void + GetScore(void) + { +- register x, z; ++ register int x, z; + short OldCityScore; + float SM, TM; + +@@ -329,9 +346,10 @@ GetScore(void) + + + /* comefrom: CityEvaluation */ ++void + DoVotes(void) + { +- register z; ++ register int z; + + CityYes = 0; + CityNo = 0; +diff --git a/src/sim/s_fileio.c b/src/sim/s_fileio.c +index 3768f01..37c2a98 100644 +--- a/src/sim/s_fileio.c ++++ b/src/sim/s_fileio.c +@@ -61,18 +61,27 @@ + */ + #include "sim.h" + ++void DoSaveCityAs(void); ++void DidSaveCity(void); ++void DidntSaveCity(char *msg); ++void DidLoadCity(void); ++void DidntLoadCity(char *msg); ++void DidLoadScenario(void); + +-#if defined(MSDOS) || defined(OSF1) || defined(IS_INTEL) + + #define SWAP_SHORTS(a,b) _swap_shorts(a,b) + #define SWAP_LONGS(a,b) _swap_longs(a,b) + #define HALF_SWAP_LONGS(a,b) _half_swap_longs(a,b) + ++#define NOOP_ON_BE { int test = 1; if (!(*(unsigned char*) (&test))) return; } ++ + static void + _swap_shorts(short *buf, int len) + { + int i; + ++ NOOP_ON_BE; ++ + /* Flip bytes in each short! */ + for (i = 0; i < len; i++) { + *buf = ((*buf & 0xFF) <<8) | ((*buf &0xFF00) >>8); +@@ -80,11 +89,14 @@ _swap_shorts(short *buf, int len) + } + } + ++#if 0 + static void + _swap_longs(long *buf, int len) + { + int i; + ++ NOOP_ON_BE; ++ + /* Flip bytes in each long! */ + for (i = 0; i < len; i++) { + long l = *buf; +@@ -96,12 +108,15 @@ _swap_longs(long *buf, int len) + buf++; + } + } ++#endif + + static void + _half_swap_longs(long *buf, int len) + { + int i; + ++ NOOP_ON_BE ++ + /* Flip bytes in each long! */ + for (i = 0; i < len; i++) { + long l = *buf; +@@ -112,15 +127,6 @@ _half_swap_longs(long *buf, int len) + } + } + +-#else +- +-#define SWAP_SHORTS(a, b) +-#define SWAP_LONGS(a, b) +-#define HALF_SWAP_LONGS(a, b) +- +-#endif +- +- + static int + _load_short(short *buf, int len, FILE *f) + { +@@ -133,6 +139,7 @@ _load_short(short *buf, int len, FILE *f) + } + + ++#if 0 + static int + _load_long(long *buf, int len, FILE *f) + { +@@ -143,6 +150,7 @@ _load_long(long *buf, int len, FILE *f) + + return 1; + } ++#endif + + + static int +@@ -160,6 +168,7 @@ _save_short(short *buf, int len, FILE *f) + } + + ++#if 0 + static int + _save_long(long *buf, int len, FILE *f) + { +@@ -173,6 +182,7 @@ _save_long(long *buf, int len, FILE *f) + + return 1; + } ++#endif + + + static +@@ -376,9 +386,10 @@ int saveFile(char *filename) + } + + ++void + LoadScenario(short s) + { +- char *name, *fname; ++ char *name = NULL, *fname = NULL; + + if (CityFileName != NULL) { + ckfree(CityFileName); +@@ -471,7 +482,8 @@ LoadScenario(short s) + } + + +-DidLoadScenario() ++void ++DidLoadScenario(void) + { + Eval("UIDidLoadScenario"); + } +@@ -488,12 +500,12 @@ int LoadCity(char *filename) + CityFileName = (char *)ckalloc(strlen(filename) + 1); + strcpy(CityFileName, filename); + +- if (cp = (char *)rindex(filename, '.')) ++ if ((cp = (char *)rindex(filename, '.'))) + *cp = 0; + #ifdef MSDOS +- if (cp = (char *)rindex(filename, '\\')) ++ if ((cp = (char *)rindex(filename, '\\'))) + #else +- if (cp = (char *)rindex(filename, '/')) ++ if ((cp = (char *)rindex(filename, '/'))) + #endif + cp++; + else +@@ -517,12 +529,14 @@ int LoadCity(char *filename) + } + + +-DidLoadCity() ++void ++DidLoadCity(void) + { + Eval("UIDidLoadCity"); + } + + ++void + DidntLoadCity(char *msg) + { + char buf[1024]; +@@ -531,7 +545,8 @@ DidntLoadCity(char *msg) + } + + +-SaveCity() ++void ++SaveCity(void) + { + char msg[256]; + +@@ -550,18 +565,21 @@ SaveCity() + } + + +-DoSaveCityAs() ++void ++DoSaveCityAs(void) + { + Eval("UISaveCityAs"); + } + + +-DidSaveCity() ++void ++DidSaveCity(void) + { + Eval("UIDidSaveCity"); + } + + ++void + DidntSaveCity(char *msg) + { + char buf[1024]; +@@ -570,6 +588,7 @@ DidntSaveCity(char *msg) + } + + ++void + SaveCityAs(char *filename) + { + char msg[256]; +@@ -581,12 +600,12 @@ SaveCityAs(char *filename) + strcpy(CityFileName, filename); + + if (saveFile(CityFileName)) { +- if (cp = (char *)rindex(filename, '.')) ++ if ((cp = (char *)rindex(filename, '.'))) + *cp = 0; + #ifdef MSDOS +- if (cp = (char *)rindex(filename, '\\')) ++ if ((cp = (char *)rindex(filename, '\\'))) + #else +- if (cp = (char *)rindex(filename, '/')) ++ if ((cp = (char *)rindex(filename, '/'))) + #endif + cp++; + else +diff --git a/src/sim/s_gen.c b/src/sim/s_gen.c +index 448781a..08bb2e1 100644 +--- a/src/sim/s_gen.c ++++ b/src/sim/s_gen.c +@@ -78,13 +78,27 @@ int LakeLevel = -1; /* level for lake creation */ + int CurveLevel = -1; /* level for river curviness */ + int CreateIsland = -1; /* -1 => 10%, 0 => never, 1 => always */ + +- ++void DoBRiv(void); ++void DoSRiv(void); ++void BRivPlop(void); ++void SRivPlop(void); ++void DoRivers(void); ++void DoTrees(void); ++void GetRandStart(void); ++void MakeLakes(void); ++void MakeIsland(void); ++void MakeNakedIsland(void); ++void GenerateMap(int r); ++ ++ ++void + GenerateNewCity(void) + { + GenerateSomeCity(Rand16()); + } + + ++void + GenerateSomeCity(int r) + { + if (CityFileName != NULL) { +@@ -112,6 +126,7 @@ GenerateSomeCity(int r) + } + + ++int + ERand(short limit) + { + short x, z; +@@ -124,6 +139,7 @@ ERand(short limit) + } + + ++void + GenerateMap(int r) + { + SeedRand(r); +@@ -154,6 +170,7 @@ GenerateMap(int r) + } + + ++void + ClearMap(void) + { + register short x, y; +@@ -164,6 +181,7 @@ ClearMap(void) + } + + ++void + ClearUnnatural(void) + { + register short x, y; +@@ -180,7 +198,8 @@ ClearUnnatural(void) + + #define RADIUS 18 + +-MakeNakedIsland() ++void ++MakeNakedIsland(void) + { + register int x, y; + +@@ -215,6 +234,7 @@ MakeNakedIsland() + } + + ++void + MakeIsland(void) + { + MakeNakedIsland(); +@@ -223,6 +243,7 @@ MakeIsland(void) + } + + ++void + MakeLakes(void) + { + short Lim1, Lim2, t, z; +@@ -249,6 +270,7 @@ MakeLakes(void) + } + + ++void + GetRandStart(void) + { + XStart = 40 + Rand(WORLD_X - 80); +@@ -258,6 +280,7 @@ GetRandStart(void) + } + + ++void + MoveMap(short dir) + { + static short DirTab[2][8] = { { 0, 1, 1, 1, 0, -1, -1, -1}, +@@ -268,10 +291,11 @@ MoveMap(short dir) + } + + ++void + TreeSplash(short xloc, short yloc) + { + short dis, dir; +- register short xoff, yoff, z; ++ register short z; + + if (TreeLevel < 0) { + dis = Rand(150) + 50; +@@ -291,6 +315,7 @@ TreeSplash(short xloc, short yloc) + } + + ++void + DoTrees(void) + { + short Amount, x, xloc, yloc; +@@ -310,6 +335,7 @@ DoTrees(void) + } + + ++void + SmoothRiver(void) + { + static short DX[4] = {-1, 0, 1, 0}; +@@ -346,6 +372,7 @@ SmoothRiver(void) + } + + ++int + IsTree(int cell) + { + if (((cell & LOMASK) >= WOODS_LOW) && +@@ -355,6 +382,7 @@ IsTree(int cell) + } + + ++void + SmoothTrees(void) + { + static short DX[4] = {-1, 0, 1, 0}; +@@ -393,6 +421,7 @@ SmoothTrees(void) + } + + ++void + DoRivers(void) + { + +@@ -411,6 +440,7 @@ DoRivers(void) + } + + ++void + DoBRiv(void) + { + int r1, r2; +@@ -436,6 +466,7 @@ DoBRiv(void) + } + + ++void + DoSRiv(void) + { + int r1, r2; +@@ -461,6 +492,7 @@ DoSRiv(void) + } + + ++void + PutOnMap(short Mchar, short Xoff, short Yoff) + { + register short Xloc, Yloc, temp; +@@ -471,7 +503,7 @@ PutOnMap(short Mchar, short Xoff, short Yoff) + Yloc = MapY + Yoff; + if (TestBounds(Xloc, Yloc) == FALSE) + return; +- if (temp = Map[Xloc][Yloc]) { ++ if ((temp = Map[Xloc][Yloc])) { + temp = temp & LOMASK; + if (temp == RIVER) + if (Mchar != CHANNEL) +@@ -483,6 +515,7 @@ PutOnMap(short Mchar, short Xoff, short Yoff) + } + + ++void + BRivPlop(void) + { + static short BRMatrix[9][9] = { +@@ -503,6 +536,7 @@ BRivPlop(void) + } + + ++void + SRivPlop(void) + { + static short SRMatrix[6][6] = { +@@ -520,7 +554,8 @@ SRivPlop(void) + } + + +-SmoothWater() ++void ++SmoothWater(void) + { + int x, y; + +diff --git a/src/sim/s_init.c b/src/sim/s_init.c +index 7f26308..6283281 100644 +--- a/src/sim/s_init.c ++++ b/src/sim/s_init.c +@@ -66,9 +66,10 @@ + + + /* comefrom: loadFile bootUp main doMessage */ +-InitWillStuff() ++void ++InitWillStuff(void) + { +- register short x, y, z; ++ register short x, y; + + RandomlySeedRand(); + InitGraphMax(); +@@ -131,7 +132,8 @@ InitWillStuff() + } + + +-ResetMapState() ++void ++ResetMapState(void) + { + SimView *view; + +@@ -141,7 +143,8 @@ ResetMapState() + } + + +-ResetEditorState() ++void ++ResetEditorState(void) + { + SimView *view; + +diff --git a/src/sim/s_msg.c b/src/sim/s_msg.c +index 330f125..075949b 100644 +--- a/src/sim/s_msg.c ++++ b/src/sim/s_msg.c +@@ -68,13 +68,20 @@ short LastPicNum; + short autoGo; + short HaveLastMessage = 0; + char LastMessage[256]; +-int DoAutoGoto(short x, short y, char *msg); +-int DoShowPicture(short id); ++ ++void DoAutoGoto(short x, short y, char *msg); ++void DoShowPicture(short id); ++void DoLoseGame(void); ++void SetMessageField(char *str); ++void DoScenarioScore(int type); ++void CheckGrowth(void); ++ + + /* comefrom: Simulate */ ++void + SendMessages(void) + { +- register z; ++ register int z; + short PowerPop; + float TM; + +@@ -186,6 +193,7 @@ SendMessages(void) + + + /* comefrom: SendMessages */ ++void + CheckGrowth(void) + { + QUAD ThisCityPop; +@@ -212,6 +220,7 @@ CheckGrowth(void) + + + /* comefrom: SendMessages */ ++void + DoScenarioScore(int type) + { + short z; +@@ -251,6 +260,7 @@ DoScenarioScore(int type) + } + + ++void + ClearMes(void) + { + MessagePort = 0; +@@ -262,6 +272,7 @@ ClearMes(void) + + /* comefrom: MakeEarthquake MakeFire MakeFire MakeFlood SendMessages + CheckGrowth DoScenarioScore DoPowerScan */ ++int + SendMes(int Mnum) + { + if (Mnum < 0) { +@@ -294,6 +305,7 @@ void SendMesAt(short Mnum, short x, short y) + } + + ++void + doMessage(void) + { + char messageStr[256]; +@@ -340,7 +352,7 @@ doMessage(void) + MakeSound("city", "Siren"); + break; + case 21: +- MakeSound("city", "Monster -speed [MonsterSpeed]"); ++ MakeSound("city", "Monster"); + break; + case 30: + MakeSound("city", "Explosion-Low"); +@@ -401,6 +413,7 @@ doMessage(void) + } + + ++void + DoAutoGoto(short x, short y, char *msg) + { + char buf[256]; +@@ -411,6 +424,7 @@ DoAutoGoto(short x, short y, char *msg) + } + + ++void + SetMessageField(char *str) + { + char buf[256]; +@@ -425,6 +439,7 @@ SetMessageField(char *str) + } + + ++void + DoShowPicture(short id) + { + char buf[256]; +@@ -434,13 +449,15 @@ DoShowPicture(short id) + } + + +-DoLoseGame() ++void ++DoLoseGame(void) + { + Eval("UILoseGame"); + } + + +-DoWinGame() ++void ++DoWinGame(void) + { + Eval("UIWinGame"); + } +diff --git a/src/sim/s_power.c b/src/sim/s_power.c +index 5d309b3..16d69fe 100644 +--- a/src/sim/s_power.c ++++ b/src/sim/s_power.c +@@ -69,8 +69,11 @@ int PowerStackNum; + char PowerStackX[PWRSTKSIZE], PowerStackY[PWRSTKSIZE]; + QUAD MaxPower, NumPower; + ++void PullPowerStack(void); ++ + + /* comefrom: TestForCond DoPowerScan TryGo */ ++int + MoveMapSim (short MDir) + { + switch (MDir) { +@@ -183,7 +186,8 @@ short TestForCond(short TFDir) + + + /* comefrom: Simulate SpecialInit InitSimMemory */ +-DoPowerScan() ++void ++DoPowerScan(void) + { + short ADir; + register int ConNum, Dir, x; +@@ -230,6 +234,7 @@ DoPowerScan() + + + /* comefrom: DoPowerScan DoSPZone */ ++void + PushPowerStack(void) + { + if (PowerStackNum < (PWRSTKSIZE - 2)) { +@@ -241,6 +246,7 @@ PushPowerStack(void) + + + /* comefrom: DoPowerScan */ ++void + PullPowerStack(void) + { + if (PowerStackNum > 0) { +diff --git a/src/sim/s_scan.c b/src/sim/s_scan.c +index 20a7d62..35cc082 100644 +--- a/src/sim/s_scan.c ++++ b/src/sim/s_scan.c +@@ -72,11 +72,23 @@ short PolMaxX, PolMaxY; + short CrimeMaxX, CrimeMaxY; + QUAD DonDither = 0; + ++void DistIntMarket(void); ++void SmoothPSMap(void); ++void SmoothFSMap(void); ++void ClrTemArray(void); ++void DoSmooth (void); ++void DoSmooth2 (void); ++void SmoothTerrain(void); ++int GetPValue(int loc); ++int GetDisCC(int x, int y); ++int GetPDen(int Ch9); ++ + + /* comefrom: Simulate SpecialInit */ ++void + FireAnalysis(void) /* Make firerate map from firestation map */ + { +- register x,y; ++ register int x,y; + + SmoothFSMap(); + SmoothFSMap(); +@@ -90,6 +102,7 @@ FireAnalysis(void) /* Make firerate map from firestation map */ + + + /* comefrom: Simulate SpecialInit */ ++void + PopDenScan(void) /* sets: PopDensity, , , ComRate */ + { + QUAD Xtot, Ytot, Ztot; +@@ -139,12 +152,13 @@ PopDenScan(void) /* sets: PopDensity, , , ComRate */ + + + /* comefrom: PopDenScan */ ++int + GetPDen(int Ch9) + { + register int pop; + + if (Ch9 == FREEZ) { +- pop = DoFreePop(Ch9); ++ pop = DoFreePop(/*Ch9*/); + return (pop); + } + if (Ch9 < COMBASE) { +@@ -164,6 +178,7 @@ GetPDen(int Ch9) + + + /* comefrom: Simulate SpecialInit */ ++void + PTLScan(void) /* Does pollution, terrain, land value */ + { + QUAD ptot, LVtot; +@@ -183,7 +198,7 @@ PTLScan(void) /* Does pollution, terrain, land value */ + zy = y <<1; + for (Mx = zx; Mx <= zx + 1; Mx++) + for (My = zy; My <= zy + 1; My++) { +- if (loc = (Map[Mx][My] & LOMASK)) { ++ if ((loc = (Map[Mx][My] & LOMASK))) { + if (loc < RUBBLE) { + Qtem[x >>1][y >>1] += 15; /* inc terrainMem */ + continue; +@@ -254,6 +269,7 @@ PTLScan(void) /* Does pollution, terrain, land value */ + + + /* comefrom: PTLScan */ ++int + GetPValue(int loc) + { + if (loc < POWERBASE) { +@@ -274,6 +290,7 @@ GetPValue(int loc) + + + /* comefrom: PTLScan DistIntMarket */ ++int + GetDisCC(int x, int y) + { + short xdis, ydis, z; +@@ -297,6 +314,7 @@ GetDisCC(int x, int y) + + + /* comefrom: Simulate SpecialInit */ ++void + CrimeScan(void) + { + short numz; +@@ -312,7 +330,7 @@ CrimeScan(void) + cmax = 0; + for (x = 0; x < HWLDX; x++) + for (y = 0; y < HWLDY; y++) { +- if (z = LandValueMem[x][y]) { ++ if ((z = LandValueMem[x][y])) { + ++numz; + z = 128 - z; + z += PopDensity[x][y]; +@@ -344,6 +362,7 @@ CrimeScan(void) + + + /* comefrom: PTLScan */ ++void + SmoothTerrain(void) + { + if (DonDither & 1) { +@@ -378,6 +397,7 @@ SmoothTerrain(void) + } + + /* comefrom: PopDenScan */ ++void + DoSmooth (void) /* smooths data in tem[x][y] into tem2[x][y] */ + { + if (DonDither & 2) { +@@ -425,6 +445,7 @@ DoSmooth (void) /* smooths data in tem[x][y] into tem2[x][y] */ + + + /* comefrom: PopDenScan */ ++void + DoSmooth2 (void) /* smooths data in tem2[x][y] into tem[x][y] */ + { + if (DonDither & 4) { +@@ -472,6 +493,7 @@ DoSmooth2 (void) /* smooths data in tem2[x][y] into tem[x][y] */ + + + /* comefrom: PopDenScan */ ++void + ClrTemArray(void) + { + register short x, y, z; +@@ -484,6 +506,7 @@ ClrTemArray(void) + + + /* comefrom: FireAnalysis */ ++void + SmoothFSMap(void) + { + register short x, y, edge; +@@ -505,9 +528,10 @@ SmoothFSMap(void) + + + /* comefrom: CrimeScan */ ++void + SmoothPSMap(void) + { +- register x, y, edge; ++ register int x, y, edge; + + for (x = 0; x < SmX; x++) + for (y = 0; y < SmY; y++) { +@@ -526,6 +550,7 @@ SmoothPSMap(void) + + + /* comefrom: PopDenScan */ ++void + DistIntMarket(void) + { + register short x, y, z; +diff --git a/src/sim/s_sim.c b/src/sim/s_sim.c +index 6f4b0bb..9d0e4c6 100644 +--- a/src/sim/s_sim.c ++++ b/src/sim/s_sim.c +@@ -85,12 +85,31 @@ short Spdcycle = 0; + short DoInitialEval = 0; + short MeltX, MeltY; + ++void CoalSmoke(int mx, int my); ++void DoAirport(void); ++void DrawStadium(int z); ++void DoFire(void); ++int GetBoatDis(void); ++int DoBridge(void); ++void DoRoad(void); ++void DoRadTile(void); ++void DoRail(void); ++void MapScan(int x1, int x2); ++void CollectTax(void); ++void Take2Census(void); ++void TakeCensus(void); ++void ClearCensus(void); ++void SetValves(void); ++void SetCommonInits(void); ++void SimLoadInit(void); ++void InitSimMemory(void); ++void DecROGMem(void); ++void DecTrafficMem(void); ++void Simulate(int mod16); + + /* comefrom: doEditWindow scoreDoer doMapInFront graphDoer doNilEvent */ +-SimFrame(void) ++void SimFrame(void) + { +- short i; +- + if (SimSpeed == 0) + return; + +@@ -110,6 +129,7 @@ SimFrame(void) + + + /* comefrom: SimFrame */ ++void + Simulate(int mod16) + { + static short SpdPwr[4] = { 1, 2, 4, 5 }; +@@ -204,6 +224,7 @@ Simulate(int mod16) + + + /* comefrom: Simulate */ ++void + DoSimInit(void) + { + Fcycle = 0; +@@ -235,6 +256,7 @@ DoSimInit(void) + + + /* comefrom: SimLoadInit */ ++void + DoNilPower(void) + { + register short x, y, z; +@@ -253,13 +275,14 @@ DoNilPower(void) + + + /* comefrom: Simulate */ ++void + DecTrafficMem(void) /* tends to empty TrfDensity */ + { + register short x, y, z; + + for (x = 0; x < HWLDX; x++) + for (y = 0; y < HWLDY; y++) +- if (z = TrfDensity[x][y]) { ++ if ((z = TrfDensity[x][y])) { + if (z > 24) { + if (z > 200) TrfDensity[x][y] = z - 34; + else TrfDensity[x][y] = z - 24; +@@ -270,6 +293,7 @@ DecTrafficMem(void) /* tends to empty TrfDensity */ + + + /* comefrom: Simulate */ ++void + DecROGMem(void) /* tends to empty RateOGMem */ + { + register short x, y, z; +@@ -292,6 +316,7 @@ DecROGMem(void) /* tends to empty RateOGMem */ + + + /* comefrom: DoSimInit */ ++void + InitSimMemory(void) + { + register short x, z; +@@ -330,6 +355,7 @@ InitSimMemory(void) + + + /* comefrom: DoSimInit */ ++void + SimLoadInit(void) + { + static short DisTab[9] = { 0, 2, 10, 5, 20, 3, 5, 5, 2 * 48}; +@@ -395,6 +421,7 @@ SimLoadInit(void) + + + /* comefrom: InitSimMemory SimLoadInit */ ++void + SetCommonInits(void) + { + EvalInit(); +@@ -411,6 +438,7 @@ SetCommonInits(void) + + + /* comefrom: Simulate DoSimInit */ ++void + SetValves(void) + { + static short TaxTable[21] = { +@@ -448,7 +476,7 @@ SetValves(void) + Births = NormResPop * (.02); /* Birth Rate */ + PjResPop = NormResPop + Migration + Births; /* Projected Res.Pop */ + +- if (temp = (ComHis[1] + IndHis[1])) LaborBase = (ResHis[1] / temp); ++ if ((temp = (ComHis[1] + IndHis[1]))) LaborBase = (ResHis[1] / temp); + else LaborBase = 1; + if (LaborBase > 1.3) LaborBase = 1.3; + if (LaborBase < 0) LaborBase = 0; /* LB > 1 - .1 */ +@@ -521,6 +549,7 @@ SetValves(void) + + + /* comefrom: Simulate DoSimInit */ ++void + ClearCensus(void) + { + register short x, y, z; +@@ -556,6 +585,7 @@ ClearCensus(void) + + + /* comefrom: Simulate */ ++void + TakeCensus(void) + { + short x; +@@ -608,6 +638,7 @@ TakeCensus(void) + + + /* comefrom: Simulate */ ++void + Take2Census(void) /* Long Term Graphs */ + { + short x; +@@ -638,6 +669,7 @@ Take2Census(void) /* Long Term Graphs */ + + + /* comefrom: Simulate */ ++void + CollectTax(void) + { + static float RLevels[3] = { 0.7, 0.9, 1.2 }; +@@ -667,6 +699,7 @@ CollectTax(void) + } + + ++void + UpdateFundEffects(void) + { + if (RoadFund) +@@ -692,13 +725,14 @@ UpdateFundEffects(void) + + + /* comefrom: Simulate DoSimInit */ ++void + MapScan(int x1, int x2) + { + register short x, y; + + for (x = x1; x < x2; x++) { + for (y = 0; y < WORLD_Y; y++) { +- if (CChr = Map[x][y]) { ++ if ((CChr = Map[x][y])) { + CChr9 = CChr & LOMASK; /* Mask off status bits */ + if (CChr9 >= FLOOD) { + SMapX = x; +@@ -744,6 +778,7 @@ MapScan(int x1, int x2) + + + /* comefrom: MapScan */ ++void + DoRail(void) + { + RailTotal++; +@@ -762,6 +797,7 @@ DoRail(void) + + + /* comefrom: MapScan */ ++void + DoRadTile(void) + { + if (!(Rand16() & 4095)) Map[SMapX][SMapY] = 0; /* Radioactive decay */ +@@ -769,6 +805,7 @@ DoRadTile(void) + + + /* comefrom: MapScan */ ++void + DoRoad(void) + { + register short Density, tden, z; +@@ -810,6 +847,7 @@ DoRoad(void) + + + /* comefrom: MapScan */ ++int + DoBridge(void) + { + static short HDx[7] = { -2, 2, -2, -1, 0, 1, 2 }; +@@ -828,7 +866,7 @@ DoBridge(void) + static short VBRTAB2[7] = { + VBRIDGE | BULLBIT, RIVER, VBRIDGE | BULLBIT, VBRIDGE | BULLBIT, + VBRIDGE | BULLBIT, VBRIDGE | BULLBIT, RIVER }; +- register z, x, y, MPtem; ++ register int z, x, y, MPtem; + + if (CChr9 == BRWV) { /* Vertical bridge close */ + if ((!(Rand16() & 3)) && +@@ -918,6 +956,7 @@ GetBoatDis(void) + + + /* comefrom: MapScan */ ++void + DoFire(void) + { + static short DX[4] = { -1, 0, 1, 0 }; +@@ -955,6 +994,7 @@ DoFire(void) + + + /* comefrom: DoFire MakeFlood */ ++void + FireZone(int Xloc, int Yloc, int ch) + { + register short Xtem, Ytem; +@@ -985,6 +1025,7 @@ FireZone(int Xloc, int Yloc, int ch) + + + /* comefrom: DoSPZone DoHospChur */ ++void + RepairZone(short ZCent, short zsize) + { + short cnt; +@@ -1011,10 +1052,11 @@ RepairZone(short ZCent, short zsize) + + + /* comefrom: DoZone */ ++void + DoSPZone(short PwrOn) + { + static short MltdwnTab[3] = { 30000, 20000, 10000 }; /* simadj */ +- register z; ++ register int z; + + switch (CChr9) { + +@@ -1117,6 +1159,7 @@ DoSPZone(short PwrOn) + + + /* comefrom: DoSPZone */ ++void + DrawStadium(int z) + { + register int x, y; +@@ -1130,6 +1173,7 @@ DrawStadium(int z) + + + /* comefrom: DoSPZone */ ++void + DoAirport(void) + { + if (!(Rand(5))) { +@@ -1142,6 +1186,7 @@ DoAirport(void) + + + /* comefrom: DoSPZone */ ++void + CoalSmoke(int mx, int my) + { + static short SmTb[4] = { COALSMOKE1, COALSMOKE2, COALSMOKE3, COALSMOKE4 }; +@@ -1156,9 +1201,10 @@ CoalSmoke(int mx, int my) + + + /* comefrom: DoSPZone MakeMeltdown */ ++void + DoMeltdown(int SX, int SY) + { +- register x, y, z, t; ++ register int x, y, z, t; + + MeltX = SX; MeltY = SY; + +@@ -1224,6 +1270,7 @@ Rand16Signed(void) + } + + ++void + RandomlySeedRand() + { + struct timeval time; +@@ -1233,7 +1280,7 @@ RandomlySeedRand() + SeedRand(time.tv_usec ^ time.tv_sec ^ sim_rand()); + } + +- ++void + SeedRand(int seed) + { + sim_srand(seed); +diff --git a/src/sim/s_traf.c b/src/sim/s_traf.c +index 37f1d45..1aa043d 100644 +--- a/src/sim/s_traf.c ++++ b/src/sim/s_traf.c +@@ -72,8 +72,17 @@ short LDir; + short Zsource; + short TrafMaxX, TrafMaxY; + ++int GetFromMap(int x); ++int DriveDone(void); ++int TryGo(int z); ++int RoadTest(int x); ++void PullPos(void); ++void SetTrafMem(void); ++int TryDrive(void); ++ + + /* comefrom: DoIndustrial DoCommercial DoResidential */ ++int + MakeTraf(int Zt) + { + short xtem, ytem; +@@ -106,6 +115,7 @@ MakeTraf(int Zt) + + + /* comefrom: MakeTraf */ ++void + SetTrafMem(void) + { + register short x, z; +@@ -139,6 +149,7 @@ SetTrafMem(void) + + + /* comefrom: TryGo */ ++void + PushPos(void) + { + PosStackN++; +@@ -148,6 +159,7 @@ PushPos(void) + + + /* comefrom: SetTrafMem */ ++void + PullPos(void) + { + SMapX = SMapXStack[PosStackN]; +@@ -157,6 +169,7 @@ PullPos(void) + + + /* comefrom: DoSPZone MakeTraf */ ++int + FindPRoad(void) /* look for road on edges of zone */ + { + static short PerimX[12] = {-1, 0, 1, 2, 2, 2, 1, 0,-1,-2,-2,-2}; +@@ -178,6 +191,7 @@ FindPRoad(void) /* look for road on edges of zone */ + } + + ++int + FindPTele(void) /* look for telecommunication on edges of zone */ + { + static short PerimX[12] = {-1, 0, 1, 2, 2, 2, 1, 0,-1,-2,-2,-2}; +@@ -199,6 +213,7 @@ FindPTele(void) /* look for telecommunication on edges of zone */ + + + /* comefrom: MakeTraf */ ++int + TryDrive(void) + { + short z; +@@ -221,6 +236,7 @@ TryDrive(void) + + + /* comefrom: TryDrive */ ++int + TryGo(int z) + { + short x, rdir, realdir; +@@ -246,6 +262,7 @@ TryGo(int z) + + + /* comefrom: TryGo DriveDone */ ++int + GetFromMap(int x) + { + switch (x) { +@@ -272,11 +289,15 @@ GetFromMap(int x) + + + /* comefrom: TryDrive */ ++int + DriveDone(void) + { + static short TARGL[3] = {COMBASE, LHTHR, LHTHR}; + static short TARGH[3] = {NUCLEAR, PORT, COMBASE}; /* for destinations */ +- register short x, z, l, h; ++#if 0 ++ register short x; ++#endif ++ register short z, l, h; + + /* unwound -Don */ + #if 0 +@@ -316,6 +337,7 @@ DriveDone(void) + + + /* comefrom: TryGo FindPRoad */ ++int + RoadTest(int x) + { + x = x & LOMASK; +diff --git a/src/sim/s_zone.c b/src/sim/s_zone.c +index ab9f3d7..4ba6cde 100644 +--- a/src/sim/s_zone.c ++++ b/src/sim/s_zone.c +@@ -64,8 +64,31 @@ + + /* Zone Stuff */ + +- +-DoZone(void) ++void ZonePlop (int base); ++void IndPlop (int Den, int Value); ++void ComPlop (int Den, int Value); ++void ResPlop (int Den, int Value); ++int EvalLot (int x, int y); ++void BuildHouse(int value); ++void DoIndOut(int pop, int value); ++void DoComOut(int pop, int value); ++void DoResOut(int pop, int value); ++void IncROG(int amount); ++void DoIndIn(int pop, int value); ++void DoComIn(int pop, int value); ++void DoResIn(int pop, int value); ++void MakeHosp(void); ++void DoResidential(int ZonePwrFlg); ++int EvalRes (int traf); ++int EvalCom (int traf); ++int GetCRVal(void); ++void DoCommercial(int ZonePwrFlg); ++void DoIndustrial(int ZonePwrFlg); ++int EvalInd (int traf); ++void DoHospChur(void); ++ ++ ++void DoZone(void) + { + short ZonePwrFlg; + +@@ -94,6 +117,7 @@ DoZone(void) + } + + ++void + DoHospChur(void) + { + if (CChr9 == HOSPITAL) { +@@ -118,13 +142,16 @@ DoHospChur(void) + #define ASCBIT (ANIMBIT | CONDBIT | BURNBIT) + #define REGBIT (CONDBIT | BURNBIT) + ++void + SetSmoke(int ZonePower) + { + static short AniThis[8] = { T, F, T, T, F, F, T, T }; + static short DX1[8] = { -1, 0, 1, 0, 0, 0, 0, 1 }; + static short DY1[8] = { -1, 0, -1, -1, 0, 0, -1, -1 }; ++#if 0 + static short DX2[8] = { -1, 0, 1, 1, 0, 0, 1, 1 }; + static short DY2[8] = { -1, 0, 0, -1, 0, 0, -1, 0 }; ++#endif + static short AniTabA[8] = { 0, 0, 32, 40, 0, 0, 48, 56 }; + static short AniTabB[8] = { 0, 0, 36, 44, 0, 0, 52, 60 }; + static short AniTabC[8] = { IND1, 0, IND2, IND4, 0, 0, IND6, IND8 }; +@@ -158,6 +185,7 @@ SetSmoke(int ZonePower) + } + + ++void + DoIndustrial(int ZonePwrFlg) + { + short tpop, zscore, TrfGood; +@@ -189,6 +217,7 @@ DoIndustrial(int ZonePwrFlg) + } + + ++void + DoCommercial(int ZonePwrFlg) + { + register short tpop, TrfGood; +@@ -227,6 +256,7 @@ DoCommercial(int ZonePwrFlg) + } + + ++void + DoResidential(int ZonePwrFlg) + { + short tpop, zscore, locvalve, value, TrfGood; +@@ -269,6 +299,7 @@ DoResidential(int ZonePwrFlg) + } + + ++void + MakeHosp(void) + { + if (NeedHosp > 0) { +@@ -284,6 +315,7 @@ MakeHosp(void) + } + + ++int + GetCRVal(void) + { + register short LVal; +@@ -297,6 +329,7 @@ GetCRVal(void) + } + + ++void + DoResIn(int pop, int value) + { + short z; +@@ -324,6 +357,7 @@ DoResIn(int pop, int value) + } + + ++void + DoComIn(int pop, int value) + { + register short z; +@@ -339,6 +373,7 @@ DoComIn(int pop, int value) + } + + ++void + DoIndIn(int pop, int value) + { + if (pop < 4) { +@@ -348,12 +383,14 @@ DoIndIn(int pop, int value) + } + + ++void + IncROG(int amount) + { + RateOGMem[SMapX>>3][SMapY>>3] += amount<<2; + } + + ++void + DoResOut(int pop, int value) + { + static short Brdr[9] = {0,3,6,1,4,7,2,5,8}; +@@ -397,6 +434,7 @@ DoResOut(int pop, int value) + } + + ++void + DoComOut(int pop, int value) + { + if (pop > 1) { +@@ -411,6 +449,7 @@ DoComOut(int pop, int value) + } + + ++void + DoIndOut(int pop, int value) + { + if (pop > 1) { +@@ -425,6 +464,7 @@ DoIndOut(int pop, int value) + } + + ++int + RZPop(int Ch9) + { + short CzDen; +@@ -434,6 +474,7 @@ RZPop(int Ch9) + } + + ++int + CZPop(int Ch9) + { + short CzDen; +@@ -444,6 +485,7 @@ CZPop(int Ch9) + } + + ++int + IZPop(int Ch9) + { + short CzDen; +@@ -454,6 +496,7 @@ IZPop(int Ch9) + } + + ++void + BuildHouse(int value) + { + short z, score, hscore, BestLoc; +@@ -487,6 +530,7 @@ BuildHouse(int value) + } + + ++void + ResPlop (int Den, int Value) + { + short base; +@@ -496,6 +540,7 @@ ResPlop (int Den, int Value) + } + + ++void + ComPlop (int Den, int Value) + { + short base; +@@ -505,6 +550,7 @@ ComPlop (int Den, int Value) + } + + ++void + IndPlop (int Den, int Value) + { + short base; +@@ -514,6 +560,7 @@ IndPlop (int Den, int Value) + } + + ++int + EvalLot (int x, int y) + { + short z, score; +@@ -538,6 +585,7 @@ EvalLot (int x, int y) + } + + ++void + ZonePlop (int base) + { + short z, x; +@@ -549,7 +597,7 @@ ZonePlop (int base) + int yy = SMapY + Zy[z]; + if (TestBounds(xx, yy)) { + x = Map[xx][yy] & LOMASK; +- if ((x >= FLOOD) && (x < ROADBASE)) return (FALSE); ++ if ((x >= FLOOD) && (x < ROADBASE)) return; + } + } + for (z = 0; z < 9; z++) { +@@ -566,6 +614,7 @@ ZonePlop (int base) + } + + ++int + EvalRes (int traf) + { + register short Value; +@@ -585,6 +634,7 @@ EvalRes (int traf) + } + + ++int + EvalCom (int traf) + { + short Value; +@@ -595,6 +645,7 @@ EvalCom (int traf) + } + + ++int + EvalInd (int traf) + { + if (traf < 0) return (-1000); +@@ -602,6 +653,7 @@ EvalInd (int traf) + } + + ++int + DoFreePop (void) + { + short count; +@@ -621,9 +673,12 @@ DoFreePop (void) + } + + ++int + SetZPower(void) /* set bit in MapWord depending on powermap */ + { ++#if 0 + short z; ++#endif + QUAD PowerWrd; + + /* TestPowerBit was taking alot of time so I inlined it. -Don */ +diff --git a/src/sim/sdl_helper b/src/sim/sdl_helper +new file mode 100644 +index 0000000..07ba129 +--- /dev/null ++++ b/src/sim/sdl_helper +@@ -0,0 +1,46 @@ ++SDLINCLUDE="`pkg-config --cflags sdl 2>/dev/null`" ++SDLLIBS="`pkg-config --libs-only-L sdl 2>/dev/null` `pkg-config --libs-only-l sdl 2>/dev/null`" ++ ++found=0 ++ ++if echo '#include '|(cpp ${SDLINCLUDE}) >/dev/null 2>&1; then ++ found=1 ++else ++ for flag in ${SDLINCLUDE}; do ++ if echo "${flag}" | grep '^-I' >/dev/null 2>&1; then ++ sdlpath="$(echo "${flag}"| sed -e 's/^-I//')" ++ if [ -f "${sdlpath}/SDL_mixer.h" ]; then ++ found=1 ++ break ++ fi ++ fi ++ done ++fi ++ ++if [ "${found}" = "1" ]; then ++ SDLINCLUDE="${SDLINCLUDE} -DWITH_SDL_MIXER" ++ SDLLIBS="${SDLLIBS} -lSDL_mixer" ++else ++ found=0 ++ ++ for sdlpath in /usr /usr/local /opt/local /opt/csw /sw; do ++ if [ -f "${sdlpath}/include/SDL/SDL_mixer.h" ]; then ++ SDLINCLUDE="${SDLINCLUDE} -I${sdlpath}/include/SDL -DWITH_SDL_MIXER" ++ SDLLIBS="${SDLLIBS} -L${sdlpath}/lib -lSDL -lSDL_mixer" ++ ++ found=1 ++ break ++ fi ++ done ++ ++ if [ "${found}" = "0" ]; then ++ SDLINCLUDE="" ++ SDLLIBS="" ++ fi ++fi ++ ++if [ "${1}" = "cflags" ]; then ++ echo "${SDLINCLUDE}" ++elif [ "${1}" = "libs" ]; then ++ echo "${SDLLIBS}" ++fi +diff --git a/src/sim/sim.c b/src/sim/sim.c +index 79a7817..4b2748c 100644 +--- a/src/sim/sim.c ++++ b/src/sim/sim.c +@@ -61,6 +61,12 @@ + */ + #include "sim.h" + ++void signal_init(); ++void sim_update_evaluations(void); ++void sim_update_editors(void); ++void sim_update_budgets(void); ++void sim_update_graphs(void); ++void sim_update_maps(void); + + /* Sim City */ + +@@ -97,6 +103,7 @@ char *FirstDisplay = NULL; + int ExitReturn = 0; + + ++void + sim_exit(int val) + { + tkMustExit = 1; +@@ -104,7 +111,7 @@ sim_exit(int val) + } + + +-sim_really_exit(int val) ++void sim_really_exit(int val) + { + DoStopMicropolis(); + +@@ -236,6 +243,7 @@ SignalExitHandler() + } + + ++void + signal_init() + { + signal(SIGHUP, (void (*)())SignalExitHandler); +@@ -246,7 +254,7 @@ signal_init() + + + void +-sim_update() ++sim_update(void) + { + gettimeofday(&now_time, NULL); + +@@ -267,6 +275,7 @@ sim_update() + } + + ++void + sim_update_editors(void) + { + SimView *view; +@@ -285,6 +294,7 @@ sim_update_editors(void) + } + + ++void + sim_update_maps(void) + { + SimView *view; +@@ -319,12 +329,14 @@ sim_update_maps(void) + } + + ++void + sim_update_graphs(void) + { + graphDoer(); + } + + ++void + sim_update_budgets(void) + { + if ((sim_skips != 0) && +@@ -336,6 +348,7 @@ sim_update_budgets(void) + } + + ++void + sim_update_evaluations(void) + { + if ((sim_skips != 0) && +@@ -409,7 +422,7 @@ short *CellDst = NULL; + void + sim_heat(void) + { +- int x, y, l, r, u, d; ++ int x, y; + static int a = 0; + short *src, *dst; + register int fl = heat_flow; +@@ -546,7 +559,6 @@ sim_heat(void) + } + } + +- + void + sim_timeout_loop(short doSim) + { +@@ -557,6 +569,7 @@ sim_timeout_loop(short doSim) + } + + ++void + sim_loop(int doSim) + { + #ifdef CAM +diff --git a/src/sim/w_budget.c b/src/sim/w_budget.c +index 5fc5e4f..ce0651e 100644 +--- a/src/sim/w_budget.c ++++ b/src/sim/w_budget.c +@@ -73,8 +73,14 @@ QUAD policeMaxValue; + QUAD fireMaxValue; + int MustDrawCurrPercents = 0; + int MustDrawBudgetWindow = 0; +-int SetBudget(char *flowStr, char *previousStr, +- char *currentStr, char *collectedStr, short tax); ++ ++void SetBudget(char *flowStr, char *previousStr, ++ char *currentStr, char *collectedStr, short tax); ++void SetBudgetValues(char *roadGot, char *roadWant, ++ char *policeGot, char *policeWant, ++ char *fireGot, char *fireWant); ++void ShowBudgetWindowAndStartWaiting(void); ++void DoBudgetNow(int fromMenu); + + + void InitFundingLevel(void) +@@ -90,18 +96,21 @@ void InitFundingLevel(void) + } + + +-DoBudget() ++void ++DoBudget(void) + { + DoBudgetNow(0); + } + + +-DoBudgetFromMenu() ++void ++DoBudgetFromMenu(void) + { + DoBudgetNow(1); + } + + ++void + DoBudgetNow(int fromMenu) + { + QUAD yumDuckets; +@@ -218,12 +227,14 @@ DoBudgetNow(int fromMenu) + } + + ++void + drawBudgetWindow(void) + { + MustDrawBudgetWindow = 1; + } + + ++void + ReallyDrawBudgetWindow(void) + { + short cashFlow, cashFlow2; +@@ -244,38 +255,40 @@ ReallyDrawBudgetWindow(void) + sprintf(flowStr, "+%s", dollarStr); + } + +- sprintf(numStr, "%d", TotalFunds); ++ sprintf(numStr, "%ld", TotalFunds); + makeDollarDecimalStr(numStr, previousStr); + +- sprintf(numStr, "%d", cashFlow2 + TotalFunds); ++ sprintf(numStr, "%ld", cashFlow2 + TotalFunds); + makeDollarDecimalStr(numStr, currentStr); + +- sprintf(numStr, "%d", TaxFund); ++ sprintf(numStr, "%ld", TaxFund); + makeDollarDecimalStr(numStr, collectedStr); + + SetBudget(flowStr, previousStr, currentStr, collectedStr, CityTax); + } + + ++void + drawCurrPercents(void) + { + MustDrawCurrPercents = 1; + } + + ++void + ReallyDrawCurrPercents(void) + { + char num[256]; + char fireWant[256], policeWant[256], roadWant[256]; + char fireGot[256], policeGot[256], roadGot[256]; + +- sprintf(num, "%d", fireMaxValue); ++ sprintf(num, "%ld", fireMaxValue); + makeDollarDecimalStr(num, fireWant); + +- sprintf(num, "%d", policeMaxValue); ++ sprintf(num, "%ld", policeMaxValue); + makeDollarDecimalStr(num, policeWant); + +- sprintf(num, "%d", roadMaxValue); ++ sprintf(num, "%ld", roadMaxValue); + makeDollarDecimalStr(num, roadWant); + + sprintf(num, "%d", (int)(fireMaxValue * firePercent)); +@@ -293,7 +306,8 @@ ReallyDrawCurrPercents(void) + } + + +-UpdateBudgetWindow() ++void ++UpdateBudgetWindow(void) + { + if (MustDrawCurrPercents) { + ReallyDrawCurrPercents(); +@@ -306,7 +320,8 @@ UpdateBudgetWindow() + } + + +-UpdateBudget() ++void ++UpdateBudget(void) + { + drawCurrPercents(); + drawBudgetWindow(); +@@ -314,7 +329,8 @@ UpdateBudget() + } + + +-ShowBudgetWindowAndStartWaiting() ++void ++ShowBudgetWindowAndStartWaiting(void) + { + Eval("UIShowBudgetAndWait"); + +@@ -322,6 +338,7 @@ ShowBudgetWindowAndStartWaiting() + } + + ++void + SetBudget(char *flowStr, char *previousStr, + char *currentStr, char *collectedStr, short tax) + { +@@ -333,6 +350,7 @@ SetBudget(char *flowStr, char *previousStr, + } + + ++void + SetBudgetValues(char *roadGot, char *roadWant, + char *policeGot, char *policeWant, + char *fireGot, char *fireWant) +diff --git a/src/sim/w_con.c b/src/sim/w_con.c +index 0d20c9a..9f25893 100644 +--- a/src/sim/w_con.c ++++ b/src/sim/w_con.c +@@ -61,6 +61,13 @@ + */ + #include "sim.h" + ++void _FixSingle(int x, int y, short *TileAdrPtr); ++void _FixZone(int x, int y, short *TileAdrPtr); ++int _LayDoze(int x, int y, short *TileAdrPtr); ++int _LayRoad(int x, int y, short *TileAdrPtr); ++int _LayRail(int x, int y, short *TileAdrPtr); ++int _LayWire(int x, int y, short *TileAdrPtr); ++ + + short _RoadTable[16] = { + 66, 67, 66, 68, +@@ -494,6 +501,7 @@ _LayWire(int x, int y, short *TileAdrPtr) + + + /* comefrom: ConnecTile */ ++void + _FixZone(int x, int y, short *TileAdrPtr) + { + _FixSingle(x,y, &TileAdrPtr[0]); +@@ -518,6 +526,7 @@ _FixZone(int x, int y, short *TileAdrPtr) + + + /* comefrom: _FixZone */ ++void + _FixSingle(int x, int y, short *TileAdrPtr) + { + short Tile; +diff --git a/src/sim/w_date.c b/src/sim/w_date.c +index 049227b..342f0f3 100644 +--- a/src/sim/w_date.c ++++ b/src/sim/w_date.c +@@ -66,6 +66,14 @@ short NewDate = 0; + Tcl_HashTable DateCmds; + int DateUpdateTime = 200; + ++void DoUpdateDate(SimDate *date); ++void DoNewDate(SimDate *date); ++void DoResizeDate(SimDate *date, int w, int h); ++void DestroyDate(SimDate *date); ++void InitNewDate(SimDate *date); ++int ConfigureSimDate(Tcl_Interp *interp, SimDate *date, ++ int argc, char **argv, int flags); ++ + + #define DEF_DATE_FONT "-Adobe-Helvetica-Bold-R-Normal-*-140-*" + #define DEF_DATE_BG_COLOR "#b0b0b0" +@@ -111,8 +119,6 @@ DisplaySimDate(ClientData clientData) + { + SimDate *date = (SimDate *) clientData; + Tk_Window tkwin = date->tkwin; +- Pixmap pm = None; +- Drawable d; + + date->flags &= ~VIEW_REDRAW_PENDING; + //fprintf(stderr, "DisplaySimDate cleared VIEW_REDRAW_PENDING\n"); +@@ -138,6 +144,7 @@ DestroySimDate(ClientData clientData) + } + + ++void + EventuallyRedrawDate(SimDate *date) + { + if (!(date->flags & VIEW_REDRAW_PENDING)) { +@@ -255,8 +262,6 @@ int DateCmdconfigure(DATE_ARGS) + + int DateCmdposition(DATE_ARGS) + { +- int result = TCL_OK; +- + if ((argc != 2) && (argc != 4)) { + return TCL_ERROR; + } +@@ -320,8 +325,6 @@ int DateCmdVisible(DATE_ARGS) + + int DateCmdReset(DATE_ARGS) + { +- int range; +- + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args", (char *) NULL); + return TCL_ERROR; +@@ -339,8 +342,6 @@ int DateCmdReset(DATE_ARGS) + + int DateCmdSet(DATE_ARGS) + { +- int range; +- + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args", (char *) NULL); + return TCL_ERROR; +@@ -379,7 +380,7 @@ DoDateCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&DateCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&DateCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + Tk_Preserve((ClientData) date); + result = cmd(date, interp, argc, argv); +@@ -472,10 +473,9 @@ ConfigureSimDate(Tcl_Interp *interp, SimDate *date, + } + + +-date_command_init() ++void ++date_command_init(void) + { +- int new; +- + Tcl_CreateCommand(tk_mainInterp, "dateview", DateViewCmd, + (ClientData)MainWindow, (void (*)()) NULL); + +@@ -492,11 +492,9 @@ date_command_init() + } + + ++void + InitNewDate(SimDate *date) + { +- int d = 8; +- struct XDisplay *xd; +- + date->next = NULL; + + /* This stuff was initialized in our caller (DateCmd) */ +@@ -537,6 +535,7 @@ InitNewDate(SimDate *date) + } + + ++void + DestroyDate(SimDate *date) + { + SimDate **gp; +@@ -562,10 +561,9 @@ DestroyDate(SimDate *date) + } + + ++void + DoResizeDate(SimDate *date, int w, int h) + { +- int resize = 0; +- + date->w_width = w; date->w_height = h; + + if (date->pixmap != None) { +@@ -584,6 +582,7 @@ DoResizeDate(SimDate *date, int w, int h) + } + + ++void + DoNewDate(SimDate *date) + { + sim->dates++; date->next = sim->date; sim->date = date; +@@ -594,15 +593,15 @@ DoNewDate(SimDate *date) + + #define BORDER 1 + ++void + DoUpdateDate(SimDate *date) + { + Display *dpy; + GC gc; + Pixmap pm; + int *pix; +- int w, h, i, j, x, y; ++ int w, h, x, y; + int tx, ty; +- float sx, sy; + + if (!date->visible) { + return; +diff --git a/src/sim/w_editor.c b/src/sim/w_editor.c +index b13e326..7b0c658 100644 +--- a/src/sim/w_editor.c ++++ b/src/sim/w_editor.c +@@ -69,6 +69,16 @@ int BobHeight = 8; + + extern Tk_ConfigSpec TileViewConfigSpecs[]; + ++void ClipTheOverlay(SimView *view); ++void DrawTheOverlay(SimView *view, GC gc, Pixmap pm, int color, ++ int top, int bottom, int left, int right, ++ int onoverlay); ++void DrawOverlay(SimView *view); ++void DrawCursor(SimView *view); ++void DrawPending(SimView *view); ++void DrawOutside(SimView *view); ++void HandleAutoGoto(SimView *view); ++ + + int EditorCmdconfigure(VIEW_ARGS) + { +@@ -409,8 +419,6 @@ int EditorCmdPanBy(VIEW_ARGS) + + int EditorCmdTweakCursor(VIEW_ARGS) + { +- int x, y; +- + XWarpPointer (view->x->dpy, None, None, 0, 0, 0, 0, 0, 0); + + return TCL_OK; +@@ -642,7 +650,6 @@ int EditorCmdShowMe(VIEW_ARGS) + + int EditorCmdFollow(VIEW_ARGS) + { +- int id; + SimSprite *sprite; + + if ((argc != 2) && (argc != 3)) { +@@ -736,8 +743,10 @@ int EditorCmdDynamicFilter(VIEW_ARGS) + + int EditorCmdWriteJpeg(VIEW_ARGS) + { ++#if 0 + int val; + char *fileName = argv[2]; ++#endif + + if (argc != 3) { + return TCL_ERROR; +@@ -749,9 +758,9 @@ int EditorCmdWriteJpeg(VIEW_ARGS) + } + + +-editor_command_init() ++void ++editor_command_init(void) + { +- int new; + extern int TileViewCmd(CLIENT_ARGS); + + Tcl_CreateCommand(tk_mainInterp, "editorview", TileViewCmd, +@@ -810,7 +819,7 @@ DoEditorCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&EditorCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&EditorCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + Tk_Preserve((ClientData) view); + result = cmd(view, interp, argc, argv); +@@ -828,6 +837,7 @@ DoEditorCmd(CLIENT_ARGS) + /*************************************************************************/ + + ++void + DoNewEditor(SimView *view) + { + sim->editors++; view->next = sim->editor; sim->editor = view; +@@ -835,6 +845,7 @@ DoNewEditor(SimView *view) + } + + ++void + DoUpdateEditor(SimView *view) + { + int dx, dy, i; +@@ -852,12 +863,12 @@ DoUpdateEditor(SimView *view) + view->skips)) { + if (sim_skips) { + if (sim_skip > 0) { +- return 0; ++ return; + } + } else { + if (view->skip > 0) { + --view->skip; +- return 0; ++ return; + } else { + view->skip = view->skips; + } +@@ -918,6 +929,7 @@ DoUpdateEditor(SimView *view) + } + + ++void + HandleAutoGoto(SimView *view) + { + if (view->follow != NULL) { +@@ -932,7 +944,7 @@ HandleAutoGoto(SimView *view) + view->auto_going && + (view->tool_mode == 0)) { + int dx, dy; +- int panx, pany, speed; ++ int speed; + double dist, sloth; + + speed = view->auto_speed; +@@ -977,6 +989,7 @@ HandleAutoGoto(SimView *view) + } + } + ++void + DrawOutside(SimView *view) + { + Pixmap pm = view->pixmap2; +@@ -1014,6 +1027,7 @@ DrawOutside(SimView *view) + + char CursorDashes[] = { 4, 4 }; + ++void + DrawPending(SimView *view) + { + Pixmap pm = view->pixmap2; +@@ -1078,6 +1092,7 @@ DrawPending(SimView *view) + } + + ++void + DrawCursor(SimView *view) + { + Pixmap pm = Tk_WindowId(view->tkwin); +@@ -1406,6 +1421,7 @@ DrawCursor(SimView *view) + } + + ++void + TimeElapsed(struct timeval *elapsed, + struct timeval *start, + struct timeval *finish) +@@ -1423,6 +1439,7 @@ TimeElapsed(struct timeval *elapsed, + + + ++void + DrawOverlay(SimView *view) + { + int width = view->w_width; +@@ -1512,6 +1529,7 @@ DrawOverlay(SimView *view) + } + + ++void + DrawTheOverlay(SimView *view, GC gc, Pixmap pm, int color, + int top, int bottom, int left, int right, + int onoverlay) +@@ -1555,6 +1573,7 @@ DrawTheOverlay(SimView *view, GC gc, Pixmap pm, int color, + } + + ++void + ClipTheOverlay(SimView *view) + { + if (view->x->color) { +diff --git a/src/sim/w_eval.c b/src/sim/w_eval.c +index dd628f4..ec0cf33 100644 +--- a/src/sim/w_eval.c ++++ b/src/sim/w_eval.c +@@ -61,6 +61,13 @@ + */ + #include "sim.h" + ++void SetEvaluation(char *changed, char *score, ++ char *ps0, char *ps1, char *ps2, char *ps3, ++ char *pv0, char *pv1, char *pv2, char *pv3, ++ char *pop, char *delta, char *assessed_dollars, ++ char *cityclass, char *citylevel, ++ char *goodyes, char *goodno, char *title); ++ + + char *cityClassStr[6] = { + "VILLAGE", "TOWN", "CITY", "CAPITAL", "METROPOLIS", "MEGALOPOLIS" +@@ -77,6 +84,7 @@ char *probStr[10] = { + + + /* comefrom: DoSubUpDate scoreDoer */ ++void + doScoreCard(void) + { + char title[256], +@@ -103,9 +111,9 @@ doScoreCard(void) + sprintf(prob1, "%d%%", ProblemVotes[ProblemOrder[1]]); + sprintf(prob2, "%d%%", ProblemVotes[ProblemOrder[2]]); + sprintf(prob3, "%d%%", ProblemVotes[ProblemOrder[3]]); +- sprintf(pop, "%d", CityPop); +- sprintf(delta, "%d", deltaCityPop); +- sprintf(assessed, "%d", CityAssValue); ++ sprintf(pop, "%ld", CityPop); ++ sprintf(delta, "%ld", deltaCityPop); ++ sprintf(assessed, "%ld", CityAssValue); + makeDollarDecimalStr(assessed, assessed_dollars); + + sprintf(score, "%d", CityScore); +@@ -126,12 +134,14 @@ doScoreCard(void) + } + + +-ChangeEval() ++void ++ChangeEval(void) + { + EvalChanged = 1; + } + + ++void + scoreDoer(void) + { + if (EvalChanged) { +@@ -141,6 +151,7 @@ scoreDoer(void) + } + + ++void + SetEvaluation(char *changed, char *score, + char *ps0, char *ps1, char *ps2, char *ps3, + char *pv0, char *pv1, char *pv2, char *pv3, +diff --git a/src/sim/w_graph.c b/src/sim/w_graph.c +index 950799f..b86d959 100644 +--- a/src/sim/w_graph.c ++++ b/src/sim/w_graph.c +@@ -71,6 +71,11 @@ short Graph10Max, Graph120Max; + Tcl_HashTable GraphCmds; + int GraphUpdateTime = 100; + ++void DoUpdateGraph(SimGraph *graph); ++void DoNewGraph(SimGraph *graph); ++void DoResizeGraph(SimGraph *graph, int w, int h); ++void InitNewGraph(SimGraph *graph); ++ + + #define DEF_GRAPH_FONT "-Adobe-Helvetica-Bold-R-Normal-*-140-*" + #define DEF_GRAPH_BG_COLOR "#b0b0b0" +@@ -104,8 +109,6 @@ DisplaySimGraph(ClientData clientData) + { + SimGraph *graph = (SimGraph *) clientData; + Tk_Window tkwin = graph->tkwin; +- Pixmap pm = None; +- Drawable d; + + graph->flags &= ~VIEW_REDRAW_PENDING; + +@@ -133,6 +136,7 @@ DestroySimGraph(ClientData clientData) + } + + ++void + EventuallyRedrawGraph(SimGraph *graph) + { + if (!(graph->flags & VIEW_REDRAW_PENDING)) { +@@ -209,8 +213,6 @@ int GraphCmdconfigure(GRAPH_ARGS) + + int GraphCmdposition(GRAPH_ARGS) + { +- int result = TCL_OK; +- + if ((argc != 2) && (argc != 4)) { + return TCL_ERROR; + } +@@ -336,7 +338,7 @@ DoGraphCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&GraphCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&GraphCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + Tk_Preserve((ClientData) graph); + result = cmd(graph, interp, argc, argv); +@@ -434,10 +436,9 @@ unsigned char HistColor[] = { + }; + + +-graph_command_init() ++void ++graph_command_init(void) + { +- int new; +- + Tcl_CreateCommand(tk_mainInterp, "graphview", GraphViewCmd, + (ClientData)MainWindow, (void (*)()) NULL); + +@@ -568,9 +569,10 @@ initGraphs(void) + + + /* comefrom: InitWillStuff */ ++void + InitGraphMax(void) + { +- register x; ++ register int x; + + ResHisMax = 0; + ComHisMax = 0; +@@ -604,11 +606,9 @@ InitGraphMax(void) + } + + ++void + InitNewGraph(SimGraph *graph) + { +- int d = 8; +- struct XDisplay *xd; +- + graph->next = NULL; + graph->range = 10; + graph->mask = ALL_HISTORIES; +@@ -641,6 +641,7 @@ InitNewGraph(SimGraph *graph) + } + + ++void + DestroyGraph(SimGraph *graph) + { + SimGraph **gp; +@@ -666,10 +667,9 @@ DestroyGraph(SimGraph *graph) + } + + ++void + DoResizeGraph(SimGraph *graph, int w, int h) + { +- int resize = 0; +- + graph->w_width = w; graph->w_height = h; + + if (graph->pixmap != None) { +@@ -688,6 +688,7 @@ DoResizeGraph(SimGraph *graph, int w, int h) + } + + ++void + DoNewGraph(SimGraph *graph) + { + sim->graphs++; graph->next = sim->graph; sim->graph = graph; +@@ -698,6 +699,7 @@ DoNewGraph(SimGraph *graph) + + #define BORDER 5 + ++void + DoUpdateGraph(SimGraph *graph) + { + Display *dpy; +diff --git a/src/sim/w_inter.c b/src/sim/w_inter.c +index 33e7771..cf7c7c9 100644 +--- a/src/sim/w_inter.c ++++ b/src/sim/w_inter.c +@@ -295,6 +295,8 @@ static void TrackInterval _ANSI_ARGS_((Interval *intervalPtr, + static void StartTrackInterval _ANSI_ARGS_((Interval *intervalPtr, + int value)); + static int ValueToPixel _ANSI_ARGS_((Interval *intervalPtr, int value)); ++ ++static void NotifyInterval(register Interval *intervalPtr); + + /* + *-------------------------------------------------------------- +@@ -799,7 +801,7 @@ DisplayVerticalInterval(clientData) + register Interval *intervalPtr = (Interval *) clientData; + register Tk_Window tkwin = intervalPtr->tkwin; + int tickRightEdge, valueRightEdge, labelLeftEdge, intervalLeftEdge; +- int totalPixels, x, y, width, height, tickValue, min, max; ++ int totalPixels, x, width, height, tickValue, min, max; + int relief; + Tk_3DBorder sliderBorder; + +@@ -1013,7 +1015,7 @@ DisplayHorizontalInterval(clientData) + register Interval *intervalPtr = (Interval *) clientData; + register Tk_Window tkwin = intervalPtr->tkwin; + int tickBottom, valueBottom, labelBottom, intervalBottom; +- int totalPixels, x, y, width, height, tickValue, min, max; ++ int totalPixels, y, width, height, tickValue, min, max; + int relief; + Tk_3DBorder sliderBorder; + +@@ -1438,9 +1440,6 @@ StartTrackInterval(intervalPtr, value) + int value; /* New value for interval. Gets + * adjusted if it's off the interval. */ + { +- int result; +- char string[20]; +- + if ((value < intervalPtr->fromValue) + ^ (intervalPtr->toValue < intervalPtr->fromValue)) { + value = intervalPtr->fromValue; +@@ -1467,8 +1466,6 @@ TrackInterval(intervalPtr, value) + register Interval *intervalPtr; /* Info about widget. */ + int value; + { +- int result; +- char string[20]; + int min, max, delta, lastmin, lastmax; + + +@@ -1548,8 +1545,8 @@ SetInterval(intervalPtr, min, max, notify) + } + + +-NotifyInterval(intervalPtr) +- register Interval *intervalPtr; /* Info about widget. */ ++static void ++NotifyInterval(register Interval *intervalPtr) + { + int result; + char string[256]; +diff --git a/src/sim/w_keys.c b/src/sim/w_keys.c +index 64c5105..3e448f7 100644 +--- a/src/sim/w_keys.c ++++ b/src/sim/w_keys.c +@@ -79,7 +79,8 @@ static char LastKeys[5]; + */ + + +-ResetLastKeys() ++void ++ResetLastKeys(void) + { + LastKeys[0] = ' '; + LastKeys[1] = ' '; +@@ -91,6 +92,7 @@ ResetLastKeys() + + + /* comefrom: processEvent */ ++void + doKeyDown(SimView *view, short charCode) + { + LastKeys[0] = LastKeys[1]; +@@ -291,6 +293,7 @@ doKeyDown(SimView *view, short charCode) + + + /* comefrom: processEvent */ ++void + doKeyUp(SimView *view, short charCode) + { + switch(charCode) { +diff --git a/src/sim/w_map.c b/src/sim/w_map.c +index 8d4e5b8..2157088 100644 +--- a/src/sim/w_map.c ++++ b/src/sim/w_map.c +@@ -69,8 +69,12 @@ extern Tk_ConfigSpec TileViewConfigSpecs[]; + + + Ink *NewInk(); ++void DrawMapInk(SimView *view); ++void WireDrawMap(SimView *view); ++void DrawMapEditorViews(SimView *view); + + ++int + MapCmdconfigure(VIEW_ARGS) + { + int result = TCL_OK; +@@ -88,6 +92,7 @@ MapCmdconfigure(VIEW_ARGS) + return result; + } + ++int + MapCmdposition(VIEW_ARGS) + { + if ((argc != 2) && (argc != 4)) { +@@ -103,6 +108,7 @@ MapCmdposition(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdsize(VIEW_ARGS) + { + if ((argc != 2) && (argc != 4)) { +@@ -124,6 +130,7 @@ MapCmdsize(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdMapState(VIEW_ARGS) + { + int state; +@@ -145,6 +152,7 @@ MapCmdMapState(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdShowEditors(VIEW_ARGS) + { + int val; +@@ -165,6 +173,7 @@ MapCmdShowEditors(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdPanStart(VIEW_ARGS) + { + int x, y, left, right, top, bottom, width, height; +@@ -208,6 +217,7 @@ gotit: + return TCL_OK; + } + ++int + MapCmdPanTo(VIEW_ARGS) + { + int x, y, dx, dy; +@@ -238,6 +248,7 @@ MapCmdPanTo(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdVisible(VIEW_ARGS) + { + int visible; +@@ -260,6 +271,7 @@ MapCmdVisible(VIEW_ARGS) + return TCL_OK; + } + ++int + MapCmdViewAt(VIEW_ARGS) + { + int x, y; +@@ -280,9 +292,9 @@ MapCmdViewAt(VIEW_ARGS) + } + + +-map_command_init() ++void ++map_command_init(void) + { +- int new; + extern int TileViewCmd(CLIENT_ARGS); + + Tcl_CreateCommand(tk_mainInterp, "mapview", TileViewCmd, +@@ -316,7 +328,7 @@ DoMapCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&MapCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&MapCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + Tk_Preserve((ClientData) view); + result = cmd(view, interp, argc, argv); +@@ -332,6 +344,7 @@ DoMapCmd(CLIENT_ARGS) + + /*************************************************************************/ + ++void + DoNewMap(SimView *view) + { + sim->maps++; view->next = sim->map; sim->map = view; +@@ -417,12 +430,12 @@ int DoUpdateMap(SimView *view) + } + + ++void + DrawMapEditorViews(SimView *view) + { + Pixmap pm = Tk_WindowId(view->tkwin); + struct SimView *ed; + int left, right, top, bottom, width, height; +- int mine; + + XSetLineAttributes(view->x->dpy, view->x->gc, 1, + LineSolid, CapButt, JoinBevel); +@@ -481,6 +494,7 @@ struct Pix { + struct Pix pix[MAX_PIX]; + + ++int + CompareColor(struct Pix *p1, struct Pix *p2) + { + register char c1 = p1->color, c2 = p2->color; +@@ -491,11 +505,15 @@ CompareColor(struct Pix *p1, struct Pix *p2) + } + + ++void + WireDrawMap(SimView *view) + { +- int different, x, y, i, last, pts; ++ int different, x, y; + unsigned char *old, *new; ++#if 0 + XPoint *points; ++ int i, last, pts; ++#endif + + if (!view->x->color) { + MemDrawMap(view); +@@ -570,10 +588,10 @@ WireDrawMap(SimView *view) + } + + ++void + DrawMapInk(SimView *view) + { + Pixmap pm = view->pixmap2; +- SimView *v; + Ink *ink, *ink2 = NewInk(); + int i, X, Y, x, y; + +diff --git a/src/sim/w_piem.c b/src/sim/w_piem.c +index 60b7ea9..17d302f 100644 +--- a/src/sim/w_piem.c ++++ b/src/sim/w_piem.c +@@ -368,6 +368,9 @@ static void NeverPopupPieMenu _ANSI_ARGS_((PieMenu *menuPtr)); + static void EventuallyPopupPieMenu _ANSI_ARGS_((PieMenu *menuPtr)); + static void DeferPopupPieMenu _ANSI_ARGS_((PieMenu *menuPtr)); + static void ShapePieMenu _ANSI_ARGS_((PieMenu *menuPtr)); ++static void LayoutPieMenu(PieMenu *menu); ++static void UpdatePieMenuEntries(PieMenu *menuPtr); ++static int CalcPieMenuItem(PieMenu *menu, int x, int y); + + + /* +@@ -546,8 +549,6 @@ PieMenuWidgetCmd(clientData, interp, argc, argv) + DeferPopupPieMenu(menuPtr); + } else if ((c == 's') && (strncmp(argv[1], "show", length) == 0) + && (length >= 2)) { +- int index; +- + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " show\"", (char *) NULL); +@@ -556,8 +557,6 @@ PieMenuWidgetCmd(clientData, interp, argc, argv) + NowPopupPieMenu(menuPtr); + } else if ((c == 'p') && (strncmp(argv[1], "pending", length) == 0) + && (length >= 2)) { +- int index; +- + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " pending\"", (char *) NULL); +@@ -567,8 +566,6 @@ PieMenuWidgetCmd(clientData, interp, argc, argv) + (menuPtr->flags & POPUP_PENDING) ? 1 : 0); + } else if ((c == 'd') && (strncmp(argv[1], "defer", length) == 0) + && (length >= 2)) { +- int index; +- + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " defer\"", (char *) NULL); +@@ -768,7 +765,10 @@ PieMenuWidgetCmd(clientData, interp, argc, argv) + } + Tk_Release((ClientData) mePtr); + } else if ((c == 'p') && (strncmp(argv[1], "post", length) == 0)) { +- int x, y, ix, iy, tmp, err; ++ int x, y; ++#if 0 ++ int ix, iy, tmp, err; ++#endif + Tk_Uid group; + + if ((argc != 4) && (argc != 5)) { +@@ -1355,7 +1355,6 @@ DisplayPieMenu(clientData) + register PieMenu *menuPtr = (PieMenu *) clientData; + register Tk_Window tkwin = menuPtr->tkwin; + XFontStruct *fontPtr; +- int index; + + menuPtr->flags &= ~REDRAW_PENDING; + if ((menuPtr->tkwin == NULL) || !Tk_IsMapped(menuPtr->tkwin)) { +@@ -1428,8 +1427,8 @@ UpdatePieMenu(clientData) + } + + +-UpdatePieMenuEntries(menuPtr) +- PieMenu *menuPtr; ++static void ++UpdatePieMenuEntries(PieMenu *menuPtr) + { + register PieMenuEntry *mePtr; + register Tk_Window tkwin = menuPtr->tkwin; +@@ -1521,7 +1520,7 @@ GetPieMenuIndex(interp, menuPtr, string, indexPtr) + * manual entry for valid .*/ + int *indexPtr; /* Where to store converted relief. */ + { +- int i, y; ++ int i; + + if ((string[0] == 'a') && (strcmp(string, "active") == 0)) { + *indexPtr = menuPtr->active; +@@ -1787,10 +1786,7 @@ UnpostSubPieMenu(interp, menuPtr) + * reporting errors. */ + register PieMenu *menuPtr; /* Information about menu as a whole. */ + { +- char string[30]; +- int result, x, y, win_x, win_y; +- unsigned int key_buttons; +- Window root, child; ++ int result; + + if (menuPtr->postedPie == NULL) { + return TCL_OK; +@@ -1909,13 +1905,11 @@ ActivatePieMenuEntry(menuPtr, index, preview) + } + + +-int +-CalcPieMenuItem(menu, x, y) +- PieMenu *menu; +- int x, y; ++static int ++CalcPieMenuItem(PieMenu *menu, int x, int y) + { + register PieMenuEntry *it, *last_it; +- int i, j, order, quadrant; ++ int i, order = 0, quadrant; + int numerator, denominator; + int first, last_i, last_order; + +@@ -2072,8 +2066,8 @@ case 3: /* + } + + +-LayoutPieMenu(menu) +- PieMenu *menu; ++static void ++LayoutPieMenu(PieMenu *menu) + { + int i; + int total_slice, radius; +diff --git a/src/sim/w_resrc.c b/src/sim/w_resrc.c +index 2446694..23fc2aa 100644 +--- a/src/sim/w_resrc.c ++++ b/src/sim/w_resrc.c +@@ -63,15 +63,15 @@ + + + #ifdef MSDOS +-#define PATHSTR "%s\\%c%c%c%c.%d" ++#define PATHSTR "%s\\%c%c%c%c.%ld" + #define PERMSTR "rb" + #else +-#define PATHSTR "%s/%c%c%c%c.%d" ++#define PATHSTR "%s/%c%c%c%c.%ld" + #define PERMSTR "r" + #endif + + +-char *HomeDir, *ResourceDir, *KeyDir, *HostName; ++char *HomeDir, *ResourceDir, *KeyDir, *HostName = ""; + + struct Resource *Resources = NULL; + +@@ -162,6 +162,7 @@ ResourceID(Handle h) + } + + ++void + GetIndString(char *str, int id, short num) + { + struct StringTable **tp, *st = NULL; +diff --git a/src/sim/w_sim.c b/src/sim/w_sim.c +index 71f2f1a..fcfa60f 100644 +--- a/src/sim/w_sim.c ++++ b/src/sim/w_sim.c +@@ -145,6 +145,7 @@ SIMCMD_CALL(StartBulldozer) + SIMCMD_CALL(StopBulldozer) + SIMCMD_CALL(MakeFire) + SIMCMD_CALL(MakeFlood) ++SIMCMD_CALL(MakeAirCrash) + SIMCMD_CALL(MakeTornado) + SIMCMD_CALL(MakeEarthquake) + SIMCMD_CALL(MakeMonster) +@@ -324,8 +325,6 @@ int SimCmdDelay(ARGS) + + int SimCmdWorldX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -337,8 +336,6 @@ int SimCmdWorldX(ARGS) + + int SimCmdWorldY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -501,7 +498,7 @@ int SimCmdFunds(ARGS) + Kick(); + } + +- sprintf(interp->result, "%d", TotalFunds); ++ sprintf(interp->result, "%ld", TotalFunds); + return (TCL_OK); + } + +@@ -730,8 +727,6 @@ int SimCmdSound(ARGS) + + int SimCmdFlush(ARGS) + { +- int style; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -777,7 +772,7 @@ int SimCmdDonDither(ARGS) + DonDither = dd; + } + +- sprintf(interp->result, "%d", DonDither); ++ sprintf(interp->result, "%ld", DonDither); + return (TCL_OK); + } + +@@ -934,7 +929,7 @@ int SimCmdFill(ARGS) + + int SimCmdDynamicData(ARGS) + { +- int index, val; ++ int index; + + if ((argc != 3) && (argc != 4)) { + return (TCL_ERROR); +@@ -1018,8 +1013,6 @@ int SimCmdUpdate(ARGS) + + int SimCmdLandValue(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1031,8 +1024,6 @@ int SimCmdLandValue(ARGS) + + int SimCmdTraffic(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1044,8 +1035,6 @@ int SimCmdTraffic(ARGS) + + int SimCmdCrime(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1057,8 +1046,6 @@ int SimCmdCrime(ARGS) + + int SimCmdUnemployment(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1070,8 +1057,6 @@ int SimCmdUnemployment(ARGS) + + int SimCmdFires(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1083,8 +1068,6 @@ int SimCmdFires(ARGS) + + int SimCmdPollution(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1096,8 +1079,6 @@ int SimCmdPollution(ARGS) + + int SimCmdPolMaxX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1109,8 +1090,6 @@ int SimCmdPolMaxX(ARGS) + + int SimCmdPolMaxY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1122,8 +1101,6 @@ int SimCmdPolMaxY(ARGS) + + int SimCmdTrafMaxX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1135,8 +1112,6 @@ int SimCmdTrafMaxX(ARGS) + + int SimCmdTrafMaxY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1148,8 +1123,6 @@ int SimCmdTrafMaxY(ARGS) + + int SimCmdMeltX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1161,8 +1134,6 @@ int SimCmdMeltX(ARGS) + + int SimCmdMeltY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1174,8 +1145,6 @@ int SimCmdMeltY(ARGS) + + int SimCmdCrimeMaxX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1187,8 +1156,6 @@ int SimCmdCrimeMaxX(ARGS) + + int SimCmdCrimeMaxY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1200,8 +1167,6 @@ int SimCmdCrimeMaxY(ARGS) + + int SimCmdCenterX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1213,8 +1178,6 @@ int SimCmdCenterX(ARGS) + + int SimCmdCenterY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1226,8 +1189,6 @@ int SimCmdCenterY(ARGS) + + int SimCmdFloodX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1239,8 +1200,6 @@ int SimCmdFloodX(ARGS) + + int SimCmdFloodY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1252,8 +1211,6 @@ int SimCmdFloodY(ARGS) + + int SimCmdCrashX(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1265,8 +1222,6 @@ int SimCmdCrashX(ARGS) + + int SimCmdCrashY(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1278,8 +1233,6 @@ int SimCmdCrashY(ARGS) + + int SimCmdDollars(ARGS) + { +- int val; +- + if (argc != 2) { + return (TCL_ERROR); + } +@@ -1389,7 +1342,7 @@ int SimCmdPlatform(ARGS) + + int SimCmdVersion(ARGS) + { +- sprintf(interp->result, MicropolisVersion); ++ strcpy(interp->result, MicropolisVersion); + + return (TCL_OK); + } +@@ -1419,7 +1372,6 @@ int SimCmdOpenWebBrowser(ARGS) + + int SimCmdQuoteURL(ARGS) + { +- int result = 1; + char buf[2048]; + char *from, *to; + int ch; +@@ -1511,6 +1463,22 @@ int SimCmdSugarMode(ARGS) + return (TCL_OK); + } + ++int SimCmdHasAirCrash(ARGS) ++{ ++ int aircrash = 0; ++ ++ if (argc != 2) { ++ return (TCL_ERROR); ++ } ++ ++#ifndef NO_AIRCRASH ++ aircrash = 1; ++#endif ++ ++ sprintf(interp->result, "%d", aircrash); ++ return (TCL_OK); ++} ++ + + /************************************************************************/ + +@@ -1525,7 +1493,7 @@ SimCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&SimCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&SimCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + result = cmd(interp, argc, argv); + } else { +@@ -1535,10 +1503,9 @@ SimCmd(CLIENT_ARGS) + } + + +-sim_command_init() ++void ++sim_command_init(void) + { +- int new; +- + Tcl_CreateCommand(tk_mainInterp, "sim", SimCmd, + (ClientData)MainWindow, (void (*)()) NULL); + +@@ -1567,6 +1534,7 @@ sim_command_init() + SIM_CMD(StopBulldozer); + SIM_CMD(MakeFire); + SIM_CMD(MakeFlood); ++ SIM_CMD(MakeAirCrash); + SIM_CMD(MakeTornado); + SIM_CMD(MakeEarthquake); + SIM_CMD(MakeMonster); +@@ -1674,4 +1642,5 @@ sim_command_init() + SIM_CMD(NeedRest); + SIM_CMD(MultiPlayerMode); + SIM_CMD(SugarMode); ++ SIM_CMD(HasAirCrash); + } +diff --git a/src/sim/w_sound.c b/src/sim/w_sound.c +index b9b323c..a903ae7 100644 +--- a/src/sim/w_sound.c ++++ b/src/sim/w_sound.c +@@ -1,3 +1,7 @@ ++/* ++ * Portions Copyright (c) 2008 Deanna Phillips ++ */ ++ + /* w_sound.c + * + * Micropolis, Unix Version. This game was released for the Unix platform +@@ -59,103 +63,331 @@ + * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY + * NOT APPLY TO YOU. + */ ++#ifdef WITH_SDL_MIXER ++#include "SDL.h" ++#include "SDL_mixer.h" ++#endif ++ + #include "sim.h" + + ++#define SIM_NSOUNDS 47 ++#define SIM_NCHANNELS 32 ++#define DOZER_CHANNEL 0 ++#define DOZER_SOUND "rumble.wav" ++ ++struct sound { ++ char *id; ++ char *file; ++#ifdef WITH_SDL_MIXER ++ Mix_Chunk *wave; ++#else ++ void *wave; ++#endif ++}; ++ ++struct sound sounds[SIM_NSOUNDS] = { ++ { "A", "a.wav", NULL }, ++ { "Aaah", "aaah.wav", NULL }, ++ { "Airport", "airport.wav", NULL }, ++ { "Beep", "beep.wav", NULL }, ++ { "Boing", "boing.wav", NULL }, ++ { "Bop", "bop.wav", NULL }, ++ { "Build", "build.wav", NULL }, ++ { "Bulldozer", "bulldozer.wav", NULL }, ++ { "Chalk", "chalk.wav", NULL }, ++ { "Coal", "coal.wav", NULL }, ++ { "Com", "com.wav", NULL }, ++ { "Computer", "computer.wav", NULL }, ++ { "Cuckoo", "cuckoo.wav", NULL }, ++ { "E", "e.wav", NULL }, ++ { "Eraser", "eraser.wav", NULL }, ++ { "Explosion-High", "explosion-high.wav", NULL }, ++ { "Explosion-Low", "explosion-low.wav", NULL }, ++ { "Fire", "fire.wav", NULL }, ++ { "HeavyTraffic", "heavytraffic.wav", NULL }, ++ { "HonkHonk-High", "honkhonk-high.wav", NULL }, ++ { "HonkHonk-Low", "honkhonk-low.wav", NULL }, ++ { "HonkHonk-Med", "honkhonk-med.wav", NULL }, ++ { "Ignition", "ignition.wav", NULL }, ++ { "Ind", "ind.wav", NULL }, ++ { "Monster", "monster.wav", NULL }, ++ { "Nuclear", "nuclear.wav", NULL }, ++ { "O", "o.wav", NULL }, ++ { "Oop", "oop.wav", NULL }, ++ { "Park", "park.wav", NULL }, ++ { "Player", "player.wav", NULL }, ++ { "Police", "police.wav", NULL }, ++ { "QuackQuack", "quackquack.wav", NULL }, ++ { "Query", "query.wav", NULL }, ++ { "Rail", "rail.wav", NULL }, ++ { "Res", "res.wav", NULL }, ++ { "Road", "road.wav", NULL }, ++ { "Rumble", "rumble.wav", NULL }, ++ { "Seaport", "seaport.wav", NULL }, ++ { "Siren", "siren.wav", NULL }, ++ { "Skid", "skid.wav", NULL }, ++ { "Sorry", "sorry.wav", NULL }, ++ { "Stadium", "stadium.wav", NULL }, ++ { "UhUh", "uhuh.wav", NULL }, ++ { "Whip", "whip.wav", NULL }, ++ { "Wire", "wire.wav", NULL }, ++ { "Woosh", "woosh.wav", NULL }, ++ { "Zone", "zone.wav", NULL } ++}; ++ ++static int SoundInitialized = 0; ++ ++#ifdef WITH_SDL_MIXER + /* Sound routines */ + + +-int SoundInitialized = 0; +-short Dozing; ++Mix_Chunk *rumble; + + +-InitializeSound() ++void ++InitializeSound(void) + { +- char cmd[256]; ++ int reserved_chans; ++ char buf[256]; + +- SoundInitialized = 1; ++ if (SDL_Init(SDL_INIT_AUDIO) == -1) { ++ fprintf(stderr, "SDL_Init: %s\n", SDL_GetError()); ++ return; ++ } + +- if (!UserSoundOn) return; ++ if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 1, 1024) == -1) { ++ fprintf(stderr, "Mix_OpenAudio: %s\n", Mix_GetError()); ++ return; ++ } ++ ++ reserved_chans = Mix_ReserveChannels(1); ++ ++ if (reserved_chans != 1) { ++ fprintf(stderr, "Mix_ReserveChannels: %s\n", Mix_GetError()); ++ return; ++ } ++ ++ if (Mix_AllocateChannels(SIM_NCHANNELS) == -1) { ++ fprintf(stderr, "Mix_AllocateChannels: %s\n", Mix_GetError()); ++ return; ++ } ++ ++ snprintf(buf, sizeof(buf), "%s/sounds/%s", ResourceDir, DOZER_SOUND); ++ rumble = Mix_LoadWAV(buf); ++ ++ if (rumble == NULL) { ++ printf("Mix_LoadWAV: %s\n", Mix_GetError()); ++ return; ++ } + +- Eval("UIInitializeSound"); ++ SoundInitialized = 1; + } + + ++void + ShutDownSound() + { +- if (SoundInitialized) { +- SoundInitialized = 0; +- Eval("UIShutDownSound"); ++ int i; ++ SoundInitialized = 0; ++ ++ for (i = 0; i < SIM_NSOUNDS; i++) { ++ if (sounds[i].wave) { ++ Mix_FreeChunk(sounds[i].wave); ++ sounds[i].wave = NULL; ++ } ++ } ++ if (rumble) { ++ Mix_FreeChunk(rumble); ++ rumble = NULL; + } ++ Mix_CloseAudio(); ++ SDL_Quit(); + } + + ++void + MakeSound(char *channel, char *id) + { + char buf[256]; ++ int i; + + if (!UserSoundOn) return; +- if (!SoundInitialized) InitializeSound(); ++ if (!SoundInitialized) return; + +- sprintf(buf, "UIMakeSound \"%s\" \"%s\"", channel, id); +- Eval(buf); +-} ++ for (i = 0; i < SIM_NSOUNDS; i++) { ++ if (!strcmp(sounds[i].id, id)) ++ break; ++ } ++ ++ if (sounds[i].wave) { ++ if (Mix_PlayChannel(-1, sounds[i].wave, 0) == -1) ++ fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError()); ++ return; ++ } + ++ snprintf(buf, sizeof(buf), "%s/sounds/%s", ResourceDir, ++ sounds[i].file); + +-MakeSoundOn(SimView *view, char *channel, char *id) ++ sounds[i].wave = Mix_LoadWAV(buf); ++ ++ if (sounds[i].wave == NULL) { ++ fprintf(stderr, "Mix_LoadWAV: %s\n", Mix_GetError()); ++ return; ++ } ++ ++ if (Mix_PlayChannel(-1, sounds[i].wave, 0) == -1) ++ fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError()); ++} ++ ++void ++StartBulldozer(void) + { +- char buf[256]; ++ if (!UserSoundOn) return; ++ if (!SoundInitialized) return; + ++ if (Mix_PlayChannel(DOZER_CHANNEL, rumble, 4) == -1) { ++ printf("Mix_PlayChannel: %s\n", Mix_GetError()); ++ return; ++ } ++} ++ ++ ++void ++StopBulldozer(void) ++{ + if (!UserSoundOn) return; +- if (!SoundInitialized) InitializeSound(); ++ if (!SoundInitialized) return; ++ ++ Mix_HaltChannel(DOZER_CHANNEL); ++} + +- sprintf(buf, "UIMakeSoundOn %s \"%s\" \"%s\"", +- Tk_PathName(view->tkwin), channel, id); +- Eval(buf); ++#else /* WITH_SDL_MIXER */ ++void ++InitializeSound() ++{ ++ SoundInitialized = 1; + } + ++void ++ShutDownSound() ++{ ++ SoundInitialized = 0; ++} + +-StartBulldozer(void) ++void ++MakeSound(char *channel, char *id) + { ++ char filename[256], player[256]; ++ static struct timeval last = {0, 0}; ++ struct timeval now; ++ unsigned int diff; ++ int i; ++ pid_t pid; ++ ++ gettimeofday(&now, NULL); ++ ++ diff = ((now.tv_sec - last.tv_sec) * 1000000) + ++ (now.tv_usec - last.tv_usec); ++ ++ if (diff < 100000) ++ return; ++ ++ last = now; ++ + if (!UserSoundOn) return; +- if (!SoundInitialized) InitializeSound(); +- if (!Dozing) { +- DoStartSound("edit", "1"); +- Dozing = 1; ++ if (!SoundInitialized) return; ++ ++ for (i = 0; i < SIM_NSOUNDS; i++) { ++ if (!strcmp(sounds[i].id, id)) ++ break; ++ } ++ ++ snprintf(filename, sizeof(filename), "%s/sounds/%s", ResourceDir, ++ sounds[i].file); ++ ++ snprintf(player, sizeof(player), "%s/sounds/player", ResourceDir); ++ ++ pid = fork(); ++ ++ switch(pid) { ++ case 0: ++ execl(player, player, filename, NULL); ++ exit(1); ++ break; ++ case -1: ++ perror("fork failed"); ++ break; ++ default: ++ break; + } + } + ++void ++StartBulldozer(void) ++{ ++ MakeSound(0, "Rumble"); ++} + ++void + StopBulldozer(void) + { +- if ((!UserSoundOn) || (!SoundInitialized)) return; +- DoStopSound("1"); +- Dozing = 0; ++} ++#endif ++ ++ ++void ++MakeSoundOn(SimView *view, char *channel, char *id) ++{ ++ if (!UserSoundOn) return; ++ if (!SoundInitialized) return; ++ ++ MakeSound(channel, id); + } + + +-/* comefrom: doKeyEvent */ ++/* XXX comefrom: doKeyEvent */ ++void + SoundOff(void) + { +- if (!SoundInitialized) InitializeSound(); +- Eval("UISoundOff"); +- Dozing = 0; ++ ShutDownSound(); + } + + ++void + DoStartSound(char *channel, char *id) + { +- char buf[256]; ++ MakeSound(channel, id); ++} + +- sprintf(buf, "UIStartSound %s %s", channel, id); +- Eval(buf); ++void ++DoStopSound(char *id) ++{ ++ StopBulldozer(); + } + ++int ++SoundCmd(CLIENT_ARGS) ++{ ++ if (!strcmp(argv[2], "Rumble")) ++ StartBulldozer(); ++ else ++ MakeSound(NULL, argv[2]); ++ return 0; ++} + +-DoStopSound(char *id) ++int ++DozerCmd(CLIENT_ARGS) + { +- char buf[256]; ++ StopBulldozer(); ++ return 0; ++} + +- sprintf(buf, "UIStopSound %s", id); +- Eval(buf); ++void ++sound_command_init(void) ++{ ++ Tcl_CreateCommand(tk_mainInterp, "playsound", SoundCmd, ++ (ClientData)NULL, (void (*)()) NULL); ++ Tcl_CreateCommand(tk_mainInterp, "stopdozer", DozerCmd, ++ (ClientData)NULL, (void (*)()) NULL); + } +diff --git a/src/sim/w_sprite.c b/src/sim/w_sprite.c +index 22688e5..c8837d5 100644 +--- a/src/sim/w_sprite.c ++++ b/src/sim/w_sprite.c +@@ -70,6 +70,23 @@ short Cycle; + SimSprite *GlobalSprites[OBJN]; + + SimSprite *NewSprite(char *name, int type, int x, int y); ++void MonsterHere(int x, int y); ++void MakeShipHere(int x, int y); ++void StartFire(int x, int y); ++void OFireZone(int Xloc, int Yloc, int ch); ++void Destroy(int ox, int oy); ++void ExplodeSprite(SimSprite *sprite); ++int CanDriveOn(int x, int y); ++void DoBusSprite(SimSprite *sprite); ++void DoExplosionSprite(SimSprite *sprite); ++void DoTornadoSprite(SimSprite *sprite); ++void DoMonsterSprite(SimSprite *sprite); ++void DoShipSprite(SimSprite *sprite); ++void DoAirplaneSprite(SimSprite *sprite); ++void DoCopterSprite(SimSprite *sprite); ++void DoTrainSprite(SimSprite *sprite); ++void DrawSprite(SimView *view, SimSprite *sprite); ++void InitSprite(SimSprite *sprite, int x, int y); + + + #define TRA_GROOVE_X -39 +@@ -109,7 +126,7 @@ DoSpriteCmd(CLIENT_ARGS) + return TCL_ERROR; + } + +- if (ent = Tcl_FindHashEntry(&SpriteCmds, argv[1])) { ++ if ((ent = Tcl_FindHashEntry(&SpriteCmds, argv[1]))) { + cmd = (int (*)())ent->clientData; + Tk_Preserve((ClientData) sprite); + result = cmd(sprite, interp, argc, argv); +@@ -198,7 +215,8 @@ int SpriteCmdInit(SPRITE_ARGS) + } + + +-sprite_command_init() ++void ++sprite_command_init(void) + { + int i; + +@@ -269,6 +287,7 @@ NewSprite(char *name, int type, int x, int y) + } + + ++void + InitSprite(SimSprite *sprite, int x, int y) + { + sprite->x = x; sprite->y = y; +@@ -381,7 +400,8 @@ InitSprite(SimSprite *sprite, int x, int y) + } + + +-DestroyAllSprites() ++void ++DestroyAllSprites(void) + { + SimSprite *sprite; + +@@ -391,6 +411,7 @@ DestroyAllSprites() + } + + ++void + DestroySprite(SimSprite *sprite) + { + SimView *view; +@@ -458,6 +479,7 @@ MakeNewSprite(int type, int x, int y) + } + + ++void + DrawObjects(SimView *view) + { + SimSprite *sprite; +@@ -479,6 +501,7 @@ DrawObjects(SimView *view) + } + + ++void + DrawSprite(SimView *view, SimSprite *sprite) + { + Pixmap pict, mask; +@@ -533,6 +556,7 @@ short TurnTo(int p, int d) + } + + ++int + TryOther(int Tpoo, int Told, int Tnew) + { + register short z; +@@ -588,6 +612,7 @@ short GetDir(int orgX, int orgY, int desX, int desY) + } + + ++int + GetDis(int x1, int y1, int x2, int y2) + { + register short dispX, dispY; +@@ -611,7 +636,7 @@ int CheckSpriteCollision(SimSprite *s1, SimSprite *s2) + } + + +-MoveObjects() ++void MoveObjects(void) + { + SimSprite *sprite; + +@@ -660,6 +685,7 @@ MoveObjects() + } + + ++void + DoTrainSprite(SimSprite *sprite) + { + static short Cx[4] = { 0, 16, 0, -16 }; +@@ -710,6 +736,7 @@ DoTrainSprite(SimSprite *sprite) + } + + ++void + DoCopterSprite(SimSprite *sprite) + { + static short CDx[9] = { 0, 0, 3, 5, 3, 0, -3, -5, -3 }; +@@ -782,6 +809,7 @@ DoCopterSprite(SimSprite *sprite) + } + + ++void + DoAirplaneSprite(SimSprite *sprite) + { + static short CDx[12] = { 0, 0, 6, 8, 6, 0, -6, -8, -6, 8, 8, 8 }; +@@ -833,6 +861,7 @@ DoAirplaneSprite(SimSprite *sprite) + } + + ++void + DoShipSprite(SimSprite *sprite) + { + static short BDx[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 }; +@@ -849,7 +878,7 @@ DoShipSprite(SimSprite *sprite) + if ((Rand16() & 3) == 1) { + if ((ScenarioID == 2) && /* San Francisco */ + (Rand(10) < 5)) { +- MakeSound("city", "HonkHonk-Low -speed 80"); ++ MakeSound("city", "HonkHonk-Low"); + } else { + MakeSound("city", "HonkHonk-Low"); + } +@@ -898,16 +927,19 @@ DoShipSprite(SimSprite *sprite) + sprite->frame = 0; + return; + } +- for (z = 0; z < 8; z++) { +- if (t == BtClrTab[z]) break; +- if (z == 7) { +- ExplodeSprite(sprite); +- Destroy(sprite->x + 48, sprite->y); ++ if (!NoDisasters) { ++ for (z = 0; z < 8; z++) { ++ if (t == BtClrTab[z]) break; ++ if (z == 7) { ++ ExplodeSprite(sprite); ++ Destroy(sprite->x + 48, sprite->y); ++ } + } + } + } + + ++void + DoMonsterSprite(SimSprite *sprite) + { + static short Gx[5] = { 2, 2, -2, -2, 0 }; +@@ -983,7 +1015,7 @@ DoMonsterSprite(SimSprite *sprite) + else z = ND2[d]; + d = 4; + if (!sprite->sound_count) { +- MakeSound("city", "Monster -speed [MonsterSpeed]"); /* monster */ ++ MakeSound("city", "Monster"); /* monster */ + sprite->sound_count = 50 + Rand(100); + } + } +@@ -1020,10 +1052,14 @@ DoMonsterSprite(SimSprite *sprite) + + if (sprite->count > 0) sprite->count--; + c = GetChar(sprite->x + sprite->x_hot, sprite->y + sprite->y_hot); +- if ((c == -1) || +- ((c == RIVER) && ++ if ((c == -1) ++#ifndef ORIGINAL_MONSTER_BEHAVIOUR ++ || ((c == RIVER) && + (sprite->count != 0) && +- (sprite->control == -1))) { ++ (sprite->count < 900) && ++ (sprite->control == -1)) ++#endif ++ ) { + sprite->frame = 0; /* kill zilla */ + } + +@@ -1044,6 +1080,7 @@ DoMonsterSprite(SimSprite *sprite) + } + + ++void + DoTornadoSprite(SimSprite *sprite) + { + static short CDx[9] = { 2, 3, 2, 0, -2, -3 }; +@@ -1095,6 +1132,7 @@ DoTornadoSprite(SimSprite *sprite) + } + + ++void + DoExplosionSprite(SimSprite *sprite) + { + short x, y; +@@ -1122,15 +1160,15 @@ DoExplosionSprite(SimSprite *sprite) + } + + ++void + DoBusSprite(SimSprite *sprite) + { + static short Dx[5] = { 0, 1, 0, -1, 0 }; + static short Dy[5] = { -1, 0, 1, 0, 0 }; + static short Dir2Frame[4] = { 1, 2, 1, 2 }; +- register int dir, dir2; +- int c, dx, dy, crossed, tx, ty, otx, oty; ++ int dx, dy, tx, ty, otx, oty; + int turned = 0; +- int speed, z; ++ int speed = 0, z; + + #ifdef DEBUGBUS + printf("Bus dir %d turn %d frame %d\n", +@@ -1348,6 +1386,7 @@ CanDriveOn(int x, int y) + } + + ++void + ExplodeSprite(SimSprite *sprite) + { + int x, y; +@@ -1404,6 +1443,7 @@ int checkWet(int x) + } + + ++void + Destroy(int ox, int oy) + { + short t, z, x, y; +@@ -1437,6 +1477,7 @@ Destroy(int ox, int oy) + } + + ++void + OFireZone(int Xloc, int Yloc, int ch) + { + register short Xtem, Ytem; +@@ -1461,9 +1502,10 @@ OFireZone(int Xloc, int Yloc, int ch) + } + + ++void + StartFire(int x, int y) + { +- register t, z; ++ register int t, z; + + x >>= 4; + y >>= 4; +@@ -1479,6 +1521,7 @@ StartFire(int x, int y) + } + + ++void + GenerateTrain(int x, int y) + { + if ((TotalPop > 20) && +@@ -1489,6 +1532,7 @@ GenerateTrain(int x, int y) + } + + ++void + GenerateBus(int x, int y) + { + if ((GetSprite(BUS) == NULL) && +@@ -1498,6 +1542,7 @@ GenerateBus(int x, int y) + } + + ++void + GenerateShip(void) + { + register short x, y; +@@ -1529,15 +1574,17 @@ GenerateShip(void) + } + + +-MakeShipHere(int x, int y, int z) ++void ++MakeShipHere(int x, int y) + { + MakeSprite(SHI, (x <<4) - (48 - 1), (y <<4)); + } + + ++void + MakeMonster(void) + { +- register x, y, z, done = 0; ++ register int x, y, z, done = 0; + SimSprite *sprite; + + if ((sprite = GetSprite(GOD)) != NULL) { +@@ -1562,16 +1609,16 @@ MakeMonster(void) + } + + ++void + MonsterHere(int x, int y) + { +- short z; +- + MakeSprite(GOD, (x <<4) + 48, (y <<4)); + ClearMes(); + SendMesAt(-21, x + 5, y); + } + + ++void + GenerateCopter(int x, int y) + { + if (GetSprite(COP) != NULL) return; +@@ -1580,6 +1627,7 @@ GenerateCopter(int x, int y) + } + + ++void + GeneratePlane(int x, int y) + { + if (GetSprite(AIR) != NULL) return; +@@ -1588,6 +1636,25 @@ GeneratePlane(int x, int y) + } + + ++void ++MakeAirCrash(void) ++{ ++#ifndef NO_AIRCRASH ++ if (GetSprite(AIR) == NULL) { ++ short x, y; ++ ++ x = Rand(WORLD_X - 20) + 10; ++ y = Rand(WORLD_Y - 10) + 5; ++ ++ GeneratePlane(x, y); ++ } ++ ++ ExplodeSprite(GetSprite(AIR)); ++#endif ++} ++ ++ ++void + MakeTornado(void) + { + short x, y; +@@ -1606,6 +1673,7 @@ MakeTornado(void) + } + + ++void + MakeExplosion(int x, int y) + { + if ((x >= 0) && (x < WORLD_X) && +@@ -1615,6 +1683,7 @@ MakeExplosion(int x, int y) + } + + ++void + MakeExplosionAt(int x, int y) + { + MakeNewSprite(EXP, x - 40, y - 16); +diff --git a/src/sim/w_stubs.c b/src/sim/w_stubs.c +index d55ce03..9f4040a 100644 +--- a/src/sim/w_stubs.c ++++ b/src/sim/w_stubs.c +@@ -81,13 +81,20 @@ short MesNum; + short EvalChanged; + short flagBlink; + ++void DoStartScenario(int scenario); ++void DoStartLoad(void); ++void DoReallyStartGame(void); ++void DoPlayNewCity(void); + ++ ++void + Spend(int dollars) + { + SetFunds(TotalFunds - dollars); + } + + ++void + SetFunds(int dollars) + { + TotalFunds = dollars; +@@ -97,7 +104,7 @@ SetFunds(int dollars) + + /* Mac */ + +-QUAD TickCount() ++QUAD TickCount(void) + { + struct timeval time; + +@@ -117,7 +124,8 @@ int size; + + /* w_hlhandlers.c */ + +-GameStarted() ++void ++GameStarted(void) + { + InvalidateMaps(); + InvalidateEditors(); +@@ -150,24 +158,28 @@ GameStarted() + } + + +-DoPlayNewCity() ++void ++DoPlayNewCity(void) + { + Eval("UIPlayNewCity"); + } + + +-DoReallyStartGame() ++void ++DoReallyStartGame(void) + { + Eval("UIReallyStartGame"); + } + + +-DoStartLoad() ++void ++DoStartLoad(void) + { + Eval("UIStartLoad"); + } + + ++void + DoStartScenario(int scenario) + { + char buf[256]; +@@ -177,20 +189,23 @@ DoStartScenario(int scenario) + } + + +-DropFireBombs() ++void ++DropFireBombs(void) + { + Eval("DropFireBombs"); + } + + +-InitGame() ++void ++InitGame(void) + { + sim_skips = sim_skip = sim_paused = sim_paused_speed = heat_steps = 0; + setSpeed(0); + } + + +-ReallyQuit() ++void ++ReallyQuit(void) + { + sim_exit(0); // Just sets tkMustExit and ExitReturn + } +diff --git a/src/sim/w_tk.c b/src/sim/w_tk.c +index 2a380b3..3ae9037 100644 +--- a/src/sim/w_tk.c ++++ b/src/sim/w_tk.c +@@ -104,14 +104,8 @@ Tk_ConfigSpec TileViewConfigSpecs[] = { + + + int TileViewCmd(CLIENT_ARGS); +-int ConfigureTileView(Tcl_Interp *interp, SimView *view, +- int argc, char **argv, int flags); + static void TileViewEventProc(ClientData clientData, XEvent *eventPtr); + static void DestroyTileView(ClientData clientData); +- +-int ConfigureSimGraph(Tcl_Interp *interp, SimGraph *graph, +- int argc, char **argv, int flags); +- + static void MicropolisTimerProc(ClientData clientData); + + int SimCmd(CLIENT_ARGS); +@@ -241,7 +235,8 @@ ConfigureTileView(Tcl_Interp *interp, SimView *view, + } + + +-InvalidateMaps() ++void ++InvalidateMaps(void) + { + SimView *view; + +@@ -255,7 +250,8 @@ InvalidateMaps() + } + + +-InvalidateEditors() ++void ++InvalidateEditors(void) + { + SimView *view; + +@@ -269,7 +265,8 @@ InvalidateEditors() + } + + +-RedrawMaps() ++void ++RedrawMaps(void) + { + SimView *view; + +@@ -283,7 +280,8 @@ RedrawMaps() + } + + +-RedrawEditors() ++void ++RedrawEditors(void) + { + SimView *view; + +@@ -302,8 +300,6 @@ DisplayTileView(ClientData clientData) + { + SimView *view = (SimView *) clientData; + Tk_Window tkwin = view->tkwin; +- Pixmap pm = None; +- Drawable d; + + view->flags &= ~VIEW_REDRAW_PENDING; + if (view->visible && (tkwin != NULL) && Tk_IsMapped(tkwin)) { +@@ -334,6 +330,7 @@ DisplayTileView(ClientData clientData) + EraserTo + */ + ++void + EventuallyRedrawView(SimView *view) + { + if (!(view->flags & VIEW_REDRAW_PENDING)) { +@@ -344,6 +341,7 @@ EventuallyRedrawView(SimView *view) + } + + ++void + CancelRedrawView(SimView *view) + { + if (view->flags & VIEW_REDRAW_PENDING) { +@@ -361,7 +359,7 @@ TileAutoScrollProc(ClientData clientData) + + if (view->tool_mode != 0) { + int dx = 0, dy = 0; +- int result, root_x, root_y, x, y; ++ int root_x, root_y, x, y; + unsigned int key_buttons; + Window root, child; + +@@ -433,7 +431,7 @@ TileViewEventProc(ClientData clientData, XEvent *eventPtr) + (eventPtr->type == MotionNotify))) { + int last_x = view->tool_x, last_y = view->tool_y, + last_showing = view->tool_showing; +- int x, y, showing, autoscroll; ++ int x, y, showing; + + if (eventPtr->type == EnterNotify) { + showing = 1; +@@ -475,8 +473,8 @@ TileViewEventProc(ClientData clientData, XEvent *eventPtr) + /* XXX: redraw all views showing cursor */ + /* XXX: also, make sure switching tools works w/out moving */ + if (((view->tool_showing != last_showing) || +- (view->tool_x != last_x) || +- (view->tool_y != last_y))) { ++ ((view->tool_x >> 4) != (last_x >> 4)) || ++ ((view->tool_y >> 4) != (last_y >> 4)))) { + #if 1 + EventuallyRedrawView(view); + #else +@@ -547,6 +545,7 @@ StructureProc(ClientData clientData, XEvent *eventPtr) + } + + ++#if 0 + static void + DelayedMap(ClientData clientData) + { +@@ -558,8 +557,10 @@ DelayedMap(ClientData clientData) + } + Tk_MapWindow(MainWindow); + } ++#endif + + ++void + DidStopPan(SimView *view) + { + char buf[256]; +@@ -621,7 +622,8 @@ ReallyStartMicropolisTimer(ClientData clientData) + } + + +-StartMicropolisTimer() ++void ++StartMicropolisTimer(void) + { + if (sim_timer_idle == 0) { + sim_timer_idle = 1; +@@ -632,7 +634,8 @@ StartMicropolisTimer() + } + + +-StopMicropolisTimer() ++void ++StopMicropolisTimer(void) + { + if (sim_timer_idle != 0) { + sim_timer_idle = 0; +@@ -651,10 +654,11 @@ StopMicropolisTimer() + } + + ++void + FixMicropolisTimer() + { + if (sim_timer_set) { +- StartMicropolisTimer(NULL); ++ StartMicropolisTimer(); + } + } + +@@ -669,7 +673,8 @@ DelayedUpdate(ClientData clientData) + } + + +-Kick() ++void ++Kick(void) + { + if (!UpdateDelayed) { + UpdateDelayed = 1; +@@ -679,7 +684,7 @@ Kick() + + + void +-StopEarthquake() ++StopEarthquake(void) + { + ShakeNow = 0; + if (earthquake_timer_set) { +@@ -689,6 +694,7 @@ StopEarthquake() + } + + ++void + DoEarthQuake(void) + { + MakeSound("city", "Explosion-Low"); +@@ -702,7 +708,8 @@ DoEarthQuake(void) + } + + +-StopToolkit() ++void ++StopToolkit(void) + { + if (tk_mainInterp != NULL) { + Eval("catch {DoStopMicropolis}"); +@@ -710,6 +717,7 @@ StopToolkit() + } + + ++int + Eval(char *buf) + { + int result = Tcl_Eval(tk_mainInterp, buf, 0, (char **) NULL); +@@ -724,10 +732,8 @@ Eval(char *buf) + } + + +-tk_main() ++void tk_main(void) + { +- char *p, *msg; +- char buf[20]; + char initCmd[256]; + Tk_3DBorder border; + +@@ -774,6 +780,7 @@ tk_main() + graph_command_init(); + date_command_init(); + sprite_command_init(); ++ sound_command_init(); + + #ifdef CAM + cam_command_init(); +@@ -819,7 +826,7 @@ tk_main() + + Tk_MainLoop(); + +- sim_exit(0); // Just sets tkMustExit and ExitReturn ++ sim_really_exit(0); + + bail: + +diff --git a/src/sim/w_tool.c b/src/sim/w_tool.c +index d678137..1143b06 100644 +--- a/src/sim/w_tool.c ++++ b/src/sim/w_tool.c +@@ -124,14 +124,18 @@ QUAD toolColors[] = { + + Ink *NewInk(); + +-short tally(short tileValue); +-int DoSetWandState(SimView *view, short state); ++void DoSetWandState(SimView *view, short state); ++void DoPendTool(SimView *view, int tool, int x, int y); ++void EraserTo(SimView *view, int x, int y); ++void EraserStart(SimView *view, int x, int y); ++void DoShowZoneStatus(char *str, char *s0, char *s1, char *s2, char *s3, char *s4, int x, int y); + + + /*************************************************************************/ + /* UTILITIES */ + + ++void + setWandState(SimView *view, short state) + { + #if 0 +@@ -440,14 +444,14 @@ check3x3(SimView *view, short mapH, short mapV, short base, short tool) + void + check4x4border(short xMap, short yMap) + { +- Ptr tilePtr; ++ short *tilePtr; + short xPos, yPos; + short cnt; + + xPos = xMap; yPos = yMap - 1; + for (cnt = 0; cnt < 4; cnt++) { + /* this will do the upper bordering row */ +- tilePtr = (Ptr) &Map[xPos][yPos]; ++ tilePtr = &Map[xPos][yPos]; + ConnecTile(xPos, yPos, tilePtr, 0); + xPos++; + } +@@ -455,7 +459,7 @@ check4x4border(short xMap, short yMap) + xPos = xMap - 1; yPos = yMap; + for (cnt = 0; cnt < 4; cnt++) { + /* this will do the left bordering row */ +- tilePtr = (Ptr) &Map[xPos][yPos]; ++ tilePtr = &Map[xPos][yPos]; + ConnecTile(xPos, yPos, tilePtr, 0); + yPos++; + } +@@ -463,7 +467,7 @@ check4x4border(short xMap, short yMap) + xPos = xMap; yPos = yMap + 4; + for (cnt = 0; cnt < 4;cnt++) { + /* this will do the bottom bordering row */ +- tilePtr = (Ptr) &Map[xPos][yPos]; ++ tilePtr = &Map[xPos][yPos]; + ConnecTile(xPos, yPos, tilePtr, 0); + xPos++; + } +@@ -471,7 +475,7 @@ check4x4border(short xMap, short yMap) + xPos = xMap + 4; yPos = yMap; + for (cnt = 0; cnt < 4; cnt++) { + /* this will do the right bordering row */ +- tilePtr = (Ptr) &Map[xPos][yPos]; ++ tilePtr = &Map[xPos][yPos]; + ConnecTile(xPos, yPos, tilePtr, 0); + yPos++; + } +@@ -637,12 +641,13 @@ check6x6(SimView *view, short mapH, short mapV, short base, short tool) + + if (autoBulldoze) { + /* if autoDoze is enabled, add up the cost of bulldozed tiles */ +- if (tileValue != 0) ++ if (tileValue != 0) { + if (tally(tileValue)) { + cost++; + } else { + flag = 0; + } ++ } + } else { + /* check and see if the tile is clear or not */ + if (tileValue != 0) { +@@ -762,9 +767,11 @@ int getDensityStr(short catNo, short mapH, short mapV) + if (z > 100) return (19); + return (18); + } ++ return 0; + } + + ++void + doZoneStatus(short mapH, short mapV) + { + char localStr[256]; +@@ -805,6 +812,7 @@ doZoneStatus(short mapH, short mapV) + } + + ++void + DoShowZoneStatus(char *str, char *s0, char *s1, char *s2, char *s3, char *s4, + int x, int y) + { +@@ -817,9 +825,10 @@ DoShowZoneStatus(char *str, char *s0, char *s1, char *s2, char *s3, char *s4, + + + /* comefrom: processWand */ ++void + put3x3Rubble(short x, short y) + { +- register xx, yy, zz; ++ register int xx, yy, zz; + + for (xx = x - 1; xx < x + 2; xx++) { + for (yy = y - 1; yy < y + 2; yy++) { +@@ -839,9 +848,10 @@ put3x3Rubble(short x, short y) + + + /* comefrom: processWand */ ++void + put4x4Rubble(short x, short y) + { +- register xx, yy, zz; ++ register int xx, yy, zz; + + for (xx = x - 1; xx < x + 3; xx++) { + for (yy = y - 1; yy < y + 3; yy++) { +@@ -861,9 +871,10 @@ put4x4Rubble(short x, short y) + + + /* comefrom: processWand */ ++void + put6x6Rubble(short x, short y) + { +- register xx, yy, zz; ++ register int xx, yy, zz; + + for (xx = x - 1; xx < x + 5; xx++) { + for (yy = y - 1; yy < y + 5; yy++) { +@@ -882,6 +893,7 @@ put6x6Rubble(short x, short y) + } + + ++void + DidTool(SimView *view, char *name, short x, short y) + { + char buf[256]; +@@ -894,6 +906,7 @@ DidTool(SimView *view, char *name, short x, short y) + } + + ++void + DoSetWandState(SimView *view, short state) + { + char buf[256]; +@@ -1306,6 +1319,7 @@ ChalkTool(SimView *view, short x, short y, short color, short first) + } + + ++void + ChalkStart(SimView *view, int x, int y, int color) + { + Ink *ink; +@@ -1325,9 +1339,12 @@ ChalkStart(SimView *view, int x, int y, int color) + } + + ++void + ChalkTo(SimView *view, int x, int y) + { ++#ifdef MOTIONBUFFER + int x0, y0, lx, ly; ++#endif + Ink *ink = (Ink *)view->track_info; + + #ifdef MOTIONBUFFER +@@ -1390,6 +1407,7 @@ EraserTool(SimView *view, short x, short y, short first) + } + + ++int + InkInBox(Ink *ink, int left, int top, int right, int bottom) + { + if ((left <= ink->right) && +@@ -1424,15 +1442,16 @@ InkInBox(Ink *ink, int left, int top, int right, int bottom) + } + + ++void + EraserStart(SimView *view, int x, int y) + { + EraserTo(view, x, y); + } + + ++void + EraserTo(SimView *view, int x, int y) + { +- SimView *v; + Ink **ip, *ink; + + for (ip = &sim->overlay; *ip != NULL;) { +@@ -1541,6 +1560,7 @@ current_tool(SimView *view, short x, short y, short first) + } + + ++void + DoTool(SimView *view, short tool, short x, short y) + { + int result; +@@ -1563,6 +1583,7 @@ DoTool(SimView *view, short tool, short x, short y) + } + + ++void + ToolDown(SimView *view, int x, int y) + { + int result; +@@ -1591,16 +1612,14 @@ ToolDown(SimView *view, int x, int y) + } + + ++void + ToolUp(SimView *view, int x, int y) + { +- int result; +- +- result = ToolDrag(view, x, y); +- +- return (result); ++ ToolDrag(view, x, y); + } + + ++void + ToolDrag(SimView *view, int px, int py) + { + int x, y, dx, dy, adx, ady, lx, ly, dist; +@@ -1623,8 +1642,6 @@ ToolDrag(SimView *view, int px, int py) + lx = view->last_x >> 4; + ly = view->last_y >> 4; + +- reset: +- + dx = x - lx; + dy = y - ly; + +@@ -1684,6 +1701,7 @@ ToolDrag(SimView *view, int px, int py) + } + + ++void + DoPendTool(SimView *view, int tool, int x, int y) + { + char buf[256]; +diff --git a/src/sim/w_update.c b/src/sim/w_update.c +index 168d626..248a311 100644 +--- a/src/sim/w_update.c ++++ b/src/sim/w_update.c +@@ -70,13 +70,21 @@ QUAD LastCityMonth; + QUAD LastFunds; + QUAD LastR, LastC, LastI; + ++void UpdateOptionsMenu(int options); ++void updateOptions(void); ++void SetDemand(double r, double c, double i); ++void drawValve(void); ++void showValves(void); ++void updateDate(void); ++void ReallyUpdateFunds(void); ++ + char *dateStr[12] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + + +-void DoUpdateHeads() ++void DoUpdateHeads(void) + { + showValves(); + doTimeStuff(); +@@ -85,38 +93,39 @@ void DoUpdateHeads() + } + + +-void UpdateEditors() ++void UpdateEditors(void) + { + InvalidateEditors(); + DoUpdateHeads(); + } + + +-void UpdateMaps() ++void UpdateMaps(void) + { + InvalidateMaps(); + } + + +-void UpdateGraphs() ++void UpdateGraphs(void) + { + ChangeCensus(); + } + + +-void UpdateEvaluation() ++void UpdateEvaluation(void) + { + ChangeEval(); + } + + +-void UpdateHeads() ++void UpdateHeads(void) + { + MustUpdateFunds = ValveFlag = 1; + LastCityTime = LastCityYear = LastCityMonth = LastFunds = LastR = -999999; + DoUpdateHeads(); + } + ++void + UpdateFunds(void) + { + MustUpdateFunds = 1; +@@ -124,6 +133,7 @@ UpdateFunds(void) + } + + ++void + ReallyUpdateFunds(void) + { + char localStr[256], dollarStr[256], buf[256]; +@@ -136,7 +146,7 @@ ReallyUpdateFunds(void) + + if (TotalFunds != LastFunds) { + LastFunds = TotalFunds; +- sprintf(localStr, "%d", TotalFunds); ++ sprintf(localStr, "%ld", TotalFunds); + makeDollarDecimalStr(localStr, dollarStr); + + sprintf(localStr, "Funds: %s", dollarStr); +@@ -147,7 +157,8 @@ ReallyUpdateFunds(void) + } + + +-doTimeStuff(void) ++void ++doTimeStuff(void) + { + // if ((CityTime >> 2) != LastCityTime) { + updateDate(); +@@ -155,6 +166,7 @@ doTimeStuff(void) + } + + ++void + updateDate(void) + { + int y; +@@ -191,6 +203,7 @@ updateDate(void) + } + + ++void + showValves(void) + { + if (ValveFlag) { +@@ -200,6 +213,7 @@ showValves(void) + } + + ++void + drawValve(void) + { + double r, c, i; +@@ -227,6 +241,7 @@ drawValve(void) + } + + ++void + SetDemand(double r, double c, double i) + { + char buf[256]; +@@ -237,7 +252,8 @@ SetDemand(double r, double c, double i) + } + + +-updateOptions() ++void ++updateOptions(void) + { + int options; + +@@ -258,6 +274,7 @@ updateOptions() + } + + ++void + UpdateOptionsMenu(int options) + { + char buf[256]; +diff --git a/src/sim/w_util.c b/src/sim/w_util.c +index 9f9db36..c3c5eb8 100644 +--- a/src/sim/w_util.c ++++ b/src/sim/w_util.c +@@ -61,9 +61,12 @@ + */ + #include "sim.h" + ++void UpdateGameLevel(void); ++ + + /* comefrom: drawTaxesCollected incBoxValue decBoxValue drawCurrentFunds + drawActualBox UpdateFunds updateCurrentCost */ ++void + makeDollarDecimalStr(char *numStr, char *dollarStr) + { + register short leftMostSet; +@@ -121,7 +124,8 @@ makeDollarDecimalStr(char *numStr, char *dollarStr) + } + + +-Pause() ++void ++Pause(void) + { + if (!sim_paused) { + sim_paused_speed = SimMetaSpeed; +@@ -131,7 +135,8 @@ Pause() + } + + +-Resume() ++void ++Resume(void) + { + if (sim_paused) { + sim_paused = 0; +@@ -140,6 +145,7 @@ Resume() + } + + ++void + setSpeed(short speed) + { + if (speed < 0) speed = 0; +@@ -167,6 +173,7 @@ setSpeed(short speed) + } + + ++void + setSkips(int skips) + { + sim_skips = skips; +@@ -174,6 +181,7 @@ setSkips(int skips) + } + + ++void + SetGameLevelFunds(short level) + { + switch (level) { +@@ -194,6 +202,7 @@ SetGameLevelFunds(short level) + } + + ++void + SetGameLevel(short level) + { + GameLevel = level; +@@ -201,7 +210,8 @@ SetGameLevel(short level) + } + + +-UpdateGameLevel() ++void ++UpdateGameLevel(void) + { + char buf[256]; + +@@ -210,6 +220,7 @@ UpdateGameLevel() + } + + ++void + setCityName(char *name) + { + char *cp = name; +@@ -223,6 +234,7 @@ setCityName(char *name) + } + + ++void + setAnyCityName(char *name) + { + char buf[1024]; +@@ -233,6 +245,7 @@ setAnyCityName(char *name) + } + + ++void + SetYear(int year) + { + // Must prevent year from going negative, since it screws up the non-floored modulo arithmetic. +@@ -247,12 +260,13 @@ SetYear(int year) + + + int +-CurrentYear() ++CurrentYear(void) + { + return (CityTime/48 + StartingYear); + } + + ++void + DoSetMapState(SimView *view, short state) + { + char buf[256]; +@@ -266,24 +280,28 @@ DoSetMapState(SimView *view, short state) + } + + +-DoNewGame() ++void ++DoNewGame(void) + { + Eval("UINewGame"); + } + + ++void + DoGeneratedCityImage(char *name, int time, int pop, char *class, int score) + { + /* XXX: TODO: print city */ + } + + ++void + DoStartElmd() + { + /* XXX: TODO: start elm daemon */ + } + + ++void + DoPopUpMessage(char *msg) + { + char buf[1024]; +diff --git a/src/sim/w_x.c b/src/sim/w_x.c +index a6472a0..b2a1c8b 100644 +--- a/src/sim/w_x.c ++++ b/src/sim/w_x.c +@@ -91,7 +91,11 @@ unsigned char ColorIntensities[] = { + /* COLOR_BLACK */ 0, + }; + ++void FreeTiles(SimView *view); ++void AllocTiles(SimView *view); ++void DoAdjustPan(struct SimView *view); + ++void + ViewToTileCoords(SimView *view, int x, int y, int *outx, int *outy) + { + x = (view->pan_x - ((view->w_width >>1) - x)) >>4; +@@ -120,6 +124,7 @@ ViewToTileCoords(SimView *view, int x, int y, int *outx, int *outy) + } + + ++void + ViewToPixelCoords(SimView *view, int x, int y, int *outx, int *outy) + { + x = view->pan_x - ((view->w_width >>1) - x); +@@ -148,7 +153,8 @@ ViewToPixelCoords(SimView *view, int x, int y, int *outx, int *outy) + } + + +-UpdateFlush() ++void ++UpdateFlush(void) + { + struct XDisplay *xd; + +@@ -216,7 +222,8 @@ printf("GOT X ERROR code %d request code %d %d\n", + } + + +-DoStopMicropolis() ++void ++DoStopMicropolis(void) + { + (void)XSetErrorHandler(CatchXError); + +@@ -244,7 +251,8 @@ DoStopMicropolis() + } + + +-DoTimeoutListen() ++void ++DoTimeoutListen(void) + { + while (Tk_DoOneEvent(TK_DONT_WAIT)) ; + } +@@ -273,10 +281,7 @@ XDisplay * + FindXDisplay(Tk_Window tkwin) + { + XDisplay *xd; +- int d = 8; +- unsigned long valuemask = 0; +- XGCValues values; +- XColor rgb, *color; ++ XColor *color; + Display *dpy = Tk_Display(tkwin); + Screen *screen = Tk_Screen(tkwin); + #ifdef IS_LINUX +@@ -327,28 +332,44 @@ FindXDisplay(Tk_Window tkwin) + color->pixel; \ + break; \ + case 15: \ ++ if (xd->visual->red_mask == 0x7c00) { \ + xd->pixels[i] = \ + (((color->red >> (8 + 3)) & 0x1f) << (5 + 5)) | \ + (((color->green >> (8 + 2)) & 0x1f) << (5)) | \ + (((color->blue >> (8 + 3)) & 0x1f) << (0)); \ ++ } else { \ ++ xd->pixels[i] = \ ++ (((color->blue >> (8 + 3)) & 0x1f) << (5 + 5)) | \ ++ (((color->green >> (8 + 2)) & 0x1f) << (5)) | \ ++ (((color->red >> (8 + 3)) & 0x1f) << (0)); \ ++ } \ + break; \ + case 16: \ ++ if (xd->visual->red_mask == 0xf800) { \ + xd->pixels[i] = \ + (((color->red >> (8 + 3)) & 0x1f) << (6 + 5)) | \ + (((color->green >> (8 + 2)) & 0x3f) << (5)) | \ + (((color->blue >> (8 + 3)) & 0x1f) << (0)); \ ++ } else { \ ++ xd->pixels[i] = \ ++ (((color->blue >> (8 + 3)) & 0x1f) << (6 + 5)) | \ ++ (((color->green >> (8 + 2)) & 0x3f) << (5)) | \ ++ (((color->red >> (8 + 3)) & 0x1f) << (0)); \ ++ } \ + break; \ + case 24: \ ++ case 32: \ ++ if (xd->visual->red_mask == 0xff0000) { \ + xd->pixels[i] = \ + ((color->red & 0xff) << 16) | \ + ((color->green & 0xff) << 8) | \ + ((color->blue & 0xff) << 0); \ +- break; \ +- case 32: \ ++ } else { \ + xd->pixels[i] = \ +- ((color->red & 0xff) << 16) | \ ++ ((color->blue & 0xff) << 16) | \ + ((color->green & 0xff) << 8) | \ +- ((color->blue & 0xff) << 0); \ ++ ((color->red & 0xff) << 0); \ ++ } \ + break; \ + } \ + } \ +@@ -470,12 +491,14 @@ FindXDisplay(Tk_Window tkwin) + } + + ++void + IncRefDisplay(XDisplay *xd) + { + xd->references++; + } + + ++void + DecRefDisplay(XDisplay *xd) + { + if ((--xd->references) == 0) { +@@ -487,13 +510,8 @@ DecRefDisplay(XDisplay *xd) + SimView * + InitNewView(SimView *view, char *title, int class, int w, int h) + { +- int type, i; +- int d = 8; +- unsigned long valuemask = 0; ++ int test = 1; + char *t; +- struct XDisplay *xd; +- XGCValues values; +- XColor rgb, *color; + + t = (char *)ckalloc(strlen(title) + 1); + strcpy(t, title); +@@ -582,6 +600,10 @@ InitNewView(SimView *view, char *title, int class, int w, int h) + view->type = X_Mem_View; + } + ++ view->x->needs_swap = !(*(unsigned char*) (&test)); ++ view->x->x_big_endian = (ImageByteOrder(view->x->dpy) == MSBFirst); ++ ++ + GetPixmaps(view->x); + view->pixels = view->x->pixels; + +@@ -591,12 +613,11 @@ InitNewView(SimView *view, char *title, int class, int w, int h) + view->pan_x = w / 2; view->pan_y = h / 2; + DoResizeView(view, w, h); + +- GetViewTiles(view); +- + return (view); + } + + ++void + DestroyView(SimView *view) + { + SimView **vp; +@@ -705,6 +726,7 @@ AllocPixels(int len, unsigned char pixel) + } + + ++void + DoResizeView(SimView *view, int w, int h) + { + int resize = 0; +@@ -884,7 +906,7 @@ DoResizeView(SimView *view, int w, int h) + } + + view->data = (unsigned char *)shmat(view->shminfo->shmid, 0, 0); +- if ((int)view->data == -1) { ++ if ((char*)view->data == (char*)-1) { + perror("shmat"); + fprintf(stderr, + "Darn, Micropolis can't find any memory to share with display \"%s\".\n", +@@ -916,7 +938,7 @@ DoResizeView(SimView *view, int w, int h) + if (!GotXError) { + attached = 1; + view->pixmap = XShmCreatePixmap(view->x->dpy, view->x->root, +- view->data, view->shminfo, ++ (char*)view->data, view->shminfo, + view->m_width, view->m_height, + view->x->depth); + XSync(view->x->dpy, False); +@@ -1138,7 +1160,7 @@ DoResizeView(SimView *view, int w, int h) + view->pixel_bytes = 2; + view->depth = 15; + bitmap_pad = 16; +- bitmap_depth = 16; ++ bitmap_depth = 15; + view->line_bytes8 = + ((view->m_width * view->pixel_bytes) + 3) & (~3); + break; +@@ -1156,7 +1178,7 @@ DoResizeView(SimView *view, int w, int h) + view->pixel_bytes = 4; + //view->pixel_bytes = 3; + view->depth = 24; +- bitmap_depth = 32; ++ bitmap_depth = 24; + bitmap_pad = 32; + view->line_bytes8 = + ((view->m_width * 4) + 3) & (~3); +@@ -1224,15 +1246,20 @@ DoResizeView(SimView *view, int w, int h) + } + } + } ++ ++ GetViewTiles(view); ++ + } + + ++void + DoPanBy(struct SimView *view, int dx, int dy) + { + DoPanTo(view, view->pan_x + dx, view->pan_y + dy); + } + + ++void + DoPanTo(struct SimView *view, int x, int y) + { + if (view->class != Editor_Class) { +@@ -1253,12 +1280,12 @@ DoPanTo(struct SimView *view, int x, int y) + + /* #define DEBUG_PAN */ + ++void + DoAdjustPan(struct SimView *view) + { + int ww2 = view->w_width >>1, wh2 = view->w_height >>1; + int px = view->pan_x, py = view->pan_y; + int last_tile_x = view->tile_x, last_tile_y = view->tile_y; +- int last_tile_width = view->tile_width, last_tile_height = view->tile_height; + int total_width = view->m_width >>4, total_height = view->m_height >>4; + //fprintf(stderr, "DoAdjustPan\n"); + +@@ -1371,6 +1398,7 @@ DoAdjustPan(struct SimView *view) + } + + ++void + AllocTiles(SimView *view) + { + int row, col; +@@ -1402,6 +1430,7 @@ AllocTiles(SimView *view) + } + + ++void + FreeTiles(SimView *view) + { + int col; +@@ -1446,6 +1475,7 @@ NewInk() + } + + ++void + FreeInk(Ink *ink) + { + ink->next = OldInk; +@@ -1453,6 +1483,7 @@ FreeInk(Ink *ink) + } + + ++void + StartInk(Ink *ink, int x, int y) + { + ink->length = 1; +@@ -1461,6 +1492,7 @@ StartInk(Ink *ink, int x, int y) + } + + ++void + AddInk(Ink *ink, int x, int y) + { + int dx = x - ink->last_x; +@@ -1494,7 +1526,7 @@ AddInk(Ink *ink, int x, int y) + ink->points[ink->length].y = dy; + ink->length++; + +- ADJUST: ++ /* ADJUST: */ + if (x < ink->left) + ink->left = x; + if (x > ink->right) +@@ -1532,7 +1564,8 @@ AddInk(Ink *ink, int x, int y) + } + + +-EraseOverlay() ++void ++EraseOverlay(void) + { + Ink *ink; + +diff --git a/src/tcl/tclenv.c b/src/tcl/tclenv.c +index 656ca53..be330e1 100644 +--- a/src/tcl/tclenv.c ++++ b/src/tcl/tclenv.c +@@ -1,7 +1,7 @@ + /* + * tclEnv.c -- + * +- * Tcl support for environment variables, including a setenv ++ * Tcl support for environment variables, including a setenv_tcl + * procedure. + * + * Copyright 1991 Regents of the University of California +@@ -57,13 +57,8 @@ static char * EnvTraceProc _ANSI_ARGS_((ClientData clientData, + int flags)); + static int FindVariable _ANSI_ARGS_((char *name, int *lengthPtr)); + +-#ifdef IS_LINUX +-int setenv _ANSI_ARGS_((const char *name, const char *value, int replace)); +-int unsetenv _ANSI_ARGS_((const char *name)); +-#else +-void setenv _ANSI_ARGS_((char *name, char *value)); +-void unsetenv _ANSI_ARGS_((char *name)); +-#endif ++void setenv_tcl _ANSI_ARGS_((char *name, char *value)); ++int unsetenv_tcl _ANSI_ARGS_((char *name)); + + + /* +@@ -188,7 +183,7 @@ FindVariable(name, lengthPtr) + /* + *---------------------------------------------------------------------- + * +- * setenv -- ++ * setenv_tcl -- + * + * Set an environment variable, replacing an existing value + * or creating a new variable if there doesn't exist a variable +@@ -204,20 +199,11 @@ FindVariable(name, lengthPtr) + *---------------------------------------------------------------------- + */ + +-#ifdef IS_LINUX +-int +-setenv(name, value, replace) +- const char *name; /* Name of variable whose value is to be +- * set. */ +- const char *value; /* New value for variable. */ +- int replace; +-#else + void +-setenv(name, value) ++setenv_tcl(name, value) + char *name; /* Name of variable whose value is to be + * set. */ + char *value; /* New value for variable. */ +-#endif + { + int index, length, nameLength; + char *p; +@@ -272,17 +258,12 @@ setenv(name, value) + for (eiPtr= firstInterpPtr; eiPtr != NULL; eiPtr = eiPtr->nextPtr) { + (void) Tcl_SetVar2(eiPtr->interp, "env", (char *)name, p+1, TCL_GLOBAL_ONLY); + } +- +-#ifdef IS_LINUX +- return 0; +-#endif +- + } + + /* + *---------------------------------------------------------------------- + * +- * unsetenv -- ++ * unsetenv_tcl -- + * + * Remove an environment variable, updating the "env" arrays + * in all interpreters managed by us. +@@ -297,12 +278,8 @@ setenv(name, value) + */ + + int +-unsetenv(name) +-#ifdef IS_LINUX +- const char *name; /* Name of variable to remove. */ +-#else ++unsetenv_tcl(name) + char *name; /* Name of variable to remove. */ +-#endif + { + int index, dummy; + char **envPtr; +@@ -402,15 +379,15 @@ EnvTraceProc(clientData, interp, name1, name2, flags) + } + + /* +- * If a value is being set, call setenv to do all of the work. ++ * If a value is being set, call setenv_tcl to do all of the work. + */ + + if (flags & TCL_TRACE_WRITES) { +- setenv(name2, Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY), 0); ++ setenv_tcl(name2, Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY)); + } + + if (flags & TCL_TRACE_UNSETS) { +- unsetenv(name2); ++ unsetenv_tcl(name2); + } + return NULL; + } +diff --git a/src/tcl/tclunix.h b/src/tcl/tclunix.h +index a4c5cab..daa298c 100644 +--- a/src/tcl/tclunix.h ++++ b/src/tcl/tclunix.h +@@ -101,7 +101,7 @@ + */ + + extern int errno; +-extern int sys_nerr; ++//extern int sys_nerr; + //#ifndef IS_LINUX + //extern char *sys_errlist[]; + //#endif +diff --git a/src/tcl/tclunxst.c b/src/tcl/tclunxst.c +index 89fb0cd..fcc1d3b 100644 +--- a/src/tcl/tclunxst.c ++++ b/src/tcl/tclunxst.c +@@ -530,7 +530,7 @@ Tcl_SignalId(sig) + #ifdef SIGKILL + case SIGKILL: return "SIGKILL"; + #endif +-#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) ++#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR)) + case SIGLOST: return "SIGLOST"; + #endif + #ifdef SIGPIPE +@@ -662,7 +662,7 @@ Tcl_SignalMsg(sig) + #ifdef SIGKILL + case SIGKILL: return "kill signal"; + #endif +-#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) ++#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR)) + case SIGLOST: return "resource lost"; + #endif + #ifdef SIGPIPE +diff --git a/src/tclx/config.mk b/src/tclx/config.mk +index 22d43cb..69ca791 100644 +--- a/src/tclx/config.mk ++++ b/src/tclx/config.mk +@@ -60,7 +60,7 @@ XPM_LIBS=-L/usr/X11R6/lib -lXpm + # profiling is enabled, the DO_STRIPPING option below must be disabled. + # + +-CC=gcc ++#CC=gcc + + OPTIMIZE_FLAG=-O3 -DIS_LINUX + #OPTIMIZE_FLAG=-g -DIS_LINUX +diff --git a/src/tclx/ossupp/makefile b/src/tclx/ossupp/makefile +index a01156f..5c2ebba 100644 +--- a/src/tclx/ossupp/makefile ++++ b/src/tclx/ossupp/makefile +@@ -30,7 +30,7 @@ CFLAGS=$(OPTIMIZE_FLAG) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ + all: made.tmp + + made.tmp: $(SUPPORT_OBJS) +- $(AR) cr ../libtcl.a $(SUPPORT_OBJS) ++ #$(AR) cr ../libtcl.a $(SUPPORT_OBJS) + touch made.tmp + + #------------------------------------------------------------------------------ +diff --git a/src/tclx/src/tclxgdat.y b/src/tclx/src/tclxgdat.y +index 6957537..e29d7ea 100644 +--- a/src/tclx/src/tclxgdat.y ++++ b/src/tclx/src/tclxgdat.y +@@ -64,78 +64,78 @@ + timedate: /* empty */ + | timedate item; + +-item: tspec = ++item: tspec + {timeflag++;} +- | zone = ++ | zone + {zoneflag++;} +- | dtspec = ++ | dtspec + {dateflag++;} +- | dyspec = ++ | dyspec + {dayflag++;} +- | rspec = ++ | rspec + {relflag++;} + | nspec; + +-nspec: NUMBER = ++nspec: NUMBER + {if (timeflag && dateflag && !relflag) year = $1; + else {timeflag++;hh = $1/100;mm = $1%100;ss = 0;merid = 24;}}; + +-tspec: NUMBER MERIDIAN = ++tspec: NUMBER MERIDIAN + {hh = $1; mm = 0; ss = 0; merid = $2;} +- | NUMBER ':' NUMBER = ++ | NUMBER ':' NUMBER + {hh = $1; mm = $3; merid = 24;} +- | NUMBER ':' NUMBER MERIDIAN = ++ | NUMBER ':' NUMBER MERIDIAN + {hh = $1; mm = $3; merid = $4;} +- | NUMBER ':' NUMBER NUMBER = ++ | NUMBER ':' NUMBER NUMBER + {hh = $1; mm = $3; merid = 24; + dayLight = STANDARD; ourzone = -($4%100 + 60*$4/100);} +- | NUMBER ':' NUMBER ':' NUMBER = ++ | NUMBER ':' NUMBER ':' NUMBER + {hh = $1; mm = $3; ss = $5; merid = 24;} +- | NUMBER ':' NUMBER ':' NUMBER MERIDIAN = ++ | NUMBER ':' NUMBER ':' NUMBER MERIDIAN + {hh = $1; mm = $3; ss = $5; merid = $6;} +- | NUMBER ':' NUMBER ':' NUMBER NUMBER = ++ | NUMBER ':' NUMBER ':' NUMBER NUMBER + {hh = $1; mm = $3; ss = $5; merid = 24; + dayLight = STANDARD; ourzone = -($6%100 + 60*$6/100);}; + +-zone: ZONE = ++zone: ZONE + {ourzone = $1; dayLight = STANDARD;} +- | DAYZONE = ++ | DAYZONE + {ourzone = $1; dayLight = DAYLIGHT;}; + +-dyspec: DAY = ++dyspec: DAY + {dayord = 1; dayreq = $1;} +- | DAY ',' = ++ | DAY ',' + {dayord = 1; dayreq = $1;} +- | NUMBER DAY = ++ | NUMBER DAY + {dayord = $1; dayreq = $2;}; + +-dtspec: NUMBER '/' NUMBER = ++dtspec: NUMBER '/' NUMBER + {month = $1; day = $3;} +- | NUMBER '/' NUMBER '/' NUMBER = ++ | NUMBER '/' NUMBER '/' NUMBER + {month = $1; day = $3; year = $5;} +- | MONTH NUMBER = ++ | MONTH NUMBER + {month = $1; day = $2;} +- | MONTH NUMBER ',' NUMBER = ++ | MONTH NUMBER ',' NUMBER + {month = $1; day = $2; year = $4;} +- | NUMBER MONTH = ++ | NUMBER MONTH + {month = $2; day = $1;} +- | NUMBER MONTH NUMBER = ++ | NUMBER MONTH NUMBER + {month = $2; day = $1; year = $3;}; + + +-rspec: NUMBER UNIT = ++rspec: NUMBER UNIT + {relsec += 60L * $1 * $2;} +- | NUMBER MUNIT = ++ | NUMBER MUNIT + {relmonth += $1 * $2;} +- | NUMBER SUNIT = ++ | NUMBER SUNIT + {relsec += $1;} +- | UNIT = ++ | UNIT + {relsec += 60L * $1;} +- | MUNIT = ++ | MUNIT + {relmonth += $1;} +- | SUNIT = ++ | SUNIT + {relsec++;} +- | rspec AGO = ++ | rspec AGO + {relsec = -relsec; relmonth = -relmonth;}; + %% + +@@ -228,7 +228,7 @@ time_t daylcorr(future, now) time_t future, now; + + static char *lptr; + +-static ++//static + yylex() + { + #ifndef YYSTYPE +diff --git a/src/tclx/src/tclxid.c b/src/tclx/src/tclxid.c +index b23d7bb..730c4ef 100644 +--- a/src/tclx/src/tclxid.c ++++ b/src/tclx/src/tclxid.c +@@ -239,7 +239,7 @@ Tcl_IdCmd (clientData, interp, argc, argv) + " process group [set]", (char *) NULL); + return TCL_ERROR; + } +- setpgrp (); ++ setpgid(getpid(), getpid()); + return TCL_OK; + } + Tcl_AppendResult (interp, tclXWrongArgs, argv [0], +diff --git a/src/tclx/src/tclxint.h b/src/tclx/src/tclxint.h +index 6a1dfee..5cacb48 100644 +--- a/src/tclx/src/tclxint.h ++++ b/src/tclx/src/tclxint.h +@@ -67,7 +67,10 @@ + # include + #endif + +-#include ++//#include "values.h" ++#include ++#include ++#define MAXDOUBLE DBL_MAX + #include + /* + * On some systems this is not included by tclUnix.h. +diff --git a/src/tk/tkbind.c b/src/tk/tkbind.c +index 1aa2614..d32d8c9 100644 +--- a/src/tk/tkbind.c ++++ b/src/tk/tkbind.c +@@ -229,11 +229,11 @@ static ModInfo modArray[] = { + "Button5", Button5Mask, 0, + "Mod1", Mod1Mask, 0, + "M1", Mod1Mask, 0, +- "Meta", Mod1Mask, 0, +- "M", Mod1Mask, 0, ++ "Meta", META_MASK, 0, ++ "M", META_MASK, 0, + "Mod2", Mod2Mask, 0, + "M2", Mod2Mask, 0, +- "Alt", Mod2Mask, 0, ++ "Alt", ALT_MASK, 0, + "Mod3", Mod3Mask, 0, + "M3", Mod3Mask, 0, + "Mod4", Mod4Mask, 0, +@@ -383,8 +383,8 @@ static PatSeq * FindSequence _ANSI_ARGS_((Tcl_Interp *interp, + static char * GetField _ANSI_ARGS_((char *p, char *copy, int size)); + static KeySym GetKeySym _ANSI_ARGS_((TkDisplay *dispPtr, + XEvent *eventPtr)); +-static PatSeq * MatchPatterns _ANSI_ARGS_((BindingTable *bindPtr, +- PatSeq *psPtr)); ++static PatSeq * MatchPatterns _ANSI_ARGS_((TkDisplay *dispPtr, ++ BindingTable *bindPtr, PatSeq *psPtr)); + + /* + *-------------------------------------------------------------- +@@ -1034,14 +1034,14 @@ Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr) + key.detail = detail; + hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key); + if (hPtr != NULL) { +- matchPtr = MatchPatterns(bindPtr, ++ matchPtr = MatchPatterns(dispPtr, bindPtr, + (PatSeq *) Tcl_GetHashValue(hPtr)); + } + if ((detail != 0) && (matchPtr == NULL)) { + key.detail = 0; + hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key); + if (hPtr != NULL) { +- matchPtr = MatchPatterns(bindPtr, ++ matchPtr = MatchPatterns(dispPtr, bindPtr, + (PatSeq *) Tcl_GetHashValue(hPtr)); + } + } +@@ -1576,7 +1576,8 @@ GetKeySym(dispPtr, eventPtr) + */ + + static PatSeq * +-MatchPatterns(bindPtr, psPtr) ++MatchPatterns(dispPtr, bindPtr, psPtr) ++ TkDisplay *dispPtr; + BindingTable *bindPtr; /* Information about binding table, such + * as ring of recent events. */ + register PatSeq *psPtr; /* List of pattern sequences. */ +@@ -1609,9 +1610,6 @@ MatchPatterns(bindPtr, psPtr) + if (ringCount <= 0) { + goto nextSequence; + } +- if (eventPtr->xany.window != window) { +- goto nextSequence; +- } + if (eventPtr->xany.type != patPtr->eventType) { + /* + * If the event is a mouse motion, button release, +@@ -1624,11 +1622,16 @@ MatchPatterns(bindPtr, psPtr) + || (eventPtr->xany.type == ButtonRelease) + || (eventPtr->xany.type == KeyRelease) + || (eventPtr->xany.type == NoExpose) ++ || (eventPtr->xany.type == EnterNotify) ++ || (eventPtr->xany.type == LeaveNotify) + || (eventPtr->xany.type == GraphicsExpose)) { + goto nextEvent; + } + goto nextSequence; + } ++ if (eventPtr->xany.window != window) { ++ goto nextSequence; ++ } + + flags = flagArray[eventPtr->type]; + if (flags & KEY_BUTTON_MOTION) { +@@ -1638,13 +1641,58 @@ MatchPatterns(bindPtr, psPtr) + } else { + state = 0; + } +- if ((state & patPtr->needMods) +- != patPtr->needMods) { +- goto nextSequence; ++ if (patPtr->needMods != 0) { ++ int modMask = patPtr->needMods; ++ ++ if (!dispPtr->metaModMask && !dispPtr->altModMask && !dispPtr->modeModMask) { ++ int i, max; ++ XModifierKeymap *modMapPtr; ++ KeyCode *codePtr; ++ KeySym keysym; ++ ++ modMapPtr = XGetModifierMapping(dispPtr->display); ++ codePtr = modMapPtr->modifiermap; ++ max = 8*modMapPtr->max_keypermod; ++ ++ for (i = 0; i < max; i++, codePtr++) { ++ if (*codePtr == 0) { ++ continue; ++ } ++ keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0); ++ if (keysym == XK_Mode_switch) { ++ dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod); ++ } ++ if ((keysym == XK_Meta_L) || (keysym == XK_Meta_R)) { ++ dispPtr->metaModMask |= ShiftMask << (i/modMapPtr->max_keypermod); ++ } ++ if ((keysym == XK_Alt_L) || (keysym == XK_Alt_R)) { ++ dispPtr->altModMask |= ShiftMask << (i/modMapPtr->max_keypermod); ++ } ++ } ++ } ++ if ((modMask & META_MASK) && (dispPtr->metaModMask != 0)) { ++ modMask = (modMask & ~META_MASK) | dispPtr->metaModMask; ++ } ++ if ((modMask & ALT_MASK) && (dispPtr->altModMask != 0)) { ++ modMask = (modMask & ~ALT_MASK) | dispPtr->altModMask; ++ } ++ ++ if ((state & META_MASK) && (dispPtr->metaModMask != 0)) { ++ state = (state & ~META_MASK) | dispPtr->metaModMask; ++ } ++ if ((state & ALT_MASK) && (dispPtr->altModMask != 0)) { ++ state = (state & ~ALT_MASK) | dispPtr->altModMask; ++ } ++ ++ if ((state & modMask) != modMask) { ++ goto nextSequence; ++ } + } ++#if 0 + if ((state & patPtr->hateMods) != 0) { + goto nextSequence; + } ++#endif + if ((patPtr->detail != 0) + && (patPtr->detail != *detailPtr)) { + goto nextSequence; +diff --git a/src/tk/tkcanvas.c b/src/tk/tkcanvas.c +index 653988c..90a9619 100644 +--- a/src/tk/tkcanvas.c ++++ b/src/tk/tkcanvas.c +@@ -1488,7 +1488,7 @@ ConfigureCanvas(interp, canvasPtr, argc, argv, flags) + + #if defined(USE_XPM3) + //#include "xpmtk.h" +-#include ++#include + /* + *-------------------------------------------------------------- + * +diff --git a/src/tk/tkcolor.c b/src/tk/tkcolor.c +index 7a7e835..4e95c80 100644 +--- a/src/tk/tkcolor.c ++++ b/src/tk/tkcolor.c +@@ -484,42 +484,67 @@ Tk_VisInfo(Screen *screen) + #else + scrnum = Tk_IndexOfScreen(screen); + vTemplate.screen = scrnum; +- vTemplate.depth = 8; +- vTemplate.class = PseudoColor; ++ vTemplate.class = TrueColor; + visualList = + XGetVisualInfo(DisplayOfScreen(screen), + VisualScreenMask | +- VisualDepthMask | + VisualClassMask, + &vTemplate, &visualsMatched); +- if (visualsMatched > 0) { +- info->visual = visualList[0].visual; +- info->depth = 8; +- info->pixmap = XCreatePixmap(screen->display, +- RootWindowOfScreen(screen), +- 1, 1, 8); +-//fprintf(stderr, "TK_CreateColormap %d\n", TK_CreateColormap); +- if ((TK_CreateColormap == 0) && +- (info->visual == DefaultVisualOfScreen(screen))) { +- info->colormap = DefaultColormapOfScreen(screen); +- info->gc = DefaultGCOfScreen(screen); +- } else { +- info->colormap = +- XCreateColormap(screen->display, +- RootWindowOfScreen(screen), +- info->visual, AllocNone); +- info->gc = +- XCreateGC(screen->display, +- info->pixmap, 0, &values); +- } +- } else { ++ info->visual = NULL; ++ ++ if (visualList != NULL) { ++ int i; ++ for (i = 0; i < visualsMatched; i++) { ++ if (visualList[i].depth > 24) ++ continue; /* Most likely broken */ ++ ++ info->visual = visualList[i].visual; ++ info->depth = visualList[i].depth; ++ ++ break; ++ } ++ } ++ ++ if (info->visual == NULL) { + info->visual = XDefaultVisualOfScreen(screen); + info->depth = XDefaultDepthOfScreen(screen); +- info->pixmap = XCreatePixmap(screen->display, +- RootWindowOfScreen(screen), +- 1, 1, info->depth); + info->colormap = XDefaultColormapOfScreen(screen); + info->gc = DefaultGCOfScreen(screen); ++ ++ if (info->depth == 8) { ++ vTemplate.screen = scrnum; ++ vTemplate.class = PseudoColor; ++ vTemplate.depth = 8; ++ visualList = XGetVisualInfo(DisplayOfScreen(screen), ++ VisualScreenMask | ++ VisualDepthMask | ++ VisualClassMask, ++ &vTemplate, &visualsMatched); ++ ++ if (visualsMatched > 0) { ++ info->visual = visualList[0].visual; ++ info->depth = visualList[0].depth; ++ ++ } ++ } ++ } ++ ++ info->pixmap = XCreatePixmap(screen->display, ++ RootWindowOfScreen(screen), ++ 1, 1, info->depth); ++ ++ if ((TK_CreateColormap == 0) && ++ (info->visual == DefaultVisualOfScreen(screen))) { ++ info->colormap = DefaultColormapOfScreen(screen); ++ info->gc = DefaultGCOfScreen(screen); ++ } else { ++ info->colormap = ++ XCreateColormap(screen->display, ++ RootWindowOfScreen(screen), ++ info->visual, AllocNone); ++ info->gc = ++ XCreateGC(screen->display, ++ info->pixmap, 0, &values); + } + + XFree((char *)visualList); +diff --git a/src/tk/tkgrab.c b/src/tk/tkgrab.c +index fe5cc4e..0bf8a39 100644 +--- a/src/tk/tkgrab.c ++++ b/src/tk/tkgrab.c +@@ -498,8 +498,6 @@ TkPointerEvent(eventPtr, winPtr) + int appGrabbed = 0; /* Non-zero means event is being + * reported to an application that is + * affected by the grab. */ +-#define ALL_BUTTONS \ +- (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) + static unsigned int state[] = { + Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask + }; +diff --git a/src/tk/tkint.h b/src/tk/tkint.h +index e2c7b7e..0083e51 100644 +--- a/src/tk/tkint.h ++++ b/src/tk/tkint.h +@@ -38,6 +38,12 @@ + #include "tclhash.h" + #endif + ++#define META_MASK (AnyModifier<<1) ++#define ALT_MASK (AnyModifier<<2) ++ ++#define ALL_BUTTONS \ ++ (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) ++ + /* + * One of the following structures is maintained for each display + * containing a window managed by Tk: +@@ -76,6 +82,9 @@ typedef struct TkDisplay { + * retrieved from the server yet. */ + KeySym *keySyms; /* Array of KeySyms, returned by + * XGetKeyboardMapping. */ ++ unsigned int modeModMask; ++ unsigned int metaModMask; ++ unsigned int altModMask; + + /* + * Information used by tkError.c only: +diff --git a/src/tk/tkpixmap.c b/src/tk/tkpixmap.c +index 3a0d9ca..753bbe1 100644 +--- a/src/tk/tkpixmap.c ++++ b/src/tk/tkpixmap.c +@@ -41,7 +41,7 @@ static char *AtFSid = "$Header: tkPixmap.c[1.1] Mon Sep 28 14:12:35 1992 garfiel + * Include the xpm 3 defines for color pixmaps + */ + //#include "xpmtk.h" +-#include ++#include + + /* + * One of the following data structures exists for each bitmap that is +diff --git a/src/tk/tkscale.c b/src/tk/tkscale.c +index 9b6e4b2..7ea2b22 100644 +--- a/src/tk/tkscale.c ++++ b/src/tk/tkscale.c +@@ -1317,7 +1317,7 @@ ScaleMouseProc(clientData, eventPtr) + eventPtr->xmotion.x, eventPtr->xmotion.y)); + } else if ((eventPtr->type == ButtonPress) + /* && (eventPtr->xbutton.button == Button1) */ +- && (eventPtr->xbutton.state == 0)) { ++ && ((eventPtr->xbutton.state & ALL_BUTTONS) == 0)) { + scalePtr->flags |= BUTTON_PRESSED; + SetScaleValue(scalePtr, PixelToValue(scalePtr, + eventPtr->xbutton.x, eventPtr->xbutton.y)); +diff --git a/src/tk/tkscrbar.c b/src/tk/tkscrbar.c +index 6cec27a..bb843bc 100644 +--- a/src/tk/tkscrbar.c ++++ b/src/tk/tkscrbar.c +@@ -974,7 +974,7 @@ ScrollbarMouseProc(clientData, eventPtr) + eventPtr->xmotion.y)); + } + } else if ((eventPtr->type == ButtonPress) +- && (eventPtr->xbutton.state == 0)) { ++ && ((eventPtr->xbutton.state & ALL_BUTTONS) == 0)) { + scrollPtr->pressField = scrollPtr->mouseField; + if (scrollPtr->pressField != SLIDER) { + scrollPtr->autoRepeat = Tk_CreateTimerHandler( +diff --git a/src/tk/tkwindow.c b/src/tk/tkwindow.c +index 77e0b77..05029aa 100644 +--- a/src/tk/tkwindow.c ++++ b/src/tk/tkwindow.c +@@ -360,6 +360,9 @@ GetScreen(interp, screenName, screenPtr) + dispPtr->selectionSerial = 0; + dispPtr->multipleAtom = None; + dispPtr->atomInit = 0; ++ dispPtr->modeModMask = 0; ++ dispPtr->metaModMask = 0; ++ dispPtr->altModMask = 0; + dispPtr->cursorFont = None; + dispPtr->grabWinPtr = NULL; + dispPtr->ungrabWinPtr = NULL; +diff --git a/src/tk/tkwm.c b/src/tk/tkwm.c +index af974be..6e17f7e 100644 +--- a/src/tk/tkwm.c ++++ b/src/tk/tkwm.c +@@ -349,36 +349,35 @@ TkWmMapWindow(winPtr) + if (wmPtr->hints.initial_state == NormalState) { + winPtr->flags |= TK_MAPPED; + } +- if (!(wmPtr->flags & WM_NEVER_MAPPED)) { +- return 1; +- } +- wmPtr->flags &= ~WM_NEVER_MAPPED; ++ if (wmPtr->flags & WM_NEVER_MAPPED) { ++ wmPtr->flags &= ~WM_NEVER_MAPPED; + +- /* +- * This is the first time this window has ever been mapped. +- * Store all the window-manager-related information for the +- * window. +- */ ++ /* ++ * This is the first time this window has ever been mapped. ++ * Store all the window-manager-related information for the ++ * window. ++ */ + + #ifndef X11R3 +- if (wmPtr->titleUid == NULL) { +- wmPtr->titleUid = winPtr->nameUid; +- } +- if (XStringListToTextProperty(&wmPtr->titleUid, 1, &textProp) != 0) { +- XSetWMName(winPtr->display, winPtr->window, &textProp); +- XFree((char *) textProp.value); +- } ++ if (wmPtr->titleUid == NULL) { ++ wmPtr->titleUid = winPtr->nameUid; ++ } ++ if (XStringListToTextProperty(&wmPtr->titleUid, 1, &textProp) != 0) { ++ XSetWMName(winPtr->display, winPtr->window, &textProp); ++ XFree((char *) textProp.value); ++ } + #endif + +- TkWmSetClass(winPtr); +- TkWmSetWmProtocols(winPtr); ++ TkWmSetClass(winPtr); ++ TkWmSetWmProtocols(winPtr); + +- if (wmPtr->iconName != NULL) { +- XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); +- } ++ if (wmPtr->iconName != NULL) { ++ XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); ++ } + +- if (wmPtr->master != None) { +- XSetTransientForHint(winPtr->display, winPtr->window, wmPtr->master); ++ if (wmPtr->master != None) { ++ XSetTransientForHint(winPtr->display, winPtr->window, wmPtr->master); ++ } + } + + wmPtr->flags |= WM_UPDATE_SIZE_HINTS; --- micropolis-activity-0.0.20071228.orig/debian/patches/series +++ micropolis-activity-0.0.20071228/debian/patches/series @@ -0,0 +1,3 @@ +zerfleddert.20100109.patch +makefile.patch +micropolis-path.patch --- micropolis-activity-0.0.20071228.orig/debian/patches/micropolis-path.patch +++ micropolis-activity-0.0.20071228/debian/patches/micropolis-path.patch @@ -0,0 +1,17 @@ +# Copyright (C) 2008 by Kenshi Muto +# Distributed under the same license as the game. See debian/copyright. + +Index: micropolis-activity/Micropolis +=================================================================== +--- micropolis-activity.orig/Micropolis 2009-09-09 13:26:04.000000000 +0200 ++++ micropolis-activity/Micropolis 2009-09-09 13:40:03.000000000 +0200 +@@ -1,7 +1,7 @@ + #!/bin/bash +-export SIMHOME=`pwd` ++export SIMHOME=/usr/share/games/micropolis + echo "Starting Micropolis in $SIMHOME ... " +-res/sim $* ++cd $SIMHOME && /usr/lib/games/micropolis/sim $* + + # + # Micropolis, Unix Version. This game was released for the Unix platform --- micropolis-activity-0.0.20071228.orig/debian/patches/makefile.patch +++ micropolis-activity-0.0.20071228/debian/patches/makefile.patch @@ -0,0 +1,194 @@ +Index: micropolis-activity/src/makefile +=================================================================== +--- micropolis-activity.orig/src/makefile 2009-09-08 12:11:25.000000000 +0200 ++++ micropolis-activity/src/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -60,6 +60,7 @@ + # NOT APPLY TO YOU. + + RES = ../res ++OPTFLAGS = -O2 -Wall -g + + TARFILES = \ + micropolis-activity/Micropolis \ +@@ -75,10 +76,10 @@ + micropolis-activity/Micropolis.png + + all: +- cd tcl ; make all +- cd tk ; make all +- cd tclx ; make all +- cd sim ; make all ++ cd tcl ; make OPTFLAGS="$(OPTFLAGS)" all ++ cd tk ; make OPTFLAGS="$(OPTFLAGS)" all ++ cd tclx ; make OPTFLAGS="$(OPTFLAGS)" all ++ cd sim ; make OPTFLAGS="$(OPTFLAGS)" all + + clean: + rm -f Micropolis.tgz +Index: micropolis-activity/src/tcl/makefile +=================================================================== +--- micropolis-activity.orig/src/tcl/makefile 2009-09-08 12:11:24.000000000 +0200 ++++ micropolis-activity/src/tcl/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -24,10 +24,9 @@ + + TCL_LIBRARY = /usr/local/lib/tcl + +-CC = gcc +- +-CFLAGS = -O3 -I. -DTCL_LIBRARY=\"${TCL_LIBRARY}\" -DIS_LINUX +-#CFLAGS = -g -I. -DTCL_LIBRARY=\"${TCL_LIBRARY}\" -DIS_LINUX ++CC = gcc ++OPTFLAGS = -O3 ++CFLAGS = $(OPTFLAGS) -I. -DTCL_LIBRARY=\"${TCL_LIBRARY}\" -DIS_LINUX + + GENERIC_OBJS = \ + regexp.o \ +Index: micropolis-activity/src/tclx/config.mk +=================================================================== +--- micropolis-activity.orig/src/tclx/config.mk 2009-09-08 12:26:30.000000000 +0200 ++++ micropolis-activity/src/tclx/config.mk 2009-09-08 12:30:18.000000000 +0200 +@@ -62,8 +62,7 @@ + + #CC=gcc + +-OPTIMIZE_FLAG=-O3 -DIS_LINUX +-#OPTIMIZE_FLAG=-g -DIS_LINUX ++TARGET_FLAG=-DIS_LINUX + + #------------------------------------------------------------------------------ + # Stripping of the final tclshell binary. Specify `true' if the binary is to +Index: micropolis-activity/src/tclx/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/makefile 2009-09-08 12:11:25.000000000 +0200 ++++ micropolis-activity/src/tclx/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -30,8 +30,9 @@ + MADE.FILES=ucbsrc/made.tmp ossupp/made.tmp src/made.tmp + TKMADE.FILES=tkucbsrc/made.tmp + +-CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ +- $(SYS_DEP_FLAGS) ++OPTFLAGS= -O3 ++CFLAGS= $(OPTFLAGS) $(TARGET_FLAG) $(XCFLAGS) -I$(TCL_UCB_DIR) \ ++ $(MEM_DEBUG_FLAGS) $(SYS_DEP_FLAGS) + + #------------------------------------------------------------------------------ + +@@ -45,10 +46,10 @@ + tcl: TCLX_MAKES + + TCLX_MAKES: libtcl.a +- cd ucbsrc; $(MAKE) -$(MAKEFLAGS) all +- cd ossupp; $(MAKE) -$(MAKEFLAGS) all +- cd tclsrc; $(MAKE) -$(MAKEFLAGS) all +- cd src; $(MAKE) -$(MAKEFLAGS) all ++ cd ucbsrc; $(MAKE) OPTFLAGS="$(OPTFLAGS)" -$(MAKEFLAGS) all ++ cd ossupp; $(MAKE) OPTFLAGS="$(OPTFLAGS)" -$(MAKEFLAGS) all ++ cd tclsrc; $(MAKE) OPTFLAGS="$(OPTFLAGS)" -$(MAKEFLAGS) all ++ cd src; $(MAKE) OPTFLAGS="$(OPTFLAGS)" -$(MAKEFLAGS) all + + + # Copy the UCB libtcl.a file from where it was built. Force the other +Index: micropolis-activity/src/tclx/ossupp/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/ossupp/makefile 2009-09-08 12:26:30.000000000 +0200 ++++ micropolis-activity/src/tclx/ossupp/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -22,8 +22,9 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS=$(OPTIMIZE_FLAG) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ +- $(SYS_DEP_FLAGS) $(SUPPORT_FLAGS) ++OPTFLAGS=-O3 ++CFLAGS=$(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I../$(TCL_UCB_DIR) \ ++ $(MEM_DEBUG_FLAGS) $(SYS_DEP_FLAGS) $(SUPPORT_FLAGS) + + #------------------------------------------------------------------------------ + +Index: micropolis-activity/src/tclx/src/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/src/makefile 2009-09-08 12:11:25.000000000 +0200 ++++ micropolis-activity/src/tclx/src/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -25,7 +25,8 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ ++OPTFLAGS= -O3 ++CFLAGS= $(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ + $(SYS_DEP_FLAGS) + + #------------------------------------------------------------------------------ +Index: micropolis-activity/src/tclx/tksrc/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/tksrc/makefile 2009-09-08 12:11:24.000000000 +0200 ++++ micropolis-activity/src/tclx/tksrc/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -23,7 +23,8 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) ++OPTFLAGS= -O3 ++CFLAGS= $(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) + + #------------------------------------------------------------------------------ + +Index: micropolis-activity/src/tclx/tkucbsrc/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/tkucbsrc/makefile 2009-09-08 12:11:24.000000000 +0200 ++++ micropolis-activity/src/tclx/tkucbsrc/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -23,7 +23,8 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I../src -I../$(TCL_TK_DIR) \ ++OPTFLAGS= -O3 ++CFLAGS= $(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I../src -I../$(TCL_TK_DIR) \ + -I../$(TCL_UCB_DIR) -I$(XHOME)/include \ + $(MEM_DEBUG_FLAGS) $(SYS_DEP_FLAGS) \ + -DTK_VERSION=\"2.2/\" +Index: micropolis-activity/src/tclx/ucbsrc/makefile +=================================================================== +--- micropolis-activity.orig/src/tclx/ucbsrc/makefile 2009-09-08 12:11:24.000000000 +0200 ++++ micropolis-activity/src/tclx/ucbsrc/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -24,8 +24,9 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS=$(OPTIMIZE_FLAG) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ +- $(SYS_DEP_FLAGS) ++OPTFLAGS=-O3 ++CFLAGS=$(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I../$(TCL_UCB_DIR) \ ++ $(MEM_DEBUG_FLAGS) $(SYS_DEP_FLAGS) + + #------------------------------------------------------------------------------ + +Index: micropolis-activity/src/tk/makefile +=================================================================== +--- micropolis-activity.orig/src/tk/makefile 2009-09-08 12:11:24.000000000 +0200 ++++ micropolis-activity/src/tk/makefile 2009-09-08 12:30:18.000000000 +0200 +@@ -28,9 +28,8 @@ + # + + CC = gcc +- +-CFLAGS = -I. -I$(XINCLUDE) -I$(TCL_DIR) -O3 -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX +-#CFLAGS = -I. -I$(XINCLUDE) -I$(TCL_DIR) -g -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX ++OPTFLAGS = -O3 ++CFLAGS = $(OPTFLAGS) -I. -I$(XINCLUDE) -I$(TCL_DIR) -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX + + TCL_DIR = ../tcl + XINCLUDE = /usr/include/X11 +Index: micropolis-activity/src/tclx/ossupp/makefile.dvx +=================================================================== +--- micropolis-activity.orig/src/tclx/ossupp/makefile.dvx 2009-09-08 12:11:25.000000000 +0200 ++++ micropolis-activity/src/tclx/ossupp/makefile.dvx 2009-09-08 12:30:18.000000000 +0200 +@@ -22,7 +22,8 @@ + + #------------------------------------------------------------------------------ + +-CFLAGS=$(OPTIMIZE_FLAG) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ ++OPTFLAGS= -O3 ++CFLAGS=$(TARGET_FLAG) $(OPTFLAGS) $(XCFLAGS) -I../$(TCL_UCB_DIR) $(MEM_DEBUG_FLAGS) \ + -DTCL_HAS_TM_ZONE $(SUPPORT_FLAGS) + + #------------------------------------------------------------------------------