parsec Class Reference

#include <parsec.hpp>

Inheritance diagram for parsec:

Inheritance graph
[legend]
Collaboration diagram for parsec:

Collaboration graph
[legend]
List of all members.

Detailed Description

A parsec can also be called a "star system" and is part of a subsector map and is where a lot of the activity of this library happens.

When the parsec constructor is invoked the parsec is put together using the book 3 rules with just a primary planet defined. Use the member method "extendedGeneration()" to flesh out the rest of the parsec's values.

See also:
sparseArrayNode

subsector

Definition at line 48 of file parsec.hpp.

Public Member Functions

 parsec ()
 parsec (int row, int column)
mainPlanetgetMainPlanet ()
void setMainPlanet (mainPlanet *p)
char * asText ()


Constructor & Destructor Documentation

parsec::parsec (  ) 

Generic constructor.

Definition at line 54 of file parsec.cpp.

00054                : sparseArrayNode() {
00055         this->primaryGeneration();
00056 }

parsec::parsec ( int  row,
int  column 
)

Parsec with parameters to set its position within a subsector.

Parameters:
row Integer value for the row
column Integer value for the column

Definition at line 59 of file parsec.cpp.

00059                                  : sparseArrayNode(row,column) {
00060         this->primaryGeneration();
00061         
00062 }


Member Function Documentation

char * parsec::asText (  ) 

Return a text representation of this parsec in Book 3 format.

Returns:
pointer to a string of characters

Definition at line 64 of file parsec.cpp.

References mainPlanet::asText(), getMainPlanet(), and sparseArrayNode::getRow().

Referenced by subsector::asText().

00064                     {
00065         char *buffer = (char*) malloc(81);
00066         
00067         buffer[0]='\0';
00068         
00069         sprintf(buffer,"%0.2d-%0.2d\t%s",this->getColumn(),this->getRow(),
00070                         this->getMainPlanet()->asText());
00071         return buffer;
00072 }

Here is the call graph for this function:

Here is the caller graph for this function:

mainPlanet * parsec::getMainPlanet (  ) 

Get a the main planet object

Returns:
pointer to the mainPlanet object representing the main planet in this parsec.

Definition at line 42 of file parsec.cpp.

Referenced by asText().

00042                                   {
00043         return main_planet;
00044 }

Here is the caller graph for this function:

void parsec::setMainPlanet ( mainPlanet p  ) 

Set the main planet for this parsec.

Parameters:
p pointer to a mainPlanet object

Definition at line 47 of file parsec.cpp.

00047                                        {
00048         main_planet=p;
00049 }


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