Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Weapon Class Reference

#include <Weapon.h>

Inheritance diagram for Weapon:
System SimObserver

List of all members.

Public Types

enum  Constants { MAX_BARRELS = 8 }
enum  Orders { MANUAL, AUTO, POINT_DEFENSE }
enum  Control { SINGLE_FIRE, RIPPLE_FIRE, SALVO_FIRE }
enum  Sweep { SWEEP_NONE, SWEEP_TIGHT, SWEEP_WIDE }
- Public Types inherited from System
enum  CATEGORY {
  MISC_SYSTEM = 0, DRIVE = 1, WEAPON, SHIELD,
  SENSOR, COMPUTER, POWER_SOURCE, FLIGHT_DECK,
  FARCASTER
}
enum  STATUS {
  DESTROYED, CRITICAL, DEGRADED, NOMINAL,
  MAINT
}
enum  POWER_FLAGS { POWER_WATTS = 1, POWER_CRITICAL = 2 }

Public Member Functions

 Weapon (WeaponDesign *d, int nmuz, Vec3 *muzzles, double az=0, double el=0)
 Weapon (const Weapon &rhs)
virtual ~Weapon ()
int operator== (const Weapon &w) const
int Track (SimObject *targ, System *sub)
ShotFire ()
ShotNetFirePrimary (SimObject *targ, System *sub, int count)
ShotNetFireSecondary (SimObject *targ, System *sub, DWORD objid)
void SetTarget (SimObject *t, System *sub)
void SelectTarget ()
bool CanTarget (DWORD classification) const
SimObjectGetTarget () const
SystemGetSubTarget () const
void SetFiringOrders (int o)
int GetFiringOrders () const
void SetControlMode (int m)
int GetControlMode () const
void SetSweep (int s)
int GetSweep () const
void Enable ()
void Disable ()
const WeaponDesignDesign () const
const char * Group () const
int Enabled () const
int Ammo () const
int Guided () const
int Locked () const
float Velocity () const
float Mass () const
float Resistance () const
ShotGetBeam (int i)
void SetAmmo (int a)
bool IsPrimary () const
bool IsDrone () const
bool IsDecoy () const
bool IsProbe () const
bool IsMissile () const
bool IsBeam () const
virtual void ExecFrame (double factor)
virtual void Orient (const Physical *rep)
virtual void Distribute (double delivered_energy, double seconds)
const ShipOwner () const
void SetOwner (Ship *ship)
int GetIndex () const
void SetIndex (int n)
Point GetAimVector () const
void SetAzimuth (double a)
double GetAzimuth () const
void SetElevation (double e)
double GetElevation () const
void SetRestAzimuth (double a)
double GetRestAzimuth () const
void SetRestElevation (double e)
double GetRestElevation () const
void SetAzimuthMax (double a)
double GetAzimuthMax () const
void SetAzimuthMin (double a)
double GetAzimuthMin () const
void SetElevationMax (double e)
double GetElevationMax () const
void SetElevationMin (double e)
double GetElevationMin () const
void SetGroup (const char *n)
bool IsBlockedFriendly () const
void SetBlockedFriendly (bool b)
SolidGetTurret ()
SolidGetTurretBase ()
SolidGetVisibleStore (int i)
virtual bool Update (SimObject *obj)
virtual const char * GetObserverName () const
- Public Member Functions inherited from System
 System (CATEGORY t, int s, const char *n, int maxv, double energy=0, double capacity=100, double sink_rate=1)
 System (const System &s)
virtual ~System ()
int operator== (const System &s) const
CATEGORY Type () const
int Subtype () const
const char * Name () const
const char * Abbreviation () const
void SetName (const char *n)
void SetAbbreviation (const char *a)
void SetDesign (SystemDesign *d)
virtual int Value () const
int MaxValue () const
STATUS Status () const
double Availability () const
double Safety () const
double Stability () const
virtual void CalcStatus ()
virtual void Repair ()
double NetAvail () const
void SetNetAvail (double d)
List< Component > & GetComponents ()
virtual void ApplyDamage (double damage)
virtual void ExecMaintFrame (double seconds)
virtual void DoEMCON (int emcon)
virtual void Mount (Point loc, float radius, float hull_factor=0.5f)
virtual void Mount (const System &system)
Point MountLocation () const
double Radius () const
double HullProtection () const
bool IsPowerCritical () const
bool UsesWatts () const
virtual double GetRequest (double seconds) const
int GetSourceIndex () const
void SetSourceIndex (int i)
virtual int Charge () const
bool IsPowerOn () const
virtual void PowerOn ()
virtual void PowerOff ()
virtual double GetPowerLevel () const
virtual void SetPowerLevel (double level)
virtual void SetOverride (bool over)
virtual void DrainPower (double to_level)
void SetCapacity (double c)
double GetCapacity () const
double GetEnergy () const
double GetSinkRate () const
void SetEMCONPower (int emcon, int power_level)
int GetEMCONPower (int emcon)
int GetExplosionType () const
void SetExplosionType (int t)
ShipGetShip () const
void SetShip (Ship *s)
int GetID () const
void SetID (int n)
- Public Member Functions inherited from SimObserver
virtual ~SimObserver ()
int operator== (const SimObserver &o) const
virtual void Observe (SimObject *obj)
virtual void Ignore (SimObject *obj)

Static Public Member Functions

static const char * TYPENAME ()

Protected Member Functions

ShotFireBarrel (int n)
ShotCreateShot (const Point &loc, const Camera &cam, WeaponDesign *dsn, const Ship *owner)
void SetBeamPoints (bool aim=false)
void Aim ()
void AimTurret (double az, double el)
void ZeroAim ()
void FindObjective ()
Point Transform (const Point &pt)
bool CanLockPoint (const Point &test, double &az, double &el, Point *obj=0)

Protected Attributes

WeaponDesigndesign
Text group
Point muzzle_pts [MAX_BARRELS]
Point rel_pts [MAX_BARRELS]
Solidturret
Solidturret_base
Solidvisible_stores [MAX_BARRELS]
int nbarrels
int active_barrel
float refire
int ammo
int ripple_count
float mass
float resist
int guided
bool enabled
bool locked
bool centered
bool firing
bool blocked
float shot_speed
int index
int orders
int control
int sweep
SimObjecttarget
Systemsubtarget
Point objective
Point obj_w
Camera aim_cam
float aim_azimuth
float aim_elevation
float old_azimuth
float old_elevation
float aim_az_max
float aim_az_min
float aim_az_rest
float aim_el_max
float aim_el_min
float aim_el_rest
DWORD aim_time
Shot ** beams
- Protected Attributes inherited from System
CATEGORY type
Shipship
int id
int subtype
int max_value
Text name
Text abrv
STATUS status
float crit_level
float availability
float safety
float stability
float safety_overload
float net_avail
Point mount_loc
Point mount_rel
float radius
float hull_factor
float energy
float capacity
float sink_rate
float power_level
int source_index
DWORD power_flags
bool power_on
BYTE emcon_power [3]
BYTE emcon
int explosion_type
List< Componentcomponents
- Protected Attributes inherited from SimObserver
List< SimObjectobserve_list

Detailed Description

Definition at line 35 of file Weapon.h.


Member Enumeration Documentation

Enumerator:
MAX_BARRELS 

Definition at line 40 of file Weapon.h.

Enumerator:
SINGLE_FIRE 
RIPPLE_FIRE 
SALVO_FIRE 

Definition at line 42 of file Weapon.h.

Enumerator:
MANUAL 
AUTO 
POINT_DEFENSE 

Definition at line 41 of file Weapon.h.

Enumerator:
SWEEP_NONE 
SWEEP_TIGHT 
SWEEP_WIDE 

Definition at line 43 of file Weapon.h.


Constructor & Destructor Documentation

Weapon::Weapon ( WeaponDesign d,
int  nmuz,
Vec3 muzzles,
double  az = 0,
double  el = 0 
)

Definition at line 33 of file Weapon.cpp.

Weapon::Weapon ( const Weapon rhs)

Definition at line 99 of file Weapon.cpp.

Weapon::~Weapon ( )
virtual

Definition at line 141 of file Weapon.cpp.


Member Function Documentation

void Weapon::Aim ( )
protected

Definition at line 928 of file Weapon.cpp.

void Weapon::AimTurret ( double  az,
double  el 
)
protected

Definition at line 1146 of file Weapon.cpp.

int Weapon::Ammo ( ) const
inline

Definition at line 73 of file Weapon.h.

bool Weapon::CanLockPoint ( const Point test,
double &  az,
double &  el,
Point obj = 0 
)
protected

Definition at line 1086 of file Weapon.cpp.

bool Weapon::CanTarget ( DWORD  classification) const

Definition at line 443 of file Weapon.cpp.

Shot * Weapon::CreateShot ( const Point loc,
const Camera cam,
WeaponDesign dsn,
const Ship owner 
)
protected

Definition at line 831 of file Weapon.cpp.

const WeaponDesign* Weapon::Design ( ) const
inline

Definition at line 70 of file Weapon.h.

void Weapon::Disable ( )
inline

Definition at line 68 of file Weapon.h.

void Weapon::Distribute ( double  delivered_energy,
double  seconds 
)
virtual

Reimplemented from System.

Definition at line 369 of file Weapon.cpp.

void Weapon::Enable ( )
inline

Definition at line 67 of file Weapon.h.

int Weapon::Enabled ( ) const
inline

Definition at line 72 of file Weapon.h.

void Weapon::ExecFrame ( double  factor)
virtual

Reimplemented from System.

Definition at line 289 of file Weapon.cpp.

void Weapon::FindObjective ( )
protected

Definition at line 1031 of file Weapon.cpp.

Shot * Weapon::Fire ( )

Definition at line 591 of file Weapon.cpp.

Shot * Weapon::FireBarrel ( int  n)
protected

Definition at line 730 of file Weapon.cpp.

Point Weapon::GetAimVector ( ) const
inline

Definition at line 100 of file Weapon.h.

double Weapon::GetAzimuth ( ) const
inline

Definition at line 102 of file Weapon.h.

double Weapon::GetAzimuthMax ( ) const
inline

Definition at line 112 of file Weapon.h.

double Weapon::GetAzimuthMin ( ) const
inline

Definition at line 114 of file Weapon.h.

Shot * Weapon::GetBeam ( int  i)

Definition at line 203 of file Weapon.cpp.

int Weapon::GetControlMode ( ) const
inline

Definition at line 63 of file Weapon.h.

double Weapon::GetElevation ( ) const
inline

Definition at line 104 of file Weapon.h.

double Weapon::GetElevationMax ( ) const
inline

Definition at line 117 of file Weapon.h.

double Weapon::GetElevationMin ( ) const
inline

Definition at line 119 of file Weapon.h.

int Weapon::GetFiringOrders ( ) const
inline

Definition at line 61 of file Weapon.h.

int Weapon::GetIndex ( ) const
inline

Definition at line 97 of file Weapon.h.

const char * Weapon::GetObserverName ( ) const
virtual

Reimplemented from SimObserver.

Definition at line 410 of file Weapon.cpp.

double Weapon::GetRestAzimuth ( ) const
inline

Definition at line 107 of file Weapon.h.

double Weapon::GetRestElevation ( ) const
inline

Definition at line 109 of file Weapon.h.

System* Weapon::GetSubTarget ( ) const
inline

Definition at line 59 of file Weapon.h.

int Weapon::GetSweep ( ) const
inline

Definition at line 65 of file Weapon.h.

SimObject* Weapon::GetTarget ( ) const
inline

Definition at line 58 of file Weapon.h.

Solid * Weapon::GetTurret ( )

Definition at line 245 of file Weapon.cpp.

Solid * Weapon::GetTurretBase ( )

Definition at line 251 of file Weapon.cpp.

Solid * Weapon::GetVisibleStore ( int  i)

Definition at line 257 of file Weapon.cpp.

const char* Weapon::Group ( ) const
inline

Definition at line 71 of file Weapon.h.

int Weapon::Guided ( ) const
inline

Definition at line 74 of file Weapon.h.

bool Weapon::IsBeam ( ) const

Definition at line 195 of file Weapon.cpp.

bool Weapon::IsBlockedFriendly ( ) const
inline

Definition at line 123 of file Weapon.h.

bool Weapon::IsDecoy ( ) const

Definition at line 177 of file Weapon.cpp.

bool Weapon::IsDrone ( ) const

Definition at line 171 of file Weapon.cpp.

bool Weapon::IsMissile ( ) const

Definition at line 189 of file Weapon.cpp.

bool Weapon::IsPrimary ( ) const

Definition at line 165 of file Weapon.cpp.

bool Weapon::IsProbe ( ) const

Definition at line 183 of file Weapon.cpp.

int Weapon::Locked ( ) const
inline

Definition at line 75 of file Weapon.h.

float Weapon::Mass ( ) const
inline

Definition at line 77 of file Weapon.h.

Shot * Weapon::NetFirePrimary ( SimObject targ,
System sub,
int  count 
)

Definition at line 667 of file Weapon.cpp.

Shot * Weapon::NetFireSecondary ( SimObject targ,
System sub,
DWORD  objid 
)

Definition at line 697 of file Weapon.cpp.

int Weapon::operator== ( const Weapon w) const
inline

Definition at line 49 of file Weapon.h.

void Weapon::Orient ( const Physical rep)
virtual

Reimplemented from System.

Definition at line 843 of file Weapon.cpp.

const Ship* Weapon::Owner ( ) const
inline

Definition at line 95 of file Weapon.h.

float Weapon::Resistance ( ) const
inline

Definition at line 78 of file Weapon.h.

void Weapon::SelectTarget ( )

Definition at line 496 of file Weapon.cpp.

void Weapon::SetAmmo ( int  a)

Definition at line 266 of file Weapon.cpp.

void Weapon::SetAzimuth ( double  a)
inline

Definition at line 101 of file Weapon.h.

void Weapon::SetAzimuthMax ( double  a)
inline

Definition at line 111 of file Weapon.h.

void Weapon::SetAzimuthMin ( double  a)
inline

Definition at line 113 of file Weapon.h.

void Weapon::SetBeamPoints ( bool  aim = false)
protected

Definition at line 900 of file Weapon.cpp.

void Weapon::SetBlockedFriendly ( bool  b)
inline

Definition at line 124 of file Weapon.h.

void Weapon::SetControlMode ( int  m)

Definition at line 427 of file Weapon.cpp.

void Weapon::SetElevation ( double  e)
inline

Definition at line 103 of file Weapon.h.

void Weapon::SetElevationMax ( double  e)
inline

Definition at line 116 of file Weapon.h.

void Weapon::SetElevationMin ( double  e)
inline

Definition at line 118 of file Weapon.h.

void Weapon::SetFiringOrders ( int  o)

Definition at line 420 of file Weapon.cpp.

void Weapon::SetGroup ( const char *  n)
inline

Definition at line 121 of file Weapon.h.

void Weapon::SetIndex ( int  n)
inline

Definition at line 98 of file Weapon.h.

void Weapon::SetOwner ( Ship ship)

Definition at line 214 of file Weapon.cpp.

void Weapon::SetRestAzimuth ( double  a)
inline

Definition at line 106 of file Weapon.h.

void Weapon::SetRestElevation ( double  e)
inline

Definition at line 108 of file Weapon.h.

void Weapon::SetSweep ( int  s)

Definition at line 434 of file Weapon.cpp.

void Weapon::SetTarget ( SimObject t,
System sub 
)

Definition at line 451 of file Weapon.cpp.

int Weapon::Track ( SimObject targ,
System sub 
)

Definition at line 575 of file Weapon.cpp.

Point Weapon::Transform ( const Point pt)
protected

Definition at line 1073 of file Weapon.cpp.

static const char* Weapon::TYPENAME ( )
inlinestatic

Reimplemented from SimObserver.

Definition at line 38 of file Weapon.h.

bool Weapon::Update ( SimObject obj)
virtual

Reimplemented from SimObserver.

Definition at line 394 of file Weapon.cpp.

float Weapon::Velocity ( ) const
inline

Definition at line 76 of file Weapon.h.

void Weapon::ZeroAim ( )
protected

Definition at line 1177 of file Weapon.cpp.


Member Data Documentation

int Weapon::active_barrel
protected

Definition at line 154 of file Weapon.h.

float Weapon::aim_az_max
protected

Definition at line 191 of file Weapon.h.

float Weapon::aim_az_min
protected

Definition at line 192 of file Weapon.h.

float Weapon::aim_az_rest
protected

Definition at line 193 of file Weapon.h.

float Weapon::aim_azimuth
protected

Definition at line 185 of file Weapon.h.

Camera Weapon::aim_cam
protected

Definition at line 184 of file Weapon.h.

float Weapon::aim_el_max
protected

Definition at line 194 of file Weapon.h.

float Weapon::aim_el_min
protected

Definition at line 195 of file Weapon.h.

float Weapon::aim_el_rest
protected

Definition at line 196 of file Weapon.h.

float Weapon::aim_elevation
protected

Definition at line 186 of file Weapon.h.

DWORD Weapon::aim_time
protected

Definition at line 198 of file Weapon.h.

int Weapon::ammo
protected

Definition at line 157 of file Weapon.h.

Shot** Weapon::beams
protected

Definition at line 200 of file Weapon.h.

bool Weapon::blocked
protected

Definition at line 170 of file Weapon.h.

bool Weapon::centered
protected

Definition at line 168 of file Weapon.h.

int Weapon::control
protected

Definition at line 176 of file Weapon.h.

WeaponDesign* Weapon::design
protected

Reimplemented from System.

Definition at line 146 of file Weapon.h.

bool Weapon::enabled
protected

Definition at line 166 of file Weapon.h.

bool Weapon::firing
protected

Definition at line 169 of file Weapon.h.

Text Weapon::group
protected

Definition at line 147 of file Weapon.h.

int Weapon::guided
protected

Definition at line 165 of file Weapon.h.

int Weapon::index
protected

Definition at line 173 of file Weapon.h.

bool Weapon::locked
protected

Definition at line 167 of file Weapon.h.

float Weapon::mass
protected

Definition at line 161 of file Weapon.h.

Point Weapon::muzzle_pts[MAX_BARRELS]
protected

Definition at line 148 of file Weapon.h.

int Weapon::nbarrels
protected

Definition at line 153 of file Weapon.h.

Point Weapon::obj_w
protected

Definition at line 183 of file Weapon.h.

Point Weapon::objective
protected

Definition at line 182 of file Weapon.h.

float Weapon::old_azimuth
protected

Definition at line 187 of file Weapon.h.

float Weapon::old_elevation
protected

Definition at line 188 of file Weapon.h.

int Weapon::orders
protected

Definition at line 175 of file Weapon.h.

float Weapon::refire
protected

Definition at line 156 of file Weapon.h.

Point Weapon::rel_pts[MAX_BARRELS]
protected

Definition at line 149 of file Weapon.h.

float Weapon::resist
protected

Definition at line 162 of file Weapon.h.

int Weapon::ripple_count
protected

Definition at line 158 of file Weapon.h.

float Weapon::shot_speed
protected

Definition at line 171 of file Weapon.h.

System* Weapon::subtarget
protected

Definition at line 180 of file Weapon.h.

int Weapon::sweep
protected

Definition at line 177 of file Weapon.h.

SimObject* Weapon::target
protected

Definition at line 179 of file Weapon.h.

Solid* Weapon::turret
protected

Definition at line 150 of file Weapon.h.

Solid* Weapon::turret_base
protected

Definition at line 151 of file Weapon.h.

Solid* Weapon::visible_stores[MAX_BARRELS]
protected

Definition at line 152 of file Weapon.h.


The documentation for this class was generated from the following files: