src/Weapons.cc
changeset 253 747b1037d83e
parent 237 3d5465bcb67d
child 258 833ad8d7db8b
equal deleted inserted replaced
252:25054ce94d07 253:747b1037d83e
     2 #include "Weapons.hh"
     2 #include "Weapons.hh"
     3 
     3 
     4 static struct WeaponParams {
     4 static struct WeaponParams {
     5     TickCount age;
     5     TickCount age;
     6     float speed;
     6     float speed;
       
     7     float recoil;
     7     float explosionRadius;
     8     float explosionRadius;
     8     TickCount reloadTime;
     9     TickCount reloadTime;
     9     std::string name;
    10     std::string name;
    10 } WEAPON_PARAMS[] = {
    11 } WEAPON_PARAMS[] = {
    11     /*  age     speed           expRadius   reloadTime      name        */
    12     /*  age     speed        recoil   expRadius   reloadTime      name        */
    12     {   10000,  5 * 80 + 50,    0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
    13     {   10000,  5 * 80 + 50, 0 * 5 + 5,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
    13     {   10000,  4 * 80 + 50,    1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
    14     {   10000,  4 * 80 + 50, 2 * 5 + 5,   1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
    14     {   10000,  3 * 80 + 50,    2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
    15     {   10000,  3 * 80 + 50, 3 * 5 + 5,   2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
    15     {   10000,  2 * 80 + 50,    3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
    16     {   10000,  2 * 80 + 50, 4 * 5 + 5,   3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
    16     {   10000,  1 * 80 + 50,    4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
    17     {   10000,  1 * 80 + 50, 5 * 5 + 5,   4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
    17     {   0,      0,              0,          0,              ""          }
    18     {   0,      0,           0,           0,          0,              ""          }
    18 };
    19 };
    19 
    20 
    20 std::vector<Weapon*> buildWeaponsList (void) {
    21 std::vector<Weapon*> buildWeaponsList (void) {
    21     std::vector<Weapon*> weapons;
    22     std::vector<Weapon*> weapons;
    22 
    23 
    23     for (WeaponParams *wp = WEAPON_PARAMS; wp->age || wp->speed || wp->explosionRadius || wp->reloadTime; wp++) {
    24     for (WeaponParams *wp = WEAPON_PARAMS; 
    24         weapons.push_back(new Weapon(wp->age, wp->speed, wp->explosionRadius, wp->reloadTime, wp->name));
    25          wp->age || wp->speed || wp->recoil || wp->explosionRadius || wp->reloadTime; 
       
    26          wp++) {
       
    27         weapons.push_back(new Weapon(wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->reloadTime, wp->name));
    25     }
    28     }
    26 
    29 
    27     return weapons;
    30     return weapons;
    28 }
    31 }
    29 
    32