Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 25LCxxx_SPI CommonTypes Gameduino mbed
LevelDescriptor.cpp@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 12:81926431fea7
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RichardE | 10:bfa1c307c99d | 1 | /* |
| RichardE | 10:bfa1c307c99d | 2 | * SOURCE FILE : LevelDescriptor.cpp |
| RichardE | 10:bfa1c307c99d | 3 | * |
| RichardE | 10:bfa1c307c99d | 4 | * Definition of class LevelDescriptor. |
| RichardE | 10:bfa1c307c99d | 5 | * Describes a level. |
| RichardE | 10:bfa1c307c99d | 6 | * |
| RichardE | 10:bfa1c307c99d | 7 | */ |
| RichardE | 10:bfa1c307c99d | 8 | |
| RichardE | 10:bfa1c307c99d | 9 | #include "LevelDescriptor.h" |
| RichardE | 10:bfa1c307c99d | 10 | |
| RichardE | 10:bfa1c307c99d | 11 | /*****************************************/ |
| RichardE | 10:bfa1c307c99d | 12 | /* GET COUNT FOR A PARTICULAR ENEMY TYPE */ |
| RichardE | 10:bfa1c307c99d | 13 | /*****************************************/ |
| RichardE | 10:bfa1c307c99d | 14 | // Pass type of enemy to fetch count for in et. |
| RichardE | 10:bfa1c307c99d | 15 | // Returns number of enemies of the given type on this level. |
| RichardE | 12:81926431fea7 | 16 | UInt8 LevelDescriptor::GetEnemyCount( EnemyType et ) const { |
| RichardE | 10:bfa1c307c99d | 17 | bool found = false; |
| RichardE | 12:81926431fea7 | 18 | const UInt8 *data = EnemyData; |
| RichardE | 10:bfa1c307c99d | 19 | while( ! found && ( *data != ENDDESCRIPTOR ) ) { |
| RichardE | 10:bfa1c307c99d | 20 | if( *data == (UInt8)et ) { |
| RichardE | 10:bfa1c307c99d | 21 | found = true; |
| RichardE | 10:bfa1c307c99d | 22 | } |
| RichardE | 10:bfa1c307c99d | 23 | else { |
| RichardE | 10:bfa1c307c99d | 24 | data += 2; |
| RichardE | 10:bfa1c307c99d | 25 | } |
| RichardE | 10:bfa1c307c99d | 26 | } |
| RichardE | 10:bfa1c307c99d | 27 | if( found ) { |
| RichardE | 10:bfa1c307c99d | 28 | return data[ 1 ]; |
| RichardE | 10:bfa1c307c99d | 29 | } |
| RichardE | 10:bfa1c307c99d | 30 | else { |
| RichardE | 10:bfa1c307c99d | 31 | return 0; |
| RichardE | 10:bfa1c307c99d | 32 | } |
| RichardE | 10:bfa1c307c99d | 33 | } |
| RichardE | 10:bfa1c307c99d | 34 |