diff options
Diffstat (limited to 'src/model/tags.cc')
-rw-r--r-- | src/model/tags.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/model/tags.cc b/src/model/tags.cc index 76f18ce..7e5a393 100644 --- a/src/model/tags.cc +++ b/src/model/tags.cc @@ -155,14 +155,15 @@ Sound::~Sound() /* ---- class Dock ------------------------------------------------- */ -Weapon::Weapon() : Tag() +Weapon::Weapon(const Type type) : Tag() { - weapon_radius = 0.01f; + set_type(type); } Weapon::Weapon(const Weapon& other) : Tag(other) { - weapon_radius = other.radius(); + weapon_type = other.type(); + weapon_cone = other.cone(); weapon_axis.assign(other.axis()); } @@ -170,6 +171,22 @@ Weapon::~Weapon() { } +void Weapon::set_type(const Type type) +{ + weapon_type = type; + switch (weapon_type) { + case Unmountable: + weapon_cone = 0.0f; + break; + case Cannon: + weapon_cone = 60.0f; // 60 degrees + break; + case Turret: + weapon_cone = 180.0f; // 180 degrees + break; + } +} + /* ---- class SubModel---------------------------------------------- */ SubModel::SubModel() : Tag() |