Sizhe Lin / Mbed 2 deprecated missile_command_Sizhe_Lin

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Fork of missile_command by ECE 2035 TA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers globals.h Source File

globals.h

00001 /* Gatech ECE2035 2014 FALL missile command
00002  * Copyright (c) 2014 Gatech ECE2035
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00020  * SOFTWARE.
00021  */
00022 #ifndef GLOBAL_H
00023 #define GLOBAL_H
00024 #include "missile_public.h "
00025 #include "player.h"
00026 #include "city_landscape_public.h "
00027 // === [global object] ===
00028 extern uLCD_4DGL uLCD;
00029 extern PLAYER current_player;
00030 extern ANTIMISSILE am[5];
00031 extern EXPLOSION ex[5];
00032 extern MISSILE missile_record[MAX_NUM_MISSILE];
00033 extern CITY city_record[MAX_NUM_CITY];
00034 
00035 
00036 // === [global settings] ===
00037 #define BACKGROUND_COLOR 0x000000 //black
00038 #define LANDSCAPE_HEIGHT 4        // number of pixel on the screen
00039 #define MAX_BUILDING_HEIGHT 10    // number of pixel on the screen
00040 
00041 
00042 // === [define the macro of error heandle function] ===
00043 // when the condition (c) is not true, assert the program and show error code
00044 #define ASSERT_P(c,e) do { \
00045     if(!(c)){ \
00046         uLCD.printf("\nERROR:%d\n",e); \
00047         while(1); \
00048     } \
00049 } while (0)
00050 
00051 
00052 // === [error code] ===
00053 #define ERROR_MISSILE_INDEX_GET_INFO      -1  // make sure your code give the valid index for missile_get_info()
00054 #define ERROR_MISSILE_INDEX_UPDATE_STATUS -2  // make sure your code give the valid index for missile_update_status()
00055 #define ERROR_MISSILE_SPEED               -3  // missile speed has to be between 1 and 8
00056 #define ERROR_MISSILE_INTERVAL            -4  // missile interval has to be between 1 and 100
00057 // other missile error code ...
00058 #define ERROR_CITY_NUMBER                 -11 // num_city in city_landscape_init() is larger than MAX_NUM_CITY
00059 #define ERROR_CITY_INDEX_GET_INFO         -12 // make sure your code give the valid index for city_get_info()
00060 #define ERROR_CITY_INDEX_DESTROY          -13 // make sure your code give the valid index for city_destroy()
00061 // other player-missile error code ...
00062 
00063 #endif //GLOBAL_H