PageRenderTime 676ms CodeModel.GetById 95ms app.highlight 450ms RepoModel.GetById 60ms app.codeStats 2ms

/src/html/simulate_8cpp-source.html

https://github.com/Plombo/micropolis
HTML | 1591 lines | 1590 code | 0 blank | 1 comment | 0 complexity | a6b3bb9fbbc9ba00583acdfc0b958a47 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  3<title>Micropolis: MicropolisEngine/src/simulate.cpp Source File</title>
  4<link href="doxygen.css" rel="stylesheet" type="text/css">
  5<link href="tabs.css" rel="stylesheet" type="text/css">
  6</head><body>
  7<!-- Generated by Doxygen 1.5.6 -->
  8<div class="navigation" id="top">
  9  <div class="tabs">
 10    <ul>
 11      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
 12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
 13      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
 14      <li><a href="annotated.html"><span>Classes</span></a></li>
 15      <li class="current"><a href="files.html"><span>Files</span></a></li>
 16    </ul>
 17  </div>
 18<h1>MicropolisEngine/src/simulate.cpp</h1><a href="simulate_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* simulate.cpp</span>
 19<a name="l00002"></a>00002 <span class="comment"> *</span>
 20<a name="l00003"></a>00003 <span class="comment"> * Micropolis, Unix Version.  This game was released for the Unix platform</span>
 21<a name="l00004"></a>00004 <span class="comment"> * in or about 1990 and has been modified for inclusion in the One Laptop</span>
 22<a name="l00005"></a>00005 <span class="comment"> * Per Child program.  Copyright (C) 1989 - 2007 Electronic Arts Inc.  If</span>
 23<a name="l00006"></a>00006 <span class="comment"> * you need assistance with this program, you may contact:</span>
 24<a name="l00007"></a>00007 <span class="comment"> *   http://wiki.laptop.org/go/Micropolis  or email  micropolis@laptop.org.</span>
 25<a name="l00008"></a>00008 <span class="comment"> *</span>
 26<a name="l00009"></a>00009 <span class="comment"> * This program is free software: you can redistribute it and/or modify</span>
 27<a name="l00010"></a>00010 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
 28<a name="l00011"></a>00011 <span class="comment"> * the Free Software Foundation, either version 3 of the License, or (at</span>
 29<a name="l00012"></a>00012 <span class="comment"> * your option) any later version.</span>
 30<a name="l00013"></a>00013 <span class="comment"> *</span>
 31<a name="l00014"></a>00014 <span class="comment"> * This program is distributed in the hope that it will be useful, but</span>
 32<a name="l00015"></a>00015 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
 33<a name="l00016"></a>00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
 34<a name="l00017"></a>00017 <span class="comment"> * General Public License for more details.  You should have received a</span>
 35<a name="l00018"></a>00018 <span class="comment"> * copy of the GNU General Public License along with this program.  If</span>
 36<a name="l00019"></a>00019 <span class="comment"> * not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
 37<a name="l00020"></a>00020 <span class="comment"> *</span>
 38<a name="l00021"></a>00021 <span class="comment"> *             ADDITIONAL TERMS per GNU GPL Section 7</span>
 39<a name="l00022"></a>00022 <span class="comment"> *</span>
 40<a name="l00023"></a>00023 <span class="comment"> * No trademark or publicity rights are granted.  This license does NOT</span>
 41<a name="l00024"></a>00024 <span class="comment"> * give you any right, title or interest in the trademark SimCity or any</span>
 42<a name="l00025"></a>00025 <span class="comment"> * other Electronic Arts trademark.  You may not distribute any</span>
 43<a name="l00026"></a>00026 <span class="comment"> * modification of this program using the trademark SimCity or claim any</span>
 44<a name="l00027"></a>00027 <span class="comment"> * affliation or association with Electronic Arts Inc. or its employees.</span>
 45<a name="l00028"></a>00028 <span class="comment"> *</span>
 46<a name="l00029"></a>00029 <span class="comment"> * Any propagation or conveyance of this program must include this</span>
 47<a name="l00030"></a>00030 <span class="comment"> * copyright notice and these terms.</span>
 48<a name="l00031"></a>00031 <span class="comment"> *</span>
 49<a name="l00032"></a>00032 <span class="comment"> * If you convey this program (or any modifications of it) and assume</span>
 50<a name="l00033"></a>00033 <span class="comment"> * contractual liability for the program to recipients of it, you agree</span>
 51<a name="l00034"></a>00034 <span class="comment"> * to indemnify Electronic Arts for any liability that those contractual</span>
 52<a name="l00035"></a>00035 <span class="comment"> * assumptions impose on Electronic Arts.</span>
 53<a name="l00036"></a>00036 <span class="comment"> *</span>
 54<a name="l00037"></a>00037 <span class="comment"> * You may not misrepresent the origins of this program; modified</span>
 55<a name="l00038"></a>00038 <span class="comment"> * versions of the program must be marked as such and not identified as</span>
 56<a name="l00039"></a>00039 <span class="comment"> * the original program.</span>
 57<a name="l00040"></a>00040 <span class="comment"> *</span>
 58<a name="l00041"></a>00041 <span class="comment"> * This disclaimer supplements the one included in the General Public</span>
 59<a name="l00042"></a>00042 <span class="comment"> * License.  TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS</span>
 60<a name="l00043"></a>00043 <span class="comment"> * PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY</span>
 61<a name="l00044"></a>00044 <span class="comment"> * OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK.  THE ENTIRE RISK OF</span>
 62<a name="l00045"></a>00045 <span class="comment"> * SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU.  ELECTRONIC ARTS</span>
 63<a name="l00046"></a>00046 <span class="comment"> * DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,</span>
 64<a name="l00047"></a>00047 <span class="comment"> * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,</span>
 65<a name="l00048"></a>00048 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY</span>
 66<a name="l00049"></a>00049 <span class="comment"> * RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,</span>
 67<a name="l00050"></a>00050 <span class="comment"> * USAGE, OR TRADE PRACTICE.  ELECTRONIC ARTS DOES NOT WARRANT AGAINST</span>
 68<a name="l00051"></a>00051 <span class="comment"> * INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL</span>
 69<a name="l00052"></a>00052 <span class="comment"> * MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE</span>
 70<a name="l00053"></a>00053 <span class="comment"> * UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE</span>
 71<a name="l00054"></a>00054 <span class="comment"> * WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE</span>
 72<a name="l00055"></a>00055 <span class="comment"> * CORRECTED.  NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR</span>
 73<a name="l00056"></a>00056 <span class="comment"> * ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY.  SOME</span>
 74<a name="l00057"></a>00057 <span class="comment"> * JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED</span>
 75<a name="l00058"></a>00058 <span class="comment"> * WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A</span>
 76<a name="l00059"></a>00059 <span class="comment"> * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY</span>
 77<a name="l00060"></a>00060 <span class="comment"> * NOT APPLY TO YOU.</span>
 78<a name="l00061"></a>00061 <span class="comment"> */</span>
 79<a name="l00062"></a>00062 
 80<a name="l00065"></a>00065 
 81<a name="l00066"></a>00066 
 82<a name="l00067"></a>00067 
 83<a name="l00068"></a>00068 <span class="preprocessor">#include "stdafx.h"</span>
 84<a name="l00069"></a>00069 <span class="preprocessor">#include "<a class="code" href="micropolis_8h.html">micropolis.h</a>"</span>
 85<a name="l00070"></a>00070 <span class="preprocessor">#include "<a class="code" href="text_8h.html">text.h</a>"</span>
 86<a name="l00071"></a>00071 
 87<a name="l00072"></a>00072 
 88<a name="l00074"></a>00074 <span class="comment">// Constants</span>
 89<a name="l00075"></a>00075 
 90<a name="l00080"></a><a class="code" href="simulate_8cpp.html#51a648456e8cdec4b21d56cddce49619">00080</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="simulate_8cpp.html#51a648456e8cdec4b21d56cddce49619">CENSUS_FREQUENCY_10</a> = 4;
 91<a name="l00081"></a>00081 
 92<a name="l00086"></a><a class="code" href="simulate_8cpp.html#5c6cb16b1685a880041afe522bfaf410">00086</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="simulate_8cpp.html#5c6cb16b1685a880041afe522bfaf410">CENSUS_FREQUENCY_120</a> = <a class="code" href="simulate_8cpp.html#51a648456e8cdec4b21d56cddce49619">CENSUS_FREQUENCY_10</a> * 12;
 93<a name="l00087"></a>00087 
 94<a name="l00091"></a><a class="code" href="simulate_8cpp.html#d568ae3e1f7b2612edb09aaca55f47c1">00091</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="simulate_8cpp.html#d568ae3e1f7b2612edb09aaca55f47c1">TAX_FREQUENCY</a> = 48;
 95<a name="l00092"></a>00092 
 96<a name="l00093"></a>00093 
 97<a name="l00095"></a>00095 
 98<a name="l00096"></a>00096 
 99<a name="l00097"></a>00097 <span class="comment">/* comefrom: doEditWindow scoreDoer doMapInFront graphDoer doNilEvent */</span>
100<a name="l00098"></a>00098 <span class="keywordtype">void</span> Micropolis::simFrame()
101<a name="l00099"></a>00099 {
102<a name="l00100"></a>00100 
103<a name="l00101"></a>00101     <span class="keywordflow">if</span> (simSpeed == 0) {
104<a name="l00102"></a>00102         <span class="keywordflow">return</span>;
105<a name="l00103"></a>00103     }
106<a name="l00104"></a>00104 
107<a name="l00105"></a>00105     <span class="keywordflow">if</span> (++speedCycle &gt; 1023) {
108<a name="l00106"></a>00106         speedCycle = 0;
109<a name="l00107"></a>00107     }
110<a name="l00108"></a>00108 
111<a name="l00109"></a>00109     <span class="keywordflow">if</span> (simSpeed == 1 &amp;&amp; (speedCycle % 5) != 0) {
112<a name="l00110"></a>00110         <span class="keywordflow">return</span>;
113<a name="l00111"></a>00111     }
114<a name="l00112"></a>00112 
115<a name="l00113"></a>00113     <span class="keywordflow">if</span> (simSpeed == 2 &amp;&amp; (speedCycle % 3) != 0) {
116<a name="l00114"></a>00114         <span class="keywordflow">return</span>;
117<a name="l00115"></a>00115     }
118<a name="l00116"></a>00116 
119<a name="l00117"></a>00117     simulate();
120<a name="l00118"></a>00118 }
121<a name="l00119"></a>00119 
122<a name="l00120"></a>00120 
123<a name="l00121"></a>00121 <span class="comment">/* comefrom: simFrame */</span>
124<a name="l00122"></a>00122 <span class="keywordtype">void</span> Micropolis::simulate()
125<a name="l00123"></a>00123 {
126<a name="l00124"></a>00124     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> speedPowerScan[3] =
127<a name="l00125"></a>00125         { 2,  4,  5 };
128<a name="l00126"></a>00126     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> SpeedPollutionTerrainLandValueScan[3] =
129<a name="l00127"></a>00127         { 2,  7, 17 };
130<a name="l00128"></a>00128     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> speedCrimeScan[3] =
131<a name="l00129"></a>00129         { 1,  8, 18 };
132<a name="l00130"></a>00130     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> speedPopulationDensityScan[3] = 
133<a name="l00131"></a>00131         { 1,  9, 19 };
134<a name="l00132"></a>00132     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> speedFireAnalysis[3] =
135<a name="l00133"></a>00133         { 1, 10, 20 };
136<a name="l00134"></a>00134 
137<a name="l00135"></a>00135     <span class="keywordtype">short</span> speedIndex = <a class="code" href="micropolis_8h.html#c72a52ee0b2b2f779f6c8714f0c42f0d">clamp</a>((<span class="keywordtype">short</span>)(simSpeed - 1), (<span class="keywordtype">short</span>)0, (<span class="keywordtype">short</span>)2);
138<a name="l00136"></a>00136 
139<a name="l00137"></a>00137     <span class="comment">// The simulator has 16 different phases, which we cycle through</span>
140<a name="l00138"></a>00138     <span class="comment">// according to phaseCycle, which is incremented and wrapped at</span>
141<a name="l00139"></a>00139     <span class="comment">// the end of this switch.</span>
142<a name="l00140"></a>00140 
143<a name="l00141"></a>00141     <span class="keywordflow">if</span> (initSimLoad) {
144<a name="l00142"></a>00142         phaseCycle = 0;
145<a name="l00143"></a>00143     } <span class="keywordflow">else</span> {
146<a name="l00144"></a>00144         phaseCycle &amp;= 15;
147<a name="l00145"></a>00145     }
148<a name="l00146"></a>00146 
149<a name="l00147"></a>00147     <span class="keywordflow">switch</span> (phaseCycle)  {
150<a name="l00148"></a>00148 
151<a name="l00149"></a>00149         <span class="keywordflow">case</span> 0:
152<a name="l00150"></a>00150 
153<a name="l00151"></a>00151             <span class="keywordflow">if</span> (++simCycle &gt; 1023) {
154<a name="l00152"></a>00152                 simCycle = 0; <span class="comment">// This is cosmic!</span>
155<a name="l00153"></a>00153             }
156<a name="l00154"></a>00154 
157<a name="l00155"></a>00155             <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#0fc9175e49a0b73af99ff1252fe1cf5c" title="Need to perform initial city evaluation.">doInitialEval</a>) {
158<a name="l00156"></a>00156                 <a class="code" href="classMicropolis.html#0fc9175e49a0b73af99ff1252fe1cf5c" title="Need to perform initial city evaluation.">doInitialEval</a> = <span class="keyword">false</span>;
159<a name="l00157"></a>00157                 <a class="code" href="classMicropolis.html#f4424d7a8c1b73d4631e00af7eda608f">cityEvaluation</a>();
160<a name="l00158"></a>00158             }
161<a name="l00159"></a>00159 
162<a name="l00160"></a>00160             <a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a>++;
163<a name="l00161"></a>00161             cityTaxAverage += <a class="code" href="classMicropolis.html#e30007117c3d96ae144aa55efd9c7a68">cityTax</a>;
164<a name="l00162"></a>00162 
165<a name="l00163"></a>00163             <span class="keywordflow">if</span> (!(simCycle &amp; 1)) {
166<a name="l00164"></a>00164                 <a class="code" href="classMicropolis.html#7300690b0ab1a74d82eda568cd06ad6f">setValves</a>();
167<a name="l00165"></a>00165             }
168<a name="l00166"></a>00166 
169<a name="l00167"></a>00167             clearCensus();
170<a name="l00168"></a>00168 
171<a name="l00169"></a>00169             <span class="keywordflow">break</span>;
172<a name="l00170"></a>00170 
173<a name="l00171"></a>00171         <span class="keywordflow">case</span> 1:
174<a name="l00172"></a>00172         <span class="keywordflow">case</span> 2:
175<a name="l00173"></a>00173         <span class="keywordflow">case</span> 3:
176<a name="l00174"></a>00174         <span class="keywordflow">case</span> 4:
177<a name="l00175"></a>00175         <span class="keywordflow">case</span> 5:
178<a name="l00176"></a>00176         <span class="keywordflow">case</span> 6:
179<a name="l00177"></a>00177         <span class="keywordflow">case</span> 7:
180<a name="l00178"></a>00178         <span class="keywordflow">case</span> 8:
181<a name="l00179"></a>00179 
182<a name="l00180"></a>00180             <span class="comment">// Scan 1/8 of the map for each of the 8 phases 1..8:</span>
183<a name="l00181"></a>00181             mapScan((phaseCycle - 1) * <a class="code" href="map__type_8h.html#e6df22d5005e60ca7b2da133fcff3c24">WORLD_W</a> / 8, phaseCycle * <a class="code" href="map__type_8h.html#e6df22d5005e60ca7b2da133fcff3c24">WORLD_W</a> / 8);
184<a name="l00182"></a>00182 
185<a name="l00183"></a>00183             <span class="keywordflow">break</span>;
186<a name="l00184"></a>00184 
187<a name="l00185"></a>00185         <span class="keywordflow">case</span> 9:
188<a name="l00186"></a>00186             <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> % <a class="code" href="simulate_8cpp.html#51a648456e8cdec4b21d56cddce49619">CENSUS_FREQUENCY_10</a> == 0) {
189<a name="l00187"></a>00187                 <a class="code" href="classMicropolis.html#38e6a348cdc3b637e975851aed325ee7">take10Census</a>();
190<a name="l00188"></a>00188             }
191<a name="l00189"></a>00189 
192<a name="l00190"></a>00190             <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> % <a class="code" href="simulate_8cpp.html#5c6cb16b1685a880041afe522bfaf410">CENSUS_FREQUENCY_120</a> == 0) {
193<a name="l00191"></a>00191                 take120Census();
194<a name="l00192"></a>00192             }
195<a name="l00193"></a>00193 
196<a name="l00194"></a>00194             <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> % <a class="code" href="simulate_8cpp.html#d568ae3e1f7b2612edb09aaca55f47c1">TAX_FREQUENCY</a> == 0)  {
197<a name="l00195"></a>00195                 <a class="code" href="classMicropolis.html#78a28a803fc10d992196950f9caea3e5">collectTax</a>();
198<a name="l00196"></a>00196                 <a class="code" href="classMicropolis.html#f4424d7a8c1b73d4631e00af7eda608f">cityEvaluation</a>();
199<a name="l00197"></a>00197             }
200<a name="l00198"></a>00198 
201<a name="l00199"></a>00199             <span class="keywordflow">break</span>;
202<a name="l00200"></a>00200 
203<a name="l00201"></a>00201         <span class="keywordflow">case</span> 10:
204<a name="l00202"></a>00202 
205<a name="l00203"></a>00203             <span class="keywordflow">if</span> (!(simCycle % 5)) {
206<a name="l00204"></a>00204                 <a class="code" href="classMicropolis.html#65be61462ac3479ba298830326241f39">decRateOfGrowthMap</a>();
207<a name="l00205"></a>00205             }
208<a name="l00206"></a>00206 
209<a name="l00207"></a>00207             <a class="code" href="classMicropolis.html#c070667e0dc312f4bcfaadfd105c2933">decTrafficMap</a>();
210<a name="l00208"></a>00208 
211<a name="l00209"></a>00209             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b3e6cbff03ff75c12da0869f13c3536f2a" title="Traffic.">MAP_TYPE_TRAFFIC_DENSITY</a>] = 1;
212<a name="l00210"></a>00210             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b3c2417bbe57747e9cc1ff42da027c2a25" title="Roads.">MAP_TYPE_ROAD</a>] = 1;
213<a name="l00211"></a>00211             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b3583437d142dc8a4f78e4225ac2665771" title="All zones.">MAP_TYPE_ALL</a>] = 1;
214<a name="l00212"></a>00212             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b3bff1f1e4ad9a46428c32d206a4e8169e" title="Residential zones.">MAP_TYPE_RES</a>] = 1;
215<a name="l00213"></a>00213             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b39f49856f32955438eb753fcd72a41a91" title="Commercial zones.">MAP_TYPE_COM</a>] = 1;
216<a name="l00214"></a>00214             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b37ff01c951350a33ca474b06fc65d82fb" title="Industrial zones.">MAP_TYPE_IND</a>] = 1;
217<a name="l00215"></a>00215             <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b31052f8c93e058d4e782cf8bfab7ce0ad" title="Dynamic filter.">MAP_TYPE_DYNAMIC</a>] = 1;
218<a name="l00216"></a>00216 
219<a name="l00217"></a>00217             <a class="code" href="classMicropolis.html#60fb2819c02b3b6b5a083f8f3b5a48e9">sendMessages</a>();
220<a name="l00218"></a>00218 
221<a name="l00219"></a>00219             <span class="keywordflow">break</span>;
222<a name="l00220"></a>00220 
223<a name="l00221"></a>00221         <span class="keywordflow">case</span> 11:
224<a name="l00222"></a>00222 
225<a name="l00223"></a>00223             <span class="keywordflow">if</span> ((simCycle % speedPowerScan[speedIndex]) == 0) {
226<a name="l00224"></a>00224                 <a class="code" href="classMicropolis.html#e8d2f45d194eac18e4c00d0c32fa73a8">doPowerScan</a>();
227<a name="l00225"></a>00225                 <a class="code" href="classMicropolis.html#4f779e46cd28bab7f3ac49f89a75abce">newMapFlags</a>[<a class="code" href="micropolis_8h.html#4c73d8aa04c5b31558f468b95d4748b3d2486a876901e06ff3df5f680f88860f" title="Power connectivity.">MAP_TYPE_POWER</a>] = 1;
228<a name="l00226"></a>00226                 newPower = <span class="keyword">true</span>; <span class="comment">/* post-release change */</span>
229<a name="l00227"></a>00227             }
230<a name="l00228"></a>00228 
231<a name="l00229"></a>00229             <span class="keywordflow">break</span>;
232<a name="l00230"></a>00230 
233<a name="l00231"></a>00231         <span class="keywordflow">case</span> 12:
234<a name="l00232"></a>00232 
235<a name="l00233"></a>00233             <span class="keywordflow">if</span> ((simCycle % SpeedPollutionTerrainLandValueScan[speedIndex]) == 0) {
236<a name="l00234"></a>00234                 pollutionTerrainLandValueScan();
237<a name="l00235"></a>00235             }
238<a name="l00236"></a>00236 
239<a name="l00237"></a>00237             <span class="keywordflow">break</span>;
240<a name="l00238"></a>00238 
241<a name="l00239"></a>00239         <span class="keywordflow">case</span> 13:
242<a name="l00240"></a>00240 
243<a name="l00241"></a>00241             <span class="keywordflow">if</span> ((simCycle % speedCrimeScan[speedIndex]) == 0) {
244<a name="l00242"></a>00242                 <a class="code" href="classMicropolis.html#a75fc627e17314b69bd3033603172f62">crimeScan</a>();
245<a name="l00243"></a>00243             }
246<a name="l00244"></a>00244 
247<a name="l00245"></a>00245             <span class="keywordflow">break</span>;
248<a name="l00246"></a>00246 
249<a name="l00247"></a>00247         <span class="keywordflow">case</span> 14:
250<a name="l00248"></a>00248 
251<a name="l00249"></a>00249             <span class="keywordflow">if</span> ((simCycle % speedPopulationDensityScan[speedIndex]) == 0) {
252<a name="l00250"></a>00250                 <a class="code" href="classMicropolis.html#eae8c405fe4d3e5346a6e85985c9e3de">populationDensityScan</a>();
253<a name="l00251"></a>00251             }
254<a name="l00252"></a>00252 
255<a name="l00253"></a>00253             <span class="keywordflow">break</span>;
256<a name="l00254"></a>00254 
257<a name="l00255"></a>00255         <span class="keywordflow">case</span> 15:
258<a name="l00256"></a>00256 
259<a name="l00257"></a>00257             <span class="keywordflow">if</span> ((simCycle % speedFireAnalysis[speedIndex]) == 0) {
260<a name="l00258"></a>00258                 <a class="code" href="classMicropolis.html#64ca60787a0970e5d65475aff72682aa">fireAnalysis</a>();
261<a name="l00259"></a>00259             }
262<a name="l00260"></a>00260 
263<a name="l00261"></a>00261             <a class="code" href="classMicropolis.html#7744e40fab0103bd71d694efb80a53a7">doDisasters</a>();
264<a name="l00262"></a>00262 
265<a name="l00263"></a>00263             <span class="keywordflow">break</span>;
266<a name="l00264"></a>00264 
267<a name="l00265"></a>00265     }
268<a name="l00266"></a>00266 
269<a name="l00267"></a>00267     <span class="comment">// Go on the the next phase.</span>
270<a name="l00268"></a>00268     phaseCycle = (phaseCycle + 1) &amp; 15;
271<a name="l00269"></a>00269 }
272<a name="l00270"></a>00270 
273<a name="l00271"></a>00271 
274<a name="l00276"></a><a class="code" href="classMicropolis.html#fe8a202062ffa639e0f0a77df48c7b42">00276</a> <span class="keywordtype">void</span> <a class="code" href="classMicropolis.html#fe8a202062ffa639e0f0a77df48c7b42">Micropolis::doSimInit</a>()
275<a name="l00277"></a>00277 {
276<a name="l00278"></a>00278     phaseCycle = 0;
277<a name="l00279"></a>00279     simCycle = 0;
278<a name="l00280"></a>00280 
279<a name="l00281"></a>00281     <span class="keywordflow">if</span> (initSimLoad == 2) {
280<a name="l00282"></a>00282         <span class="comment">/* if new city */</span>
281<a name="l00283"></a>00283         initSimMemory();
282<a name="l00284"></a>00284     }
283<a name="l00285"></a>00285 
284<a name="l00286"></a>00286     <span class="keywordflow">if</span> (initSimLoad == 1) {
285<a name="l00287"></a>00287         <span class="comment">/* if city just loaded */</span>
286<a name="l00288"></a>00288         <a class="code" href="classMicropolis.html#3677b147f78681a08d513502ecf76ec7">simLoadInit</a>();
287<a name="l00289"></a>00289     }
288<a name="l00290"></a>00290 
289<a name="l00291"></a>00291     <a class="code" href="classMicropolis.html#7300690b0ab1a74d82eda568cd06ad6f">setValves</a>();
290<a name="l00292"></a>00292     clearCensus();
291<a name="l00293"></a>00293     mapScan(0, <a class="code" href="map__type_8h.html#e6df22d5005e60ca7b2da133fcff3c24">WORLD_W</a>);
292<a name="l00294"></a>00294     <a class="code" href="classMicropolis.html#e8d2f45d194eac18e4c00d0c32fa73a8">doPowerScan</a>();
293<a name="l00295"></a>00295     newPower = <span class="keyword">true</span>;         <span class="comment">/* post rel */</span>
294<a name="l00296"></a>00296     pollutionTerrainLandValueScan();
295<a name="l00297"></a>00297     <a class="code" href="classMicropolis.html#a75fc627e17314b69bd3033603172f62">crimeScan</a>();
296<a name="l00298"></a>00298     <a class="code" href="classMicropolis.html#eae8c405fe4d3e5346a6e85985c9e3de">populationDensityScan</a>();
297<a name="l00299"></a>00299     <a class="code" href="classMicropolis.html#64ca60787a0970e5d65475aff72682aa">fireAnalysis</a>();
298<a name="l00300"></a>00300     <a class="code" href="classMicropolis.html#68a8a943747e432edfc50b761878b524">newMap</a> = 1;
299<a name="l00301"></a>00301     <a class="code" href="classMicropolis.html#a7e9d8ace7ee9d4d30793a18766832d5">censusChanged</a> = <span class="keyword">true</span>;
300<a name="l00302"></a>00302     <a class="code" href="classMicropolis.html#9a031709dddb583f85715eb66c454bc9">totalPop</a> = 1;
301<a name="l00303"></a>00303     <a class="code" href="classMicropolis.html#0fc9175e49a0b73af99ff1252fe1cf5c" title="Need to perform initial city evaluation.">doInitialEval</a> = <span class="keyword">true</span>;
302<a name="l00304"></a>00304 }
303<a name="l00305"></a>00305 
304<a name="l00306"></a>00306 
305<a name="l00311"></a><a class="code" href="classMicropolis.html#d803f7bd23e783c36fb8c41f8e6c1c3a">00311</a> <span class="keywordtype">void</span> <a class="code" href="classMicropolis.html#d803f7bd23e783c36fb8c41f8e6c1c3a">Micropolis::doNilPower</a>()
306<a name="l00312"></a>00312 {
307<a name="l00313"></a>00313     <span class="keywordtype">short</span> x, y;
308<a name="l00314"></a>00314 
309<a name="l00315"></a>00315     <span class="keywordflow">for</span> (x = 0; x &lt; <a class="code" href="map__type_8h.html#e6df22d5005e60ca7b2da133fcff3c24">WORLD_W</a>; x++) {
310<a name="l00316"></a>00316         <span class="keywordflow">for</span> (y = 0; y &lt; <a class="code" href="map__type_8h.html#d649289f6f5a81082f7cceae8b94d137">WORLD_H</a>; y++) {
311<a name="l00317"></a>00317             <a class="code" href="micropolis_8h.html#b028519b9cc0b89492159d43dd99587f">MapValue</a> z = <a class="code" href="classMicropolis.html#9caa2dda6edc913f82c4c48c77ae7859">map</a>[x][y];
312<a name="l00318"></a>00318             <span class="keywordflow">if</span> (z &amp; <a class="code" href="micropolis_8h.html#93d97f16dc324013ff1e55444bddaf4251e1c6ee74965ce4cb1bc90467824add" title="bit 10, tile is the center tile of the zone.">ZONEBIT</a>) {
313<a name="l00319"></a>00319                 <a class="code" href="classMicropolis.html#4b7b16a79e84ab9a51d87b5d94711d0d">setZonePower</a>(<a class="code" href="classPosition.html">Position</a>(x, y));
314<a name="l00320"></a>00320             }
315<a name="l00321"></a>00321         }
316<a name="l00322"></a>00322     }
317<a name="l00323"></a>00323 }
318<a name="l00324"></a>00324 
319<a name="l00325"></a>00325 
320<a name="l00327"></a><a class="code" href="classMicropolis.html#c070667e0dc312f4bcfaadfd105c2933">00327</a> <span class="keywordtype">void</span> <a class="code" href="classMicropolis.html#c070667e0dc312f4bcfaadfd105c2933">Micropolis::decTrafficMap</a>()
321<a name="l00328"></a>00328 {
322<a name="l00329"></a>00329     <span class="comment">/* tends to empty trafficDensityMap */</span>
323<a name="l00330"></a>00330     <span class="keywordtype">short</span> x, y, z;
324<a name="l00331"></a>00331 
325<a name="l00332"></a>00332     <span class="keywordflow">for</span> (x = 0; x &lt; <a class="code" href="map__type_8h.html#e6df22d5005e60ca7b2da133fcff3c24">WORLD_W</a>; x += <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.MAP_BLOCKSIZE) {
326<a name="l00333"></a>00333         <span class="keywordflow">for</span> (y = 0; y &lt; <a class="code" href="map__type_8h.html#d649289f6f5a81082f7cceae8b94d137">WORLD_H</a>; y += <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.MAP_BLOCKSIZE) {
327<a name="l00334"></a>00334             z = <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.worldGet(x, y);
328<a name="l00335"></a>00335             <span class="keywordflow">if</span> (z == 0) {
329<a name="l00336"></a>00336                 <span class="keywordflow">continue</span>;
330<a name="l00337"></a>00337             }
331<a name="l00338"></a>00338 
332<a name="l00339"></a>00339             <span class="keywordflow">if</span> (z &lt;= 24) {
333<a name="l00340"></a>00340                 <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.worldSet(x, y, 0);
334<a name="l00341"></a>00341                 <span class="keywordflow">continue</span>;
335<a name="l00342"></a>00342             }
336<a name="l00343"></a>00343 
337<a name="l00344"></a>00344             <span class="keywordflow">if</span> (z &gt; 200) {
338<a name="l00345"></a>00345                 <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.worldSet(x, y, z - 34);
339<a name="l00346"></a>00346             } <span class="keywordflow">else</span> {
340<a name="l00347"></a>00347                 <a class="code" href="classMicropolis.html#bbcdc5868df96b13375d8732aaadaf70" title="Traffic density map.">trafficDensityMap</a>.worldSet(x, y, z - 24);
341<a name="l00348"></a>00348             }
342<a name="l00349"></a>00349         }
343<a name="l00350"></a>00350     }
344<a name="l00351"></a>00351 }
345<a name="l00352"></a>00352 
346<a name="l00353"></a>00353 
347<a name="l00359"></a><a class="code" href="classMicropolis.html#65be61462ac3479ba298830326241f39">00359</a> <span class="keywordtype">void</span> <a class="code" href="classMicropolis.html#65be61462ac3479ba298830326241f39">Micropolis::decRateOfGrowthMap</a>()
348<a name="l00360"></a>00360 {
349<a name="l00361"></a>00361     <span class="comment">/* tends to empty rateOfGrowthMap */</span>
350<a name="l00362"></a>00362     <span class="keywordtype">short</span> x, y, z;
351<a name="l00363"></a>00363 
352<a name="l00364"></a>00364     <span class="keywordflow">for</span> (x = 0; x &lt; <a class="code" href="classMicropolis.html#deb19ae202d9fa5e3252daccc8a46165">rateOfGrowthMap</a>.<a class="code" href="classMap.html#8a13cba25628a61b16212a7e28af966f" title="Number of clusters in horizontal direction.">MAP_W</a>; x++) {
353<a name="l00365"></a>00365         <span class="keywordflow">for</span> (y = 0; y &lt; <a class="code" href="classMicropolis.html#deb19ae202d9fa5e3252daccc8a46165">rateOfGrowthMap</a>.<a class="code" href="classMap.html#c35433254907a267e26f74b60e5b8a82" title="Number of clusters in vertical direction.">MAP_H</a>; y++) {
354<a name="l00366"></a>00366             z = <a class="code" href="classMicropolis.html#deb19ae202d9fa5e3252daccc8a46165">rateOfGrowthMap</a>.<a class="code" href="classMap.html#2f9646a8e32ceafd4b44bfc190188daf">get</a>(x, y);
355<a name="l00367"></a>00367             <span class="keywordflow">if</span> (z == 0) {
356<a name="l00368"></a>00368                 <span class="keywordflow">continue</span>;
357<a name="l00369"></a>00369             }
358<a name="l00370"></a>00370 
359<a name="l00371"></a>00371             <span class="keywordflow">if</span> (z &gt; 0) {
360<a name="l00372"></a>00372                 z--;
361<a name="l00373"></a>00373                 z = <a class="code" href="micropolis_8h.html#c72a52ee0b2b2f779f6c8714f0c42f0d">clamp</a>(z, (<span class="keywordtype">short</span>)-200, (<span class="keywordtype">short</span>)200);
362<a name="l00374"></a>00374                 <a class="code" href="classMicropolis.html#deb19ae202d9fa5e3252daccc8a46165">rateOfGrowthMap</a>.<a class="code" href="classMap.html#88bae500fceb367d8ded76be192cc8cf">set</a>(x, y, z);
363<a name="l00375"></a>00375                 <span class="keywordflow">continue</span>;
364<a name="l00376"></a>00376             }
365<a name="l00377"></a>00377 
366<a name="l00378"></a>00378             <span class="keywordflow">if</span> (z &lt; 0)  {
367<a name="l00379"></a>00379                 z++;
368<a name="l00380"></a>00380                 z = <a class="code" href="micropolis_8h.html#c72a52ee0b2b2f779f6c8714f0c42f0d">clamp</a>(z, (<span class="keywordtype">short</span>)-200, (<span class="keywordtype">short</span>)200);
369<a name="l00381"></a>00381                 <a class="code" href="classMicropolis.html#deb19ae202d9fa5e3252daccc8a46165">rateOfGrowthMap</a>.<a class="code" href="classMap.html#88bae500fceb367d8ded76be192cc8cf">set</a>(x, y, z);
370<a name="l00382"></a>00382             }
371<a name="l00383"></a>00383         }
372<a name="l00384"></a>00384     }
373<a name="l00385"></a>00385 }
374<a name="l00386"></a>00386 
375<a name="l00387"></a>00387 
376<a name="l00388"></a>00388 <span class="comment">/* comefrom: doSimInit */</span>
377<a name="l00389"></a>00389 <span class="keywordtype">void</span> Micropolis::initSimMemory()
378<a name="l00390"></a>00390 {
379<a name="l00391"></a>00391     setCommonInits();
380<a name="l00392"></a>00392 
381<a name="l00393"></a>00393     <span class="keywordflow">for</span> (<span class="keywordtype">short</span> x = 0; x &lt; 240; x++)  {
382<a name="l00394"></a>00394         <a class="code" href="classMicropolis.html#3aa2fd8af4ad557830a8c9677ded44f3">resHist</a>[x] = 0;
383<a name="l00395"></a>00395         <a class="code" href="classMicropolis.html#af42284eb1c7f337fd3eadd6ecb57ae9">comHist</a>[x] = 0;
384<a name="l00396"></a>00396         <a class="code" href="classMicropolis.html#a8b3a322fafd536d0321829744bea508">indHist</a>[x] = 0;
385<a name="l00397"></a>00397         <a class="code" href="classMicropolis.html#528303a1a67ab43c8bf96bcc07935e1c">moneyHist</a>[x] = 128;
386<a name="l00398"></a>00398         <a class="code" href="classMicropolis.html#8013d2fc2b5163a68d032775235d10e4">crimeHist</a>[x] = 0;
387<a name="l00399"></a>00399         <a class="code" href="classMicropolis.html#8018b7f8abc1d78e953ce4d617a8e07f">pollutionHist</a>[x] = 0;
388<a name="l00400"></a>00400     }
389<a name="l00401"></a>00401 
390<a name="l00402"></a>00402     crimeRamp = 0;
391<a name="l00403"></a>00403     pollutionRamp = 0;
392<a name="l00404"></a>00404     <a class="code" href="classMicropolis.html#9a031709dddb583f85715eb66c454bc9">totalPop</a> = 0;
393<a name="l00405"></a>00405     resValve = 0;
394<a name="l00406"></a>00406     comValve = 0;
395<a name="l00407"></a>00407     indValve = 0;
396<a name="l00408"></a>00408     <a class="code" href="classMicropolis.html#7f49569045b9610edd3ebffecc52c9d6" title="Block residential growth.">resCap</a> = <span class="keyword">false</span>; <span class="comment">// Do not block residential growth</span>
397<a name="l00409"></a>00409     <a class="code" href="classMicropolis.html#bfe3e641c98cdc2d2255c9a704d13f84" title="Block commercial growth.">comCap</a> = <span class="keyword">false</span>; <span class="comment">// Do not block commercial growth</span>
398<a name="l00410"></a>00410     <a class="code" href="classMicropolis.html#7ddfcdd36cf345c8609ca6c47972c23f" title="Block industrial growth.">indCap</a> = <span class="keyword">false</span>; <span class="comment">// Do not block industrial growth</span>
399<a name="l00411"></a>00411 
400<a name="l00412"></a>00412     externalMarket = 6.0;
401<a name="l00413"></a>00413     <a class="code" href="classMicropolis.html#b5002dd51f3b6af50818b495736ee4a8" title="The disaster for which a count-down is running.">disasterEvent</a> = <a class="code" href="micropolis_8h.html#198c01cbf13aa7ce7b025ff7b7aba07d0d3ea8a4184c0484369c12517741b315" title="No scenario (free playing).">SC_NONE</a>;
402<a name="l00414"></a>00414     <a class="code" href="classMicropolis.html#1cd0908b7976c8f2dbb92affdeda5b7f" title="The type of score table to use.">scoreType</a> = <a class="code" href="micropolis_8h.html#198c01cbf13aa7ce7b025ff7b7aba07d0d3ea8a4184c0484369c12517741b315" title="No scenario (free playing).">SC_NONE</a>;
403<a name="l00415"></a>00415 
404<a name="l00416"></a>00416     <span class="comment">/* This clears powermem */</span>
405<a name="l00417"></a>00417     <a class="code" href="classMicropolis.html#3fb9e01b03d7a2e31830f5f5aa979042" title="Stack counter, points to top-most item.">powerStackPointer</a> = 0;
406<a name="l00418"></a>00418     <a class="code" href="classMicropolis.html#e8d2f45d194eac18e4c00d0c32fa73a8">doPowerScan</a>();
407<a name="l00419"></a>00419     newPower = <span class="keyword">true</span>; <span class="comment">/* post rel */</span>
408<a name="l00420"></a>00420 
409<a name="l00421"></a>00421     initSimLoad = 0;
410<a name="l00422"></a>00422 }
411<a name="l00423"></a>00423 
412<a name="l00424"></a>00424 
413<a name="l00425"></a>00425 <span class="comment">/* comefrom: doSimInit */</span>
414<a name="l00426"></a><a class="code" href="classMicropolis.html#3677b147f78681a08d513502ecf76ec7">00426</a> <span class="keywordtype">void</span> <a class="code" href="classMicropolis.html#3677b147f78681a08d513502ecf76ec7">Micropolis::simLoadInit</a>()
415<a name="l00427"></a>00427 {
416<a name="l00428"></a>00428     <span class="comment">// Disaster delay table for each scenario</span>
417<a name="l00429"></a>00429     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> disasterWaitTable[<a class="code" href="micropolis_8h.html#198c01cbf13aa7ce7b025ff7b7aba07db3f89d43f15511743b0918dbfb55cda1" title="Number of scenarios.">SC_COUNT</a>] = {
418<a name="l00430"></a>00430         0,          <span class="comment">// No scenario (free playing)</span>
419<a name="l00431"></a>00431         2,          <span class="comment">// Dullsville (boredom)</span>
420<a name="l00432"></a>00432         10,         <span class="comment">// San francisco (earth quake)</span>
421<a name="l00433"></a>00433         4 * 10,     <span class="comment">// Hamburg (fire bombs)</span>
422<a name="l00434"></a>00434         20,         <span class="comment">// Bern (traffic)</span>
423<a name="l00435"></a>00435         3,          <span class="comment">// Tokyo (scary monster)</span>
424<a name="l00436"></a>00436         5,          <span class="comment">// Detroit (crime)</span>
425<a name="l00437"></a>00437         5,          <span class="comment">// Boston (nuclear meltdown)</span>
426<a name="l00438"></a>00438         2 * 48,     <span class="comment">// Rio (flooding)</span>
427<a name="l00439"></a>00439     };
428<a name="l00440"></a>00440 
429<a name="l00441"></a>00441     <span class="comment">// Time to wait before score calculation for each scenario</span>
430<a name="l00442"></a>00442     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> scoreWaitTable[<a class="code" href="micropolis_8h.html#198c01cbf13aa7ce7b025ff7b7aba07db3f89d43f15511743b0918dbfb55cda1" title="Number of scenarios.">SC_COUNT</a>] = {
431<a name="l00443"></a>00443         0,          <span class="comment">// No scenario (free playing)</span>
432<a name="l00444"></a>00444         30 * 48,    <span class="comment">// Dullsville (boredom)</span>
433<a name="l00445"></a>00445         5 * 48,     <span class="comment">// San francisco (earth quake)</span>
434<a name="l00446"></a>00446         5 * 48,     <span class="comment">// Hamburg (fire bombs)</span>
435<a name="l00447"></a>00447         10 * 48,    <span class="comment">// Bern (traffic)</span>
436<a name="l00448"></a>00448         5 * 48,     <span class="comment">// Tokyo (scary monster)</span>
437<a name="l00449"></a>00449         10 * 48,    <span class="comment">// Detroit (crime)</span>
438<a name="l00450"></a>00450         5 * 48,     <span class="comment">// Boston (nuclear meltdown)</span>
439<a name="l00451"></a>00451         10 * 48,    <span class="comment">// Rio (flooding)</span>
440<a name="l00452"></a>00452     };
441<a name="l00453"></a>00453 
442<a name="l00454"></a>00454     externalMarket = (float)<a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[1];
443<a name="l00455"></a>00455     <a class="code" href="classMicropolis.html#5d9fe750f7ef5fcb0a92439f5910babc">resPop</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[2];
444<a name="l00456"></a>00456     <a class="code" href="classMicropolis.html#d7b75efb6c46396ce974ebf779da1df5">comPop</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[3];
445<a name="l00457"></a>00457     <a class="code" href="classMicropolis.html#169e7adb32b85265280903adc267db05">indPop</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[4];
446<a name="l00458"></a>00458     resValve = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[5];
447<a name="l00459"></a>00459     comValve = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[6];
448<a name="l00460"></a>00460     indValve = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[7];
449<a name="l00461"></a>00461     crimeRamp = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[10];
450<a name="l00462"></a>00462     pollutionRamp = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[11];
451<a name="l00463"></a>00463     <a class="code" href="classMicropolis.html#9c909da1d2153c2b2a8fab69b6bde033">landValueAverage</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[12];
452<a name="l00464"></a>00464     <a class="code" href="classMicropolis.html#27cda86f25ab0a3bd1c2a276d980e0ca">crimeAverage</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[13];
453<a name="l00465"></a>00465     <a class="code" href="classMicropolis.html#781360d98ea08c94e29e255357d62c66">pollutionAverage</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[14];
454<a name="l00466"></a>00466     <a class="code" href="classMicropolis.html#2c151216bd34be7dde50beaf4da769ba" title="Difficulty level of the game (0..2).">gameLevel</a> = (<a class="code" href="micropolis_8h.html#9d2c8df557e927eceec042cd07a5a948">GameLevel</a>)<a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[15];
455<a name="l00467"></a>00467 
456<a name="l00468"></a>00468     <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> &lt; 0) {
457<a name="l00469"></a>00469         <a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> = 0;
458<a name="l00470"></a>00470     }
459<a name="l00471"></a>00471 
460<a name="l00472"></a>00472     <span class="keywordflow">if</span> (!externalMarket) {
461<a name="l00473"></a>00473         externalMarket = 4.0;
462<a name="l00474"></a>00474     }
463<a name="l00475"></a>00475 
464<a name="l00476"></a>00476     <span class="comment">// Set game level</span>
465<a name="l00477"></a>00477     <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#2c151216bd34be7dde50beaf4da769ba" title="Difficulty level of the game (0..2).">gameLevel</a> &gt; <a class="code" href="micropolis_8h.html#9d2c8df557e927eceec042cd07a5a948aaedeafbc6c45c4a94af09896efce3de" title="Last game level value.">LEVEL_LAST</a> || <a class="code" href="classMicropolis.html#2c151216bd34be7dde50beaf4da769ba" title="Difficulty level of the game (0..2).">gameLevel</a> &lt; <a class="code" href="micropolis_8h.html#9d2c8df557e927eceec042cd07a5a94859ce9e3f9ce68c6755bf8c5c813c65cf" title="First game level value.">LEVEL_FIRST</a>) {
466<a name="l00478"></a>00478         <a class="code" href="classMicropolis.html#2c151216bd34be7dde50beaf4da769ba" title="Difficulty level of the game (0..2).">gameLevel</a> = <a class="code" href="micropolis_8h.html#9d2c8df557e927eceec042cd07a5a94859ce9e3f9ce68c6755bf8c5c813c65cf" title="First game level value.">LEVEL_FIRST</a>;
467<a name="l00479"></a>00479     }
468<a name="l00480"></a>00480     <a class="code" href="classMicropolis.html#b8731570f5210acb35c3b17c789c13de">setGameLevel</a>(<a class="code" href="classMicropolis.html#2c151216bd34be7dde50beaf4da769ba" title="Difficulty level of the game (0..2).">gameLevel</a>);
469<a name="l00481"></a>00481 
470<a name="l00482"></a>00482     setCommonInits();
471<a name="l00483"></a>00483 
472<a name="l00484"></a>00484     <span class="comment">// Load cityClass</span>
473<a name="l00485"></a>00485     <a class="code" href="classMicropolis.html#c4082a6b1766c10abf78c072f4a82bd8" title="City class, affected by city population.">cityClass</a> = (<a class="code" href="micropolis_8h.html#799233e0858aa81c56a4d0b5ce073bf5">CityClass</a>)(<a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[16]);
474<a name="l00486"></a>00486     <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#c4082a6b1766c10abf78c072f4a82bd8" title="City class, affected by city population.">cityClass</a> &gt; <a class="code" href="micropolis_8h.html#799233e0858aa81c56a4d0b5ce073bf54bddea86a3e62a6e0be66b41b23815e0" title="Megalopolis, &amp;gt; 500000 citizens.">CC_MEGALOPOLIS</a> || <a class="code" href="classMicropolis.html#c4082a6b1766c10abf78c072f4a82bd8" title="City class, affected by city population.">cityClass</a> &lt; <a class="code" href="micropolis_8h.html#799233e0858aa81c56a4d0b5ce073bf5c5cef4753dce58f4dd5db174084b462e" title="Village.">CC_VILLAGE</a>) {
475<a name="l00487"></a>00487         <a class="code" href="classMicropolis.html#c4082a6b1766c10abf78c072f4a82bd8" title="City class, affected by city population.">cityClass</a> = <a class="code" href="micropolis_8h.html#799233e0858aa81c56a4d0b5ce073bf5c5cef4753dce58f4dd5db174084b462e" title="Village.">CC_VILLAGE</a>;
476<a name="l00488"></a>00488     }
477<a name="l00489"></a>00489 
478<a name="l00490"></a>00490     <a class="code" href="classMicropolis.html#bee816116369dbcd99c8afd507568c29">cityScore</a> = <a class="code" href="classMicropolis.html#e8e96d1adb850155aa16958fda24ed7d">miscHist</a>[17];
479<a name="l00491"></a>00491     <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#bee816116369dbcd99c8afd507568c29">cityScore</a> &gt; 999 || <a class="code" href="classMicropolis.html#bee816116369dbcd99c8afd507568c29">cityScore</a> &lt; 1) {
480<a name="l00492"></a>00492         <a class="code" href="classMicropolis.html#bee816116369dbcd99c8afd507568c29">cityScore</a> = 500;
481<a name="l00493"></a>00493     }
482<a name="l00494"></a>00494 
483<a name="l00495"></a>00495     <a class="code" href="classMicropolis.html#7f49569045b9610edd3ebffecc52c9d6" title="Block residential growth.">resCap</a> = <span class="keyword">false</span>;
484<a name="l00496"></a>00496     <a class="code" href="classMicropolis.html#bfe3e641c98cdc2d2255c9a704d13f84" title="Block commercial growth.">comCap</a> = <span class="keyword">false</span>;
485<a name="l00497"></a>00497     <a class="code" href="classMicropolis.html#7ddfcdd36cf345c8609ca6c47972c23f" title="Block industrial growth.">indCap</a> = <span class="keyword">false</span>;
486<a name="l00498"></a>00498 
487<a name="l00499"></a>00499     cityTaxAverage = (<a class="code" href="classMicropolis.html#559deb21709590d2d08e21da2dfb0518">cityTime</a> % 48) * 7;  <span class="comment">/* post */</span>
488<a name="l00500"></a>00500 
489<a name="l00501"></a>00501     <span class="comment">// Set power map.</span>
490<a name="l00503"></a>00503 <span class="comment"></span>    <a class="code" href="classMicropolis.html#3ff1d3ea9d5d31ea38087d2df215858b">powerGridMap</a>.fill(1);
491<a name="l00504"></a>00504 
492<a name="l00505"></a>00505     <a class="code" href="classMicropolis.html#d803f7bd23e783c36fb8c41f8e6c1c3a">doNilPower</a>();
493<a name="l00506"></a>00506 
494<a name="l00507"></a>00507     <span class="keywordflow">if</span> (<a class="code" href="classMicropolis.html#2ef685b0d3c202a6d03e62d6d745449b" title="Scenario being played.">scenario</a> &gt;= <a class="code"

Large files files are truncated, but you can click here to view the full file