src/Weapons.cc
author saiam
Sun, 07 Dec 2008 19:54:00 +0000
changeset 253 747b1037d83e
parent 237 3d5465bcb67d
child 258 833ad8d7db8b
permissions -rw-r--r--
Added recoil to weapon constructor. Recoil still not used.

#include "Weapons.hh"

static struct WeaponParams {
    TickCount age;
    float speed;
    float recoil;
    float explosionRadius;
    TickCount reloadTime;
    std::string name;
} WEAPON_PARAMS[] = {
    /*  age     speed        recoil   expRadius   reloadTime      name        */
    {   10000,  5 * 80 + 50, 0 * 5 + 5,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
    {   10000,  4 * 80 + 50, 2 * 5 + 5,   1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
    {   10000,  3 * 80 + 50, 3 * 5 + 5,   2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
    {   10000,  2 * 80 + 50, 4 * 5 + 5,   3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
    {   10000,  1 * 80 + 50, 5 * 5 + 5,   4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
    {   0,      0,           0,           0,          0,              ""          }
};

std::vector<Weapon*> buildWeaponsList (void) {
    std::vector<Weapon*> weapons;

    for (WeaponParams *wp = WEAPON_PARAMS; 
         wp->age || wp->speed || wp->recoil || wp->explosionRadius || wp->reloadTime; 
         wp++) {
        weapons.push_back(new Weapon(wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->reloadTime, wp->name));
    }

    return weapons;
}