summaryrefslogtreecommitdiff
path: root/docs/html/_game_8cpp_source.html
blob: 677b9f068f2783116628093c7a355afe0a377969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Rally X: source/logic/Game.cpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="car.PNG"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Rally X
   
   </div>
   <div id="projectbrief">ELEN3009 Project by Justin Wernick and David Schneider</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">source/logic/Game.cpp</div>  </div>
</div>
<div class="contents">
<a href="_game_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="_game_8h.html">Game.h</a>&quot;</span>
<a name="l00002"></a>00002 
<a name="l00003"></a><a class="code" href="class_game.html#ad59df6562a58a614fda24622d3715b65">00003</a> <a class="code" href="class_game.html#ad59df6562a58a614fda24622d3715b65" title="Constructor, that creates the relevant Allegro entities.">Game::Game</a>()
<a name="l00004"></a>00004     :_config(<span class="stringliteral">&quot;config.txt&quot;</span>),
<a name="l00005"></a>00005     _screen(_config.screenWidth(), _config.screenHeight(), _config.fullscreen())
<a name="l00006"></a>00006 {
<a name="l00007"></a>00007     <a class="code" href="class_game.html#af153fc1d94c473114cfbd63728d21f91" title="Creates FPS events per second, that are put into _timerEvents.">_timer</a>  = al_create_timer(1.0/<a class="code" href="class_game.html#a636d6897103fd12d230489d512bf2be1" title="Frames per second, the number of times the gameloop is run every second.">FPS</a>);
<a name="l00008"></a>00008     <a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a> = al_create_event_queue();
<a name="l00009"></a>00009     al_register_event_source(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>, al_get_timer_event_source(<a class="code" href="class_game.html#af153fc1d94c473114cfbd63728d21f91" title="Creates FPS events per second, that are put into _timerEvents.">_timer</a>));
<a name="l00010"></a>00010 }
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="class_game.html#ae3d112ca6e0e55150d2fdbc704474530">00012</a> <a class="code" href="class_game.html#ae3d112ca6e0e55150d2fdbc704474530" title="Constructor, that destroys the relevant Allegro entities.">Game::~Game</a>()
<a name="l00013"></a>00013 {
<a name="l00014"></a>00014     al_destroy_event_queue(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>);
<a name="l00015"></a>00015     al_destroy_timer(<a class="code" href="class_game.html#af153fc1d94c473114cfbd63728d21f91" title="Creates FPS events per second, that are put into _timerEvents.">_timer</a>);
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="class_game.html#a3d9b98f7c4a96ecf578f75b96c9f0e90">00019</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a3d9b98f7c4a96ecf578f75b96c9f0e90" title="Entry point for the program. This should be called from main.">Game::start</a>()
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021     <span class="keywordflow">while</span> (!<a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#acca34443ba0ad97922069658d688ea9a" title="Function to find if the player has chosen to exit the game.">exitClicked</a>())
<a name="l00022"></a>00022     {
<a name="l00023"></a>00023         <span class="keywordtype">string</span> filename = <a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#a45d06e513491e40f76013fb670c6c6cc" title="Presents the player with a file dialog, requesting a level file to be selected.">getLevel</a>();
<a name="l00024"></a>00024         <span class="keywordflow">if</span> (!filename.empty())
<a name="l00025"></a>00025         {
<a name="l00026"></a>00026             <a class="code" href="class_game.html#a2bd8589c18470f644445d97c1c35d169" title="Initialises all of the GameObject lists using a file.">initLevel</a>(filename);
<a name="l00027"></a>00027             <a class="code" href="class_game.html#a069837f5f3f3b91b581e41dd74667211" title="Main part of the game, performs the actions in each frame FPS times per second until the game is over...">runloop</a>();
<a name="l00028"></a>00028         }
<a name="l00029"></a>00029     }
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="class_game.html#a2bd8589c18470f644445d97c1c35d169">00032</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a2bd8589c18470f644445d97c1c35d169" title="Initialises all of the GameObject lists using a file.">Game::initLevel</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; levelFile)
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034     <a class="code" href="class_game.html#a03cf795e9aaa4c5950b4b5e918ab9ab6" title="Destroys all GameObjects in the game, resetting the lists for a new level to be loaded.">clearLists</a>();
<a name="l00035"></a>00035     <a class="code" href="class_level_reader.html" title="Reads the game objects from a text file and calls relevant constructors.">LevelReader</a> reader(levelFile);
<a name="l00036"></a>00036     reader.<a class="code" href="class_level_reader.html#a27277149f3270e040c8ffeadbca79758" title="Function to read the chosen file into the data structures used in the game.">readLevel</a>(<a class="code" href="class_game.html#a33457b2c7fa4f43b89e54ce9c5ac6f83" title="The environment that confines the movements of GameObjects, specifically Cars.">_maze</a>, <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>, <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>, <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>, <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>);
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
<a name="l00039"></a><a class="code" href="class_game.html#a069837f5f3f3b91b581e41dd74667211">00039</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a069837f5f3f3b91b581e41dd74667211" title="Main part of the game, performs the actions in each frame FPS times per second until the game is over...">Game::runloop</a>()
<a name="l00040"></a>00040 {
<a name="l00041"></a>00041     <span class="keywordtype">bool</span> gameWon = <span class="keyword">false</span>;
<a name="l00042"></a>00042     <span class="keywordtype">bool</span> gameLost = <span class="keyword">false</span>;
<a name="l00043"></a>00043     al_start_timer(<a class="code" href="class_game.html#af153fc1d94c473114cfbd63728d21f91" title="Creates FPS events per second, that are put into _timerEvents.">_timer</a>);
<a name="l00044"></a>00044 
<a name="l00045"></a>00045     <span class="keywordflow">while</span> (!<a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#acca34443ba0ad97922069658d688ea9a" title="Function to find if the player has chosen to exit the game.">exitClicked</a>())
<a name="l00046"></a>00046     {
<a name="l00047"></a>00047         al_wait_for_event(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>, NULL);
<a name="l00048"></a>00048         al_flush_event_queue(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>);
<a name="l00049"></a>00049 
<a name="l00050"></a>00050         <a class="code" href="class_game.html#a79df6376b332d63c9eca0dcee30305c3" title="Calls the update method on each of the GameObjects in the game.">update</a>();
<a name="l00051"></a>00051         <a class="code" href="class_game.html#ab88620fda0d1fa729dcab6013e8f1efc" title="Object that checks for collisions each frame.">_collisionDetector</a>.<a class="code" href="class_collision_detector.html#a6ee96032c26ceeab038d2702d7064c7b" title="Checks for collisions between all relevant pairs of objects, and calls the relevant collision functio...">checkCollisions</a>(<a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>, <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>, <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>, <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>, <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>);
<a name="l00052"></a>00052         <a class="code" href="class_game.html#a961f632fbe7f4ba08d23fe9edc7711be" title="Removes any GameObjects that have been destroyed from their lists.">cleanup</a>();
<a name="l00053"></a>00053         <a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#aec3c5c20e14d6ef033c8a6a559a84872" title="Draws the given objects on the screen.">draw</a>(<a class="code" href="class_game.html#a33457b2c7fa4f43b89e54ce9c5ac6f83" title="The environment that confines the movements of GameObjects, specifically Cars.">_maze</a>, <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>, <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>, <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>, <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>, <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>, <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>);
<a name="l00054"></a>00054 
<a name="l00055"></a>00055         gameLost = <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.empty();
<a name="l00056"></a>00056         gameWon = <a class="code" href="class_checkpoint.html#a872d8574b6f0a7960854fb1175e05f13" title="Function for accessing the number of checkpoints that currently exist.">Checkpoint::checkpointCount</a>()==0;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         <span class="keywordflow">if</span> (gameLost)
<a name="l00059"></a>00059         {
<a name="l00060"></a>00060             <a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#aab9ab8447df2b526985970d2ac80c919" title="Draws a splash screen when the level has been lost.">drawLoss</a>();
<a name="l00061"></a>00061             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;90; i++)
<a name="l00062"></a>00062             {
<a name="l00063"></a>00063                 al_wait_for_event(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>, NULL);
<a name="l00064"></a>00064                 al_drop_next_event(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>);
<a name="l00065"></a>00065             }
<a name="l00066"></a>00066             <span class="keywordflow">break</span>;
<a name="l00067"></a>00067         }
<a name="l00068"></a>00068         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (gameWon)
<a name="l00069"></a>00069         {
<a name="l00070"></a>00070             <a class="code" href="class_game.html#a9bc904a37fe9b3e85a597b6b5c6a66d5" title="Handles all drawing operations.">_screen</a>.<a class="code" href="class_screen.html#ad4c1281e4d59eb89377dd87bba8a310e" title="Draws a splash screen when the level has been won.">drawWin</a>();
<a name="l00071"></a>00071             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;90; i++)
<a name="l00072"></a>00072             {
<a name="l00073"></a>00073                 al_wait_for_event(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>, NULL);
<a name="l00074"></a>00074                 al_drop_next_event(<a class="code" href="class_game.html#a2b7303df1b6d0163b78c2c306164859f" title="Catches events from _timer, used to regulate speed of runloop.">_timerEvents</a>);
<a name="l00075"></a>00075             }
<a name="l00076"></a>00076             <span class="keywordflow">break</span>;
<a name="l00077"></a>00077         }
<a name="l00078"></a>00078     }
<a name="l00079"></a>00079     al_stop_timer(<a class="code" href="class_game.html#af153fc1d94c473114cfbd63728d21f91" title="Creates FPS events per second, that are put into _timerEvents.">_timer</a>);
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081 
<a name="l00082"></a><a class="code" href="class_game.html#a79df6376b332d63c9eca0dcee30305c3">00082</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a79df6376b332d63c9eca0dcee30305c3" title="Calls the update method on each of the GameObjects in the game.">Game::update</a>()
<a name="l00083"></a>00083 {
<a name="l00084"></a>00084     <span class="keywordflow">for</span> (list&lt;PlayerCar&gt;::iterator iter = <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.begin(); iter!=<a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.end(); ++iter)
<a name="l00085"></a>00085     {
<a name="l00086"></a>00086         iter-&gt;update(<a class="code" href="class_game.html#a33457b2c7fa4f43b89e54ce9c5ac6f83" title="The environment that confines the movements of GameObjects, specifically Cars.">_maze</a>, <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>);
<a name="l00087"></a>00087     }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     <span class="keywordflow">for</span> (list&lt;EnemyCar&gt;::iterator iter = <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.begin(); iter!=<a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.end(); ++iter)
<a name="l00090"></a>00090     {
<a name="l00091"></a>00091         iter-&gt;update(<a class="code" href="class_game.html#a33457b2c7fa4f43b89e54ce9c5ac6f83" title="The environment that confines the movements of GameObjects, specifically Cars.">_maze</a>, <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>, <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>);
<a name="l00092"></a>00092     }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094     <span class="keywordflow">for</span> (list&lt;Smokescreen&gt;::iterator iter = <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.begin(); iter!=<a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.end(); ++iter)
<a name="l00095"></a>00095     {
<a name="l00096"></a>00096         iter-&gt;update();
<a name="l00097"></a>00097     }
<a name="l00098"></a>00098     <span class="keywordflow">for</span> (list&lt;DestroyedObjectPopup&gt;::iterator iter = <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.begin(); iter!=<a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.end(); ++iter)
<a name="l00099"></a>00099     {
<a name="l00100"></a>00100         iter-&gt;update();
<a name="l00101"></a>00101     }
<a name="l00102"></a>00102 }
<a name="l00103"></a>00103 
<a name="l00104"></a><a class="code" href="class_game.html#a961f632fbe7f4ba08d23fe9edc7711be">00104</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a961f632fbe7f4ba08d23fe9edc7711be" title="Removes any GameObjects that have been destroyed from their lists.">Game::cleanup</a>()
<a name="l00105"></a>00105 {
<a name="l00106"></a>00106     <span class="keywordflow">for</span> (list&lt;PlayerCar&gt;::iterator iter = <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.begin(); iter!=<a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.end();)
<a name="l00107"></a>00107     {
<a name="l00108"></a>00108         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00109"></a>00109         {
<a name="l00110"></a>00110             <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.push_back(<a class="code" href="class_destroyed_object_popup.html" title="Object that appears on the screen for a short time when another object has been destroyed.">DestroyedObjectPopup</a>(iter-&gt;x(), iter-&gt;y(), <a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8b9eb5b79abe467982784ea2227d67e0">BitmapStore::CRASHED_CAR</a>));
<a name="l00111"></a>00111             iter = <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.erase(iter);
<a name="l00112"></a>00112         }
<a name="l00113"></a>00113         <span class="keywordflow">else</span>
<a name="l00114"></a>00114         {
<a name="l00115"></a>00115             ++iter;
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117     }
<a name="l00118"></a>00118     <span class="keywordflow">for</span> (list&lt;EnemyCar&gt;::iterator iter = <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.begin(); iter!=<a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.end();)
<a name="l00119"></a>00119     {
<a name="l00120"></a>00120         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00121"></a>00121         {
<a name="l00122"></a>00122             <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.push_back(<a class="code" href="class_destroyed_object_popup.html" title="Object that appears on the screen for a short time when another object has been destroyed.">DestroyedObjectPopup</a>(iter-&gt;x(), iter-&gt;y(), <a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8b9eb5b79abe467982784ea2227d67e0">BitmapStore::CRASHED_CAR</a>));
<a name="l00123"></a>00123             iter = <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.erase(iter);
<a name="l00124"></a>00124         }
<a name="l00125"></a>00125         <span class="keywordflow">else</span>
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             ++iter;
<a name="l00128"></a>00128         }
<a name="l00129"></a>00129     }
<a name="l00130"></a>00130     <span class="keywordflow">for</span> (list&lt;Checkpoint&gt;::iterator iter = <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>.begin(); iter!=<a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>.end();)
<a name="l00131"></a>00131     {
<a name="l00132"></a>00132         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00133"></a>00133         {
<a name="l00134"></a>00134             <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.push_back(<a class="code" href="class_destroyed_object_popup.html" title="Object that appears on the screen for a short time when another object has been destroyed.">DestroyedObjectPopup</a>(iter-&gt;x(), iter-&gt;y(), <a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a824f0021358b88c7f1172d7dece95948">BitmapStore::CLAIMED_CHECKPOINT</a>));
<a name="l00135"></a>00135             iter = <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>.erase(iter);
<a name="l00136"></a>00136         }
<a name="l00137"></a>00137         <span class="keywordflow">else</span>
<a name="l00138"></a>00138         {
<a name="l00139"></a>00139             ++iter;
<a name="l00140"></a>00140         }
<a name="l00141"></a>00141     }
<a name="l00142"></a>00142     <span class="keywordflow">for</span> (list&lt;Rock&gt;::iterator iter = <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>.begin(); iter!=<a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>.end();)
<a name="l00143"></a>00143     {
<a name="l00144"></a>00144         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00145"></a>00145         {
<a name="l00146"></a>00146             iter = <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>.erase(iter);
<a name="l00147"></a>00147         }
<a name="l00148"></a>00148         <span class="keywordflow">else</span>
<a name="l00149"></a>00149         {
<a name="l00150"></a>00150             ++iter;
<a name="l00151"></a>00151         }
<a name="l00152"></a>00152     }
<a name="l00153"></a>00153     <span class="keywordflow">for</span> (list&lt;Smokescreen&gt;::iterator iter = <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.begin(); iter!=<a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.end();)
<a name="l00154"></a>00154     {
<a name="l00155"></a>00155         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00156"></a>00156         {
<a name="l00157"></a>00157             iter = <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.erase(iter);
<a name="l00158"></a>00158         }
<a name="l00159"></a>00159         <span class="keywordflow">else</span>
<a name="l00160"></a>00160         {
<a name="l00161"></a>00161             ++iter;
<a name="l00162"></a>00162         }
<a name="l00163"></a>00163     }
<a name="l00164"></a>00164     <span class="keywordflow">for</span> (list&lt;DestroyedObjectPopup&gt;::iterator iter = <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.begin(); iter!=<a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.end();)
<a name="l00165"></a>00165     {
<a name="l00166"></a>00166         <span class="keywordflow">if</span> (iter-&gt;destroyed())
<a name="l00167"></a>00167         {
<a name="l00168"></a>00168             iter = <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.erase(iter);
<a name="l00169"></a>00169         }
<a name="l00170"></a>00170         <span class="keywordflow">else</span>
<a name="l00171"></a>00171         {
<a name="l00172"></a>00172             ++iter;
<a name="l00173"></a>00173         }
<a name="l00174"></a>00174     }
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 
<a name="l00177"></a><a class="code" href="class_game.html#a03cf795e9aaa4c5950b4b5e918ab9ab6">00177</a> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a03cf795e9aaa4c5950b4b5e918ab9ab6" title="Destroys all GameObjects in the game, resetting the lists for a new level to be loaded.">Game::clearLists</a>()
<a name="l00178"></a>00178 {
<a name="l00179"></a>00179     <a class="code" href="class_game.html#a75bf3282da1519766a6b75e2d83293ac" title="Typically a single PlayerCar, controlled by the person playing the game.">_players</a>.clear();
<a name="l00180"></a>00180     <a class="code" href="class_game.html#afbd3e358076a6cf2e72faefe1c202df9" title="List of all EnemyCars chasing the player.">_enemies</a>.clear();
<a name="l00181"></a>00181     <a class="code" href="class_game.html#a856252e94c580f59b926affc7d45b4bf" title="List of checkpoints that the player needs to collect.">_checkpoints</a>.clear();
<a name="l00182"></a>00182     <a class="code" href="class_game.html#a9f14643bfc4d595dc7dfa3160a59d71b" title="List of rocks that the player and EnemyCars need to avoid.">_rocks</a>.clear();
<a name="l00183"></a>00183     <a class="code" href="class_game.html#a88916ad9e8095b99a9c870a053180c1c" title="List of Smokescreen objects that are currently able to delay EnemyCars.">_smokescreens</a>.clear();
<a name="l00184"></a>00184     <a class="code" href="class_game.html#a9bea5a0ee430443effa418d42a903f83" title="List of purely visual DestroyedObjectPopups that need to be drawn.">_popups</a>.clear();
<a name="l00185"></a>00185 }
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 5 2011 20:08:30 for Rally X by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>