Richard Ellingworth / Mbed 2 deprecated RobotRic

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LevelDescriptor.h Source File

LevelDescriptor.h

00001 /*
00002  * SOURCE FILE : LevelDescriptor.h
00003  *
00004  * Definition of class LevelDescriptor.
00005  * Describes a level.
00006  *
00007  */
00008 
00009 #ifndef LevelDescriptorDefined
00010 
00011   #define LevelDescriptorDefined
00012 
00013   #include "Types.h"
00014   #include "EnemyType.h"
00015 
00016   class LevelDescriptor {
00017 
00018   public :
00019 
00020     // Number of humans.
00021     UInt8 HumanCount;
00022     
00023     // Array containing enemy data.
00024     // The array alternates between enemy type and count and MUST
00025     // be terminated with a byte of value ENDDESCRIPTOR.
00026     const UInt8* EnemyData;
00027     
00028     /***************/
00029     /* CONSTRUCTOR */
00030     /***************/
00031     // Pass number of humans on level in hc.
00032     // Pass array of data defining enemies in ed.
00033     // The array alternates between enemy type and count and MUST
00034     // be terminated with a byte of value ENDDESCRIPTOR.
00035     LevelDescriptor( UInt8 hc, const UInt8 *ed ) {
00036         HumanCount = hc;
00037         EnemyData = ed;
00038     }
00039     
00040     /**************/
00041     /* DESTRUCTOR */
00042     /**************/
00043     virtual ~LevelDescriptor() {
00044     }
00045     
00046     // Used to mark the end of the descriptor array.
00047     #define ENDDESCRIPTOR ((UInt8)0xFF)
00048     
00049     /*****************************************/
00050     /* GET COUNT FOR A PARTICULAR ENEMY TYPE */
00051     /*****************************************/
00052     // Pass type of enemy to fetch count for in et.
00053     // Returns number of enemies of the given type on this level.
00054     UInt8 GetEnemyCount( EnemyType et ) const;
00055     
00056   private :
00057 
00058   };
00059 
00060 #endif
00061 
00062 /* END of LevelDescriptor.h */
00063 
00064