00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include <malloc.h>
00026 #include <string.h>
00027
00028 #include "parsec.hpp"
00029 #include "dice.hpp"
00030
00031 static int determineSystemNature(){
00032 int roll = d2d6();
00033 return ( roll < 8 ? NATURE_SOLO :
00034 ( ( roll >= 8 ) && ( roll < 12 ) ? NATURE_BINARY : NATURE_TRINARY ));
00035 }
00036
00037 void parsec::primaryGeneration(){
00038 main_planet=new mainPlanet();
00039
00040 }
00041
00042 mainPlanet* parsec::getMainPlanet(){
00043 return main_planet;
00044 }
00045
00046
00047 void parsec::setMainPlanet(mainPlanet* p){
00048 main_planet=p;
00049 }
00050
00051
00052
00053
00054 parsec::parsec() : sparseArrayNode() {
00055 this->primaryGeneration();
00056 }
00057
00058
00059 parsec::parsec(int row,int column) : sparseArrayNode(row,column) {
00060 this->primaryGeneration();
00061
00062 }
00063
00064 char* parsec::asText(){
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 }
00073
00074