src/book2/book2-jump-drive.cpp

00001 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
00002 /*
00003  * frpuniverse
00004  * Copyright (C) Peter L. Berghold 2008 <peter@berghold.net>
00005  * 
00006  * frpuniverse is free software.
00007  * 
00008  * You may redistribute it and/or modify it under the terms of the
00009  * GNU General Public License, as published by the Free Software
00010  * Foundation; either version 2 of the License, or (at your option)
00011  * any later version.
00012  * 
00013  * frpuniverse is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with frpuniverse.  If not, write to:
00020  *      The Free Software Foundation, Inc.,
00021  *      51 Franklin Street, Fifth Floor
00022  *      Boston, MA  02110-1301, USA.
00023  */
00024 
00025 #include "book2/book2-jump-drive.hpp"
00026 #include "traveller-constants.hpp"
00027 
00028 static driveRecord jumpDriveTable[24]={
00029         {'A',10,MCR 10},
00030         {'B',15,MCR 20},
00031         {'C',20,MCR 30},
00032         {'D',25,MCR 40},
00033         {'E',30,MCR 50},
00034         {'F',35,MCR 60},
00035         {'G',40,MCR 70},
00036         {'H',45,MCR 80},
00037         {'J',50,MCR 90},
00038         {'K',55,MCR 100},
00039         {'L',60,MCR 110},
00040         {'M',65,MCR 120},
00041         {'N',70,MCR 130},
00042         {'P',75,MCR 140},
00043         {'Q',80,MCR 150},
00044         {'R',85,MCR 160},
00045         {'S',90,MCR 170},
00046         {'T',95,MCR 180},
00047         {'U',100,MCR 190},
00048         {'V',105,MCR 200},
00049         {'W',110,MCR 210},
00050         {'X',115,MCR 220},
00051         {'Y',120,MCR 230},
00052         {'Z',125,MCR 240},
00053 };
00054 
00055 book2JumpDrive::book2JumpDrive() : book2DriveObject (){
00056 }
00057 
00058 book2JumpDrive::book2JumpDrive(char m) : book2DriveObject (){
00059         
00060         this->setModel(m);
00061 }
00062 
00063 void book2JumpDrive::setModel(char m){
00064         this->book2DriveObject::setModel (m);  // Invoke the base class's method. 
00065         int ix;
00066         int set=0;
00067         
00068         for(ix=0;ix<24;ix++){   // search the table for the model number
00069                 if ( jumpDriveTable[ix].model == m ){ // if found...
00070                         this->setCost(jumpDriveTable[ix].cost);  // set the cost
00071                         this->setMass(jumpDriveTable[ix].mass);  // set the tonnage
00072                         set = 1;
00073                 }
00074         }
00075         
00076         if ( set == 0 ) 
00077                 this->book2DriveObject::setModel('?');
00078         
00079         
00080 }

Generated on Fri Mar 7 16:40:53 2008 for frpuniverse by  doxygen 1.4.7