book2Ship Class Reference

#include <book2-ship.hpp>

Inheritance diagram for book2Ship:

Inheritance graph
[legend]
Collaboration diagram for book2Ship:

Collaboration graph
[legend]
List of all members.

Detailed Description

Defines a starship as defined in book2 "Starships" of the original boxed set of Traveller books.

Definition at line 48 of file book2-ship.hpp.

Public Member Functions

 book2Ship ()
 book2Ship (int ix)
void addHull (book2ShipHull *h)
void addHull (int ix)
void addHull (double m, double d)
void addDrives (char p, char m, char j)


Constructor & Destructor Documentation

book2Ship::book2Ship ( int  ix  ) 

Alternate constructor

Parameters:
ix -- integer index as defined in the SH? macros.
See also:
book2ShipHull

Definition at line 36 of file book2-ship.cpp.

00036                            : shipObj() {
00037         hull = new book2ShipHull(ix);
00038 }


Member Function Documentation

void book2Ship::addDrives ( char  p,
char  m,
char  j 
)

Add our drives using the drive model numbers

Parameters:
p -- model number of the power plant
m -- model number of the maneuver drives
j -- model number of the jump drives

Definition at line 53 of file book2-ship.cpp.

References book2ShipHull::getDriveCompartment(), book2ShipHull::getMainCompartment(), book2ShipHull::setDriveCompartment(), book2ShipHull::setMainCompartment(), and book2DriveCompartment::totalMass().

00053                                               {
00054         drives = new book2DriveCompartment (p,m,j);
00055         double totalDriveMass = drives->totalMass();
00056         
00057         if (hull->getDriveCompartment() < totalDriveMass ){
00058                 double diff = totalDriveMass - hull->getDriveCompartment();
00059                 double newDriveCompartment = hull->getDriveCompartment() + diff;
00060                 double newMainCompartment = hull->getMainCompartment() - diff;
00061                 
00062                 hull->setMainCompartment(newMainCompartment);
00063                 hull->setDriveCompartment(newDriveCompartment);
00064         }
00065         
00066 }

Here is the call graph for this function:

void book2Ship::addHull ( double  m,
double  d 
)

Add a hull, take 3 using a custom hull. Parameters for main compartment and drive compartment must be in increments of even 100's or the main comartment size will be adjusted accordingly. A total hull size of more than 5000 is not allowed either and adjustments will be made.

Parameters:
m double value for the main compartment size
d double value for the drive compartment size

Definition at line 49 of file book2-ship.cpp.

00049                                          {
00050         hull = new book2ShipHull(m,d);
00051 }

void book2Ship::addHull ( int  ix  ) 

Add a hull, take 2

Parameters:
ix integer index into standard hull types

Definition at line 45 of file book2-ship.cpp.

00045                               {
00046         hull = new book2ShipHull(ix);
00047 }

void book2Ship::addHull ( book2ShipHull h  ) 

Add a hull, take 1

Parameters:
h pointer to object of type book2ShipHull that is the hull for this ship

Definition at line 41 of file book2-ship.cpp.

Referenced by mbb2FreeTrader::mbb2FreeTrader(), mbb2Scout::mbb2Scout(), mbb2Seeker::mbb2Seeker(), and mbb2Yacht::mbb2Yacht().

00041                                        {
00042         hull = h;
00043 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:41:24 2008 for frpuniverse by  doxygen 1.4.7