summaryrefslogtreecommitdiff
path: root/docs/html/class_level_reader.html
blob: 07bc827b2e0337229f813e5ed14b4ae4ae22c146 (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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<!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: LevelReader Class Reference</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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><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="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#pri-static-attribs">Static Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">LevelReader Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="LevelReader" -->
<p>Reads the game objects from a text file and calls relevant constructors.  
 <a href="class_level_reader.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>&gt;</code></p>

<p><a href="class_level_reader-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#ad093a54f9753a22dd66748b82a08c1fd">LevelReader</a> (string filename)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor that stores the path of the file containing the level to be read with the readLevel function.  <a href="#ad093a54f9753a22dd66748b82a08c1fd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a27277149f3270e040c8ffeadbca79758">readLevel</a> (<a class="el" href="class_maze.html">Maze</a> &amp;maze, list&lt; <a class="el" href="class_player_car.html">PlayerCar</a> &gt; &amp;players, list&lt; <a class="el" href="class_enemy_car.html">EnemyCar</a> &gt; &amp;enemies, list&lt; <a class="el" href="class_checkpoint.html">Checkpoint</a> &gt; &amp;checkpoints, list&lt; <a class="el" href="class_rock.html">Rock</a> &gt; &amp;rocks)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to read the chosen file into the data structures used in the game.  <a href="#a27277149f3270e040c8ffeadbca79758"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a233910d4cd16ff624d76b06ca8071f7e">_filename</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Path of the file containing the level.  <a href="#a233910d4cd16ff624d76b06ca8071f7e"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-static-attribs"></a>
Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a8de3d894f4e67a7a0f66f6dfc3a7fbe1">PLAYER_CHAR</a> = '@'</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Character represented a <a class="el" href="class_player_car.html" title="A GameObject that is controlled by the player.">PlayerCar</a> in the level file.  <a href="#a8de3d894f4e67a7a0f66f6dfc3a7fbe1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a67d3735d6a3e40fa61527dd1ff7cfa22">ENEMY_CHAR</a> = 'X'</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Character represented an <a class="el" href="class_enemy_car.html" title="GameObject that chases the player around the maze.">EnemyCar</a> in the level file.  <a href="#a67d3735d6a3e40fa61527dd1ff7cfa22"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#ad401a0f48a3eac678c0f53e95ea1f354">CHECKPOINT_CHAR</a> = 'P'</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Character represented a <a class="el" href="class_checkpoint.html" title="GameObject that the player needs to pick up by driving over.">Checkpoint</a> in the level file.  <a href="#ad401a0f48a3eac678c0f53e95ea1f354"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a321a0fcc5a9ae36a394782be4c71bd7d">ROCK_CHAR</a> = 'O'</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Character represented a <a class="el" href="class_rock.html" title="A game object that acts as an obstacle to the player.">Rock</a> in the level file.  <a href="#a321a0fcc5a9ae36a394782be4c71bd7d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_level_reader.html#a250f9fede6584dc196acce86a8e217f9">WALL_CHAR</a> = '#'</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Character represented a solid part of the maze in the level file.  <a href="#a250f9fede6584dc196acce86a8e217f9"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Reads the game objects from a text file and calls relevant constructors. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Justin Wernick </dd>
<dd>
David Schneider </dd></dl>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00035">35</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad093a54f9753a22dd66748b82a08c1fd"></a><!-- doxytag: member="LevelReader::LevelReader" ref="ad093a54f9753a22dd66748b82a08c1fd" args="(string filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LevelReader::LevelReader </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor that stores the path of the file containing the level to be read with the readLevel function. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">filename</td><td>The path of the file containing the level. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_level_reader_8cpp_source.html#l00003">3</a> of file <a class="el" href="_level_reader_8cpp_source.html">LevelReader.cpp</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a27277149f3270e040c8ffeadbca79758"></a><!-- doxytag: member="LevelReader::readLevel" ref="a27277149f3270e040c8ffeadbca79758" args="(Maze &amp;maze, list&lt; PlayerCar &gt; &amp;players, list&lt; EnemyCar &gt; &amp;enemies, list&lt; Checkpoint &gt; &amp;checkpoints, list&lt; Rock &gt; &amp;rocks)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void LevelReader::readLevel </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_maze.html">Maze</a> &amp;&#160;</td>
          <td class="paramname"><em>maze</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">list&lt; <a class="el" href="class_player_car.html">PlayerCar</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>players</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">list&lt; <a class="el" href="class_enemy_car.html">EnemyCar</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>enemies</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">list&lt; <a class="el" href="class_checkpoint.html">Checkpoint</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>checkpoints</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">list&lt; <a class="el" href="class_rock.html">Rock</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>rocks</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Function to read the chosen file into the data structures used in the game. </p>
<p>Each character in the file is iterated through, and added to the appropriate data structure if it matches one of the defined constants. Lists should be cleared prior to calling this function.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">maze</td><td>Object representing the walls, populated with a vector of x,y pairs. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">players</td><td>List representing the player(s) in the game. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">enemies</td><td>List representing the enemies in the game. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">checkpoints</td><td>List representing the checkpoints in the game. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">rocks</td><td>List representing the rocks in the game. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_level_reader_8cpp_source.html#l00007">7</a> of file <a class="el" href="_level_reader_8cpp_source.html">LevelReader.cpp</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a233910d4cd16ff624d76b06ca8071f7e"></a><!-- doxytag: member="LevelReader::_filename" ref="a233910d4cd16ff624d76b06ca8071f7e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string <a class="el" href="class_level_reader.html#a233910d4cd16ff624d76b06ca8071f7e">LevelReader::_filename</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Path of the file containing the level. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00068">68</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<a class="anchor" id="ad401a0f48a3eac678c0f53e95ea1f354"></a><!-- doxytag: member="LevelReader::CHECKPOINT_CHAR" ref="ad401a0f48a3eac678c0f53e95ea1f354" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char <a class="el" href="class_level_reader.html#ad401a0f48a3eac678c0f53e95ea1f354">LevelReader::CHECKPOINT_CHAR</a> = 'P'<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Character represented a <a class="el" href="class_checkpoint.html" title="GameObject that the player needs to pick up by driving over.">Checkpoint</a> in the level file. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00064">64</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<a class="anchor" id="a67d3735d6a3e40fa61527dd1ff7cfa22"></a><!-- doxytag: member="LevelReader::ENEMY_CHAR" ref="a67d3735d6a3e40fa61527dd1ff7cfa22" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char <a class="el" href="class_level_reader.html#a67d3735d6a3e40fa61527dd1ff7cfa22">LevelReader::ENEMY_CHAR</a> = 'X'<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Character represented an <a class="el" href="class_enemy_car.html" title="GameObject that chases the player around the maze.">EnemyCar</a> in the level file. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00063">63</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<a class="anchor" id="a8de3d894f4e67a7a0f66f6dfc3a7fbe1"></a><!-- doxytag: member="LevelReader::PLAYER_CHAR" ref="a8de3d894f4e67a7a0f66f6dfc3a7fbe1" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char <a class="el" href="class_level_reader.html#a8de3d894f4e67a7a0f66f6dfc3a7fbe1">LevelReader::PLAYER_CHAR</a> = '@'<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Character represented a <a class="el" href="class_player_car.html" title="A GameObject that is controlled by the player.">PlayerCar</a> in the level file. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00062">62</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<a class="anchor" id="a321a0fcc5a9ae36a394782be4c71bd7d"></a><!-- doxytag: member="LevelReader::ROCK_CHAR" ref="a321a0fcc5a9ae36a394782be4c71bd7d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char <a class="el" href="class_level_reader.html#a321a0fcc5a9ae36a394782be4c71bd7d">LevelReader::ROCK_CHAR</a> = 'O'<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Character represented a <a class="el" href="class_rock.html" title="A game object that acts as an obstacle to the player.">Rock</a> in the level file. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00065">65</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<a class="anchor" id="a250f9fede6584dc196acce86a8e217f9"></a><!-- doxytag: member="LevelReader::WALL_CHAR" ref="a250f9fede6584dc196acce86a8e217f9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char <a class="el" href="class_level_reader.html#a250f9fede6584dc196acce86a8e217f9">LevelReader::WALL_CHAR</a> = '#'<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Character represented a solid part of the maze in the level file. </p>

<p>Definition at line <a class="el" href="_level_reader_8h_source.html#l00066">66</a> of file <a class="el" href="_level_reader_8h_source.html">LevelReader.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>source/data/<a class="el" href="_level_reader_8h_source.html">LevelReader.h</a></li>
<li>source/data/<a class="el" href="_level_reader_8cpp_source.html">LevelReader.cpp</a></li>
</ul>
</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:31 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>