multimap<string, int> m;
// and using something like this
m.insert(pair<string, int>("laser", 1));
m.insert(pair<string, int>("torpedo", 2));
m.insert(pair<string, int>("laser", 3));
multimap<string, int> weapon;
weapon.insert(pair<string, int>("laser", 1));
etc..
function weapon_replace (old_weapon, new_weapon, <optional weapongroup>)
{
..check if old weapon is really on the ship..
..check if new weapon is available to player (inventory?)
..do stuff to whatever structure you decide to use..
..was an optional weapongroup given? if so, lets set that up now..
..return something..
}
function weapon_replace (old_weapon, new_weapon, <optional weapongroup>)
{
..check if old weapon is really on the ship..
..check if new weapon is available to player (inventory?)
..do stuff to whatever structure you decide to use..
..was an optional weapongroup given? if so, lets set that up now..
..return something..
}
weapon[0] = blaster, weapon[1] = railgun, weapon[blasters] = { 0, 2, 3 }, weapon[aft] = { 3, 4, 5 };
But with correct syntax, of course. :)