Syringe Class Reference

#include <syringe.h>

Inheritance diagram for Syringe:

Inheritance graph
[legend]
Collaboration diagram for Syringe:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Syringe ()
SyringeConfigcfg ()

Protected Member Functions

bool p_Shoot ()
void Refresh ()
void Draw ()

Detailed Description

Definition at line 42 of file syringe.h.


Constructor & Destructor Documentation

Syringe::Syringe (  ) 

Definition at line 29 of file syringe.cpp.

00029                  : Weapon(WEAPON_SYRINGE, "syringe", new SyringeConfig())
00030 {
00031   m_name = _("Syringe");
00032 }


Member Function Documentation

SyringeConfig & Syringe::cfg (  ) 

Definition at line 80 of file syringe.cpp.

00080                             {
00081   return static_cast<SyringeConfig&>(*extra_params);
00082 }

Here is the caller graph for this function:

void Syringe::Draw (  )  [protected, virtual]

Reimplemented from Weapon.

Definition at line 34 of file syringe.cpp.

00034                    {
00035   Weapon::Draw();
00036 }

Here is the call graph for this function:

bool Syringe::p_Shoot (  )  [protected, virtual]

Implements Weapon.

Definition at line 38 of file syringe.cpp.

00038                       {
00039   double angle = ActiveCharacter().GetFiringAngle();
00040   double radius = 0.0;
00041   bool end = false;
00042 
00043   jukebox.Play ("share","weapon/syringe");
00044 
00045   do
00046   {
00047     // Did we have finished the computation
00048     radius += 1.0;
00049     if (cfg().range < radius)
00050     {
00051       radius = cfg().range;
00052       end = true;
00053     }
00054 
00055     // Compute point coordinates
00056     Point2i relative_pos(static_cast<int>(radius * cos(angle)),
00057                          static_cast<int>(radius * sin(angle)) );
00058     Point2i pos_to_check = ActiveCharacter().GetHandPosition() + relative_pos;
00059     FOR_ALL_LIVING_CHARACTERS(team, character)
00060     if (&(*character) != &ActiveCharacter())
00061     {
00062       // Did we touch somebody ?
00063       if( character->ObjTouche(pos_to_check) )
00064       {
00065         // Apply damage (*ver).SetEnergyDelta (-cfg().damage);
00066         character->SetDiseaseDamage(cfg().damage, cfg().turns);
00067         end = true;
00068       }
00069     }
00070   } while (!end);
00071 
00072   return true;
00073 }

Here is the call graph for this function:

void Syringe::Refresh (  )  [protected, virtual]

Implements Weapon.

Definition at line 75 of file syringe.cpp.

00075                      {
00076   if (m_is_active)
00077     m_is_active = false;
00078 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:21:14 2007 for Wormux by  doxygen 1.4.7