├── .gitignore ├── COPYING ├── FILE_FORMAT.txt ├── HACKING ├── INSTALL ├── README ├── TODO ├── build.xml ├── graphics ├── HACKING.txt ├── airport.png ├── airport_3x3.png ├── coal.png ├── coal_3x3.png ├── coal_smoke_animation.ani ├── coal_smoke_frames.png ├── coal_smoke_frames_3x3.png ├── com_zones.png ├── com_zones_3x3.png ├── fire.ani ├── firestation.png ├── firestation_3x3.png ├── fountain.ani ├── heavy_traffic.ani ├── ind01_pistons.ani ├── ind01_pistons_frames.png ├── ind03_smoke_animation.ani ├── ind03_smoke_frames.png ├── ind04_smoke_animation.ani ├── ind04_smoke_frames.png ├── ind07_smoke_animation.ani ├── ind07_smoke_frames.png ├── ind08_smoke_animation.ani ├── ind08_smoke_frames.png ├── ind_zones.png ├── ind_zones_3x3.png ├── light_traffic.ani ├── misc_animation.png ├── misc_animation_3x3.png ├── nuclear-swirl.ani ├── nuclear.png ├── nuclear_3x3.png ├── police.png ├── police_3x3.png ├── radar.ani ├── rails.png ├── rails_3x3.png ├── res_houses.png ├── res_houses_3x3.png ├── res_zones.png ├── res_zones_3x3.png ├── roads.png ├── roads_3x3.png ├── roadwire.png ├── roadwire_3x3.png ├── sample-layered-image.xml ├── seaport.png ├── seaport_3x3.png ├── stadium.png ├── stadium2.png ├── stadium2_3x3.png ├── stadium_3x3.png ├── stadium_animation.ani ├── stadium_animation_gfx.png ├── terrain.png ├── terrain_3x3.png ├── tiles.rc ├── traffic_frames.png ├── traffic_frames_3x3.png ├── wires.png └── wires_3x3.png ├── micropolisj.icns ├── micropolisj.ico ├── resources ├── airport.png ├── coal.png ├── com.png ├── demandg.png ├── fire.png ├── grcom.png ├── grcomhi.png ├── grcrim.png ├── grcrimhi.png ├── grind.png ├── grindhi.png ├── grmony.png ├── grmonyhi.png ├── grpoll.png ├── grpollhi.png ├── grres.png ├── grreshi.png ├── icairp.png ├── icairphi.png ├── iccoal.png ├── iccoalhi.png ├── iccom.png ├── iccomhi.png ├── icdozr.png ├── icdozrhi.png ├── icfire.png ├── icfirehi.png ├── icind.png ├── icindhi.png ├── icnuc.png ├── icnuchi.png ├── icpark.png ├── icparkhi.png ├── icpol.png ├── icpolhi.png ├── icqry.png ├── icqryhi.png ├── icrail.png ├── icrailhi.png ├── icres.png ├── icreshi.png ├── icroad.png ├── icroadhi.png ├── icseap.png ├── icseaphi.png ├── icstad.png ├── icstadhi.png ├── icwire.png ├── icwirehi.png ├── ind.png ├── legendmm.png ├── legendpm.png ├── micropolism.png ├── nuclear.png ├── obj1-0.png ├── obj1-1.png ├── obj1-2.png ├── obj1-3.png ├── obj1-4.png ├── obj2-0.png ├── obj2-1.png ├── obj2-2.png ├── obj2-3.png ├── obj2-4.png ├── obj2-5.png ├── obj2-6.png ├── obj2-7.png ├── obj3-0.png ├── obj3-1.png ├── obj3-10.png ├── obj3-2.png ├── obj3-3.png ├── obj3-4.png ├── obj3-5.png ├── obj3-6.png ├── obj3-7.png ├── obj3-8.png ├── obj3-9.png ├── obj4-0.png ├── obj4-1.png ├── obj4-2.png ├── obj4-3.png ├── obj4-4.png ├── obj4-5.png ├── obj4-6.png ├── obj4-7.png ├── obj5-0.png ├── obj5-1.png ├── obj5-10.png ├── obj5-11.png ├── obj5-12.png ├── obj5-13.png ├── obj5-14.png ├── obj5-15.png ├── obj5-2.png ├── obj5-3.png ├── obj5-4.png ├── obj5-5.png ├── obj5-6.png ├── obj5-7.png ├── obj5-8.png ├── obj5-9.png ├── obj6-0.png ├── obj6-1.png ├── obj6-2.png ├── obj7-0.png ├── obj7-1.png ├── obj7-2.png ├── obj7-3.png ├── obj7-4.png ├── obj7-5.png ├── obj8-0.png ├── obj8-1.png ├── obj8-2.png ├── obj8-3.png ├── police.png ├── res.png ├── seaport.png ├── sounds │ ├── bop.wav │ ├── explosion-high.wav │ ├── explosion-low.wav │ ├── heavytraffic.wav │ ├── honkhonk-hi.wav │ ├── honkhonk-high.wav │ ├── honkhonk-low.wav │ ├── honkhonk-med.wav │ ├── layzone.wav │ ├── monster.wav │ ├── siren.wav │ ├── sorry.wav │ ├── uhuh.wav │ └── zombie-roar-5.wav └── stadium.png ├── src └── micropolisj │ ├── Main.java │ ├── XML_Helper.java │ ├── build_tool │ ├── MakeTiles.java │ └── RearrangeTiles.java │ ├── engine │ ├── AirplaneSprite.java │ ├── BudgetNumbers.java │ ├── BuildingTool.java │ ├── Bulldozer.java │ ├── CityBudget.java │ ├── CityDimension.java │ ├── CityEval.java │ ├── CityLocation.java │ ├── CityProblem.java │ ├── CityRect.java │ ├── Disaster.java │ ├── EarthquakeListener.java │ ├── ExplosionSprite.java │ ├── GameLevel.java │ ├── HelicopterSprite.java │ ├── MapGenerator.java │ ├── MapListener.java │ ├── MapScanner.java │ ├── MapState.java │ ├── Micropolis.java │ ├── MicropolisMessage.java │ ├── MicropolisTool.java │ ├── MonsterSprite.java │ ├── RoadLikeTool.java │ ├── ShipSprite.java │ ├── Sound.java │ ├── Speed.java │ ├── Sprite.java │ ├── SpriteKind.java │ ├── TerrainBehavior.java │ ├── TileBehavior.java │ ├── TileConstants.java │ ├── TileSpec.java │ ├── Tiles.java │ ├── ToolEffect.java │ ├── ToolEffectIfc.java │ ├── ToolPreview.java │ ├── ToolResult.java │ ├── ToolStroke.java │ ├── TornadoSprite.java │ ├── TrafficGen.java │ ├── TrainSprite.java │ ├── TranslatedToolEffect.java │ ├── ZoneStatus.java │ └── package.html │ ├── graphics │ ├── Animation.java │ └── TileImage.java │ ├── gui │ ├── BudgetDialog.java │ ├── ColorParser.java │ ├── DemandIndicator.java │ ├── EvaluationPane.java │ ├── GraphsPane.java │ ├── MainWindow.java │ ├── MessagesPane.java │ ├── MicropolisDrawingArea.java │ ├── NewCityDialog.java │ ├── NotificationPane.java │ ├── OverlayMapView.java │ ├── TileImages.java │ └── package.html │ └── util │ ├── StringsModel.java │ ├── TranslatedStringsTable.java │ └── TranslationTool.java ├── strings ├── CityMessages.properties ├── CityMessages_de.properties ├── CityMessages_fr.utf8 ├── CityMessages_sv.properties ├── CityStrings.properties ├── CityStrings_de.properties ├── CityStrings_fr.utf8 ├── CityStrings_sv.properties ├── GuiStrings.properties ├── GuiStrings_de.properties ├── GuiStrings_fr.utf8 ├── GuiStrings_sv.properties ├── StatusMessages.properties ├── StatusMessages_de.properties ├── StatusMessages_fr.utf8 └── StatusMessages_sv.properties └── tiles └── aliases.txt /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.jar 3 | docs/api 4 | graphics/generated 5 | .*.swp 6 | -------------------------------------------------------------------------------- /FILE_FORMAT.txt: -------------------------------------------------------------------------------- 1 | Save files have the following format: 2 | 3 | Offset 0x0000 : History of residential levels (240 16-bit integers) 4 | 0x01E0 : History of commericial levels 5 | 0x03C0 : History of industrial levels 6 | 0x05A0 : History of crime levels 7 | 0x0780 : History of pollution levels 8 | 0x0960 : History of cash flow 9 | 0x0B40 : Miscellaneous values 10 | 0x0C30 : Map data (by columns, west to east) 11 | -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | Localization 2 | ============ 3 | 4 | Unless you are a native English speaker, you may like to run Micropolis 5 | in your own language. Micropolis is designed to be run in any language, 6 | but we need translators to provide the translated text to display. 7 | 8 | 1. Open a command prompt window and `cd' to the directory containing 9 | the micropolisj.jar file. 10 | 11 | 2. Run the following command to launch the translation tool: 12 | 13 | java -cp micropolisj.jar micropolisj.util.TranslationTool 14 | 15 | 3. Click Add Locale and enter the appropriate 2-character language 16 | code, and (optionally) a 2-character country code. 17 | 18 | 4. Next to each string, double-click the blank field and type in 19 | a translation. 20 | 21 | 5. Click Save. (This will cause the translated strings to be written 22 | in the proper format into a subdirectory named micropolisj.) 23 | 24 | 6. Close the translation tool. Send the generated files (from the 25 | micropolisj subdirectory) to jason@long.name for inclusion in the 26 | next release of Micropolis. 27 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Prerequisites 2 | ============= 3 | 4 | To build MicropolisJ you will need 5 | * Java Development Kit (version 7), get it from http://oracle.com/technetwork/java 6 | * Apache Ant, get it from http://ant.apache.org 7 | 8 | 9 | Building the Package 10 | ==================== 11 | 12 | 1. `cd' to the directory containing the package's source code. 13 | 14 | 2. Type `ant' to compile the package. 15 | 16 | 17 | Installing MicropolisJ 18 | ====================== 19 | 20 | Everything you need to run the program is contained within the micropolisj.jar 21 | file, so just copy that file to wherever you like. 22 | 23 | 24 | Running MicropolisJ 25 | =================== 26 | 27 | Type `java -jar micropolisj.jar` to run the program. 28 | 29 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | 3 | MicropolisJ (Micropolis in Java) 4 | 5 | ======================================================================== 6 | 7 | MicropolisJ is Micropolis for the Java platform. 8 | Copyright (C) 2013 Jason Long (jason@long.name). 9 | Portions Copyright (C) 1989-2007 Electronic Arts Inc. 10 | 11 | MicropolisJ is based on Micropolis, Unix version, which was developed by 12 | Don Hopkins (dhopkins@DonHopkins.com, http://www.DonHopkins.com) for 13 | DUX Software under license from Maxis, in or around 1990. This version 14 | was later modified for inclusion in the One Laptop Per Child (OLPC) 15 | program, and released as free and open source software under the GPL in 16 | 2008. 17 | Copyright (C) 1989-2007 Electronic Arts Inc. 18 | 19 | The original Micropolis game was designed and implemented by Will Wright. 20 | Copyright (C) 2002 by Electronic Arts. 21 | 22 | ======================================================================== 23 | 24 | How to Run This Program 25 | ----------------------- 26 | 27 | First of all, you must have Java (version 7 or better) installed on your 28 | computer. You can get Java at http://java.com/download. 29 | 30 | Next, simply double-click the enclosed micropolisj.jar file to run the 31 | program. 32 | 33 | 34 | How to Build This Program from Source 35 | ------------------------------------- 36 | 37 | See the INSTALL file for instructions on building the program from this 38 | source code release. 39 | 40 | See the COPYING file for the full text copy of the GNU General Public 41 | License. 42 | 43 | If you need assistance with this program, you may contact: 44 | Jason Long (jason@long.name) 45 | 46 | ======================================================================== 47 | 48 | This program is free software: you can redistribute it and/or modify 49 | it under the terms of the GNU General Public License as published by 50 | the Free Software Foundation, either version 3 of the License, or (at 51 | your option) any later version. 52 | 53 | This program is distributed in the hope that it will be useful, but 54 | WITHOUT ANY WARRANTY; without even the implied warranty of 55 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 56 | General Public License for more details. You should have received a 57 | copy of the GNU General Public License along with this program. If 58 | not, see . 59 | 60 | ADDITIONAL TERMS per GNU GPL Section 7 61 | 62 | No trademark or publicity rights are granted. This license does NOT 63 | give you any right, title or interest in the trademark SimCity or any 64 | other Electronic Arts trademark. You may not distribute any 65 | modification of this program using the trademark SimCity or claim any 66 | affliation or association with Electronic Arts Inc. or its employees. 67 | Any propagation or conveyance of this program must include this 68 | copyright notice and these terms. 69 | 70 | If you convey this program (or any modifications of it) and assume 71 | contractual liability for the program to recipients of it, you agree 72 | to indemnify Electronic Arts for any liability that those contractual 73 | assumptions impose on Electronic Arts. 74 | 75 | You may not misrepresent the origins of this program; modified 76 | versions of the program must be marked as such and not identified as 77 | the original program. 78 | 79 | This disclaimer supplements the one included in the General Public 80 | License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS 81 | PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY 82 | OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF 83 | SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS 84 | DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES, 85 | INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, 86 | FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY 87 | RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING, 88 | USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST 89 | INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL 90 | MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE 91 | UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE 92 | WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE 93 | CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR 94 | ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME 95 | JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED 96 | WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A 97 | CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY 98 | NOT APPLY TO YOU. 99 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Micropolis::map[] array- 2 | *Consider changing type from 'char' to 'short' 3 | 4 | Finances- 5 | *Pay operating costs either every week or at the beginning of the year, 6 | instead of at the end of the year. This will fix an issue where it is 7 | possible to get negative money... just make your expenses exceed your 8 | income and run completely out of money. 9 | 10 | On Game Load- 11 | *All zones are unpowered for the first several ticks. I'd imagine there 12 | are similar problems with the landValueMap, pollutionMap, tfDensity, 13 | policeCoverage etc. I think what should happen is that the various methods 14 | that update these maps should be called at load time. 15 | *Evaluation data is not available. 16 | *cityTime may not match history.cityTime 17 | 18 | Disasters- 19 | *When running FAST or SUPER_FAST, automatically pause or slow down the 20 | simulation when a disaster occurs. 21 | *Floods- should be allowed to flood zones, but I think this is currently 22 | not the case. 23 | 24 | City size notifications- 25 | *Pause and pop up a message the first time the city reaches 2000, 10000, 26 | 50000, etc. people. 27 | 28 | Graphics- 29 | *Let graphics be pluggable; use a mechanism similar to how the UI strings 30 | are pluggable according to locale. 31 | 32 | Draw-Bridge- 33 | *If there's traffic on a bridge, the draw bridge does not open correctly. 34 | 35 | Scenarios- 36 | *Implement. See original C/Tcl code, src/sim/s_fileio.c LoadScenario(), 37 | and res/snro.111, res/snro.222, etc. 38 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 62 | 64 | 65 | 66 | 67 | 68 | 69 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 147 | 148 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /graphics/HACKING.txt: -------------------------------------------------------------------------------- 1 | =============== 2 | The Recipe File 3 | =============== 4 | 5 | The `tiles.rc' file is the recipe file for generating the tiles. 6 | It is a plain-text file, where each line begins with a tile id, 7 | followed by an image specification. 8 | 9 | The image specification consists of one or more image layers separated 10 | by the pipe character (|). The layers are drawn in the order specified. 11 | 12 | A layer is a file name (excluding the .png extension), optionally followed 13 | by @X,Y, where X,Y specify the upper-left corner of the rectangle to 14 | draw. 15 | 16 | 17 | ============================== 18 | Generating the composite image 19 | ============================== 20 | 21 | To build a new tiles.png file, do the following: 22 | 23 | 1. Open a command-prompt, and cd to the micropolis-java directory. 24 | 25 | 2. Build Micropolis by typing the following command: 26 | 27 | ant 28 | 29 | 3. The generated tiles.png file can be found in the build/ subdirectory. 30 | 31 | 4. Now you can run Micropolis with the new graphics. Type: 32 | 33 | java -jar micropolisj.jar 34 | -------------------------------------------------------------------------------- /graphics/airport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/airport.png -------------------------------------------------------------------------------- /graphics/airport_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/airport_3x3.png -------------------------------------------------------------------------------- /graphics/coal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/coal.png -------------------------------------------------------------------------------- /graphics/coal_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/coal_3x3.png -------------------------------------------------------------------------------- /graphics/coal_smoke_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/coal_smoke_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/coal_smoke_frames.png -------------------------------------------------------------------------------- /graphics/coal_smoke_frames_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/coal_smoke_frames_3x3.png -------------------------------------------------------------------------------- /graphics/com_zones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/com_zones.png -------------------------------------------------------------------------------- /graphics/com_zones_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/com_zones_3x3.png -------------------------------------------------------------------------------- /graphics/fire.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /graphics/firestation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/firestation.png -------------------------------------------------------------------------------- /graphics/firestation_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/firestation_3x3.png -------------------------------------------------------------------------------- /graphics/fountain.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/heavy_traffic.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/ind01_pistons.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /graphics/ind01_pistons_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind01_pistons_frames.png -------------------------------------------------------------------------------- /graphics/ind03_smoke_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/ind03_smoke_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind03_smoke_frames.png -------------------------------------------------------------------------------- /graphics/ind04_smoke_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/ind04_smoke_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind04_smoke_frames.png -------------------------------------------------------------------------------- /graphics/ind07_smoke_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/ind07_smoke_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind07_smoke_frames.png -------------------------------------------------------------------------------- /graphics/ind08_smoke_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/ind08_smoke_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind08_smoke_frames.png -------------------------------------------------------------------------------- /graphics/ind_zones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind_zones.png -------------------------------------------------------------------------------- /graphics/ind_zones_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/ind_zones_3x3.png -------------------------------------------------------------------------------- /graphics/light_traffic.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/misc_animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/misc_animation.png -------------------------------------------------------------------------------- /graphics/misc_animation_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/misc_animation_3x3.png -------------------------------------------------------------------------------- /graphics/nuclear-swirl.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /graphics/nuclear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/nuclear.png -------------------------------------------------------------------------------- /graphics/nuclear_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/nuclear_3x3.png -------------------------------------------------------------------------------- /graphics/police.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/police.png -------------------------------------------------------------------------------- /graphics/police_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/police_3x3.png -------------------------------------------------------------------------------- /graphics/radar.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /graphics/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/rails.png -------------------------------------------------------------------------------- /graphics/rails_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/rails_3x3.png -------------------------------------------------------------------------------- /graphics/res_houses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/res_houses.png -------------------------------------------------------------------------------- /graphics/res_houses_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/res_houses_3x3.png -------------------------------------------------------------------------------- /graphics/res_zones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/res_zones.png -------------------------------------------------------------------------------- /graphics/res_zones_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/res_zones_3x3.png -------------------------------------------------------------------------------- /graphics/roads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/roads.png -------------------------------------------------------------------------------- /graphics/roads_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/roads_3x3.png -------------------------------------------------------------------------------- /graphics/roadwire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/roadwire.png -------------------------------------------------------------------------------- /graphics/roadwire_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/roadwire_3x3.png -------------------------------------------------------------------------------- /graphics/sample-layered-image.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /graphics/seaport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/seaport.png -------------------------------------------------------------------------------- /graphics/seaport_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/seaport_3x3.png -------------------------------------------------------------------------------- /graphics/stadium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/stadium.png -------------------------------------------------------------------------------- /graphics/stadium2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/stadium2.png -------------------------------------------------------------------------------- /graphics/stadium2_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/stadium2_3x3.png -------------------------------------------------------------------------------- /graphics/stadium_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/stadium_3x3.png -------------------------------------------------------------------------------- /graphics/stadium_animation.ani: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /graphics/stadium_animation_gfx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/stadium_animation_gfx.png -------------------------------------------------------------------------------- /graphics/terrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/terrain.png -------------------------------------------------------------------------------- /graphics/terrain_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/terrain_3x3.png -------------------------------------------------------------------------------- /graphics/traffic_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/traffic_frames.png -------------------------------------------------------------------------------- /graphics/traffic_frames_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/traffic_frames_3x3.png -------------------------------------------------------------------------------- /graphics/wires.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/wires.png -------------------------------------------------------------------------------- /graphics/wires_3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/graphics/wires_3x3.png -------------------------------------------------------------------------------- /micropolisj.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/micropolisj.icns -------------------------------------------------------------------------------- /micropolisj.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/micropolisj.ico -------------------------------------------------------------------------------- /resources/airport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/airport.png -------------------------------------------------------------------------------- /resources/coal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/coal.png -------------------------------------------------------------------------------- /resources/com.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/com.png -------------------------------------------------------------------------------- /resources/demandg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/demandg.png -------------------------------------------------------------------------------- /resources/fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/fire.png -------------------------------------------------------------------------------- /resources/grcom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grcom.png -------------------------------------------------------------------------------- /resources/grcomhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grcomhi.png -------------------------------------------------------------------------------- /resources/grcrim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grcrim.png -------------------------------------------------------------------------------- /resources/grcrimhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grcrimhi.png -------------------------------------------------------------------------------- /resources/grind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grind.png -------------------------------------------------------------------------------- /resources/grindhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grindhi.png -------------------------------------------------------------------------------- /resources/grmony.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grmony.png -------------------------------------------------------------------------------- /resources/grmonyhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grmonyhi.png -------------------------------------------------------------------------------- /resources/grpoll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grpoll.png -------------------------------------------------------------------------------- /resources/grpollhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grpollhi.png -------------------------------------------------------------------------------- /resources/grres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grres.png -------------------------------------------------------------------------------- /resources/grreshi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/grreshi.png -------------------------------------------------------------------------------- /resources/icairp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icairp.png -------------------------------------------------------------------------------- /resources/icairphi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icairphi.png -------------------------------------------------------------------------------- /resources/iccoal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/iccoal.png -------------------------------------------------------------------------------- /resources/iccoalhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/iccoalhi.png -------------------------------------------------------------------------------- /resources/iccom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/iccom.png -------------------------------------------------------------------------------- /resources/iccomhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/iccomhi.png -------------------------------------------------------------------------------- /resources/icdozr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icdozr.png -------------------------------------------------------------------------------- /resources/icdozrhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icdozrhi.png -------------------------------------------------------------------------------- /resources/icfire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icfire.png -------------------------------------------------------------------------------- /resources/icfirehi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icfirehi.png -------------------------------------------------------------------------------- /resources/icind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icind.png -------------------------------------------------------------------------------- /resources/icindhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icindhi.png -------------------------------------------------------------------------------- /resources/icnuc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icnuc.png -------------------------------------------------------------------------------- /resources/icnuchi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icnuchi.png -------------------------------------------------------------------------------- /resources/icpark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icpark.png -------------------------------------------------------------------------------- /resources/icparkhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icparkhi.png -------------------------------------------------------------------------------- /resources/icpol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icpol.png -------------------------------------------------------------------------------- /resources/icpolhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icpolhi.png -------------------------------------------------------------------------------- /resources/icqry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icqry.png -------------------------------------------------------------------------------- /resources/icqryhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icqryhi.png -------------------------------------------------------------------------------- /resources/icrail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icrail.png -------------------------------------------------------------------------------- /resources/icrailhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icrailhi.png -------------------------------------------------------------------------------- /resources/icres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icres.png -------------------------------------------------------------------------------- /resources/icreshi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icreshi.png -------------------------------------------------------------------------------- /resources/icroad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icroad.png -------------------------------------------------------------------------------- /resources/icroadhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icroadhi.png -------------------------------------------------------------------------------- /resources/icseap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icseap.png -------------------------------------------------------------------------------- /resources/icseaphi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icseaphi.png -------------------------------------------------------------------------------- /resources/icstad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icstad.png -------------------------------------------------------------------------------- /resources/icstadhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icstadhi.png -------------------------------------------------------------------------------- /resources/icwire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icwire.png -------------------------------------------------------------------------------- /resources/icwirehi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/icwirehi.png -------------------------------------------------------------------------------- /resources/ind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/ind.png -------------------------------------------------------------------------------- /resources/legendmm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/legendmm.png -------------------------------------------------------------------------------- /resources/legendpm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/legendpm.png -------------------------------------------------------------------------------- /resources/micropolism.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/micropolism.png -------------------------------------------------------------------------------- /resources/nuclear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/nuclear.png -------------------------------------------------------------------------------- /resources/obj1-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj1-0.png -------------------------------------------------------------------------------- /resources/obj1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj1-1.png -------------------------------------------------------------------------------- /resources/obj1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj1-2.png -------------------------------------------------------------------------------- /resources/obj1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj1-3.png -------------------------------------------------------------------------------- /resources/obj1-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj1-4.png -------------------------------------------------------------------------------- /resources/obj2-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-0.png -------------------------------------------------------------------------------- /resources/obj2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-1.png -------------------------------------------------------------------------------- /resources/obj2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-2.png -------------------------------------------------------------------------------- /resources/obj2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-3.png -------------------------------------------------------------------------------- /resources/obj2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-4.png -------------------------------------------------------------------------------- /resources/obj2-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-5.png -------------------------------------------------------------------------------- /resources/obj2-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-6.png -------------------------------------------------------------------------------- /resources/obj2-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj2-7.png -------------------------------------------------------------------------------- /resources/obj3-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-0.png -------------------------------------------------------------------------------- /resources/obj3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-1.png -------------------------------------------------------------------------------- /resources/obj3-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-10.png -------------------------------------------------------------------------------- /resources/obj3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-2.png -------------------------------------------------------------------------------- /resources/obj3-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-3.png -------------------------------------------------------------------------------- /resources/obj3-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-4.png -------------------------------------------------------------------------------- /resources/obj3-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-5.png -------------------------------------------------------------------------------- /resources/obj3-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-6.png -------------------------------------------------------------------------------- /resources/obj3-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-7.png -------------------------------------------------------------------------------- /resources/obj3-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-8.png -------------------------------------------------------------------------------- /resources/obj3-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj3-9.png -------------------------------------------------------------------------------- /resources/obj4-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-0.png -------------------------------------------------------------------------------- /resources/obj4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-1.png -------------------------------------------------------------------------------- /resources/obj4-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-2.png -------------------------------------------------------------------------------- /resources/obj4-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-3.png -------------------------------------------------------------------------------- /resources/obj4-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-4.png -------------------------------------------------------------------------------- /resources/obj4-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-5.png -------------------------------------------------------------------------------- /resources/obj4-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-6.png -------------------------------------------------------------------------------- /resources/obj4-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj4-7.png -------------------------------------------------------------------------------- /resources/obj5-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-0.png -------------------------------------------------------------------------------- /resources/obj5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-1.png -------------------------------------------------------------------------------- /resources/obj5-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-10.png -------------------------------------------------------------------------------- /resources/obj5-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-11.png -------------------------------------------------------------------------------- /resources/obj5-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-12.png -------------------------------------------------------------------------------- /resources/obj5-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-13.png -------------------------------------------------------------------------------- /resources/obj5-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-14.png -------------------------------------------------------------------------------- /resources/obj5-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-15.png -------------------------------------------------------------------------------- /resources/obj5-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-2.png -------------------------------------------------------------------------------- /resources/obj5-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-3.png -------------------------------------------------------------------------------- /resources/obj5-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-4.png -------------------------------------------------------------------------------- /resources/obj5-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-5.png -------------------------------------------------------------------------------- /resources/obj5-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-6.png -------------------------------------------------------------------------------- /resources/obj5-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-7.png -------------------------------------------------------------------------------- /resources/obj5-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-8.png -------------------------------------------------------------------------------- /resources/obj5-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj5-9.png -------------------------------------------------------------------------------- /resources/obj6-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj6-0.png -------------------------------------------------------------------------------- /resources/obj6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj6-1.png -------------------------------------------------------------------------------- /resources/obj6-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj6-2.png -------------------------------------------------------------------------------- /resources/obj7-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-0.png -------------------------------------------------------------------------------- /resources/obj7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-1.png -------------------------------------------------------------------------------- /resources/obj7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-2.png -------------------------------------------------------------------------------- /resources/obj7-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-3.png -------------------------------------------------------------------------------- /resources/obj7-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-4.png -------------------------------------------------------------------------------- /resources/obj7-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj7-5.png -------------------------------------------------------------------------------- /resources/obj8-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj8-0.png -------------------------------------------------------------------------------- /resources/obj8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj8-1.png -------------------------------------------------------------------------------- /resources/obj8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj8-2.png -------------------------------------------------------------------------------- /resources/obj8-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/obj8-3.png -------------------------------------------------------------------------------- /resources/police.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/police.png -------------------------------------------------------------------------------- /resources/res.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/res.png -------------------------------------------------------------------------------- /resources/seaport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/seaport.png -------------------------------------------------------------------------------- /resources/sounds/bop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/bop.wav -------------------------------------------------------------------------------- /resources/sounds/explosion-high.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/explosion-high.wav -------------------------------------------------------------------------------- /resources/sounds/explosion-low.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/explosion-low.wav -------------------------------------------------------------------------------- /resources/sounds/heavytraffic.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/heavytraffic.wav -------------------------------------------------------------------------------- /resources/sounds/honkhonk-hi.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/honkhonk-hi.wav -------------------------------------------------------------------------------- /resources/sounds/honkhonk-high.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/honkhonk-high.wav -------------------------------------------------------------------------------- /resources/sounds/honkhonk-low.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/honkhonk-low.wav -------------------------------------------------------------------------------- /resources/sounds/honkhonk-med.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/honkhonk-med.wav -------------------------------------------------------------------------------- /resources/sounds/layzone.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/layzone.wav -------------------------------------------------------------------------------- /resources/sounds/monster.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/monster.wav -------------------------------------------------------------------------------- /resources/sounds/siren.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/siren.wav -------------------------------------------------------------------------------- /resources/sounds/sorry.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/sorry.wav -------------------------------------------------------------------------------- /resources/sounds/uhuh.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/uhuh.wav -------------------------------------------------------------------------------- /resources/sounds/zombie-roar-5.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/sounds/zombie-roar-5.wav -------------------------------------------------------------------------------- /resources/stadium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason17055/micropolis-java/9f6ddb4b5f36a005fe4c4f77488d7969eabf0797/resources/stadium.png -------------------------------------------------------------------------------- /src/micropolisj/Main.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj; 10 | 11 | import javax.swing.*; 12 | 13 | import micropolisj.gui.MainWindow; 14 | 15 | public class Main 16 | { 17 | static void createAndShowGUI() 18 | { 19 | MainWindow win = new MainWindow(); 20 | win.setVisible(true); 21 | win.doNewCity(true); 22 | } 23 | 24 | public static void main(String [] args) 25 | { 26 | SwingUtilities.invokeLater(new Runnable() { 27 | public void run() { 28 | createAndShowGUI(); 29 | }}); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/micropolisj/XML_Helper.java: -------------------------------------------------------------------------------- 1 | package micropolisj; 2 | 3 | import java.io.*; 4 | import javax.xml.stream.*; 5 | 6 | public class XML_Helper 7 | { 8 | private XML_Helper() {} 9 | 10 | public static void skipToEndElement(XMLStreamReader in) 11 | throws XMLStreamException 12 | { 13 | if (!in.isStartElement()) { 14 | return; 15 | } 16 | 17 | int tagDepth = 1; 18 | while (tagDepth > 0 && in.hasNext()) { 19 | in.next(); 20 | if (in.isStartElement()) { 21 | tagDepth++; 22 | } 23 | else if (in.isEndElement()) { 24 | tagDepth--; 25 | } 26 | } 27 | } 28 | 29 | public static Reader readElementText(XMLStreamReader in) 30 | { 31 | return new ElementTextReader(in); 32 | } 33 | 34 | static class ElementTextReader extends Reader 35 | { 36 | XMLStreamReader xsr; 37 | int tagDepth; 38 | char [] buf; 39 | int buf_start; 40 | int buf_end; 41 | 42 | ElementTextReader(XMLStreamReader xsr) 43 | { 44 | this.xsr = xsr; 45 | this.tagDepth = 1; 46 | } 47 | 48 | private void readMore() 49 | throws XMLStreamException 50 | { 51 | while (tagDepth > 0 && buf_start == buf_end) { 52 | 53 | int nodeType = xsr.next(); 54 | if (nodeType == XMLStreamConstants.START_ELEMENT) { 55 | tagDepth++; 56 | } 57 | else if (nodeType == XMLStreamConstants.END_ELEMENT) { 58 | tagDepth--; 59 | } 60 | else if (nodeType == XMLStreamConstants.CDATA || 61 | nodeType == XMLStreamConstants.CHARACTERS || 62 | nodeType == XMLStreamConstants.ENTITY_REFERENCE || 63 | nodeType == XMLStreamConstants.SPACE) 64 | { 65 | buf = xsr.getTextCharacters(); 66 | buf_start = xsr.getTextStart(); 67 | buf_end = buf_start + xsr.getTextLength(); 68 | } 69 | } 70 | 71 | } 72 | 73 | @Override 74 | public int read(char[] cbuf, int off, int len) 75 | throws IOException 76 | { 77 | if (buf_start == buf_end) { 78 | 79 | try { 80 | readMore(); 81 | } 82 | catch (XMLStreamException e) { 83 | throw new IOException("XML stream error: "+ e, e); 84 | } 85 | 86 | if (tagDepth == 0) { 87 | // reached closing tag 88 | return -1; 89 | } 90 | } 91 | 92 | if (buf_start + len <= buf_end) { 93 | // already have the text loaded 94 | System.arraycopy(buf, buf_start, cbuf, off, len); 95 | buf_start += len; 96 | return len; 97 | } 98 | else { 99 | // not enough text available for entire request, 100 | // so just return what we have until the next 101 | // request 102 | 103 | len = buf_end - buf_start; 104 | assert len > 0; 105 | 106 | System.arraycopy(buf, buf_start, cbuf, off, len); 107 | buf_start += len; 108 | assert buf_start == buf_end; 109 | return len; 110 | } 111 | } 112 | 113 | @Override 114 | public void close() 115 | throws IOException 116 | { 117 | buf_start = 0; 118 | buf_end = 0; 119 | 120 | try { 121 | 122 | while (tagDepth > 0 && xsr.hasNext()) { 123 | xsr.next(); 124 | if (xsr.isStartElement()) { 125 | tagDepth++; 126 | } 127 | else if (xsr.isEndElement()) { 128 | tagDepth--; 129 | } 130 | } 131 | } 132 | catch (XMLStreamException e) { 133 | throw new IOException("XML stream error: "+e, e); 134 | } 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/micropolisj/build_tool/RearrangeTiles.java: -------------------------------------------------------------------------------- 1 | package micropolisj.build_tool; 2 | 3 | import java.awt.*; 4 | import java.awt.image.BufferedImage; 5 | import java.io.*; 6 | import java.util.*; 7 | import javax.imageio.*; 8 | import javax.swing.ImageIcon; 9 | 10 | /** 11 | * Just a little utility I wrote to rearrange 16x16 tiles into a grid 12 | * of a different width. Not included in the Micropolis build. 13 | */ 14 | public class RearrangeTiles 15 | { 16 | static final int DEST_COLUMNS = 16; 17 | static final int TILE_SIZE = 16; 18 | 19 | public static void main(String [] args) 20 | throws Exception 21 | { 22 | File inputFile = new File(args[0]); 23 | File outputFile = new File(args[1]); 24 | 25 | // read in the image 26 | Image srcImage = new ImageIcon(inputFile.toString()).getImage(); 27 | int srcCols = srcImage.getWidth(null) / TILE_SIZE; 28 | int srcRows = srcImage.getHeight(null) / TILE_SIZE; 29 | int ntiles = srcRows * srcCols; 30 | 31 | // actually assemble the image 32 | int destCols = DEST_COLUMNS; 33 | int destRows = (ntiles + destCols-1) / destCols; 34 | BufferedImage buf = new BufferedImage(TILE_SIZE*DEST_COLUMNS,TILE_SIZE*destRows,BufferedImage.TYPE_INT_RGB); 35 | Graphics2D gr = buf.createGraphics(); 36 | 37 | for (int i = 0; i < ntiles; i++) { 38 | 39 | int srcRow = i / srcCols; 40 | int srcCol = i % srcCols; 41 | 42 | int destRow = i / destCols; 43 | int destCol = i % destCols; 44 | 45 | gr.drawImage( 46 | srcImage, 47 | destCol*TILE_SIZE, destRow*TILE_SIZE, 48 | (destCol+1)*TILE_SIZE,(destRow+1)*TILE_SIZE, 49 | srcCol*TILE_SIZE, srcRow*TILE_SIZE, 50 | (srcCol+1)*TILE_SIZE, (srcRow+1)*TILE_SIZE, 51 | null); 52 | } 53 | 54 | ImageIO.write(buf, "png", outputFile); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/micropolisj/engine/AirplaneSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Implements the airplane. 13 | * The airplane appears if the city contains an airport. 14 | * It first takes off, then flies around randomly, 15 | * occassionally crashing. 16 | */ 17 | public class AirplaneSprite extends Sprite 18 | { 19 | int destX; 20 | int destY; 21 | 22 | // Note: frames 1-8 used for regular movement 23 | // 9-11 used for Taking off 24 | static int [] CDx = { 0, 0, 6, 8, 6, 0, -6, -8, -6, 8, 8, 8 }; 25 | static int [] CDy = { 0, -8, -6, 0, 6, 8, 6, 0, -6, 0, 0, 0 }; 26 | 27 | public AirplaneSprite(Micropolis engine, int xpos, int ypos) 28 | { 29 | super(engine, SpriteKind.AIR); 30 | this.x = xpos * 16 + 8; 31 | this.y = ypos * 16 + 8; 32 | this.width = 48; 33 | this.height = 48; 34 | this.offx = -24; 35 | this.offy = -24; 36 | 37 | this.destY = this.y; 38 | if (xpos > engine.getWidth()-20) { 39 | // not enough room to east of airport for taking off 40 | this.destX = x - 200; 41 | this.frame = 7; 42 | } 43 | else { 44 | this.destX = x + 200; 45 | this.frame = 11; 46 | } 47 | } 48 | 49 | @Override 50 | public void moveImpl() 51 | { 52 | int z = this.frame; 53 | 54 | if (city.acycle % 5 == 0) { 55 | if (z > 8) { //plane is still taking off 56 | z--; 57 | if (z < 9) { z = 3; } 58 | this.frame = z; 59 | } 60 | else { // go to destination 61 | int d = getDir(x, y, destX, destY); 62 | z = turnTo(z, d); 63 | this.frame = z; 64 | } 65 | } 66 | 67 | if (getDis(x, y, destX, destY) < 50) { // at destination 68 | //FIXME- original code allows destination to be off-the-map 69 | destX = city.PRNG.nextInt(city.getWidth()) * 16 + 8; 70 | destY = city.PRNG.nextInt(city.getHeight()) * 16 + 8; 71 | } 72 | 73 | if (!city.noDisasters) { 74 | boolean explode = false; 75 | 76 | for (Sprite s : city.allSprites()) { 77 | if (s != this && 78 | (s.kind == SpriteKind.AIR || s.kind == SpriteKind.COP) && 79 | checkSpriteCollision(s)) 80 | { 81 | s.explodeSprite(); 82 | explode = true; 83 | } 84 | } 85 | if (explode) { 86 | explodeSprite(); 87 | } 88 | } 89 | 90 | this.x += CDx[z]; 91 | this.y += CDy[z]; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/micropolisj/engine/BudgetNumbers.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * The information generated by the generateBudget function. 13 | * @see micropolisj.engine.Micropolis#generateBudget 14 | */ 15 | public class BudgetNumbers 16 | { 17 | public int taxRate; 18 | public int taxIncome; 19 | public int operatingExpenses; 20 | public int previousBalance; 21 | public int newBalance; 22 | 23 | public int roadRequest; 24 | public int roadFunded; 25 | public double roadPercent; 26 | 27 | public int fireRequest; 28 | public int fireFunded; 29 | public double firePercent; 30 | 31 | public int policeRequest; 32 | public int policeFunded; 33 | public double policePercent; 34 | } 35 | -------------------------------------------------------------------------------- /src/micropolisj/engine/BuildingTool.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | class BuildingTool extends ToolStroke 14 | { 15 | public BuildingTool(Micropolis engine, MicropolisTool tool, int xpos, int ypos) 16 | { 17 | super(engine, tool, xpos, ypos); 18 | } 19 | 20 | @Override 21 | public void dragTo(int xdest, int ydest) 22 | { 23 | this.xpos = xdest; 24 | this.ypos = ydest; 25 | this.xdest = xdest; 26 | this.ydest = ydest; 27 | } 28 | 29 | @Override 30 | boolean apply1(ToolEffectIfc eff) 31 | { 32 | switch (tool) 33 | { 34 | case FIRE: 35 | return applyZone(eff, Tiles.loadByOrdinal(FIRESTATION)); 36 | 37 | case POLICE: 38 | return applyZone(eff, Tiles.loadByOrdinal(POLICESTATION)); 39 | 40 | case POWERPLANT: 41 | return applyZone(eff, Tiles.loadByOrdinal(POWERPLANT)); 42 | 43 | case STADIUM: 44 | return applyZone(eff, Tiles.loadByOrdinal(STADIUM)); 45 | 46 | case SEAPORT: 47 | return applyZone(eff, Tiles.loadByOrdinal(PORT)); 48 | 49 | case NUCLEAR: 50 | return applyZone(eff, Tiles.loadByOrdinal(NUCLEAR)); 51 | 52 | case AIRPORT: 53 | return applyZone(eff, Tiles.loadByOrdinal(AIRPORT)); 54 | 55 | default: 56 | // not expected 57 | throw new Error("unexpected tool: "+tool); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Bulldozer.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | class Bulldozer extends ToolStroke 14 | { 15 | Bulldozer(Micropolis city, int xpos, int ypos) 16 | { 17 | super(city, MicropolisTool.BULLDOZER, xpos, ypos); 18 | } 19 | 20 | @Override 21 | protected void applyArea(ToolEffectIfc eff) 22 | { 23 | CityRect b = getBounds(); 24 | 25 | // scan selection area for rubble, forest, etc... 26 | for (int y = 0; y < b.height; y++) { 27 | for (int x = 0; x < b.width; x++) { 28 | 29 | ToolEffectIfc subEff = new TranslatedToolEffect(eff, b.x+x, b.y+y); 30 | if (city.isTileDozeable(subEff)) { 31 | 32 | dozeField(subEff); 33 | } 34 | 35 | } 36 | } 37 | 38 | // scan selection area for zones... 39 | for (int y = 0; y < b.height; y++) { 40 | for (int x = 0; x < b.width; x++) { 41 | 42 | if (isZoneCenter(eff.getTile(b.x+x,b.y+y))) { 43 | dozeZone(new TranslatedToolEffect(eff, b.x+x, b.y+y)); 44 | } 45 | } 46 | } 47 | } 48 | 49 | void dozeZone(ToolEffectIfc eff) 50 | { 51 | int currTile = eff.getTile(0, 0); 52 | 53 | // zone center bit is set 54 | assert isZoneCenter(currTile); 55 | 56 | CityDimension dim = getZoneSizeFor(currTile); 57 | assert dim != null; 58 | assert dim.width >= 3; 59 | assert dim.height >= 3; 60 | 61 | eff.spend(1); 62 | 63 | // make explosion sound; 64 | // bigger zones => bigger explosions 65 | 66 | if (dim.width * dim.height < 16) { 67 | eff.makeSound(0, 0, Sound.EXPLOSION_HIGH); 68 | } 69 | else if (dim.width * dim.height < 36) { 70 | eff.makeSound(0, 0, Sound.EXPLOSION_LOW); 71 | } 72 | else { 73 | eff.makeSound(0, 0, Sound.EXPLOSION_BOTH); 74 | } 75 | 76 | putRubble(new TranslatedToolEffect(eff, -1, -1), dim.width, dim.height); 77 | return; 78 | } 79 | 80 | void dozeField(ToolEffectIfc eff) 81 | { 82 | int tile = eff.getTile(0, 0); 83 | 84 | if (isOverWater(tile)) 85 | { 86 | // dozing over water, replace with water. 87 | eff.setTile(0, 0, RIVER); 88 | } 89 | else 90 | { 91 | // dozing on land, replace with land. Simple, eh? 92 | eff.setTile(0, 0, DIRT); 93 | } 94 | 95 | fixZone(eff); 96 | eff.spend(1); 97 | return; 98 | } 99 | 100 | void putRubble(ToolEffectIfc eff, int w, int h) 101 | { 102 | for (int yy = 0; yy < h; yy++) { 103 | for (int xx = 0; xx < w; xx++) { 104 | int tile = eff.getTile(xx,yy); 105 | if (tile == CLEAR) 106 | continue; 107 | 108 | if (tile != RADTILE && tile != DIRT) { 109 | int z = inPreview ? 0 : city.PRNG.nextInt(3); 110 | int nTile = TINYEXP + z; 111 | eff.setTile(xx, yy, nTile); 112 | } 113 | } 114 | } 115 | fixBorder(eff, w, h); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/micropolisj/engine/CityBudget.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | public class CityBudget 12 | { 13 | private final Micropolis city; 14 | 15 | /** 16 | * The amount of cash on hand. 17 | */ 18 | public int totalFunds; 19 | 20 | /** 21 | * Amount of taxes collected so far in the current financial 22 | * period (in 1/TAXFREQ's). 23 | */ 24 | int taxFund; 25 | 26 | /** 27 | * Amount of prepaid road maintenance (in 1/TAXFREQ's). 28 | */ 29 | int roadFundEscrow; 30 | 31 | /** 32 | * Amount of prepaid fire station maintenance (in 1/TAXFREQ's). 33 | */ 34 | int fireFundEscrow; 35 | 36 | /** 37 | * Amount of prepaid police station maintenance (in 1/TAXFREQ's). 38 | */ 39 | int policeFundEscrow; 40 | 41 | CityBudget(Micropolis city) 42 | { 43 | this.city = city; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/micropolisj/engine/CityDimension.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Encapsulates the width and height of a rectangular section of a Micropolis city. 13 | */ 14 | public class CityDimension 15 | { 16 | public int width; 17 | public int height; 18 | 19 | public CityDimension(int width, int height) 20 | { 21 | this.width = width; 22 | this.height = height; 23 | } 24 | 25 | @Override 26 | public int hashCode() 27 | { 28 | return width*33+height; 29 | } 30 | 31 | @Override 32 | public boolean equals(Object obj) 33 | { 34 | if (obj instanceof CityDimension) { 35 | CityDimension rhs = (CityDimension) obj; 36 | return this.width == rhs.width && this.height == rhs.height; 37 | } 38 | else { 39 | return false; 40 | } 41 | } 42 | 43 | @Override 44 | public String toString() 45 | { 46 | return width+"x"+height; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/micropolisj/engine/CityLocation.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Coordinates of a location (x,y) in the city. 13 | */ 14 | public class CityLocation 15 | { 16 | /** The X coordinate of this location. 17 | * Increasing X coordinates correspond to East, 18 | * and decreasing X coordinates correspond to West. */ 19 | public int x; 20 | 21 | /** The Y coordinate of this location. 22 | * Increasing Y coordinates correspond to South, 23 | * and decreasing Y coordinates correspond to North. */ 24 | public int y; 25 | 26 | /** 27 | * Constructs and initializes city coordinates. 28 | */ 29 | public CityLocation(int x, int y) 30 | { 31 | this.x = x; 32 | this.y = y; 33 | } 34 | 35 | @Override 36 | public int hashCode() 37 | { 38 | return x*33+y; 39 | } 40 | 41 | @Override 42 | public boolean equals(Object obj) 43 | { 44 | if (obj instanceof CityLocation) { 45 | CityLocation rhs = (CityLocation)obj; 46 | return this.x == rhs.x && this.y == rhs.y; 47 | } 48 | else { 49 | return false; 50 | } 51 | } 52 | 53 | @Override 54 | public String toString() 55 | { 56 | return "("+x+","+y+")"; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/micropolisj/engine/CityProblem.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Enumeration of various city problems that the citizens complain about. 13 | */ 14 | public enum CityProblem 15 | { 16 | CRIME, 17 | POLLUTION, 18 | HOUSING, 19 | TAXES, 20 | TRAFFIC, 21 | UNEMPLOYMENT, 22 | FIRE; 23 | } 24 | -------------------------------------------------------------------------------- /src/micropolisj/engine/CityRect.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Specifies a rectangular area in the city's coordinate space. 13 | * This class is functionally equivalent to Java AWT's Rectangle 14 | * class, but is portable to Java editions that do not contain AWT. 15 | */ 16 | public class CityRect 17 | { 18 | /** The X coordinate of the upper-left corner of the rectangle. */ 19 | public int x; 20 | 21 | /** The Y coordinate of the upper-left corner of the rectangle. */ 22 | public int y; 23 | 24 | /** The width of the rectangle. */ 25 | public int width; 26 | 27 | /** The height of the rectangle. */ 28 | public int height; 29 | 30 | public CityRect() 31 | { 32 | } 33 | 34 | public CityRect(int x, int y, int width, int height) 35 | { 36 | this.x = x; 37 | this.y = y; 38 | this.width = width; 39 | this.height = height; 40 | } 41 | 42 | @Override 43 | public boolean equals(Object obj) 44 | { 45 | if (obj instanceof CityRect) { 46 | CityRect rhs = (CityRect)obj; 47 | return this.x == rhs.x && 48 | this.y == rhs.y && 49 | this.width == rhs.width && 50 | this.height == rhs.height; 51 | } 52 | else { 53 | return false; 54 | } 55 | } 56 | 57 | @Override 58 | public String toString() 59 | { 60 | return "["+x+","+y+","+width+"x"+height+"]"; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Disaster.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Lists the disasters that the user can invoke. 13 | */ 14 | public enum Disaster 15 | { 16 | MONSTER, 17 | FIRE, 18 | FLOOD, 19 | MELTDOWN, 20 | TORNADO, 21 | EARTHQUAKE; 22 | } 23 | -------------------------------------------------------------------------------- /src/micropolisj/engine/EarthquakeListener.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * The listener interface for receiving earthquake notifications. 13 | */ 14 | public interface EarthquakeListener 15 | { 16 | void earthquakeStarted(); 17 | } 18 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ExplosionSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Implements an explosion. 15 | * An explosion occurs when certain sprites collide, 16 | * or when a zone is demolished by fire. 17 | */ 18 | public class ExplosionSprite extends Sprite 19 | { 20 | public ExplosionSprite(Micropolis engine, int x, int y) 21 | { 22 | super(engine, SpriteKind.EXP); 23 | this.x = x; 24 | this.y = y; 25 | this.width = 48; 26 | this.height = 48; 27 | this.offx = -24; 28 | this.offy = -24; 29 | this.frame = 1; 30 | } 31 | 32 | @Override 33 | public void moveImpl() 34 | { 35 | if (city.acycle % 2 == 0) { 36 | if (this.frame == 1) { 37 | city.makeSound(x/16, y/16, Sound.EXPLOSION_HIGH); 38 | city.sendMessageAt(MicropolisMessage.EXPLOSION_REPORT, x/16, y/16); 39 | } 40 | this.frame++; 41 | } 42 | 43 | if (this.frame > 6) { 44 | this.frame = 0; 45 | 46 | startFire(x/16, y/16); 47 | startFire(x/16-1, y/16-1); 48 | startFire(x/16+1, y/16-1); 49 | startFire(x/16-1, y/16+1); 50 | startFire(x/16+1, y/16+1); 51 | return; 52 | } 53 | } 54 | 55 | void startFire(int xpos, int ypos) 56 | { 57 | if (!city.testBounds(xpos, ypos)) 58 | return; 59 | 60 | int t = city.getTile(xpos, ypos); 61 | if (!isCombustible(t) && t != DIRT) 62 | return; 63 | if (isZoneCenter(t)) 64 | return; 65 | city.setTile(xpos, ypos, FIRE); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/micropolisj/engine/GameLevel.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | public class GameLevel 12 | { 13 | public static final int MIN_LEVEL = 0; 14 | public static final int MAX_LEVEL = 2; 15 | 16 | public static boolean isValid(int lev) 17 | { 18 | return lev >= MIN_LEVEL && lev <= MAX_LEVEL; 19 | } 20 | 21 | public static int getStartingFunds(int lev) 22 | { 23 | switch (lev) { 24 | case 0: return 20000; 25 | case 1: return 10000; 26 | case 2: return 5000; 27 | default: 28 | throw new Error("unexpected game level: "+lev); 29 | } 30 | } 31 | 32 | //prevent this class from being instantiated 33 | private GameLevel() {} 34 | } 35 | -------------------------------------------------------------------------------- /src/micropolisj/engine/HelicopterSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Implements the helicopter. 13 | * The helicopter appears if the city contains an airport. 14 | * It usually flies to the location in the city with the highest 15 | * traffic density, but sometimes flies to other locations. 16 | */ 17 | public class HelicopterSprite extends Sprite 18 | { 19 | int count; 20 | int destX; 21 | int destY; 22 | int origX; 23 | int origY; 24 | 25 | static int [] CDx = { 0, 0, 3, 5, 3, 0, -3, -5, -3 }; 26 | static int [] CDy = { 0, -5, -3, 0, 3, 5, 3, 0, -3 }; 27 | static final int SOUND_FREQ = 200; 28 | 29 | public HelicopterSprite(Micropolis engine, int xpos, int ypos) 30 | { 31 | super(engine, SpriteKind.COP); 32 | this.x = xpos * 16 + 8; 33 | this.y = ypos * 16 + 8; 34 | this.width = 32; 35 | this.height = 32; 36 | this.offx = -16; 37 | this.offy = -16; 38 | 39 | this.destX = city.PRNG.nextInt(city.getWidth()) * 16 + 8; 40 | this.destY = city.PRNG.nextInt(city.getHeight()) * 16 + 8; 41 | 42 | this.origX = x; 43 | this.origY = y; 44 | this.count = 1500; 45 | this.frame = 5; 46 | } 47 | 48 | @Override 49 | public void moveImpl() 50 | { 51 | if (this.count > 0) { 52 | this.count--; 53 | } 54 | 55 | if (this.count == 0) { 56 | 57 | // attract copter to monster and tornado so it blows up more often 58 | if (city.hasSprite(SpriteKind.GOD)) { 59 | 60 | MonsterSprite monster = (MonsterSprite) city.getSprite(SpriteKind.GOD); 61 | this.destX = monster.x; 62 | this.destY = monster.y; 63 | 64 | } 65 | else if (city.hasSprite(SpriteKind.TOR)) { 66 | 67 | TornadoSprite tornado = (TornadoSprite) city.getSprite(SpriteKind.TOR); 68 | this.destX = tornado.x; 69 | this.destY = tornado.y; 70 | 71 | } 72 | else { 73 | this.destX = origX; 74 | this.destY = origY; 75 | } 76 | 77 | if (getDis(x, y, origX, origY) < 30) { 78 | // made it back to airport, go ahead and land. 79 | this.frame = 0; 80 | return; 81 | } 82 | } 83 | 84 | if (city.acycle % SOUND_FREQ == 0) { 85 | // send report, if hovering over high traffic area 86 | int xpos = this.x / 16; 87 | int ypos = this.y / 16; 88 | 89 | if (city.getTrafficDensity(xpos, ypos) > 170 && 90 | city.PRNG.nextInt(8) == 0) 91 | { 92 | city.sendMessageAt(MicropolisMessage.HEAVY_TRAFFIC_REPORT, 93 | xpos, ypos); 94 | city.makeSound(xpos, ypos, Sound.HEAVYTRAFFIC); 95 | } 96 | } 97 | 98 | int z = this.frame; 99 | if (city.acycle % 3 == 0) { 100 | int d = getDir(x, y, destX, destY); 101 | z = turnTo(z, d); 102 | this.frame = z; 103 | } 104 | x += CDx[z]; 105 | y += CDy[z]; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/micropolisj/engine/MapListener.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * The listener interface for receiving notifications whenever a tile on 13 | * the city map changes, or when a sprite moves or changes. 14 | */ 15 | public interface MapListener 16 | { 17 | /** Called on every tick of the simulation. */ 18 | void mapAnimation(); 19 | 20 | /** Called whenever data for a specific overlay has changed. */ 21 | void mapOverlayDataChanged(MapState overlayDataType); 22 | 23 | /** Called when a sprite moves. */ 24 | void spriteMoved(Sprite sprite); 25 | 26 | /** Called when a map tile changes, including for animations. */ 27 | void tileChanged(int xpos, int ypos); 28 | 29 | /** Called when the entire map should be reread and rendered. */ 30 | void wholeMapChanged(); 31 | } 32 | -------------------------------------------------------------------------------- /src/micropolisj/engine/MapState.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Lists the various map overlay options that are available. 13 | */ 14 | public enum MapState 15 | { 16 | ALL, //ALMAP 17 | RESIDENTIAL, //REMAP 18 | COMMERCIAL, //COMAP 19 | INDUSTRIAL, //INMAP 20 | TRANSPORT, //RDMAP 21 | POPDEN_OVERLAY, //PDMAP 22 | GROWTHRATE_OVERLAY, //RGMAP 23 | LANDVALUE_OVERLAY, //LVMAP 24 | CRIME_OVERLAY, //CRMAP 25 | POLLUTE_OVERLAY, //PLMAP 26 | TRAFFIC_OVERLAY, //TDMAP 27 | POWER_OVERLAY, //PRMAP 28 | FIRE_OVERLAY, //FIMAP 29 | POLICE_OVERLAY; //POMAP 30 | } 31 | -------------------------------------------------------------------------------- /src/micropolisj/engine/MicropolisMessage.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Enumeration of every possible message for the user generated by the game engine. 13 | */ 14 | public enum MicropolisMessage 15 | { 16 | //orig_num generated last tested/verified 17 | NEED_RES, // 1 doMessages 1/19 18 | NEED_COM, // 2 doMessages 1/19 19 | NEED_IND, // 3 doMessages 1/19 20 | NEED_ROADS, // 4 doMessages 1/19 21 | NEED_RAILS, // 5 doMessages 1/20 22 | NEED_POWER, // 6 doMessages 1/19 23 | NEED_STADIUM, // 7 doMessages 1/20 24 | NEED_SEAPORT, // 8 doMessages 1/20 25 | NEED_AIRPORT, // 9 doMessages 26 | HIGH_POLLUTION, // 10 doMessages 1/20 27 | HIGH_CRIME, // 11 doMessages 1/19 28 | HIGH_TRAFFIC, // 12 doMessages 1/20 29 | NEED_FIRESTATION, // 13 doMessages 1/19 30 | NEED_POLICE, // 14 doMessages 1/19 31 | BLACKOUTS, // 15 doMessages 1/19 32 | HIGH_TAXES, // 16 doMessages 1/19 33 | ROADS_NEED_FUNDING, // 17 doMessages 34 | FIRE_NEED_FUNDING, // 18 doMessages 35 | POLICE_NEED_FUNDING, // 19 doMessages 36 | FIRE_REPORT, // 20 37 | MONSTER_REPORT, 38 | TORNADO_REPORT, 39 | EARTHQUAKE_REPORT, // 23 makeEarthquake 40 | PLANECRASH_REPORT, 41 | SHIPWRECK_REPORT, 42 | TRAIN_CRASH_REPORT, 43 | COPTER_CRASH_REPORT, 44 | HIGH_UNEMPLOYMENT, 45 | OUT_OF_FUNDS_REPORT, 46 | FIREBOMBING_REPORT, //30 47 | NEED_PARKS, 48 | EXPLOSION_REPORT, 49 | INSUFFICIENT_FUNDS, // 33 MainWindow.applyCurrentTool 50 | BULLDOZE_FIRST, // 34 MainWindow.applyCurrentTool 51 | POP_2K_REACHED, // 35 checkGrowth 1/19 52 | POP_10K_REACHED, // 36 checkGrowth 53 | POP_50K_REACHED, // 37 checkGrowth 54 | POP_100K_REACHED, // 38 checkGrowth 55 | POP_500K_REACHED, // 39 checkGrowth 56 | BROWNOUTS_REPORT, // 40 1/20 57 | HEAVY_TRAFFIC_REPORT, // 41 HelicopterSprite 58 | FLOOD_REPORT, 59 | MELTDOWN_REPORT, // 43 doMeltdown 60 | RIOTING_REPORT, 61 | 62 | // added by Jason 63 | NO_NUCLEAR_PLANTS; 64 | 65 | /** Whether the message should be displayed in the notification pane. */ 66 | public boolean useNotificationPane = false; 67 | 68 | static 69 | { 70 | // not location-specific 71 | POP_2K_REACHED.useNotificationPane = true; 72 | POP_10K_REACHED.useNotificationPane = true; 73 | POP_50K_REACHED.useNotificationPane = true; 74 | POP_100K_REACHED.useNotificationPane = true; 75 | POP_500K_REACHED.useNotificationPane = true; 76 | HIGH_CRIME.useNotificationPane = true; 77 | HIGH_POLLUTION.useNotificationPane = true; 78 | 79 | // location-specific 80 | FLOOD_REPORT.useNotificationPane = true; 81 | FIRE_REPORT.useNotificationPane = true; 82 | TORNADO_REPORT.useNotificationPane = true; 83 | MELTDOWN_REPORT.useNotificationPane = true; 84 | EARTHQUAKE_REPORT.useNotificationPane = true; 85 | TRAIN_CRASH_REPORT.useNotificationPane = true; 86 | SHIPWRECK_REPORT.useNotificationPane = true; 87 | COPTER_CRASH_REPORT.useNotificationPane = true; 88 | PLANECRASH_REPORT.useNotificationPane = true; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/micropolisj/engine/MicropolisTool.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Enumerates the various tools that can be applied to the map by the user. 15 | * Call the tool's apply() method to actually use the tool on the map. 16 | */ 17 | public enum MicropolisTool 18 | { 19 | BULLDOZER(1, 1), 20 | WIRE(1, 5), //cost=25 for underwater 21 | ROADS(1, 10), //cost=50 for over water 22 | RAIL(1, 20), //cost=100 for underwater 23 | RESIDENTIAL(3, 100), 24 | COMMERCIAL(3, 100), 25 | INDUSTRIAL(3, 100), 26 | FIRE(3, 500), 27 | POLICE(3, 500), 28 | STADIUM(4, 5000), 29 | PARK(1, 10), 30 | SEAPORT(4, 3000), 31 | POWERPLANT(4, 3000), 32 | NUCLEAR(4, 5000), 33 | AIRPORT(6, 10000), 34 | QUERY(1, 0); 35 | 36 | int size; 37 | int cost; 38 | 39 | private MicropolisTool(int size, int cost) 40 | { 41 | this.size = size; 42 | this.cost = cost; 43 | } 44 | 45 | public int getWidth() 46 | { 47 | return size; 48 | } 49 | 50 | public int getHeight() 51 | { 52 | return getWidth(); 53 | } 54 | 55 | public ToolStroke beginStroke(Micropolis engine, int xpos, int ypos) 56 | { 57 | switch (this) { 58 | case BULLDOZER: 59 | return new Bulldozer(engine, xpos, ypos); 60 | 61 | case WIRE: 62 | case ROADS: 63 | case RAIL: 64 | return new RoadLikeTool(engine, this, xpos, ypos); 65 | 66 | case FIRE: 67 | case POLICE: 68 | case STADIUM: 69 | case SEAPORT: 70 | case POWERPLANT: 71 | case NUCLEAR: 72 | case AIRPORT: 73 | return new BuildingTool(engine, this, xpos, ypos); 74 | 75 | default: 76 | return new ToolStroke(engine, this, xpos, ypos); 77 | } 78 | } 79 | 80 | public ToolResult apply(Micropolis engine, int xpos, int ypos) 81 | { 82 | return beginStroke(engine, xpos, ypos).apply(); 83 | } 84 | 85 | /** 86 | * This is the cost displayed in the GUI when the tool is selected. 87 | * It does not necessarily reflect the cost charged when a tool is 88 | * applied, as extra may be charged for clearing land or building 89 | * over or through water. 90 | */ 91 | public int getToolCost() 92 | { 93 | return cost; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/micropolisj/engine/MonsterSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Implements a monster (one of the Micropolis disasters). 15 | */ 16 | public class MonsterSprite extends Sprite 17 | { 18 | int count; 19 | int soundCount; 20 | int destX; 21 | int destY; 22 | int origX; 23 | int origY; 24 | int step; 25 | boolean flag; //true if the monster wants to return home 26 | 27 | //GODZILLA FRAMES 28 | // 1...3 : northeast 29 | // 4...6 : southeast 30 | // 7...9 : southwest 31 | // 10..12 : northwest 32 | // 13 : north 33 | // 14 : east 34 | // 15 : south 35 | // 16 : west 36 | 37 | // movement deltas 38 | static int [] Gx = { 2, 2, -2, -2, 0 }; 39 | static int [] Gy = { -2, 2, 2, -2, 0 }; 40 | 41 | static int [] ND1 = { 0, 1, 2, 3 }; 42 | static int [] ND2 = { 1, 2, 3, 0 }; 43 | static int [] nn1 = { 2, 5, 8, 11 }; 44 | static int [] nn2 = { 11, 2, 5, 8 }; 45 | 46 | public MonsterSprite(Micropolis engine, int xpos, int ypos) 47 | { 48 | super(engine, SpriteKind.GOD); 49 | this.x = xpos * 16 + 8; 50 | this.y = ypos * 16 + 8; 51 | this.width = 48; 52 | this.height = 48; 53 | this.offx = -24; 54 | this.offy = -24; 55 | 56 | this.origX = x; 57 | this.origY = y; 58 | 59 | this.frame = xpos > city.getWidth() / 2 ? 60 | (ypos > city.getHeight() / 2 ? 10 : 7) : 61 | (ypos > city.getHeight() / 2 ? 1 : 4); 62 | 63 | this.count = 1000; 64 | CityLocation p = city.getLocationOfMaxPollution(); 65 | this.destX = p.x * 16 + 8; 66 | this.destY = p.y * 16 + 8; 67 | this.flag = false; 68 | this.step = 1; 69 | } 70 | 71 | @Override 72 | public void moveImpl() 73 | { 74 | if (this.frame == 0) { 75 | return; 76 | } 77 | 78 | if (soundCount > 0) { 79 | soundCount--; 80 | } 81 | 82 | int d = (this.frame - 1) / 3; // basic direction 83 | int z = (this.frame - 1) % 3; // step index (only valid for d<4) 84 | 85 | if (d < 4) { //turn n s e w 86 | assert step == -1 || step == 1; 87 | if (z == 2) step = -1; 88 | if (z == 0) step = 1; 89 | z += step; 90 | 91 | if (getDis(x, y, destX, destY) < 60) { 92 | 93 | // reached destination 94 | 95 | if (!flag) { 96 | // destination was the pollution center; 97 | // now head for home 98 | flag = true; 99 | destX = origX; 100 | destY = origY; 101 | } 102 | else { 103 | // destination was origX, origY; 104 | // hide the sprite 105 | this.frame = 0; 106 | return; 107 | } 108 | } 109 | 110 | int c = getDir(x, y, destX, destY); 111 | c = (c - 1) / 2; //convert to one of four basic headings 112 | assert c >= 0 && c < 4; 113 | 114 | if ((c != d) && city.PRNG.nextInt(11) == 0) { 115 | // randomly determine direction to turn 116 | if (city.PRNG.nextInt(2) == 0) { 117 | z = ND1[d]; 118 | } 119 | else { 120 | z = ND2[d]; 121 | } 122 | d = 4; //transition heading 123 | 124 | if (soundCount == 0) { 125 | city.makeSound(x/16, y/16, Sound.MONSTER); 126 | soundCount = 50 + city.PRNG.nextInt(101); 127 | } 128 | } 129 | } 130 | else { 131 | assert this.frame >= 13 && this.frame <= 16; 132 | 133 | int z2 = (this.frame - 13) % 4; 134 | 135 | if (city.PRNG.nextInt(4) == 0) { 136 | int newFrame; 137 | if (city.PRNG.nextInt(2) == 0) { 138 | newFrame = nn1[z2]; 139 | } else { 140 | newFrame = nn2[z2]; 141 | } 142 | d = (newFrame-1) / 3; 143 | z = (newFrame-1) % 3; 144 | 145 | assert d < 4; 146 | } 147 | else { 148 | d = 4; 149 | } 150 | } 151 | 152 | this.frame = ((d * 3) + z) + 1; 153 | 154 | assert this.frame >= 1 && this.frame <= 16; 155 | 156 | this.x += Gx[d]; 157 | this.y += Gy[d]; 158 | 159 | if (this.count > 0) { 160 | this.count--; 161 | } 162 | 163 | int c = getChar(x, y); 164 | if (c == -1 || 165 | (c == RIVER && this.count != 0 && false) 166 | ) { 167 | this.frame = 0; //kill zilla 168 | } 169 | 170 | for (Sprite s : city.allSprites()) 171 | { 172 | if (checkSpriteCollision(s) && 173 | (s.kind == SpriteKind.AIR || 174 | s.kind == SpriteKind.COP || 175 | s.kind == SpriteKind.SHI || 176 | s.kind == SpriteKind.TRA) 177 | ) { 178 | s.explodeSprite(); 179 | } 180 | } 181 | 182 | destroyTile(x / 16, y / 16); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ShipSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Implements the cargo ship. 15 | * The cargo ship is created if the city contains a sea port. 16 | * It follows the river "channel" that was originally generated. 17 | * It frequently turns around. 18 | */ 19 | public class ShipSprite extends Sprite 20 | { 21 | static int [] BDx = { 0, 0, 1, 1, 1, 0, -1, -1, -1 }; 22 | static int [] BDy = { 0, -1, -1, 0, 1, 1, 1, 0, -1 }; 23 | static int [] BPx = { 0, 0, 2, 2, 2, 0, -2, -2, -2 }; 24 | static int [] BPy = { 0, -2, -2, 0, 2, 2, 2, 0, -2 }; 25 | static int [] BtClrTab = { RIVER, CHANNEL, POWERBASE, POWERBASE+1, 26 | RAILBASE, RAILBASE+1, BRWH, BRWV }; 27 | 28 | int newDir; 29 | int count; 30 | int soundCount; 31 | 32 | public static final int NORTH_EDGE = 5; 33 | public static final int EAST_EDGE = 7; 34 | public static final int SOUTH_EDGE = 1; 35 | public static final int WEST_EDGE = 3; 36 | 37 | public ShipSprite(Micropolis engine, int xpos, int ypos, int edge) 38 | { 39 | super(engine, SpriteKind.SHI); 40 | this.x = xpos * 16 + 8; 41 | this.y = ypos * 16 + 8; 42 | this.width = 48; 43 | this.height = 48; 44 | this.offx = -24; 45 | this.offy = -24; 46 | this.frame = edge; 47 | this.newDir = edge; 48 | this.dir = 10; 49 | this.count = 1; 50 | } 51 | 52 | @Override 53 | public void moveImpl() 54 | { 55 | int t = RIVER; 56 | 57 | this.soundCount--; 58 | if (this.soundCount <= 0) { 59 | if (city.PRNG.nextInt(4) == 0) { 60 | city.makeSound(x/16,y/16,Sound.HONKHONK_LOW); 61 | } 62 | this.soundCount = 200; 63 | } 64 | 65 | this.count--; 66 | if (this.count <= 0) { 67 | this.count = 9; 68 | if (this.newDir != this.frame) { 69 | this.frame = turnTo(this.frame, this.newDir); 70 | return; 71 | } 72 | int tem = city.PRNG.nextInt(8); 73 | int pem; 74 | for (pem = tem; pem < (tem + 8); pem++) { 75 | int z = (pem % 8) + 1; 76 | if (z == this.dir) 77 | continue; 78 | 79 | int xpos = this.x / 16 + BDx[z]; 80 | int ypos = this.y / 16 + BDy[z]; 81 | 82 | if (city.testBounds(xpos, ypos)) { 83 | t = city.getTile(xpos, ypos); 84 | if ((t == CHANNEL) || (t == BRWH) || (t == BRWV) || 85 | tryOther(t, this.dir, z)) 86 | { 87 | this.newDir = z; 88 | this.frame = turnTo(this.frame, this.newDir); 89 | this.dir = z + 4; 90 | if (this.dir > 8) { this.dir -= 8; } 91 | break; 92 | } 93 | } 94 | } 95 | 96 | if (pem == (tem + 8)) { 97 | this.dir = 10; 98 | this.newDir = city.PRNG.nextInt(8)+1; 99 | } 100 | } 101 | else { 102 | int z = this.frame; 103 | if (z == this.newDir) { 104 | this.x += BPx[z]; 105 | this.y += BPy[z]; 106 | } 107 | } 108 | 109 | if (!spriteInBounds()) { 110 | this.frame = 0; 111 | return; 112 | } 113 | 114 | boolean found = false; 115 | for (int z : BtClrTab) { 116 | if (t == z) { 117 | found = true; 118 | } 119 | } 120 | if (!found) { 121 | if (!city.noDisasters) { 122 | explodeSprite(); 123 | destroyTile(x/16, y/16); 124 | } 125 | } 126 | } 127 | 128 | boolean tryOther(int tile, int oldDir, int newDir) 129 | { 130 | int z = oldDir + 4; 131 | if (z > 8) z -= 8; 132 | if (newDir != z) return false; 133 | 134 | return (tile == POWERBASE || tile == POWERBASE+1 || 135 | tile == RAILBASE || tile == RAILBASE+1); 136 | } 137 | 138 | boolean spriteInBounds() 139 | { 140 | int xpos = x / 16; 141 | int ypos = y / 16; 142 | return city.testBounds(xpos, ypos); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Sound.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import java.net.URL; 12 | 13 | /** 14 | * Enumerates the various sounds that the city may produce. 15 | * The engine is not responsible for actually playing the sound. That task 16 | * belongs to the front-end (i.e. the user interface). 17 | */ 18 | public enum Sound 19 | { 20 | EXPLOSION_LOW ("explosion-low"), 21 | EXPLOSION_HIGH("explosion-high"), 22 | EXPLOSION_BOTH("explosion-low"), 23 | UHUH ("bop"), 24 | SORRY ("bop"), 25 | BUILD ("layzone"), 26 | BULLDOZE (null), 27 | HONKHONK_LOW ("honkhonk-low"), 28 | HONKHONK_MED ("honkhonk-med"), 29 | HONKHONK_HIGH ("honkhonk-high"), 30 | HONKHONK_HI ("honkhonk-hi"), 31 | SIREN ("siren"), 32 | HEAVYTRAFFIC ("heavytraffic"), 33 | MONSTER ("zombie-roar-5"); 34 | 35 | String wavName; 36 | private Sound(String wavName) 37 | { 38 | this.wavName = wavName; 39 | } 40 | 41 | public URL getAudioFile() 42 | { 43 | String n2 = "/sounds/"+wavName+".wav"; 44 | URL u = Sound.class.getResource(n2); 45 | return u; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Speed.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Lists the simulation speeds available. 13 | * Contains properties identifying how often the animation timer fires, 14 | * and how many animation steps are fired at each interval. 15 | * Note: for every 2 animation steps, one simulation step is triggered. 16 | */ 17 | public enum Speed 18 | { 19 | PAUSED ( 999, 0), 20 | SLOW ( 625, 1), //one sim step every 1250 ms 21 | NORMAL ( 125, 1), //one sim step every 250 ms 22 | FAST ( 25, 1), //one sim step every 50 ms 23 | SUPER_FAST( 25, 5); //one sim step every 10 ms 24 | 25 | /** The animation speed, expressed as an interval in milliseconds. */ 26 | public final int animationDelay; 27 | 28 | /** For faster speeds, how many simulation steps should occur for every 29 | * update to the screen. */ 30 | public final int simStepsPerUpdate; 31 | 32 | private Speed(int delay, int simSteps) 33 | { 34 | this.animationDelay = delay; 35 | this.simStepsPerUpdate = simSteps; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Sprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Represents a mobile entity on the city map, such as a tornado 15 | * or a train. There can be any number present in a city, and each one 16 | * gets a chance to act on every tick of the simulation. 17 | * 18 | * @see Micropolis#moveObjects 19 | */ 20 | public abstract class Sprite 21 | { 22 | Micropolis city; 23 | 24 | //TODO- enforce read-only nature of the following properties 25 | // (i.e. do not let them be modified directly by other classes) 26 | 27 | public SpriteKind kind; 28 | 29 | public int offx; 30 | public int offy; 31 | public int width = 32; 32 | public int height = 32; 33 | 34 | public int frame; 35 | public int x; 36 | public int y; 37 | 38 | public int lastX; 39 | public int lastY; 40 | 41 | int dir; 42 | 43 | protected Sprite(Micropolis engine, SpriteKind kind) 44 | { 45 | this.city = engine; 46 | this.kind = kind; 47 | } 48 | 49 | protected final int getChar(int x, int y) 50 | { 51 | int xpos = x / 16; 52 | int ypos = y / 16; 53 | if (city.testBounds(xpos, ypos)) { 54 | return city.getTile(xpos, ypos); 55 | } else { 56 | return -1; 57 | } 58 | } 59 | 60 | /** 61 | * For subclasses to override. Actually does the movement and animation 62 | * of this particular sprite. Setting this.frame to zero will cause the 63 | * sprite to be unallocated. 64 | */ 65 | protected abstract void moveImpl(); 66 | 67 | /** 68 | * Perform this agent's movement and animation. 69 | */ 70 | public final void move() 71 | { 72 | lastX = x; 73 | lastY = y; 74 | moveImpl(); 75 | city.fireSpriteMoved(this); 76 | } 77 | 78 | /** 79 | * Tells whether this sprite is visible. 80 | */ 81 | public final boolean isVisible() 82 | { 83 | return this.frame != 0; 84 | } 85 | 86 | /** 87 | * Computes direction from one point to another. 88 | * @return integer between 1 and 8, with 89 | * 1 == north, 90 | * 3 == east, 91 | * 5 == south, 92 | * 7 == west. 93 | */ 94 | static final int getDir(int orgX, int orgY, int desX, int desY) 95 | { 96 | final int Gdtab [] = { 0, 3, 2, 1, 3, 4, 5, 7, 6, 5, 7, 8, 1 }; 97 | int dispX = desX - orgX; 98 | int dispY = desY - orgY; 99 | 100 | int z = dispX < 0 ? (dispY < 0 ? 11 : 8) : (dispY < 0 ? 2 : 5); 101 | 102 | dispX = Math.abs(dispX); 103 | dispY = Math.abs(dispY); 104 | int absDist = dispX + dispY; 105 | 106 | if (dispX * 2 < dispY) z++; 107 | else if (dispY * 2 < dispX) z--; 108 | 109 | if (z >= 1 && z <= 12) { 110 | return Gdtab[z]; 111 | } 112 | else { 113 | assert false; 114 | return 0; 115 | } 116 | } 117 | 118 | /** 119 | * Computes manhatten distance between two points. 120 | */ 121 | static final int getDis(int x0, int y0, int x1, int y1) 122 | { 123 | return Math.abs(x0-x1) + Math.abs(y0-y1); 124 | } 125 | 126 | /** 127 | * Replaces this sprite with an exploding sprite. 128 | */ 129 | final void explodeSprite() 130 | { 131 | this.frame = 0; 132 | 133 | city.makeExplosionAt(x, y); 134 | int xpos = x/16; 135 | int ypos = y/16; 136 | 137 | switch (kind) { 138 | case AIR: 139 | city.crashLocation = new CityLocation(xpos, ypos); 140 | city.sendMessageAt(MicropolisMessage.PLANECRASH_REPORT, xpos, ypos); 141 | break; 142 | case SHI: 143 | city.crashLocation = new CityLocation(xpos, ypos); 144 | city.sendMessageAt(MicropolisMessage.SHIPWRECK_REPORT, xpos, ypos); 145 | break; 146 | case TRA: 147 | case BUS: 148 | city.crashLocation = new CityLocation(xpos, ypos); 149 | city.sendMessageAt(MicropolisMessage.TRAIN_CRASH_REPORT, xpos, ypos); 150 | break; 151 | case COP: 152 | city.crashLocation = new CityLocation(xpos, ypos); 153 | city.sendMessageAt(MicropolisMessage.COPTER_CRASH_REPORT, xpos, ypos); 154 | break; 155 | } 156 | 157 | city.makeSound(xpos, ypos, Sound.EXPLOSION_HIGH); 158 | } 159 | 160 | /** 161 | * Checks whether another sprite is in collision ranges. 162 | * @return true iff the sprite is in collision range 163 | */ 164 | final boolean checkSpriteCollision(Sprite otherSprite) 165 | { 166 | if (!isVisible()) return false; 167 | if (!otherSprite.isVisible()) return false; 168 | 169 | return (getDis(this.x, this.y, otherSprite.x, otherSprite.y) < 30); 170 | } 171 | 172 | /** 173 | * Destroys whatever is at the specified location, 174 | * replacing it with fire, rubble, or water as appropriate. 175 | */ 176 | final void destroyTile(int xpos, int ypos) 177 | { 178 | if (!city.testBounds(xpos, ypos)) 179 | return; 180 | 181 | int t = city.getTile(xpos, ypos); 182 | if (isOverWater(t)) { 183 | if (isRoad(t)) { 184 | // becomes water 185 | city.setTile(xpos, ypos, RIVER); 186 | } 187 | // wires and tunnels cannot be destroyed 188 | return; 189 | } 190 | 191 | if (!isCombustible(t)) { 192 | // cannot destroy it 193 | return; 194 | } 195 | 196 | if (isZoneCenter(t)) { 197 | city.killZone(xpos, ypos, t); 198 | 199 | CityDimension d = getZoneSizeFor(t); 200 | if (d.width >= 3 && d.height >= 3) { 201 | city.makeExplosion(xpos, ypos); 202 | return; 203 | } 204 | } 205 | 206 | city.setTile(xpos, ypos, TINYEXP); 207 | } 208 | 209 | /** 210 | * Helper function for rotating a sprite. 211 | * @param p the sprite's current attitude (1-8) 212 | * @param d the desired attitude (1-8) 213 | * @return the new attitude 214 | */ 215 | static final int turnTo(int p, int d) 216 | { 217 | if (p == d) 218 | return p; 219 | if (p < d) { 220 | if (d - p < 4) p++; 221 | else p--; 222 | } 223 | else { 224 | if (p - d < 4) p--; 225 | else p++; 226 | } 227 | if (p > 8) return 1; 228 | if (p < 1) return 8; 229 | return p; 230 | } 231 | 232 | } 233 | -------------------------------------------------------------------------------- /src/micropolisj/engine/SpriteKind.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Enumeration of the various kinds of sprites that may appear in the city. 13 | */ 14 | public enum SpriteKind 15 | { 16 | TRA(1,5), 17 | COP(2,8), 18 | AIR(3,11), 19 | SHI(4,8), 20 | GOD(5,16), 21 | TOR(6,3), 22 | EXP(7,6), 23 | BUS(8,4); 24 | 25 | public final int objectId; 26 | public final int numFrames; 27 | 28 | private SpriteKind(int objectId, int numFrames) 29 | { 30 | this.objectId = objectId; 31 | this.numFrames = numFrames; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/micropolisj/engine/TileBehavior.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import java.util.Random; 12 | import static micropolisj.engine.TileConstants.*; 13 | 14 | public abstract class TileBehavior 15 | { 16 | protected final Micropolis city; 17 | protected final Random PRNG; 18 | int xpos; 19 | int ypos; 20 | int tile; 21 | 22 | protected TileBehavior(Micropolis city) 23 | { 24 | this.city = city; 25 | this.PRNG = city.PRNG; 26 | } 27 | 28 | public final void processTile(int xpos, int ypos) 29 | { 30 | this.xpos = xpos; 31 | this.ypos = ypos; 32 | this.tile = city.getTile(xpos, ypos); 33 | apply(); 34 | } 35 | 36 | /** 37 | * Activate the tile identified by xpos and ypos properties. 38 | */ 39 | public abstract void apply(); 40 | } 41 | -------------------------------------------------------------------------------- /src/micropolisj/engine/Tiles.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import java.io.*; 12 | import java.nio.charset.Charset; 13 | import java.util.*; 14 | 15 | /** 16 | * Provides global methods for loading tile specifications. 17 | */ 18 | public class Tiles 19 | { 20 | static final Charset UTF8 = Charset.forName("UTF-8"); 21 | static TileSpec [] tiles; 22 | static Map tilesByName = new HashMap(); 23 | static { 24 | try { 25 | readTiles(); 26 | checkTiles(); 27 | } 28 | catch (IOException e) { 29 | throw new RuntimeException(e); 30 | } 31 | } 32 | 33 | static final String TILE_ALIASES = "/tiles/aliases.txt"; 34 | static Map loadTileUpgradeMap() 35 | { 36 | try { 37 | Properties p = new Properties(); 38 | p.load( 39 | new InputStreamReader( 40 | Tiles.class.getResourceAsStream(TILE_ALIASES), 41 | UTF8 42 | ) 43 | ); 44 | 45 | HashMap rv = new HashMap(); 46 | for (Map.Entry e : p.entrySet()) { 47 | rv.put((String)e.getKey(), (String)e.getValue()); 48 | } 49 | return rv; 50 | 51 | } 52 | catch (IOException e) { 53 | // probably means the resource file was not found 54 | System.err.println(TILE_ALIASES + ": "+e); 55 | return Collections.emptyMap(); 56 | } 57 | } 58 | 59 | static void readTiles() 60 | throws IOException 61 | { 62 | ArrayList tilesList = new ArrayList(); 63 | 64 | Properties tilesRc = new Properties(); 65 | tilesRc.load( 66 | new InputStreamReader( 67 | Tiles.class.getResourceAsStream("/tiles.rc"), 68 | UTF8 69 | ) 70 | ); 71 | 72 | String [] tileNames = TileSpec.generateTileNames(tilesRc); 73 | tiles = new TileSpec[tileNames.length]; 74 | 75 | for (int i = 0; i < tileNames.length; i++) { 76 | String tileName = tileNames[i]; 77 | String rawSpec = tilesRc.getProperty(tileName); 78 | if (rawSpec == null) { 79 | break; 80 | } 81 | 82 | TileSpec ts = TileSpec.parse(i, tileName, rawSpec, tilesRc); 83 | tilesByName.put(tileName, ts); 84 | tiles[i] = ts; 85 | } 86 | 87 | for (int i = 0; i < tiles.length; i++) { 88 | tiles[i].resolveReferences(tilesByName); 89 | 90 | TileSpec.BuildingInfo bi = tiles[i].getBuildingInfo(); 91 | if (bi != null) { 92 | for (int j = 0; j < bi.members.length; j++) { 93 | TileSpec memberTile = bi.members[j]; 94 | int offx = (bi.width >= 3 ? -1 : 0) + j % bi.width; 95 | int offy = (bi.height >= 3 ? -1 : 0) + j / bi.width; 96 | 97 | if (memberTile.owner == null && 98 | (offx != 0 || offy != 0) 99 | ) 100 | { 101 | memberTile.owner = tiles[i]; 102 | memberTile.ownerOffsetX = offx; 103 | memberTile.ownerOffsetY = offy; 104 | } 105 | } 106 | } 107 | } 108 | } 109 | 110 | public static TileSpec load(String tileName) 111 | { 112 | return tilesByName.get(tileName); 113 | } 114 | 115 | public static TileSpec loadByOrdinal(int tileNumber) 116 | { 117 | return load(Integer.toString(tileNumber)); 118 | } 119 | 120 | /** 121 | * Access a tile specification by index number. 122 | * 123 | * @return a tile specification, or null if there is no tile 124 | * with the given number 125 | */ 126 | public static TileSpec get(int tileNumber) 127 | { 128 | if (tileNumber >= 0 && tileNumber < tiles.length) { 129 | return tiles[tileNumber]; 130 | } 131 | else { 132 | return null; 133 | } 134 | } 135 | 136 | public static int getTileCount() 137 | { 138 | return tiles.length; 139 | } 140 | 141 | static void checkTiles() 142 | { 143 | for (int i = 0; i < tiles.length; i++) { 144 | // do something here 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ToolEffect.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.CLEAR; 12 | 13 | class ToolEffect implements ToolEffectIfc 14 | { 15 | final Micropolis city; 16 | final ToolPreview preview; 17 | final int originX; 18 | final int originY; 19 | 20 | ToolEffect(Micropolis city) 21 | { 22 | this(city, 0, 0); 23 | } 24 | 25 | ToolEffect(Micropolis city, int xpos, int ypos) 26 | { 27 | this.city = city; 28 | this.preview = new ToolPreview(); 29 | this.originX = xpos; 30 | this.originY = ypos; 31 | } 32 | 33 | //implements ToolEffectIfc 34 | public int getTile(int dx, int dy) 35 | { 36 | int c = preview.getTile(dx, dy); 37 | if (c != CLEAR) { 38 | return c; 39 | } 40 | 41 | if (city.testBounds(originX + dx, originY + dy)) { 42 | return city.getTile(originX + dx, originY + dy); 43 | } 44 | else { 45 | // tiles outside city's boundary assumed to be 46 | // tile #0 (dirt). 47 | return 0; 48 | } 49 | } 50 | 51 | //implements ToolEffectIfc 52 | public void makeSound(int dx, int dy, Sound sound) 53 | { 54 | preview.makeSound(dx, dy, sound); 55 | } 56 | 57 | //implements ToolEffectIfc 58 | public void setTile(int dx, int dy, int tileValue) 59 | { 60 | preview.setTile(dx, dy, tileValue); 61 | } 62 | 63 | //implements ToolEffectIfc 64 | public void spend(int amount) 65 | { 66 | preview.spend(amount); 67 | } 68 | 69 | //implements ToolEffectIfc 70 | public void toolResult(ToolResult tr) 71 | { 72 | preview.toolResult(tr); 73 | } 74 | 75 | ToolResult apply() 76 | { 77 | if (originX - preview.offsetX < 0 || 78 | originX - preview.offsetX + preview.getWidth() > city.getWidth() || 79 | originY - preview.offsetY < 0 || 80 | originY - preview.offsetY + preview.getHeight() > city.getHeight()) 81 | { 82 | return ToolResult.UH_OH; 83 | } 84 | 85 | if (city.budget.totalFunds < preview.cost) { 86 | return ToolResult.INSUFFICIENT_FUNDS; 87 | } 88 | 89 | boolean anyFound = false; 90 | for (int y = 0; y < preview.tiles.length; y++) { 91 | for (int x = 0; x < preview.tiles[y].length; x++) { 92 | int c = preview.tiles[y][x]; 93 | if (c != CLEAR) { 94 | city.setTile(originX + x - preview.offsetX, originY + y - preview.offsetY, (char) c); 95 | anyFound = true; 96 | } 97 | } 98 | } 99 | 100 | for (ToolPreview.SoundInfo si : preview.sounds) 101 | { 102 | city.makeSound(si.x, si.y, si.sound); 103 | } 104 | 105 | if (anyFound && preview.cost != 0) { 106 | city.spend(preview.cost); 107 | return ToolResult.SUCCESS; 108 | } 109 | else { 110 | return preview.toolResult; 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ToolEffectIfc.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | public interface ToolEffectIfc 12 | { 13 | /** 14 | * Gets the tile at a relative location. 15 | * @return a non-negative tile identifier 16 | */ 17 | int getTile(int dx, int dy); 18 | 19 | void makeSound(int dx, int dy, Sound sound); 20 | 21 | /** 22 | * Sets the tile value at a relative location. 23 | */ 24 | void setTile(int dx, int dy, int tileValue); 25 | 26 | /** 27 | * Deduct an amount from the controller's cash funds. 28 | */ 29 | void spend(int amount); 30 | 31 | void toolResult(ToolResult tr); 32 | } 33 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ToolPreview.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import java.util.*; 12 | import static micropolisj.engine.TileConstants.*; 13 | 14 | public class ToolPreview implements ToolEffectIfc 15 | { 16 | public int offsetX; 17 | public int offsetY; 18 | public short [][] tiles; 19 | public int cost; 20 | public ToolResult toolResult; 21 | public List sounds; 22 | 23 | public static class SoundInfo 24 | { 25 | public int x; 26 | public int y; 27 | public Sound sound; 28 | 29 | SoundInfo(int x, int y, Sound sound) 30 | { 31 | this.x = x; 32 | this.y = y; 33 | this.sound = sound; 34 | } 35 | } 36 | 37 | ToolPreview() 38 | { 39 | this.tiles = new short[0][0]; 40 | this.sounds = new ArrayList(); 41 | this.toolResult = ToolResult.NONE; 42 | } 43 | 44 | //implements ToolEffectIfc 45 | public int getTile(int dx, int dy) 46 | { 47 | if (inRange(dx, dy)) { 48 | return tiles[offsetY+dy][offsetX+dx]; 49 | } 50 | else { 51 | return CLEAR; 52 | } 53 | } 54 | 55 | public CityRect getBounds() 56 | { 57 | return new CityRect( 58 | -offsetX, 59 | -offsetY, 60 | getWidth(), 61 | getHeight() 62 | ); 63 | } 64 | 65 | int getWidth() 66 | { 67 | return tiles.length != 0 ? tiles[0].length : 0; 68 | } 69 | 70 | int getHeight() 71 | { 72 | return tiles.length; 73 | } 74 | 75 | boolean inRange(int dx, int dy) 76 | { 77 | return offsetY+dy >= 0 && 78 | offsetY+dy < getHeight() && 79 | offsetX+dx >= 0 && 80 | offsetX+dx < getWidth(); 81 | } 82 | 83 | void expandTo(int dx, int dy) 84 | { 85 | if (tiles == null || tiles.length == 0) { 86 | tiles = new short[1][1]; 87 | tiles[0][0] = CLEAR; 88 | offsetX = -dx; 89 | offsetY = -dy; 90 | return; 91 | } 92 | 93 | // expand each existing row as needed 94 | for (int i = 0; i < tiles.length; i++) { 95 | short[] A = tiles[i]; 96 | if (offsetX+dx >= A.length) { 97 | int newLen = offsetX+dx+1; 98 | short[] AA = new short[newLen]; 99 | System.arraycopy(A, 0, AA, 0, A.length); 100 | Arrays.fill(AA, A.length, newLen, CLEAR); 101 | tiles[i] = AA; 102 | } 103 | else if (offsetX+dx < 0) { 104 | int addl = -(offsetX+dx); 105 | int newLen = A.length + addl; 106 | short[] AA = new short[newLen]; 107 | System.arraycopy(A, 0, AA, addl, A.length); 108 | Arrays.fill(AA, 0, addl, CLEAR); 109 | tiles[i] = AA; 110 | } 111 | } 112 | 113 | if (offsetX+dx < 0) { 114 | int addl = -(offsetX+dx); 115 | offsetX += addl; 116 | } 117 | 118 | int width = tiles[0].length; 119 | if (offsetY+dy >= tiles.length) { 120 | int newLen = offsetY+dy+1; 121 | short[][] newTiles = new short[newLen][width]; 122 | System.arraycopy(tiles, 0, newTiles, 0, tiles.length); 123 | for (int i = tiles.length; i < newLen; i++) { 124 | Arrays.fill(newTiles[i], CLEAR); 125 | } 126 | tiles = newTiles; 127 | } 128 | else if (offsetY+dy < 0) { 129 | int addl = -(offsetY+dy); 130 | int newLen = tiles.length + addl; 131 | short[][] newTiles = new short[newLen][width]; 132 | System.arraycopy(tiles, 0, newTiles, addl, tiles.length); 133 | for (int i = 0; i < addl; i++) { 134 | Arrays.fill(newTiles[i], CLEAR); 135 | } 136 | tiles = newTiles; 137 | 138 | offsetY += addl; 139 | } 140 | } 141 | 142 | //implements ToolEffectIfc 143 | public void makeSound(int dx, int dy, Sound sound) 144 | { 145 | sounds.add(new SoundInfo(dx, dy, sound)); 146 | } 147 | 148 | //implements ToolEffectIfc 149 | public void setTile(int dx, int dy, int tileValue) 150 | { 151 | expandTo(dx, dy); 152 | tiles[offsetY+dy][offsetX+dx] = (short)tileValue; 153 | } 154 | 155 | //implements ToolEffectIfc 156 | public void spend(int amount) 157 | { 158 | cost += amount; 159 | } 160 | 161 | //implements ToolEffectIfc 162 | public void toolResult(ToolResult tr) 163 | { 164 | this.toolResult = tr; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ToolResult.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Lists the various results that may occur when applying a tool. 13 | */ 14 | public enum ToolResult 15 | { 16 | SUCCESS, // 1 17 | NONE, // 0 18 | UH_OH, // -1; invalid position 19 | INSUFFICIENT_FUNDS; // -2 20 | } 21 | -------------------------------------------------------------------------------- /src/micropolisj/engine/TornadoSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Implements a tornado (one of the Micropolis disasters). 13 | */ 14 | public class TornadoSprite extends Sprite 15 | { 16 | static int [] CDx = { 2, 3, 2, 0, -2, -3 }; 17 | static int [] CDy = { -2, 0, 2, 3, 2, 0 }; 18 | 19 | boolean flag; 20 | int count; 21 | 22 | public TornadoSprite(Micropolis engine, int xpos, int ypos) 23 | { 24 | super(engine, SpriteKind.TOR); 25 | this.x = xpos * 16 + 8; 26 | this.y = ypos * 16 + 8; 27 | this.width = 48; 28 | this.height = 48; 29 | this.offx = -24; 30 | this.offy = -40; 31 | 32 | this.frame = 1; 33 | this.count = 200; 34 | } 35 | 36 | @Override 37 | public void moveImpl() 38 | { 39 | int z = this.frame; 40 | 41 | if (z == 2) { 42 | //cycle animation 43 | 44 | if (this.flag) 45 | z = 3; 46 | else 47 | z = 1; 48 | } 49 | else { 50 | this.flag = (z == 1); 51 | z = 2; 52 | } 53 | 54 | if (this.count > 0) { 55 | this.count--; 56 | } 57 | 58 | this.frame = z; 59 | 60 | for (Sprite s : city.allSprites()) { 61 | if (checkSpriteCollision(s) && 62 | (s.kind == SpriteKind.AIR || 63 | s.kind == SpriteKind.COP || 64 | s.kind == SpriteKind.SHI || 65 | s.kind == SpriteKind.TRA) 66 | ) { 67 | s.explodeSprite(); 68 | } 69 | } 70 | 71 | int zz = city.PRNG.nextInt(CDx.length); 72 | x += CDx[zz]; 73 | y += CDy[zz]; 74 | 75 | if (!city.testBounds(x/16, y/16)) { 76 | // out of bounds 77 | this.frame = 0; 78 | return; 79 | } 80 | 81 | if (this.count == 0 && city.PRNG.nextInt(501) == 0) { 82 | // early termination 83 | this.frame = 0; 84 | return; 85 | } 86 | 87 | destroyTile(x/16, y/16); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/micropolisj/engine/TrafficGen.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import java.util.*; 12 | import static micropolisj.engine.TileConstants.*; 13 | 14 | /** 15 | * Contains the code for generating city traffic. 16 | */ 17 | class TrafficGen 18 | { 19 | final Micropolis city; 20 | int mapX; 21 | int mapY; 22 | ZoneType sourceZone; 23 | 24 | int lastdir; 25 | Stack positions = new Stack(); 26 | 27 | static final int MAX_TRAFFIC_DISTANCE = 30; 28 | 29 | public TrafficGen(Micropolis city) 30 | { 31 | this.city = city; 32 | } 33 | 34 | int makeTraffic() 35 | { 36 | if (findPerimeterRoad()) //look for road on this zone's perimeter 37 | { 38 | if (tryDrive()) //attempt to drive somewhere 39 | { 40 | // success; incr trafdensity 41 | setTrafficMem(); 42 | return 1; 43 | } 44 | 45 | return 0; 46 | } 47 | else 48 | { 49 | // no road found 50 | return -1; 51 | } 52 | } 53 | 54 | void setTrafficMem() 55 | { 56 | while (!positions.isEmpty()) 57 | { 58 | CityLocation pos = positions.pop(); 59 | mapX = pos.x; 60 | mapY = pos.y; 61 | assert city.testBounds(mapX, mapY); 62 | 63 | // check for road/rail 64 | int tile = city.getTile(mapX, mapY); 65 | if (tile >= ROADBASE && tile < POWERBASE) 66 | { 67 | city.addTraffic(mapX, mapY, 50); 68 | } 69 | } 70 | } 71 | 72 | static final int [] PerimX = { -1, 0, 1, 2, 2, 2, 1, 0,-1, -2,-2,-2 }; 73 | static final int [] PerimY = { -2,-2,-2, -1, 0, 1, 2, 2, 2, 1, 0,-1 }; 74 | boolean findPerimeterRoad() 75 | { 76 | for (int z = 0; z < 12; z++) 77 | { 78 | int tx = mapX + PerimX[z]; 79 | int ty = mapY + PerimY[z]; 80 | 81 | if (roadTest(tx, ty)) 82 | { 83 | mapX = tx; 84 | mapY = ty; 85 | return true; 86 | } 87 | } 88 | return false; 89 | } 90 | 91 | boolean roadTest(int tx, int ty) 92 | { 93 | if (!city.testBounds(tx, ty)) { 94 | return false; 95 | } 96 | 97 | char c = city.getTile(tx, ty); 98 | 99 | if (c < ROADBASE) 100 | return false; 101 | else if (c > LASTRAIL) 102 | return false; 103 | else if (c >= POWERBASE && c < LASTPOWER) 104 | return false; 105 | else 106 | return true; 107 | } 108 | 109 | boolean tryDrive() 110 | { 111 | lastdir = 5; 112 | positions.clear(); 113 | 114 | for (int z = 0; z < MAX_TRAFFIC_DISTANCE; z++) //maximum distance to try 115 | { 116 | if (tryGo(z)) 117 | { 118 | // got a road 119 | if (driveDone()) 120 | { 121 | // destination reached 122 | return true; 123 | } 124 | } 125 | else 126 | { 127 | // deadend, try backing up 128 | if (!positions.isEmpty()) 129 | { 130 | positions.pop(); 131 | z += 3; 132 | } 133 | else 134 | { 135 | return false; 136 | } 137 | } 138 | } 139 | 140 | // gone maxdis 141 | return false; 142 | } 143 | 144 | static final int [] DX = { 0, 1, 0, -1 }; 145 | static final int [] DY = { -1, 0, 1, 0 }; 146 | boolean tryGo(int z) 147 | { 148 | // random starting direction 149 | int rdir = city.PRNG.nextInt(4); 150 | 151 | for (int d = rdir; d < rdir + 4; d++) 152 | { 153 | int realdir = d % 4; 154 | if (realdir == lastdir) 155 | continue; 156 | 157 | if (roadTest(mapX + DX[realdir], mapY + DY[realdir])) 158 | { 159 | mapX += DX[realdir]; 160 | mapY += DY[realdir]; 161 | lastdir = (realdir + 2) % 4; 162 | 163 | if (z % 2 == 1) 164 | { 165 | // save pos every other move 166 | positions.push(new CityLocation(mapX, mapY)); 167 | } 168 | 169 | return true; 170 | } 171 | } 172 | 173 | return false; 174 | } 175 | 176 | boolean driveDone() 177 | { 178 | int low, high; 179 | switch (sourceZone) 180 | { 181 | case RESIDENTIAL: 182 | low = COMBASE; 183 | high = NUCLEAR; 184 | break; 185 | case COMMERCIAL: 186 | low = LHTHR; 187 | high = PORT; 188 | break; 189 | case INDUSTRIAL: 190 | low = LHTHR; 191 | high = COMBASE; 192 | break; 193 | default: 194 | throw new Error("unreachable"); 195 | } 196 | 197 | if (mapY > 0) 198 | { 199 | int tile = city.getTile(mapX, mapY-1); 200 | if (tile >= low && tile <= high) 201 | return true; 202 | } 203 | if (mapX + 1 < city.getWidth()) 204 | { 205 | int tile = city.getTile(mapX + 1, mapY); 206 | if (tile >= low && tile <= high) 207 | return true; 208 | } 209 | if (mapY + 1 < city.getHeight()) 210 | { 211 | int tile = city.getTile(mapX, mapY + 1); 212 | if (tile >= low && tile <= high) 213 | return true; 214 | } 215 | if (mapX > 0) 216 | { 217 | int tile = city.getTile(mapX - 1, mapY); 218 | if (tile >= low && tile <= high) 219 | return true; 220 | } 221 | return false; 222 | } 223 | 224 | /** 225 | * The three main types of zones found in Micropolis. 226 | */ 227 | static enum ZoneType 228 | { 229 | RESIDENTIAL, COMMERCIAL, INDUSTRIAL; 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /src/micropolisj/engine/TrainSprite.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | import static micropolisj.engine.TileConstants.*; 12 | 13 | /** 14 | * Implements the commuter train. 15 | * The commuter train appears if the city has a certain amount of 16 | * railroad track. It wanders around the city's available track 17 | * randomly. 18 | */ 19 | public class TrainSprite extends Sprite 20 | { 21 | static int [] Cx = { 0, 16, 0, -16 }; 22 | static int [] Cy = { -16, 0, 16, 0 }; 23 | static int [] Dx = { 0, 4, 0, -4, 0 }; 24 | static int [] Dy = { -4, 0, 4, 0, 0 }; 25 | static int [] TrainPic2 = { 1, 2, 1, 2, 5 }; 26 | static final int TRA_GROOVE_X = 8; 27 | static final int TRA_GROOVE_Y = 8; 28 | 29 | static final int FRAME_NORTHSOUTH = 1; 30 | static final int FRAME_EASTWEST = 2; 31 | static final int FRAME_NW_SE = 3; 32 | static final int FRAME_SW_NE = 4; 33 | static final int FRAME_UNDERWATER = 5; 34 | 35 | static final int DIR_NORTH = 0; 36 | static final int DIR_EAST = 1; 37 | static final int DIR_SOUTH = 2; 38 | static final int DIR_WEST = 3; 39 | static final int DIR_NONE = 4; //not moving 40 | 41 | public TrainSprite(Micropolis engine, int xpos, int ypos) 42 | { 43 | super(engine, SpriteKind.TRA); 44 | this.x = xpos * 16 + TRA_GROOVE_X; 45 | this.y = ypos * 16 + TRA_GROOVE_Y; 46 | this.offx = -16; 47 | this.offy = -16; 48 | this.dir = DIR_NONE; //not moving 49 | } 50 | 51 | @Override 52 | public void moveImpl() 53 | { 54 | if (frame == 3 || frame == 4) { 55 | frame = TrainPic2[this.dir]; 56 | } 57 | x += Dx[this.dir]; 58 | y += Dy[this.dir]; 59 | if (city.acycle % 4 == 0) { 60 | // should be at the center of a cell, if not, correct it 61 | x = (x/16) * 16 + TRA_GROOVE_X; 62 | y = (y/16) * 16 + TRA_GROOVE_Y; 63 | int d1 = city.PRNG.nextInt(4); 64 | for (int z = d1; z < d1 + 4; z++) { 65 | int d2 = z % 4; 66 | if (this.dir != DIR_NONE) { //impossible? 67 | if (d2 == (this.dir + 2) % 4) 68 | continue; 69 | } 70 | 71 | int c = getChar(this.x + Cx[d2], this.y + Cy[d2]); 72 | if (((c >= RAILBASE) && (c <= LASTRAIL)) || //track? 73 | (c == RAILVPOWERH) || 74 | (c == RAILHPOWERV)) 75 | { 76 | if ((this.dir != d2) && (this.dir != DIR_NONE)) { 77 | if (this.dir + d2 == 3) 78 | this.frame = FRAME_NW_SE; 79 | else 80 | this.frame = FRAME_SW_NE; 81 | } 82 | else { 83 | this.frame = TrainPic2[d2]; 84 | } 85 | 86 | if ((c == RAILBASE) || (c == (RAILBASE+1))) { 87 | //underwater 88 | this.frame = FRAME_UNDERWATER; 89 | } 90 | this.dir = d2; 91 | return; 92 | } 93 | } 94 | if (this.dir == DIR_NONE) { 95 | // train has nowhere to go, so retire 96 | this.frame = 0; 97 | return; 98 | } 99 | this.dir = DIR_NONE; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/micropolisj/engine/TranslatedToolEffect.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | class TranslatedToolEffect implements ToolEffectIfc 12 | { 13 | final ToolEffectIfc base; 14 | final int dx; 15 | final int dy; 16 | 17 | TranslatedToolEffect(ToolEffectIfc base, int dx, int dy) 18 | { 19 | this.base = base; 20 | this.dx = dx; 21 | this.dy = dy; 22 | } 23 | 24 | //implements ToolEffectIfc 25 | public int getTile(int x, int y) 26 | { 27 | return base.getTile(x+dx, y+dy); 28 | } 29 | 30 | //implements ToolEffectIfc 31 | public void makeSound(int x, int y, Sound sound) 32 | { 33 | base.makeSound(x+dx, y+dy, sound); 34 | } 35 | 36 | //implements ToolEffectIfc 37 | public void setTile(int x, int y, int tileValue) 38 | { 39 | base.setTile(x+dx, y+dy, tileValue); 40 | } 41 | 42 | //implements ToolEffectIfc 43 | public void spend(int amount) 44 | { 45 | base.spend(amount); 46 | } 47 | 48 | //implements ToolEffectIfc 49 | public void toolResult(ToolResult tr) 50 | { 51 | base.toolResult(tr); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/micropolisj/engine/ZoneStatus.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.engine; 10 | 11 | /** 12 | * Contains the information generated by the query tool. 13 | * The numbers have very limited use, they are interpreted directly 14 | * by the showZoneStatus() method of NotificationPane. 15 | */ 16 | public class ZoneStatus 17 | { 18 | /** Number from 0 to 27, identifying the type of building. */ 19 | public int building; 20 | /** Number from 1 to 4, 1=Low, 2=Medium, 3=High, 4=Very High. */ 21 | public int popDensity; 22 | /** Number from 5 to 8, 5=Slum, 6=Lower Class, etc. */ 23 | public int landValue; 24 | /** Number from 9 to 12, 9=Safe, 10=Light, 11=Moderate, etc. */ 25 | public int crimeLevel; 26 | /** Number from 13 to 16, 13=None, 14=Moderate, 15=Heavy, etc. */ 27 | public int pollution; 28 | /** Number from 17 to 20, 17=Declining, 18=Stable, etc. */ 29 | public int growthRate; 30 | } 31 | -------------------------------------------------------------------------------- /src/micropolisj/engine/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Contains the backend classes that implement the actual city simulation.

4 | 5 | -------------------------------------------------------------------------------- /src/micropolisj/graphics/Animation.java: -------------------------------------------------------------------------------- 1 | package micropolisj.graphics; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.Graphics2D; 5 | import java.io.*; 6 | import java.util.*; 7 | import javax.xml.stream.*; 8 | import static micropolisj.XML_Helper.*; 9 | 10 | public class Animation extends TileImage implements TileImage.MultiPart 11 | { 12 | static final int DEFAULT_DURATION = 125; 13 | 14 | public List frames = new ArrayList(); 15 | public int totalDuration; 16 | 17 | public static Animation load(File aniFile, LoaderContext ctx) 18 | throws IOException 19 | { 20 | FileInputStream fis = new FileInputStream(aniFile); 21 | 22 | try { 23 | 24 | XMLStreamReader in = XMLInputFactory.newInstance().createXMLStreamReader(fis, "UTF-8"); 25 | in.nextTag(); 26 | if (!(in.getEventType() == XMLStreamConstants.START_ELEMENT && 27 | in.getLocalName().equals("micropolis-animation"))) { 28 | throw new IOException("Unrecognized file format"); 29 | } 30 | 31 | Animation a = read(in, ctx); 32 | 33 | in.close(); 34 | 35 | return a; 36 | } 37 | catch (XMLStreamException e) 38 | { 39 | throw new IOException(aniFile.toString()+": "+e.getMessage(), e); 40 | } 41 | finally 42 | { 43 | fis.close(); 44 | } 45 | } 46 | 47 | public static Animation read(XMLStreamReader in, LoaderContext ctx) 48 | throws XMLStreamException 49 | { 50 | Animation a = new Animation(); 51 | a.load(in, ctx); 52 | return a; 53 | } 54 | 55 | //implements MultiPart 56 | public MultiPart makeEmptyCopy() 57 | { 58 | return new Animation(); 59 | } 60 | 61 | //implements MultiPart 62 | public Iterable parts() 63 | { 64 | return frames; 65 | } 66 | 67 | //implements MultiPart 68 | public void addPartLike(TileImage image, Part refPart) 69 | { 70 | addFrame(image, ((Frame)refPart).duration); 71 | } 72 | 73 | //implements MultiPart 74 | public TileImage asTileImage() 75 | { 76 | return this; 77 | } 78 | 79 | public void addFrame(TileImage img, int duration) 80 | { 81 | totalDuration += duration; 82 | Frame f = new Frame(img, duration); 83 | frames.add(f); 84 | } 85 | 86 | public TileImage getFrameByTime(int acycle) 87 | { 88 | assert frames.size() >= 1; 89 | assert totalDuration > 0; 90 | 91 | int t = (acycle*125) % totalDuration; 92 | int nframesLessOne = frames.size() - 1; 93 | for (int i = 0; i < nframesLessOne; i++) { 94 | Frame f = frames.get(i); 95 | t -= f.duration; 96 | if (t < 0) { 97 | return f.frame; 98 | } 99 | } 100 | return frames.get(nframesLessOne).frame; 101 | } 102 | 103 | void load(XMLStreamReader in, LoaderContext ctx) 104 | throws XMLStreamException 105 | { 106 | while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { 107 | assert in.isStartElement(); 108 | 109 | String tagName = in.getLocalName(); 110 | if (tagName.equals("frame")) { 111 | 112 | String tmp = in.getAttributeValue(null, "duration"); 113 | int duration = tmp != null ? Integer.parseInt(tmp) : DEFAULT_DURATION; 114 | 115 | TileImage frameImage = TileImage.readTileImageM(in, ctx); 116 | addFrame( frameImage, duration ); 117 | } 118 | else { 119 | // unrecognized element 120 | skipToEndElement(in); 121 | } 122 | } 123 | } 124 | 125 | public class Frame implements Part 126 | { 127 | public final TileImage frame; 128 | public final int duration; 129 | 130 | public Frame(TileImage frame, int duration) 131 | { 132 | this.frame = frame; 133 | this.duration = duration; 134 | } 135 | 136 | //implements TileImage.Part 137 | public TileImage getImage() { 138 | return frame; 139 | } 140 | } 141 | 142 | private TileImage getDefaultImage() 143 | { 144 | return frames.get(0).frame; 145 | } 146 | 147 | @Override 148 | public void drawFragment(Graphics2D gr, int destX, int destY, int srcX, int srcY) 149 | { 150 | // Warning: drawing without considering the animation 151 | getDefaultImage().drawFragment(gr, destX, destY, srcX, srcY); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/micropolisj/gui/ColorParser.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.gui; 10 | 11 | import java.awt.Color; 12 | 13 | public class ColorParser 14 | { 15 | private ColorParser() {} 16 | 17 | static Color parseColor(String str) 18 | { 19 | if (str.startsWith("#") && str.length() == 7) { 20 | return new Color(Integer.parseInt(str.substring(1), 16)); 21 | } 22 | else if (str.startsWith("rgba(") && str.endsWith(")")) { 23 | String [] parts = str.substring(5,str.length()-1).split(","); 24 | int r = Integer.parseInt(parts[0]); 25 | int g = Integer.parseInt(parts[1]); 26 | int b = Integer.parseInt(parts[2]); 27 | double aa = Double.parseDouble(parts[3]); 28 | int a = Math.min(255, (int)Math.floor(aa*256.0)); 29 | return new Color(r,g,b,a); 30 | } 31 | else { 32 | throw new Error("invalid color format: "+str); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/micropolisj/gui/DemandIndicator.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.gui; 10 | 11 | import java.awt.*; 12 | import java.awt.image.*; 13 | import java.net.URL; 14 | import javax.swing.*; 15 | 16 | import micropolisj.engine.*; 17 | 18 | public class DemandIndicator extends JComponent 19 | implements Micropolis.Listener 20 | { 21 | Micropolis engine; 22 | 23 | public DemandIndicator() 24 | { 25 | } 26 | 27 | public void setEngine(Micropolis newEngine) 28 | { 29 | if (engine != null) { //old engine 30 | engine.removeListener(this); 31 | } 32 | 33 | engine = newEngine; 34 | 35 | if (engine != null) { //new engine 36 | engine.addListener(this); 37 | } 38 | repaint(); 39 | } 40 | 41 | static final BufferedImage backgroundImage = loadImage("/demandg.png"); 42 | static BufferedImage loadImage(String resourceName) 43 | { 44 | URL iconUrl = MicropolisDrawingArea.class.getResource(resourceName); 45 | Image refImage = new ImageIcon(iconUrl).getImage(); 46 | 47 | BufferedImage bi = new BufferedImage(refImage.getWidth(null), refImage.getHeight(null), 48 | BufferedImage.TYPE_INT_RGB); 49 | Graphics2D gr = bi.createGraphics(); 50 | gr.drawImage(refImage, 0, 0, null); 51 | 52 | return bi; 53 | } 54 | 55 | static final Dimension MY_SIZE = new Dimension( 56 | backgroundImage.getWidth(), 57 | backgroundImage.getHeight() 58 | ); 59 | 60 | @Override 61 | public Dimension getMinimumSize() 62 | { 63 | return MY_SIZE; 64 | } 65 | 66 | @Override 67 | public Dimension getPreferredSize() 68 | { 69 | return MY_SIZE; 70 | } 71 | 72 | @Override 73 | public Dimension getMaximumSize() 74 | { 75 | return MY_SIZE; 76 | } 77 | 78 | static final int UPPER_EDGE = 19; 79 | static final int LOWER_EDGE = 28; 80 | static final int MAX_LENGTH = 16; 81 | static final int RES_LEFT = 8; 82 | static final int COM_LEFT = 17; 83 | static final int IND_LEFT = 26; 84 | static final int BAR_WIDTH = 6; 85 | 86 | public void paintComponent(Graphics gr1) 87 | { 88 | Graphics2D gr = (Graphics2D) gr1; 89 | gr.drawImage(backgroundImage, 0, 0, null); 90 | 91 | if (engine == null) 92 | return; 93 | 94 | int resValve = engine.getResValve(); 95 | int ry0 = resValve <= 0 ? LOWER_EDGE : UPPER_EDGE; 96 | int ry1 = ry0 - resValve/100; 97 | 98 | if (ry1 - ry0 > MAX_LENGTH) { ry1 = ry0 + MAX_LENGTH; } 99 | if (ry1 - ry0 < -MAX_LENGTH) { ry1 = ry0 - MAX_LENGTH; } 100 | 101 | int comValve = engine.getComValve(); 102 | int cy0 = comValve <= 0 ? LOWER_EDGE : UPPER_EDGE; 103 | int cy1 = cy0 - comValve/100; 104 | 105 | int indValve = engine.getIndValve(); 106 | int iy0 = indValve <= 0 ? LOWER_EDGE : UPPER_EDGE; 107 | int iy1 = iy0 - indValve/100; 108 | 109 | if (ry0 != ry1) 110 | { 111 | Rectangle resRect = new Rectangle(RES_LEFT, Math.min(ry0,ry1), BAR_WIDTH, Math.abs(ry1-ry0)); 112 | gr.setColor(Color.GREEN); 113 | gr.fill(resRect); 114 | gr.setColor(Color.BLACK); 115 | gr.draw(resRect); 116 | } 117 | 118 | if (cy0 != cy1) 119 | { 120 | Rectangle comRect = new Rectangle(COM_LEFT, Math.min(cy0,cy1), BAR_WIDTH, Math.abs(cy1-cy0)); 121 | gr.setColor(Color.BLUE); 122 | gr.fill(comRect); 123 | gr.setColor(Color.BLACK); 124 | gr.draw(comRect); 125 | } 126 | 127 | if (iy0 != iy1) 128 | { 129 | Rectangle indRect = new Rectangle(IND_LEFT, Math.min(iy0,iy1), BAR_WIDTH, Math.abs(iy1-iy0)); 130 | gr.setColor(Color.YELLOW); 131 | gr.fill(indRect); 132 | gr.setColor(Color.BLACK); 133 | gr.draw(indRect); 134 | } 135 | } 136 | 137 | //implements Micropolis.Listener 138 | public void demandChanged() 139 | { 140 | repaint(); 141 | } 142 | 143 | //implements Micropolis.Listener 144 | public void cityMessage(MicropolisMessage m, CityLocation p) { } 145 | public void citySound(Sound sound, CityLocation p) { } 146 | public void censusChanged() { } 147 | public void evaluationChanged() { } 148 | public void fundsChanged() { } 149 | public void optionsChanged() { } 150 | } 151 | -------------------------------------------------------------------------------- /src/micropolisj/gui/MessagesPane.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.gui; 10 | 11 | import java.util.*; 12 | import javax.swing.*; 13 | import javax.swing.text.*; 14 | 15 | import micropolisj.engine.*; 16 | 17 | public class MessagesPane extends JTextPane 18 | { 19 | static ResourceBundle cityMessageStrings = ResourceBundle.getBundle("micropolisj.CityMessages"); 20 | 21 | public MessagesPane() 22 | { 23 | setEditable(false); 24 | } 25 | 26 | public void appendCityMessage(MicropolisMessage message) 27 | { 28 | appendMessageText(cityMessageStrings.getString(message.name())); 29 | } 30 | 31 | void appendMessageText(String messageText) 32 | { 33 | try { 34 | StyledDocument doc = getStyledDocument(); 35 | if (doc.getLength() != 0) { 36 | doc.insertString(doc.getLength(), "\n", null); 37 | } 38 | doc.insertString(doc.getLength(), messageText, null); 39 | } 40 | catch (BadLocationException e) { 41 | throw new Error("unexpected", e); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/micropolisj/gui/NewCityDialog.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.gui; 10 | 11 | import java.awt.*; 12 | import java.awt.event.*; 13 | import java.io.*; 14 | import java.util.*; 15 | import javax.swing.*; 16 | import javax.swing.filechooser.FileNameExtensionFilter; 17 | 18 | import micropolisj.engine.*; 19 | import static micropolisj.gui.MainWindow.EXTENSION; 20 | 21 | public class NewCityDialog extends JDialog 22 | { 23 | Micropolis engine; 24 | JButton previousMapBtn; 25 | Stack previousMaps = new Stack(); 26 | Stack nextMaps = new Stack(); 27 | OverlayMapView mapPane; 28 | HashMap levelBtns = new HashMap(); 29 | 30 | static final ResourceBundle strings = MainWindow.strings; 31 | 32 | public NewCityDialog(MainWindow owner, boolean showCancelOption) 33 | { 34 | super(owner); 35 | setTitle(strings.getString("welcome.caption")); 36 | setModal(true); 37 | 38 | assert owner != null; 39 | 40 | JPanel p1 = new JPanel(new BorderLayout()); 41 | p1.setBorder(BorderFactory.createEmptyBorder(10,20,10,20)); 42 | getContentPane().add(p1, BorderLayout.CENTER); 43 | 44 | engine = new Micropolis(); 45 | new MapGenerator(engine).generateNewCity(); 46 | 47 | mapPane = new OverlayMapView(engine); 48 | mapPane.setBorder(BorderFactory.createLoweredBevelBorder()); 49 | p1.add(mapPane, BorderLayout.WEST); 50 | 51 | JPanel p2 = new JPanel(new BorderLayout()); 52 | p1.add(p2, BorderLayout.CENTER); 53 | 54 | Box levelBox = new Box(BoxLayout.Y_AXIS); 55 | levelBox.setBorder(BorderFactory.createEmptyBorder(0,10,0,10)); 56 | p2.add(levelBox, BorderLayout.CENTER); 57 | 58 | levelBox.add(Box.createVerticalGlue()); 59 | JRadioButton radioBtn; 60 | for (int lev = GameLevel.MIN_LEVEL; lev <= GameLevel.MAX_LEVEL; lev++) 61 | { 62 | final int x = lev; 63 | radioBtn = new JRadioButton(strings.getString("menu.difficulty."+lev)); 64 | radioBtn.addActionListener(new ActionListener() { 65 | public void actionPerformed(ActionEvent evt) { 66 | setGameLevel(x); 67 | }}); 68 | levelBox.add(radioBtn); 69 | levelBtns.put(lev, radioBtn); 70 | } 71 | levelBox.add(Box.createVerticalGlue()); 72 | setGameLevel(GameLevel.MIN_LEVEL); 73 | 74 | JPanel buttonPane = new JPanel(); 75 | getContentPane().add(buttonPane, BorderLayout.SOUTH); 76 | 77 | JButton btn; 78 | btn = new JButton(strings.getString("welcome.previous_map")); 79 | btn.addActionListener(new ActionListener() { 80 | public void actionPerformed(ActionEvent evt) { 81 | onPreviousMapClicked(); 82 | }}); 83 | btn.setEnabled(false); 84 | buttonPane.add(btn); 85 | previousMapBtn = btn; 86 | 87 | btn = new JButton(strings.getString("welcome.play_this_map")); 88 | btn.addActionListener(new ActionListener() { 89 | public void actionPerformed(ActionEvent evt) { 90 | onPlayClicked(); 91 | }}); 92 | buttonPane.add(btn); 93 | getRootPane().setDefaultButton(btn); 94 | 95 | btn = new JButton(strings.getString("welcome.next_map")); 96 | btn.addActionListener(new ActionListener() { 97 | public void actionPerformed(ActionEvent evt) { 98 | onNextMapClicked(); 99 | }}); 100 | buttonPane.add(btn); 101 | 102 | btn = new JButton(strings.getString("welcome.load_city")); 103 | btn.addActionListener(new ActionListener() { 104 | public void actionPerformed(ActionEvent evt) { 105 | onLoadCityClicked(); 106 | }}); 107 | buttonPane.add(btn); 108 | 109 | if (showCancelOption) { 110 | btn = new JButton(strings.getString("welcome.cancel")); 111 | btn.addActionListener(new ActionListener() { 112 | public void actionPerformed(ActionEvent evt) { 113 | onCancelClicked(); 114 | }}); 115 | buttonPane.add(btn); 116 | } 117 | else { 118 | btn = new JButton(strings.getString("welcome.quit")); 119 | btn.addActionListener(new ActionListener() { 120 | public void actionPerformed(ActionEvent evt) { 121 | onQuitClicked(); 122 | }}); 123 | buttonPane.add(btn); 124 | } 125 | 126 | pack(); 127 | setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 128 | setLocationRelativeTo(owner); 129 | getRootPane().registerKeyboardAction(new ActionListener() { 130 | public void actionPerformed(ActionEvent evt) { 131 | dispose(); 132 | }}, 133 | KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), 134 | JComponent.WHEN_IN_FOCUSED_WINDOW); 135 | } 136 | 137 | private void onPreviousMapClicked() 138 | { 139 | if (previousMaps.isEmpty()) 140 | return; 141 | 142 | nextMaps.push(engine); 143 | engine = previousMaps.pop(); 144 | mapPane.setEngine(engine); 145 | 146 | previousMapBtn.setEnabled(!previousMaps.isEmpty()); 147 | } 148 | 149 | private void onNextMapClicked() 150 | { 151 | if (nextMaps.isEmpty()) 152 | { 153 | Micropolis m = new Micropolis(); 154 | new MapGenerator(m).generateNewCity(); 155 | nextMaps.add(m); 156 | } 157 | 158 | previousMaps.push(engine); 159 | engine = nextMaps.pop(); 160 | mapPane.setEngine(engine); 161 | 162 | previousMapBtn.setEnabled(true); 163 | } 164 | 165 | private void onLoadCityClicked() 166 | { 167 | try 168 | { 169 | JFileChooser fc = new JFileChooser(); 170 | FileNameExtensionFilter filter1 = new FileNameExtensionFilter(strings.getString("cty_file"), EXTENSION); 171 | fc.setFileFilter(filter1); 172 | 173 | int rv = fc.showOpenDialog(this); 174 | if (rv == JFileChooser.APPROVE_OPTION) { 175 | File file = fc.getSelectedFile(); 176 | Micropolis newEngine = new Micropolis(); 177 | newEngine.load(file); 178 | startPlaying(newEngine, file); 179 | } 180 | } 181 | catch (Exception e) 182 | { 183 | e.printStackTrace(System.err); 184 | JOptionPane.showMessageDialog(this, e, strings.getString("main.error_caption"), 185 | JOptionPane.ERROR_MESSAGE); 186 | } 187 | } 188 | 189 | void startPlaying(Micropolis newEngine, File file) 190 | { 191 | MainWindow win = (MainWindow) getOwner(); 192 | win.setEngine(newEngine); 193 | win.currentFile = file; 194 | win.makeClean(); 195 | dispose(); 196 | } 197 | 198 | private void onPlayClicked() 199 | { 200 | engine.setGameLevel(getSelectedGameLevel()); 201 | engine.setFunds(GameLevel.getStartingFunds(engine.gameLevel)); 202 | startPlaying(engine, null); 203 | } 204 | 205 | private void onCancelClicked() 206 | { 207 | dispose(); 208 | } 209 | 210 | private void onQuitClicked() 211 | { 212 | System.exit(0); 213 | } 214 | 215 | private int getSelectedGameLevel() 216 | { 217 | for (int lev : levelBtns.keySet()) 218 | { 219 | if (levelBtns.get(lev).isSelected()) { 220 | return lev; 221 | } 222 | } 223 | return GameLevel.MIN_LEVEL; 224 | } 225 | 226 | private void setGameLevel(int level) 227 | { 228 | for (int lev : levelBtns.keySet()) 229 | { 230 | levelBtns.get(lev).setSelected(lev == level); 231 | } 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /src/micropolisj/gui/NotificationPane.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.gui; 10 | 11 | import java.awt.*; 12 | import java.awt.event.*; 13 | import java.util.*; 14 | import javax.swing.*; 15 | 16 | import micropolisj.engine.*; 17 | import static micropolisj.gui.ColorParser.parseColor; 18 | 19 | public class NotificationPane extends JPanel 20 | { 21 | JLabel headerLbl; 22 | JViewport mapViewport; 23 | MicropolisDrawingArea mapView; 24 | JPanel mainPane; 25 | JComponent infoPane; 26 | 27 | static final Dimension VIEWPORT_SIZE = new Dimension(160,160); 28 | static final Color QUERY_COLOR = new Color(255,165,0); 29 | static final ResourceBundle strings = MainWindow.strings; 30 | static final ResourceBundle mstrings = ResourceBundle.getBundle("micropolisj.CityMessages"); 31 | static final ResourceBundle s_strings = ResourceBundle.getBundle("micropolisj.StatusMessages"); 32 | 33 | public NotificationPane(Micropolis engine) 34 | { 35 | super(new BorderLayout()); 36 | setVisible(false); 37 | 38 | headerLbl = new JLabel(); 39 | headerLbl.setOpaque(true); 40 | headerLbl.setHorizontalAlignment(SwingConstants.CENTER); 41 | headerLbl.setBorder(BorderFactory.createRaisedBevelBorder()); 42 | add(headerLbl, BorderLayout.NORTH); 43 | 44 | JButton dismissBtn = new JButton(strings.getString("notification.dismiss")); 45 | dismissBtn.addActionListener(new ActionListener() { 46 | public void actionPerformed(ActionEvent evt) { 47 | onDismissClicked(); 48 | }}); 49 | add(dismissBtn, BorderLayout.SOUTH); 50 | 51 | mainPane = new JPanel(new BorderLayout()); 52 | add(mainPane, BorderLayout.CENTER); 53 | 54 | JPanel viewportContainer = new JPanel(new BorderLayout()); 55 | viewportContainer.setBorder( 56 | BorderFactory.createCompoundBorder( 57 | BorderFactory.createEmptyBorder(8,4,8,4), 58 | BorderFactory.createLineBorder(Color.BLACK) 59 | )); 60 | mainPane.add(viewportContainer, BorderLayout.WEST); 61 | 62 | mapViewport = new JViewport(); 63 | mapViewport.setPreferredSize(VIEWPORT_SIZE); 64 | mapViewport.setMaximumSize(VIEWPORT_SIZE); 65 | mapViewport.setMinimumSize(VIEWPORT_SIZE); 66 | viewportContainer.add(mapViewport, BorderLayout.CENTER); 67 | 68 | mapView = new MicropolisDrawingArea(engine); 69 | mapViewport.setView(mapView); 70 | } 71 | 72 | private void onDismissClicked() 73 | { 74 | setVisible(false); 75 | } 76 | 77 | void setPicture(Micropolis engine, int xpos, int ypos) 78 | { 79 | Dimension sz = VIEWPORT_SIZE; 80 | 81 | mapView.setEngine(engine); 82 | Rectangle r = mapView.getTileBounds(xpos,ypos); 83 | 84 | mapViewport.setViewPosition(new Point( 85 | r.x + r.width/2 - sz.width/2, 86 | r.y + r.height/2 - sz.height/2 87 | )); 88 | } 89 | 90 | public void showMessage(Micropolis engine, MicropolisMessage msg, int xpos, int ypos) 91 | { 92 | setPicture(engine, xpos, ypos); 93 | 94 | if (infoPane != null) { 95 | mainPane.remove(infoPane); 96 | infoPane = null; 97 | } 98 | 99 | headerLbl.setText(mstrings.getString(msg.name()+".title")); 100 | headerLbl.setBackground(parseColor(mstrings.getString(msg.name()+".color"))); 101 | 102 | JLabel myLabel = new JLabel("

"+ 103 | mstrings.getString(msg.name()+".detail") + "

"); 104 | myLabel.setPreferredSize(new Dimension(1,1)); 105 | 106 | infoPane = myLabel; 107 | mainPane.add(myLabel, BorderLayout.CENTER); 108 | 109 | setVisible(true); 110 | } 111 | 112 | public void showZoneStatus(Micropolis engine, int xpos, int ypos, ZoneStatus zone) 113 | { 114 | headerLbl.setText(strings.getString("notification.query_hdr")); 115 | headerLbl.setBackground(QUERY_COLOR); 116 | 117 | String buildingStr = zone.building != -1 ? s_strings.getString("zone."+zone.building) : ""; 118 | String popDensityStr = s_strings.getString("status."+zone.popDensity); 119 | String landValueStr = s_strings.getString("status."+zone.landValue); 120 | String crimeLevelStr = s_strings.getString("status."+zone.crimeLevel); 121 | String pollutionStr = s_strings.getString("status."+zone.pollution); 122 | String growthRateStr = s_strings.getString("status."+zone.growthRate); 123 | 124 | setPicture(engine, xpos, ypos); 125 | 126 | if (infoPane != null) { 127 | mainPane.remove(infoPane); 128 | infoPane = null; 129 | } 130 | 131 | JPanel p = new JPanel(new GridBagLayout()); 132 | mainPane.add(p, BorderLayout.CENTER); 133 | infoPane = p; 134 | 135 | GridBagConstraints c1 = new GridBagConstraints(); 136 | GridBagConstraints c2 = new GridBagConstraints(); 137 | 138 | c1.gridx = 0; 139 | c2.gridx = 1; 140 | c1.gridy = c2.gridy = 0; 141 | c1.anchor = GridBagConstraints.WEST; 142 | c2.anchor = GridBagConstraints.WEST; 143 | c1.insets = new Insets(0,0,0,8); 144 | c2.weightx = 1.0; 145 | 146 | p.add(new JLabel(strings.getString("notification.zone_lbl")), c1); 147 | p.add(new JLabel(buildingStr), c2); 148 | 149 | c1.gridy = ++c2.gridy; 150 | p.add(new JLabel(strings.getString("notification.density_lbl")), c1); 151 | p.add(new JLabel(popDensityStr), c2); 152 | 153 | c1.gridy = ++c2.gridy; 154 | p.add(new JLabel(strings.getString("notification.value_lbl")), c1); 155 | p.add(new JLabel(landValueStr), c2); 156 | 157 | c1.gridy = ++c2.gridy; 158 | p.add(new JLabel(strings.getString("notification.crime_lbl")), c1); 159 | p.add(new JLabel(crimeLevelStr), c2); 160 | 161 | c1.gridy = ++c2.gridy; 162 | p.add(new JLabel(strings.getString("notification.pollution_lbl")), c1); 163 | p.add(new JLabel(pollutionStr), c2); 164 | 165 | c1.gridy = ++c2.gridy; 166 | p.add(new JLabel(strings.getString("notification.growth_lbl")), c1); 167 | p.add(new JLabel(growthRateStr), c2); 168 | 169 | c1.gridy++; 170 | c1.gridwidth = 2; 171 | c1.weighty = 1.0; 172 | p.add(new JLabel(), c1); 173 | 174 | setVisible(true); 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /src/micropolisj/gui/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Contains the front-end user interface that drives the game.

4 |

5 | Most of the funtionality is tied in by the MainWindow class. 6 | The MicropolisDrawingArea class provides the city renderer. 7 | The OverlapMapView class provides the mini-map. 8 |

9 | 10 | -------------------------------------------------------------------------------- /src/micropolisj/util/StringsModel.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.util; 10 | 11 | import java.io.*; 12 | import java.util.*; 13 | import javax.swing.table.*; 14 | 15 | class StringsModel extends AbstractTableModel 16 | { 17 | StringInfo [] strings; 18 | ArrayList locales = new ArrayList(); 19 | 20 | static class MyLocaleInfo 21 | { 22 | String code; 23 | HashMap propsMap = new HashMap(); 24 | boolean dirty; 25 | 26 | MyLocaleInfo(String code) { 27 | this.code = code; 28 | } 29 | } 30 | 31 | static class StringInfo 32 | { 33 | String file; 34 | String id; 35 | 36 | StringInfo(String file, String id) 37 | { 38 | this.file = file; 39 | this.id = id; 40 | } 41 | } 42 | 43 | static final String [] FILES = { 44 | "CityMessages", 45 | "CityStrings", 46 | "GuiStrings", 47 | "StatusMessages" 48 | }; 49 | 50 | File workingDirectory; 51 | 52 | StringsModel() throws IOException 53 | { 54 | workingDirectory = new File( 55 | new File(System.getProperty("user.home")), 56 | "micropolis-translations" 57 | ); 58 | 59 | ArrayList ss = new ArrayList(); 60 | for (String f : FILES) { 61 | loadStrings(f, ss); 62 | } 63 | strings = ss.toArray(new StringInfo[0]); 64 | } 65 | 66 | static void loadStrings(String file, ArrayList ss) 67 | throws IOException 68 | { 69 | Properties p = new Properties(); 70 | p.load(StringsModel.class.getResourceAsStream("/micropolisj/"+file+".properties")); 71 | String [] propNames = p.keySet().toArray(new String[0]); 72 | Arrays.sort(propNames); 73 | 74 | for (String propName : propNames) 75 | { 76 | StringInfo si = new StringInfo(file, propName); 77 | ss.add(si); 78 | } 79 | } 80 | 81 | public Object getValueAt(int row, int col) 82 | { 83 | StringInfo si = strings[row]; 84 | if (col == 0) { 85 | return si.id; 86 | } 87 | 88 | MyLocaleInfo l = locales.get(col-1); 89 | Properties p = l.propsMap.get(si.file); 90 | return p.getProperty(si.id); 91 | } 92 | 93 | @Override 94 | public int getRowCount() 95 | { 96 | return strings.length; 97 | } 98 | 99 | @Override 100 | public int getColumnCount() 101 | { 102 | return 1 + locales.size(); 103 | } 104 | 105 | @Override 106 | public Class getColumnClass(int col) 107 | { 108 | return String.class; 109 | } 110 | 111 | @Override 112 | public String getColumnName(int col) 113 | { 114 | if (col == 0) { 115 | return "String"; 116 | } 117 | else { 118 | MyLocaleInfo l = locales.get(col-1); 119 | return l.code != null ? l.code : "C"; 120 | } 121 | } 122 | 123 | @Override 124 | public boolean isCellEditable(int row, int col) 125 | { 126 | if (col == 0) { 127 | return false; 128 | } 129 | else { 130 | MyLocaleInfo l = locales.get(col-1); 131 | return l.code != null; 132 | } 133 | } 134 | 135 | @Override 136 | public void setValueAt(Object aValue, int row, int col) 137 | { 138 | StringInfo si = strings[row]; 139 | if (col == 0) { 140 | return; 141 | } 142 | 143 | MyLocaleInfo l = locales.get(col-1); 144 | Properties p = l.propsMap.get(si.file); 145 | p.setProperty(si.id, (String)aValue); 146 | l.dirty = true; 147 | } 148 | 149 | /** 150 | * Gets the file in the user's working directory. 151 | */ 152 | File getPFile(String file, String localeCode) 153 | { 154 | File d = new File(workingDirectory, "micropolisj"); 155 | return new File(d, 156 | file 157 | +(localeCode != null ? "_"+localeCode : "") 158 | +".properties"); 159 | } 160 | 161 | void addLocale(String localeCode) 162 | throws IOException 163 | { 164 | MyLocaleInfo li = new MyLocaleInfo(localeCode); 165 | for (String file : FILES) 166 | { 167 | Properties p = new Properties(); 168 | { 169 | // load strings from our jar file 170 | String s = "/micropolisj/"+file+(localeCode != null ? "_"+localeCode : "") + ".properties"; 171 | InputStream in = getClass().getResourceAsStream(s); 172 | if (in != null) { 173 | p.load(in); 174 | } 175 | } 176 | File f = getPFile(file, localeCode); 177 | if (f.exists()) { 178 | p.load(new FileInputStream(f)); 179 | } 180 | li.propsMap.put(file, p); 181 | } 182 | 183 | locales.add(li); 184 | fireTableStructureChanged(); 185 | } 186 | 187 | String [] getAllLocaleCodes() 188 | { 189 | String [] rv = new String[locales.size()]; 190 | for (int i = 0; i < rv.length; i++) { 191 | rv[i] = locales.get(i).code; 192 | } 193 | return rv; 194 | } 195 | 196 | void removeLocale(String localeCode) 197 | { 198 | assert localeCode != null; 199 | 200 | boolean found = false; 201 | for (int i = locales.size()-1; i >= 0; i--) { 202 | String loc = locales.get(i).code; 203 | if (localeCode.equals(loc)) { 204 | locales.remove(i); 205 | found = true; 206 | } 207 | } 208 | if (found) { 209 | fireTableStructureChanged(); 210 | } 211 | } 212 | 213 | void makeDirectories(File f) 214 | throws IOException 215 | { 216 | File d = f.getParentFile(); 217 | if (d != null) { 218 | d.mkdirs(); 219 | } 220 | } 221 | 222 | void save() 223 | throws IOException 224 | { 225 | for (MyLocaleInfo l : locales) 226 | { 227 | if (!l.dirty) continue; 228 | 229 | for (String file : FILES) 230 | { 231 | Properties p = l.propsMap.get(file); 232 | File f = getPFile(file, l.code); 233 | makeDirectories(f); 234 | p.store(new FileOutputStream(f), l.code); 235 | } 236 | l.dirty = false; 237 | } 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /src/micropolisj/util/TranslatedStringsTable.java: -------------------------------------------------------------------------------- 1 | // This file is part of MicropolisJ. 2 | // Copyright (C) 2013 Jason Long 3 | // Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | // 5 | // MicropolisJ is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU GPLv3, with additional terms. 7 | // See the README file, included in this distribution, for details. 8 | 9 | package micropolisj.util; 10 | 11 | import java.awt.*; 12 | import javax.swing.*; 13 | import javax.swing.table.*; 14 | 15 | public class TranslatedStringsTable extends JTable 16 | { 17 | public TranslatedStringsTable(TableModel tm) 18 | { 19 | super(tm); 20 | setDefaultEditor(String.class, new DefaultCellEditor(new JTextField())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /strings/CityMessages_de.properties: -------------------------------------------------------------------------------- 1 | #de_DE 2 | #Sun Nov 10 12:27:07 CET 2013 3 | POP_500K_REACHED.title=Megastadt 4 | TORNADO_REPORT=Wirbelsturm berichtet \!\! 5 | FIRE_NEED_FUNDING=Feuerwehr ben\u00F6tigt Finanzierung. 6 | HIGH_TRAFFIC.title=Verkehrs Warnung\! 7 | EARTHQUAKE_REPORT.detail=Ein schweres Erdbeben\! L\u00F6sche so schnell wie m\u00F6glich die Feuer, bevor sie sich ausbreiten. Dann repariere die Stromleitungen und baue die Stadt wieder auf. 8 | NEED_POWER=Baue ein Kraftwerk. 9 | POP_2K_REACHED.title=Kleinstadt 10 | HEAVY_TRAFFIC_REPORT.title=Starkes Verkehrsaufkommen\! 11 | MELTDOWN_REPORT.detail=Ein Kraftwerk hatte eine Kernschmelze. Bitte dieses Gebiet meiden, bis die Radioaktivit\u00E4t nachl\u00E4sst.

Viele kommende Generationen werden jetzt mit diesem Problem zurechtkommen m\u00FCssen. 12 | FLOOD_REPORT.title=\u00DCberschwemmung gemeldet\! 13 | HIGH_UNEMPLOYMENT=Arbeitslosenrate ist hoch. 14 | POP_10K_REACHED.title=Stadt 15 | FLOOD_REPORT.detail=\u00DCberschwemmung entlang der Uferlinie gemeldet\! 16 | TORNADO_REPORT.title=Wirbelsturm Alarm\! 17 | POP_10K_REACHED.detail=Die Kleinstadt ist zu einer richtigen Stadt gewachsen, mit einer aktuellen Einwohnerzahl von 10.000. Weiter so\! 18 | NO_NUCLEAR_PLANTS=Kernschmelze nicht m\u00F6glich. Zuerst mu\u00DF ein Kernkraftwerk gebaut werden. 19 | MELTDOWN_REPORT=Eine Kraftwerk hatte eine Kernschmelze \!\!\! 20 | HEAVY_TRAFFIC_REPORT=Starkes Verkehrsaufkommen gemeldet. 21 | EXPLOSION_REPORT=Explosion festgestellt \! 22 | MONSTER_REPORT=Ein Monster wurde gesichtet \!\! 23 | NEED_SEAPORT=Die Industrie ben\u00F6tigt einen Hafen. 24 | HIGH_POLLUTION.detail=Die Luftverschmutzung in der Stadt hat den zul\u00E4ssigen Grenzwert \u00FCberschritten. Es besteht die Gefahr von gravierenden \u00D6kologischen Sch\u00E4den.

Entweder wird etwas unternommen oder es m\u00FCssen Gasmasken verteilt werden. 25 | FIRE_REPORT.detail=Ein Feuer wurde gemeldet\! 26 | SHIPWRECK_REPORT.detail=Ein Schiff ist aufgelaufen\! 27 | NEED_COM=Mehr B\u00FCrogebiete ben\u00F6tigt. 28 | COPTER_CRASH_REPORT.detail=Ein Hubschrauber ist abgest\u00FCrzt\! 29 | NEED_IND=Mehr Industriegebiete ben\u00F6tigt. 30 | POP_500K_REACHED.detail=Gl\u00FCckwunsch, die Stadt hat die h\u00F6chste Stufe urbaner Entwicklung erreicht, die Megastadt. 31 | INSUFFICIENT_FUNDS=Nicht genug Geld um das zu bauen. 32 | POP_50K_REACHED=Die Einwohnerzahl hat 50.000 erreicht. 33 | HIGH_POLLUTION.title=Sehr hohe Luftverschmutzung\! 34 | FIREBOMBING_REPORT=Brandbomben gemeldet \! 35 | HIGH_CRIME.title=Hohe Kriminalit\u00E4t\! 36 | COPTER_CRASH_REPORT=Ein Hubschrauber ist abgest\u00FCrzt\! 37 | NEED_RES=Mehr Wohngebiete ben\u00F6tigt. 38 | POP_100K_REACHED.detail=Die Hauptstadt hat jetzt den Status einer Metropole errlangt. Die aktuelle Einwohnerzahl ist 100.000. Mit diesen Verwalterf\u00E4higkeiten k\u00F6nnte man eigentlich auch gleich als Bundeskanzler kandidieren. 39 | POP_100K_REACHED.title=Metropole 40 | PLANECRASH_REPORT.detail=Ein Flugzeug ist abgest\u00FCrzt\! 41 | HIGH_CRIME.detail=Kriminalit\u00E4t in der Stadt ger\u00E4t au\u00DFer Kontrolle. Der Mob brandschatzt und pl\u00FCndert die Innenstadt. Der Bundeskanzler wird das Milit\u00E4r schicken, wenn das Problem nicht wieder unter Kontrolle gebracht wird. 42 | HIGH_POLLUTION=Sehr hohe Luftverschmutzung. 43 | BULLDOZE_FIRST=Die Fl\u00E4che mu\u00DF zuerst planiert werden. 44 | POP_500K_REACHED=Die Einwohnerzahl hat 500.000 erreicht. 45 | HIGH_TRAFFIC.detail=Verkehr in der Stadt ist extrem. Die Stadt hat einen Verkehrsinfarkt. Die Pendler werden militant.

Mehr Stra\u00DFen und Gleise bauen oder eine kugelsichere Limosine kaufen. 46 | NEED_FIRESTATION=Die Einwohner m\u00F6chten eine Feuerwehr. 47 | POP_50K_REACHED.title=Hauptstadt 48 | BROWNOUTS_REPORT=Unterspannung. Baue neues Kraftwerk. 49 | EARTHQUAKE_REPORT=Schweres Erdbeben gemeldet \!\! 50 | NEED_POLICE=Die Einwohner m\u00F6chten eine Polizeistation. 51 | BLACKOUTS=Stromausf\u00E4lle. Leitungsnetz pr\u00FCfen. 52 | FIRE_REPORT=Feuer gemeldet \! 53 | NEED_ROADS=Mehr Stra\u00DFen ben\u00F6tigt. 54 | TORNADO_REPORT.detail=Ein Wirbelsturm wurde gesichtet\! Er kann nicht aufgehalten werden, daher sollten die Sch\u00E4den nachtr\u00E4glich repariert werden\! 55 | TRAIN_CRASH_REPORT.title=Zugungl\u00FCck\! 56 | POP_100K_REACHED=Die Einwohnerzahl hat 100.000 erreicht. 57 | HIGH_TRAFFIC=H\u00E4ufige Staus festgestellt. 58 | NEED_RAILS=Unzureichendes Zugsystem. 59 | RIOTING_REPORT.title=Unruhen\! 60 | PLANECRASH_REPORT.title=Flugzeug abgest\u00FCrzt\! 61 | FIRE_REPORT.title=Feuer gemeldet\! 62 | TRAIN_CRASH_REPORT.detail=Ein Zug hatte einen Unfall\! 63 | EARTHQUAKE_REPORT.title=Erdbeben\! 64 | MONSTER_REPORT.detail=Eine riesige reptilienhafte Kreatur wurde im Wasser gesichtet. Sie scheint von Gegenden mit hoher Luftverschmutzung angezogen zu werden. Sie zieht eine Schneise der Verw\u00FCstung.
Man kann nur abwarten, bis sie verschwindet und dann die Stadt neu aufbauen. 65 | OUT_OF_FUNDS_REPORT=Die Stadt ist pleite gegangen\! 66 | POP_2K_REACHED.detail=Gl\u00FCckwunsch, das Dorf ist zu einer Kleinstadt angewachsen. Sie hat jetzt 2.000 Einwohner. 67 | MONSTER_REPORT.title=Monster Angriff\! 68 | POP_10K_REACHED=Die Einwohnerzahl hat 10.000 erreicht. 69 | PLANECRASH_REPORT=Ein Flugzeug ist abgest\u00FCrzt\! 70 | HEAVY_TRAFFIC_REPORT.detail=Hubschrauber Eins
Melden starkes Verkehrsaufkommen\! 71 | RIOTING_REPORT=Sie randalieren in den Stra\u00DFen \!\! 72 | HIGH_CRIME=Kriminalit\u00E4t sehr hoch. 73 | FIREBOMBING_REPORT.title=Brandbomben gemeldet\! 74 | EARTHQUAKE_REPORT.color= 75 | ROADS_NEED_FUNDING=Stra\u00DFen gehen kaputt, da sie nicht repariert werden. 76 | NEED_AIRPORT=Der Handel ben\u00F6tigt einen Flughafen. 77 | POP_50K_REACHED.detail=Die Stadt wurde zur Hauptstadt. Die aktuelle Einwohnerzahl ist 50.000. Die politische Zukunft schaut hervorragend aus. 78 | RIOTING_REPORT.detail=Die Einwohner randalieren in den Stra\u00DFen, setzen Autos und H\u00E4user in Brand\!

Medienberichterstattung wurde unterbrochen. 79 | FIREBOMBING_REPORT.detail=Brandbomben werden abgeworfen\!\! 80 | POLICE_NEED_FUNDING=Polizeireviere ben\u00F6tigen Geld 81 | NEED_PARKS=Ben\u00F6tigen mehr Parks. 82 | HIGH_TAXES=B\u00FCrger unzufrieden. Zu hohe Steuern. 83 | MELTDOWN_REPORT.title=Kernschmelze\! 84 | COPTER_CRASH_REPORT.title=Hubschrauberabsturz\! 85 | SHIPWRECK_REPORT.title=Schiffsungl\u00FCck\! 86 | SHIPWRECK_REPORT=Schiffsungl\u00FCck berichtet \! 87 | POP_2K_REACHED=Die Einwohnerzahl hat 2.000 erreicht. 88 | TRAIN_CRASH_REPORT=Zugungl\u00FCck \! 89 | NEED_STADIUM=Die Einwohner m\u00F6chten ein Stadion. 90 | FLOOD_REPORT=\u00DCberschwemmung gemeldet \! 91 | -------------------------------------------------------------------------------- /strings/CityMessages_sv.properties: -------------------------------------------------------------------------------- 1 | #sv_SE 2 | #Sat Jun 15 18:46:11 CEST 2013 3 | POP_100K_REACHED=Befolkningen har n\u00E5tt 100 000. 4 | POP_10K_REACHED.detail=Din t\u00E4tort har vuxit till en stad med en befolkning p\u00E5 10 000. Forts\u00E4tt s\u00E5\! 5 | POP_2K_REACHED.title=T\u00C4TORT 6 | BULLDOZE_FIRST=Du m\u00E5ste schakta omr\u00E5det f\u00F6rst. 7 | OUT_OF_FUNDS_REPORT=DIN STAD \u00C4R BANKRUTT\! 8 | POP_500K_REACHED=Befolkningen har n\u00E5tt 500 000. 9 | POP_50K_REACHED=Befolkningen har n\u00E5tt 50 000. 10 | RIOTING_REPORT.title=UPPROR\! 11 | POP_50K_REACHED.title=HUVUDSTAD 12 | POP_2K_REACHED=Befolkningen har n\u00E5tt 2 000. 13 | POP_10K_REACHED.title=STAD 14 | SHIPWRECK_REPORT=Skeppsvrak rapporterat \! 15 | POLICE_NEED_FUNDING=Polisen beh\u00F6ver ett pengatillskott. 16 | BLACKOUTS= 17 | POP_100K_REACHED.detail= 18 | POP_500K_REACHED.detail=Grattis, du har n\u00E5tt den h\u00F6gsta niv\u00E5n som \u00E4r m\u00F6jlig\! 19 | ROADS_NEED_FUNDING=V\u00E4gar fulla av potth\u00E5l pga budgeth\u00E5l. 20 | TRAIN_CRASH_REPORT.detail=Ett t\u00E5g har krockat\! 21 | RIOTING_REPORT=Uppror ute p\u00E5 gatorna \!\! 22 | TRAIN_CRASH_REPORT.title=T\u00C5GOLYCKA\! 23 | SHIPWRECK_REPORT.detail=En b\u00E5t har kapsejsat\! 24 | POP_50K_REACHED.detail=Din stad har blivit huvudstad. Befolkningen \u00E4r 50 000. Din framtid ser ljus ut. 25 | SHIPWRECK_REPORT.title=SKEPPSVRAK\! 26 | TRAIN_CRASH_REPORT=Ett t\u00E5g krockade \! 27 | TORNADO_REPORT.detail= 28 | TORNADO_REPORT.title=TORNADOLARM\! 29 | POP_10K_REACHED=Befolkningen har n\u00E5tt 10 000. 30 | TORNADO_REPORT=Tornado rapporterad \!\! 31 | -------------------------------------------------------------------------------- /strings/CityStrings.properties: -------------------------------------------------------------------------------- 1 | !! This file is part of MicropolisJ. 2 | !! Copyright (C) 2013 Jason Long 3 | !! Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | !! 5 | !! MicropolisJ is free software; you can redistribute it and/or modify 6 | !! it under the terms of the GNU GPLv3, with additional terms. 7 | !! See the README file, included in this distribution, for details. 8 | 9 | problem.CRIME = CRIME 10 | problem.POLLUTION = POLLUTION 11 | problem.HOUSING = HOUSING COSTS 12 | problem.TAXES = TAXES 13 | problem.TRAFFIC = TRAFFIC 14 | problem.UNEMPLOYMENT = UNEMPLOYMENT 15 | problem.FIRE = FIRES 16 | 17 | class.0 = VILLAGE 18 | class.1 = TOWN 19 | class.2 = CITY 20 | class.3 = CAPITAL 21 | class.4 = METROPOLIS 22 | class.5 = MEGALOPOLIS 23 | 24 | level.0 = Easy 25 | level.1 = Medium 26 | level.2 = Hard 27 | -------------------------------------------------------------------------------- /strings/CityStrings_de.properties: -------------------------------------------------------------------------------- 1 | #de_DE 2 | #Sun Nov 10 12:27:07 CET 2013 3 | class.5=Megastadt 4 | problem.HOUSING=Mietkosten 5 | class.4=Metropole 6 | class.3=Hauptstadt 7 | problem.FIRE=Feuer 8 | class.2=Stadt 9 | class.1=Kleinstadt 10 | class.0=Dorf 11 | problem.CRIME=Kriminalit\u00E4t 12 | level.2=Schwer 13 | level.1=Mittel 14 | level.0=Einfach 15 | problem.TAXES=Steuern 16 | problem.UNEMPLOYMENT=Arbeitslosigkeit 17 | problem.POLLUTION=Luftverschmutzung 18 | problem.TRAFFIC=Verkehr 19 | -------------------------------------------------------------------------------- /strings/CityStrings_fr.utf8: -------------------------------------------------------------------------------- 1 | !! This file is part of MicropolisJ. 2 | !! Copyright (C) 2013 Jason Long 3 | !! Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | !! 5 | !! MicropolisJ is free software; you can redistribute it and/or modify 6 | !! it under the terms of the GNU GPLv3, with additional terms. 7 | !! See the README file, included in this distribution, for details. 8 | 9 | !! French - France Translation by Benoît Gross June 2013 10 | 11 | problem.CRIME = CRIME 12 | problem.POLLUTION = POLLUTION 13 | problem.HOUSING = PRIX DE L'IMMOBILIER 14 | problem.TAXES = TAXES 15 | problem.TRAFFIC = CIRCULATION 16 | problem.UNEMPLOYMENT = CHÔMAGE 17 | problem.FIRE = INCENDIES 18 | 19 | class.0 = VILLAGE 20 | class.1 = COMMUNE 21 | class.2 = VILLE 22 | class.3 = CAPITALE 23 | class.4 = MÉTROPOLE 24 | class.5 = MÉGAPOLE 25 | 26 | level.0 = Facile 27 | level.1 = Moyen 28 | level.2 = Difficile 29 | -------------------------------------------------------------------------------- /strings/CityStrings_sv.properties: -------------------------------------------------------------------------------- 1 | #sv_SE 2 | #Sat Jun 15 18:46:11 CEST 2013 3 | problem.HOUSING=HYRESKOSTNADER 4 | class.5=MEGALOPOLIS 5 | class.4=METROPOLIS 6 | problem.FIRE=BR\u00C4NDER 7 | class.3=HUVUDSTAD 8 | class.2=STAD 9 | class.1=T\u00C4TORT 10 | problem.CRIME=BROTT 11 | class.0=BY 12 | level.2=Sv\u00E5r 13 | level.1=Medel 14 | level.0=L\u00E4tt 15 | problem.TAXES=SKATTER 16 | problem.UNEMPLOYMENT=ARBETSL\u00D6SHET 17 | problem.POLLUTION=F\u00D6RORENING 18 | problem.TRAFFIC=TRAFIK 19 | -------------------------------------------------------------------------------- /strings/GuiStrings_de.properties: -------------------------------------------------------------------------------- 1 | #de_DE 2 | #Sun Nov 10 12:27:07 CET 2013 3 | menu.game.load=Lade Stadt... 4 | budgetdlg.funding_level_hdr=H\u00F6he der Finanzierung 5 | menu.speed.PAUSED=Pausierend 6 | menu.speed=Geschwindigkeit 7 | menu.windows.evaluation=Statistik 8 | dismiss-evaluation=Statistik schliessen 9 | welcome.play_this_map=Verwende diese Karte 10 | menu.speed.SLOW=Langsam 11 | public-opinion=\u00D6ffentliche Meinung 12 | city-score-head=Gesamt Stadtbewertung (0-1000) 13 | menu.overlays.LANDVALUE_OVERLAY=Grundst\u00FCckswert 14 | tool.SEAPORT.tip=Baue Hafen 15 | tool.INDUSTRIAL.name=Industriegebiet 16 | stats-last-year=(letztes Jahr) 17 | tool.INDUSTRIAL.tip=Industriegebiete 18 | menu.windows.graph=Diagramm 19 | main.error_close=Schlie\u00DFen 20 | tool.BULLDOZER.name=Bagger 21 | welcome.quit=Beenden 22 | tool.QUERY.tip=Frage Zonenstatus ab 23 | budgetdlg.police_fund=Ausgaben Polizei 24 | budgetdlg.operating_expenses=Betriebskosten 25 | tool.PARK.name=Park 26 | menu.overlays.POLICE_OVERLAY=Polizei Pr\u00E4senz 27 | notification.zone_lbl=Gebiet\: 28 | tool.AIRPORT.name=Flughafen 29 | stats-game-level=Spiel Schwierigkeit\: 30 | menu.zones=Gebiete 31 | budgetdlg.period_ending=Jahresabrechnung 32 | tool.COMMERCIAL.tip=B\u00FCrogebiete 33 | menu.game.exit=Beenden 34 | menu.help.about=\u00DCber 35 | tool.NUCLEAR.tip=Baue Kernkraftwerk 36 | budgetdlg.road_fund=Ausgaben Verkehr 37 | budgetdlg.reset=Zur\u00FCcksetzen auf Ursprungswerte 38 | menu.speed.NORMAL=Normal 39 | notification.pollution_lbl=Verschmutzung\: 40 | main.error_shutdown=Programm beenden 41 | menu.disasters=Katastrophen 42 | tool.RAIL.name=Schiene 43 | public-opinion-yes=Ja 44 | menu.game.new=Neue Stadt... 45 | budgetdlg.cash_begin=Geld am Anfang des Jahres 46 | main.error_caption=Fehler 47 | tool.WIRE.name=Stromleitung 48 | tool.POLICE.name=Polizeistation 49 | tool.POWERPLANT.name=Kohlekraftwerk 50 | graph_label.POLLUTION=Luftverschmutzung 51 | main.caption_unnamed_city=MicropolisJ 52 | tool.PARK.tip=Baue Parks 53 | main.error_unexpected=Ein unerwarteter Fehler ist aufgetreten 54 | tool.SEAPORT.name=Hafen 55 | welcome.load_city=Lade Stadt 56 | tool.BULLDOZER.tip=Baggern 57 | notification.dismiss=Schlie\u00DFen 58 | tool.RAIL.tip=Baue Schienen 59 | welcome.caption=Wilkommen zu MicropolisJ 60 | tool.NUCLEAR.name=Kernkraftwerk 61 | notification.growth_lbl=Wachstum\: 62 | menu.disasters.MELTDOWN=Kernschmelze 63 | budgetdlg.fire_fund=Ausgaben Feuerwehr 64 | menu.disasters.FLOOD=Flut 65 | dismiss_graph=Diagramm schliessen 66 | menu.game=Spiel 67 | main.tools_caption=Werkzeuge 68 | main.date_label=Datum\: 69 | notification.crime_lbl=Kriminalit\u00E4t\: 70 | welcome.cancel=Abbrechen 71 | menu.disasters.MONSTER=Monster 72 | menu.zones.INDUSTRIAL=Industriegebiete 73 | budgetdlg.annual_receipts_hdr=J\u00E4hrliche Eink\u00FCnfte 74 | menu.game.save_as=Speichere Stadt unter... 75 | graph_label.MONEY=Wert 76 | budgetdlg.pause_game=Spiel anhalten 77 | notification.query_hdr=Frage Gebietsdaten ab 78 | notification.density_lbl=Dichte\: 79 | menu.options.auto_budget=Automatischer Haushalt 80 | budgetdlg.title=Einnahmen 81 | menu.windows=Fenster 82 | menu.speed.FAST=Schnell 83 | notification.value_lbl=Wert\: 84 | menu.help.launch-translation-tool=\u00DCbersetzungswerkzeug starten 85 | budgetdlg.auto_budget=Automatischer Haushalt 86 | stats-assessed-value=Sch\u00E4tzwert\: 87 | stats-category=Kategorie\: 88 | menu.zones.RESIDENTIAL=Wohngebiete 89 | public-opinion-2=Was sind die schlimmsten Probleme? 90 | public-opinion-1=Macht der B\u00FCrgermeister gute Arbeit? 91 | menu.overlays.POPDEN_OVERLAY=Bev\u00F6lkerungsdichte 92 | menu.overlays.POLLUTE_OVERLAY=Luftverschmutzung 93 | menu.zones.TRANSPORT=Verkehrsnetz 94 | city-score-current=Aktuelle Bewertung\: 95 | stats-population=Bev\u00F6lkerung 96 | menu.options=Einstellungen 97 | menu.options.zoom_in=Vergr\u00F6\u00DFern 98 | tool.ROADS.name=Stra\u00DFe 99 | tool.RESIDENTIAL.name=Wohngebiet 100 | public-opinion-no=Nein 101 | menu.overlays.TRAFFIC_OVERLAY=Verkehrsdichte 102 | menu.overlays.CRIME_OVERLAY=Verbrechensrate 103 | main.population_label=Einwohnerzahl\: 104 | menu.help=Hilfe 105 | budgetdlg.allocation_hdr=Bezahlt 106 | menu.zones.ALL=Alle 107 | welcome.previous_map=Vorherige Karte 108 | error.shutdown_query=Programm wirklich beenden? Die Stadt wird nicht gespeichert. 109 | graph_label.INDPOP=Industriegebiete 110 | menu.options.sound=Ton 111 | main.funds_label=Einnahmen\: 112 | menu.overlays.GROWTHRATE_OVERLAY=Wachstumsrate 113 | tool.AIRPORT.tip=Baue Flughafen 114 | main.about_caption=\u00DCber MicropolisJ 115 | budgetdlg.requested_hdr=Angefordert 116 | tool.RESIDENTIAL.tip=Wohngebiete 117 | menu.options.disasters=Katastrophen 118 | budgetdlg.capital_expenses=Investitionen 119 | menu.zones.COMMERCIAL=B\u00FCrogebiete 120 | tool.POWERPLANT.tip=Baue Kohlekraftwerk 121 | tool.POLICE.tip=Baue Polizeistation 122 | main.save_query=Stadt speichern? 123 | budgetdlg.cash_end=Geld am Ende des Jahres 124 | budgetdlg.continue=Weitermachen mit diesen Angaben 125 | tool.FIRE.name=Feuerwehr 126 | menu.windows.budget=Haushalt 127 | graph_label.RESPOP=Wohngebiete 128 | graph_label.COMPOP=B\u00FCrogebiete 129 | statistics-head=Statistiken 130 | menu.disasters.FIRE=Feuer 131 | main.error_show_stacktrace=Details ansehen 132 | menu.options.auto_bulldoze=Automatisch planieren 133 | budgetdlg.taxes_collected=Steuern erhoben 134 | tool.FIRE.tip=Baue Feuerwehr 135 | menu.disasters.TORNADO=Wirbelsturm 136 | budgetdlg.tax_rate_hdr=Steuerrate 137 | menu.speed.SUPER_FAST=Sehr schnell 138 | menu.difficulty=Schwierigkeit 139 | graph_label.CRIME=Kriminalit\u00E4t 140 | tool.ROADS.tip=Baue Stra\u00DFen 141 | tool.QUERY.name=Abfrage 142 | tool.STADIUM.tip=Baue Stadion 143 | menu.overlays=Einblendungen 144 | menu.overlays.POWER_OVERLAY=Stromnetz 145 | menu.overlays.FIRE_OVERLAY=Feuerwehr Abdeckung 146 | tool.WIRE.tip=Baue Stromleitung 147 | budgetdlg.tax_revenue=Steuereinnahmen 148 | menu.options.zoom_out=Verkleinern 149 | menu.game.save=Speichere Stadt 150 | stats-net-migration=Netto Zuwanderung 151 | welcome.next_map=N\u00E4chste Karte 152 | menu.disasters.EARTHQUAKE=Erdbeben 153 | tool.COMMERCIAL.name=B\u00FCrogebiet 154 | menu.difficulty.2=Schwer 155 | menu.difficulty.1=Mittel 156 | menu.difficulty.0=Leicht 157 | onetwenty_years=120 Jahre 158 | city-score-change=J\u00E4hrliche Ausgaben\: 159 | tool.STADIUM.name=Stadion 160 | ten_years=10 Jahre 161 | -------------------------------------------------------------------------------- /strings/GuiStrings_sv.properties: -------------------------------------------------------------------------------- 1 | #sv_SE 2 | #Sat Jun 15 18:46:11 CEST 2013 3 | menu.game.load=Ladda stad... 4 | budgetdlg.funding_level_hdr=Penganiv\u00E5 5 | menu.speed.PAUSED=Paus 6 | menu.speed=Hastighet 7 | menu.windows.evaluation=Utv\u00E4rdering 8 | dismiss-evaluation=St\u00E4ng utv\u00E4rdering 9 | welcome.play_this_map=Spela karta 10 | menu.speed.SLOW=L\u00E5ngsamt 11 | public-opinion=Folkets \u00E5sikter 12 | city-score-head=Total po\u00E4ng (0 - 1000) 13 | menu.overlays.LANDVALUE_OVERLAY=Markv\u00E4rde 14 | tool.SEAPORT.tip=Bygg hamn 15 | tool.INDUSTRIAL.name=INDUSTRI 16 | stats-last-year=(f\u00F6rra \u00E5ret) 17 | tool.INDUSTRIAL.tip=Bygg industriomr\u00E5de 18 | menu.windows.graph=Graf 19 | main.error_close=St\u00E4ng 20 | tool.BULLDOZER.name=SCHAKTMASKIN 21 | welcome.quit=Avsluta 22 | tool.QUERY.tip=Fr\u00E5geverktyg 23 | budgetdlg.police_fund=Polisbudget 24 | budgetdlg.operating_expenses=Driftkostander 25 | tool.PARK.name=PARK 26 | menu.overlays.POLICE_OVERLAY=Polist\u00E4ckning 27 | funds={0,number,integer} kr 28 | notification.zone_lbl=Zontyp\: 29 | tool.AIRPORT.name=FLYGPLATS 30 | stats-game-level=Spelniv\u00E5\: 31 | menu.zones=Zoner 32 | budgetdlg.period_ending=Upph\u00F6rande period 33 | tool.COMMERCIAL.tip=Bygg aff\u00E4rsomr\u00E5de 34 | menu.game.exit=Avsluta 35 | menu.help.about=Om 36 | tool.NUCLEAR.tip=Bygg k\u00E4rnkraftverk 37 | cty_file=CTY-fil 38 | budgetdlg.road_fund=V\u00E4gbudget 39 | budgetdlg.reset=\u00C5terst\u00E4ll till standard 40 | menu.speed.NORMAL=Normal 41 | notification.pollution_lbl=F\u00F6rorening\: 42 | main.error_shutdown=Avsluta program 43 | menu.disasters=Katastrofer 44 | tool.RAIL.name=J\u00C4RNV\u00C4G 45 | main.version_string= 46 | public-opinion-yes=JA 47 | menu.game.new=Ny stad... 48 | budgetdlg.cash_begin=Pengar i b\u00F6rjan av \u00E5ret 49 | main.error_caption=Fel 50 | tool.WIRE.name=KRAFTLEDNING 51 | tool.POLICE.name=POLIS 52 | tool.POWERPLANT.name=KOLKRAFTVERK 53 | graph_label.POLLUTION=F\u00F6rorening 54 | tool.PARK.tip=Bygg parker 55 | main.error_unexpected=Ett ok\u00E4nt fel uppstod 56 | tool.SEAPORT.name=HAMN 57 | welcome.load_city=Ladda stad 58 | tool.BULLDOZER.tip=Schaktmaskin 59 | notification.dismiss=St\u00E4ng 60 | tool.RAIL.tip=Bygg j\u00E4rnv\u00E4g 61 | welcome.caption=V\u00E4lkommen till MicopolisJ 62 | tool.NUCLEAR.name=K\u00C4RNKRAFTVERK 63 | notification.growth_lbl=Tillv\u00E4xt\: 64 | menu.disasters.MELTDOWN=H\u00E4rdsm\u00E4lta 65 | budgetdlg.fire_fund=Brandbudget 66 | menu.disasters.FLOOD=\u00D6versv\u00E4mning 67 | dismiss_graph=St\u00E4ng graf 68 | menu.game=Spel 69 | main.tools_caption=Verktyg 70 | main.date_label=Datum\: 71 | notification.crime_lbl=Brott\: 72 | welcome.cancel=Avbryt 73 | menu.disasters.MONSTER=Monster 74 | menu.zones.INDUSTRIAL=Aff\u00E4rer 75 | budgetdlg.annual_receipts_hdr=\u00C5rliga kvitton 76 | menu.game.save_as=Spara stad som... 77 | graph_label.MONEY=Pengafl\u00F6de 78 | budgetdlg.pause_game=Pausa spel 79 | notification.query_hdr=Fr\u00E5geverktyg 80 | notification.density_lbl=T\u00E4thet\: 81 | menu.options.auto_budget=Autobudget 82 | budgetdlg.title=Budget 83 | menu.windows=F\u00F6nster 84 | menu.speed.FAST=Snabbt 85 | notification.value_lbl=V\u00E4rde\: 86 | menu.help.launch-translation-tool=Starta \u00F6vers\u00E4ttningsverktyget 87 | budgetdlg.auto_budget=Autobudget 88 | stats-assessed-value=Uppskattat v\u00E4rde\: 89 | stats-category=Kategori\: 90 | menu.zones.RESIDENTIAL=Bost\u00E4der 91 | public-opinion-2=Vilka problem \u00E4r v\u00E4rst? 92 | public-opinion-1=G\u00F6r borgm\u00E4staren ett bra jobb? 93 | menu.overlays.POPDEN_OVERLAY=Befolkningst\u00E4thet 94 | menu.overlays.POLLUTE_OVERLAY=F\u00F6rorening 95 | menu.zones.TRANSPORT=Transport 96 | city-score-current=Nuvarande po\u00E4ng\: 97 | stats-population=Befolkning\: 98 | menu.options=Alternativ 99 | tool.ROADS.name=V\u00C4G 100 | tool.RESIDENTIAL.name=BOST\u00C4DER 101 | public-opinion-no=NEJ 102 | menu.overlays.TRAFFIC_OVERLAY=Trafikt\u00E4thet 103 | menu.overlays.CRIME_OVERLAY=Brottsniv\u00E5 104 | main.population_label=Befolkning\: 105 | menu.help=Hj\u00E4lp 106 | budgetdlg.allocation_hdr=Utbetalt 107 | menu.zones.ALL=Alla 108 | welcome.previous_map=F\u00F6reg. karata 109 | error.shutdown_query=\u00C4r du s\u00E4ker p\u00E5 att du avsluta? Din stad kommer inte att sparas. 110 | graph_label.INDPOP=Industri 111 | menu.options.sound=Ljud 112 | main.funds_label=Pengar\: 113 | menu.overlays.GROWTHRATE_OVERLAY=Tillv\u00E4xtstakt 114 | tool.AIRPORT.tip=Bygg flygplats 115 | main.about_caption=Om MicropolisJ 116 | budgetdlg.requested_hdr=Efterfr\u00E5gat 117 | tool.RESIDENTIAL.tip=Bygg bostadsomr\u00E5de 118 | menu.options.disasters=Katastrofer 119 | budgetdlg.capital_expenses=Kapitalutgifter 120 | menu.zones.COMMERCIAL=Industri 121 | tool.POWERPLANT.tip=Bygg kolkraftverk 122 | tool.POLICE.tip=Bygg polisstation 123 | main.save_query=Vill du spara den h\u00E4r staden? 124 | budgetdlg.cash_end=Pengar i slutet av \u00E5ret 125 | budgetdlg.continue=Forts\u00E4tt med dessa v\u00E4rden 126 | tool.FIRE.name=BRANDK\u00C5R 127 | menu.windows.budget=Budget 128 | graph_label.RESPOP=Bost\u00E4der 129 | graph_label.COMPOP=Aff\u00E4rer 130 | statistics-head=Statistik 131 | menu.disasters.FIRE=Eldsv\u00E5da 132 | main.error_show_stacktrace=Visa detaljer 133 | menu.options.auto_bulldoze=Autoschaktning 134 | budgetdlg.taxes_collected=Insamlad skatt 135 | tool.FIRE.tip=Bygg brandstation 136 | menu.disasters.TORNADO=Tornado 137 | budgetdlg.tax_rate_hdr=Skatteniv\u00E5 138 | menu.speed.SUPER_FAST=J\u00E4ttefort 139 | menu.difficulty=Sv\u00E5rhetsgrad 140 | graph_label.CRIME=Brott 141 | tool.ROADS.tip=Bygg v\u00E4g 142 | tool.QUERY.name=FR\u00C5GA 143 | tool.STADIUM.tip=Bygg arena 144 | menu.overlays=Datakartor 145 | menu.overlays.POWER_OVERLAY=Kraftn\u00E4t 146 | menu.overlays.FIRE_OVERLAY=Brandt\u00E4ckning 147 | tool.WIRE.tip=Bygg kraftledning 148 | budgetdlg.tax_revenue=Skatteinkomst 149 | menu.game.save=Spara stad 150 | stats-net-migration=Nettomigrering\: 151 | welcome.next_map=N\u00E4sta karta 152 | menu.disasters.EARTHQUAKE=Jordb\u00E4vning 153 | tool.COMMERCIAL.name=AFF\u00C4RER 154 | menu.difficulty.2=Sv\u00E5r 155 | menu.difficulty.1=Medel 156 | menu.difficulty.0=L\u00E4tt 157 | onetwenty_years=120 \u00C5R 158 | city-score-change=\u00C5rlig f\u00F6r\u00E4ndring\: 159 | tool.STADIUM.name=ARENA 160 | ten_years=10 \u00C5R 161 | -------------------------------------------------------------------------------- /strings/StatusMessages.properties: -------------------------------------------------------------------------------- 1 | !! This file is part of MicropolisJ. 2 | !! Copyright (C) 2013 Jason Long 3 | !! Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | !! 5 | !! MicropolisJ is free software; you can redistribute it and/or modify 6 | !! it under the terms of the GNU GPLv3, with additional terms. 7 | !! See the README file, included in this distribution, for details. 8 | 9 | zone.0 = Clear 10 | zone.1 = Water 11 | zone.2 = Trees 12 | zone.3 = Rubble 13 | zone.4 = Flood 14 | zone.5 = Radioactive Waste 15 | zone.6 = Fire 16 | zone.7 = Road 17 | zone.8 = Power 18 | zone.9 = Rail 19 | zone.10 = Residential 20 | zone.11 = Commercial 21 | zone.12 = Industrial 22 | zone.13 = Seaport 23 | zone.14 = Airport 24 | zone.15 = Coal Power 25 | zone.16 = Fire Department 26 | zone.17 = Police Department 27 | zone.18 = Stadium 28 | zone.19 = Nuclear Power 29 | zone.20 = Draw Bridge 30 | zone.21 = Radar Dish 31 | zone.22 = Fountain 32 | zone.23 = 33 | zone.24 = Steelers 38 Bears 3 34 | zone.25 = 35 | zone.26 = Ur 238 36 | zone.27 = 37 | 38 | ! population density 39 | status.1 = Low 40 | status.2 = Medium 41 | status.3 = High 42 | status.4 = Very High 43 | ! land value 44 | status.5 = Slum 45 | status.6 = Lower Class 46 | status.7 = Middle Class 47 | status.8 = High 48 | ! crime level 49 | status.9 = Safe 50 | status.10 = Light 51 | status.11 = Moderate 52 | status.12 = Dangerous 53 | ! pollution 54 | status.13 = None 55 | status.14 = Moderate 56 | status.15 = Heavy 57 | status.16 = Very Heavy 58 | ! growth rate 59 | status.17 = Declining 60 | status.18 = Stable 61 | status.19 = Slow Growth 62 | status.20 = Fast Growth 63 | -------------------------------------------------------------------------------- /strings/StatusMessages_de.properties: -------------------------------------------------------------------------------- 1 | #de_DE 2 | #Sun Nov 10 12:27:07 CET 2013 3 | zone.19=Kernkraftwerk 4 | zone.18=Stadion 5 | zone.17=Polizeirevier 6 | zone.16=Feuerwehr 7 | zone.15=Kohlekraftwerk 8 | zone.14=Flughafen 9 | zone.13=Hafen 10 | zone.12=Industriegebiet 11 | zone.11=B\u00FCrogebiet 12 | zone.10=Wohngebiet 13 | status.20=Schnelles Wachstum 14 | zone.9=Schiene 15 | zone.8=Strom 16 | zone.7=Stra\u00DFe 17 | zone.6=Feuer 18 | status.19=Langsames Wachstum 19 | zone.5=Radioaktive Verseuchung 20 | status.18=Stabil 21 | zone.4=Flut 22 | status.17=R\u00FCckl\u00E4ufig 23 | zone.3=Ger\u00F6ll 24 | status.16=Sehr stark 25 | zone.2=B\u00E4ume 26 | zone.1=Wasser 27 | status.15=Stark 28 | zone.0=Ebene 29 | status.14=M\u00E4\u00DFig 30 | status.13=Keine 31 | status.12=Gef\u00E4hrlich 32 | status.11=M\u00E4\u00DFig 33 | status.10=Leicht 34 | status.9=Sicher 35 | status.8=Hoch 36 | status.7=Mittelklasse 37 | status.6=Unterklasse 38 | zone.25=Zugbr\u00FCcke 39 | status.5=Elendsviertel 40 | status.4=Sehr hoch 41 | zone.23=Industrie 42 | status.3=Hoch 43 | zone.22=Springbrunnen 44 | status.2=Mittel 45 | zone.21=Radarsch\u00FCssel 46 | status.1=Niedrig 47 | zone.20=Zugbr\u00FCcke 48 | -------------------------------------------------------------------------------- /strings/StatusMessages_fr.utf8: -------------------------------------------------------------------------------- 1 | !! This file is part of MicropolisJ. 2 | !! Copyright (C) 2013 Jason Long 3 | !! Portions Copyright (C) 1989-2007 Electronic Arts Inc. 4 | !! 5 | !! MicropolisJ is free software; you can redistribute it and/or modify 6 | !! it under the terms of the GNU GPLv3, with additional terms. 7 | !! See the README file, included in this distribution, for details. 8 | 9 | !! French - France Translation by Benoît Gross June 2013 10 | 11 | zone.0 = Vierge 12 | zone.1 = Eau 13 | zone.2 = Arbres 14 | zone.3 = Gravas 15 | zone.4 = Inondation 16 | zone.5 = Déchets radioactifs 17 | zone.6 = Feu 18 | zone.7 = Route 19 | zone.8 = Énergie 20 | zone.9 = Rail 21 | zone.10 = Résidence 22 | zone.11 = Commerce 23 | zone.12 = Industrie 24 | zone.13 = Port maritime 25 | zone.14 = Aéroport 26 | zone.15 = Centrale au charbon 27 | zone.16 = Caserne de pompiers 28 | zone.17 = Poste de police 29 | zone.18 = Stade 30 | zone.19 = Centrale nucléaire 31 | zone.20 = Pont 32 | zone.21 = Radar 33 | zone.22 = Fontaine 34 | zone.23 = Industrie 35 | zone.24 = Olympique Métro 38 Barzeques 3 36 | zone.25 = Pont 37 | zone.26 = Uranium 238 38 | zone.27 = 39 | 40 | ! population density 41 | status.1 = Basse 42 | status.2 = Moyenne 43 | status.3 = Élevée 44 | status.4 = Très élevée 45 | ! land value 46 | status.5 = Bidonville 47 | status.6 = Classe populaire 48 | status.7 = Classe moyenne 49 | status.8 = Classe aisée 50 | ! crime level 51 | status.9 = Aucune 52 | status.10 = Légère 53 | status.11 = Modérée 54 | status.12 = Dangereuse 55 | ! pollution 56 | status.13 = Aucune 57 | status.14 = Modérée 58 | status.15 = Élevée 59 | status.16 = Très élevée 60 | ! growth rate 61 | status.17 = En déclin 62 | status.18 = Stable 63 | status.19 = Croissance lente 64 | status.20 = Croissance rapide 65 | -------------------------------------------------------------------------------- /strings/StatusMessages_sv.properties: -------------------------------------------------------------------------------- 1 | #sv_SE 2 | #Sat Jun 15 18:46:11 CEST 2013 3 | zone.19=K\u00E4rnkraftverk 4 | zone.18=Arena 5 | zone.17=Polisstation 6 | zone.16=Brandstation 7 | zone.15=Kolkraftverk 8 | zone.14=Flygplats 9 | zone.13=Hamn 10 | zone.12=Industri 11 | zone.11=Aff\u00E4rer 12 | zone.10=Bost\u00E4der 13 | status.20=Snabb tillv\u00E4xt 14 | zone.9=J\u00E4rnv\u00E4g 15 | zone.8=Kraftledning 16 | zone.7=V\u00E4g 17 | zone.6=Eld 18 | status.19=L\u00E5ngsam tillv\u00E4xt 19 | zone.5=Radioaktivt avfall 20 | status.18=Stabil 21 | zone.4=\u00D6versv\u00E4mning 22 | status.17=P\u00E5 nedg\u00E5ng 23 | zone.3=Spillror 24 | status.16=V\u00E4ldigt tung 25 | zone.2=Tr\u00E4d 26 | status.15=Tung 27 | zone.1=Vatten 28 | status.14=Medel 29 | zone.0=Barmark 30 | status.13=Ingen 31 | status.12=Farlig 32 | status.11=Medel 33 | status.10=L\u00E4tt 34 | status.9=S\u00E4ker 35 | status.8=H\u00F6g 36 | status.7=Medelklass 37 | zone.26=U 238 38 | status.6=Arbetarklass 39 | zone.25=Sv\u00E4ngbro 40 | status.5=Obefintligt 41 | zone.24=Sverige 3 Danmark 0 42 | status.4=V\u00E4ldigt h\u00F6g 43 | zone.23=Industri 44 | status.3=H\u00F6g 45 | zone.22=Font\u00E4n 46 | status.2=Medel 47 | zone.21=Parabol 48 | status.1=L\u00E5g 49 | zone.20=Sv\u00E4ngbro 50 | -------------------------------------------------------------------------------- /tiles/aliases.txt: -------------------------------------------------------------------------------- 1 | # In this file are tiles whose official names have changed. 2 | # Each entry consists of . 3 | # Whenever is found when loading a Micropolis save-file, 4 | # that tile will be mapped to automatically. 5 | # 6 | 7 | # old fire animation 8 | 57 56 9 | 58 56 10 | 59 56 11 | 60 56 12 | 61 56 13 | 62 56 14 | 63 56 15 | # light traffic 16 | 96 80 17 | 97 81 18 | 98 82 19 | 99 83 20 | 100 84 21 | 101 85 22 | 102 86 23 | 103 87 24 | 104 88 25 | 105 89 26 | 106 90 27 | 107 91 28 | 108 92 29 | 109 93 30 | 110 94 31 | 32 | 112 80 33 | 113 81 34 | 114 82 35 | 115 83 36 | 116 84 37 | 117 85 38 | 118 86 39 | 119 87 40 | 120 88 41 | 121 89 42 | 122 90 43 | 123 91 44 | 124 92 45 | 125 93 46 | 126 94 47 | 48 | 128 80 49 | 129 81 50 | 130 82 51 | 131 83 52 | 132 84 53 | 133 85 54 | 134 86 55 | 135 87 56 | 136 88 57 | 137 89 58 | 138 90 59 | 139 91 60 | 140 92 61 | 141 93 62 | 142 94 63 | 143 95 64 | # heavy traffic 65 | 160 144 66 | 161 145 67 | 162 146 68 | 163 147 69 | 164 148 70 | 165 149 71 | 166 150 72 | 167 151 73 | 168 152 74 | 169 153 75 | 170 154 76 | 171 155 77 | 172 156 78 | 173 157 79 | 174 158 80 | 81 | 176 144 82 | 177 145 83 | 178 146 84 | 179 147 85 | 180 148 86 | 181 149 87 | 182 150 88 | 183 151 89 | 184 152 90 | 185 153 91 | 186 154 92 | 187 155 93 | 188 156 94 | 189 157 95 | 190 158 96 | 97 | 192 144 98 | 193 145 99 | 194 146 100 | 195 147 101 | 196 148 102 | 197 149 103 | 198 150 104 | 199 151 105 | 200 152 106 | 201 153 107 | 202 154 108 | 203 155 109 | 204 156 110 | 205 157 111 | 206 158 112 | # radar dish animation 113 | 833 832 114 | 834 832 115 | 835 832 116 | 836 832 117 | 837 832 118 | 838 832 119 | 839 832 120 | # fountain animation 121 | 841 840 122 | 842 840 123 | 843 840 124 | # IND pistons animation 125 | 853 852 126 | 854 852 127 | 855 852 128 | 856 852 129 | 857 852 130 | 858 852 131 | 859 852 132 | # IND zone smoke animations 133 | 885 884 134 | 886 884 135 | 887 884 136 | 889 888 137 | 890 888 138 | 891 888 139 | 893 892 140 | 894 892 141 | 895 892 142 | 897 896 143 | 898 896 144 | 899 896 145 | 901 900 146 | 902 900 147 | 903 900 148 | 905 904 149 | 906 904 150 | 907 904 151 | 909 908 152 | 910 908 153 | 911 908 154 | 913 912 155 | 914 912 156 | 915 912 157 | # coal smoke animation 158 | 917 916 159 | 918 916 160 | 919 916 161 | 921 920 162 | 922 920 163 | 923 920 164 | 925 924 165 | 926 924 166 | 927 924 167 | 929 928 168 | 930 928 169 | 931 928 170 | # stadium animation 171 | 933 932 172 | 934 932 173 | 935 932 174 | 936 932 175 | 937 932 176 | 938 932 177 | 939 932 178 | 941 940 179 | 942 940 180 | 943 940 181 | 944 940 182 | 945 940 183 | 946 940 184 | 947 940 185 | # nuclear swirl 186 | 953 952 187 | 954 952 188 | 955 952 189 | --------------------------------------------------------------------------------