Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Weapon.h

Go to the documentation of this file.
00001 
00007 #ifndef _WEAPON_H_
00008 #define _WEAPON_H_
00009 
00010 #define WEAPON_GRENADE  0
00011 #define WEAPON_GUN              1
00012 #define WEAPON_ROCKET   2
00013 
00014 struct SWeapon {
00015         int type;
00016         float power;
00017         float reload;
00018         float speed;
00019 };
00020 
00021 class Weapon {
00022         public:
00023                 inline static void set(SWeapon &w, int type);
00024 };
00025 
00026 void Weapon::set(SWeapon &w, int type) {
00027         switch (type) {
00028                 case WEAPON_ROCKET:
00029                         w.power = 0.4f;
00030                         w.reload = 350.0f;
00031                         w.speed = 0.65f;
00032                         w.type = WEAPON_ROCKET;
00033                         break;
00034 
00035                 case WEAPON_GUN:
00036                 default:
00037                         w.power = 0.15f;
00038                         w.reload = 75.0f;
00039                         w.speed = 1.2f;
00040                         w.type = WEAPON_GUN;
00041                         break;
00042         }
00043 }
00044 
00045 #endif

Generated on Sun Jun 5 15:47:05 2005 for Defacto by  doxygen 1.4.3