src/book2/book2-maneuver-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-maneuver-drive.hpp"
00026 #include "traveller-constants.hpp"
00027 static driveRecord maneuverDriveTable[24]={
00028         {'A',1,MCR 4},
00029         {'B',3,MCR 8},
00030         {'C',5,MCR 12},
00031         {'D',7,MCR 16},
00032         {'E',9,MCR 20},
00033         {'F',11,MCR 24},
00034         {'G',13,MCR 28},
00035         {'H',15,MCR 32},
00036         {'J',17,MCR 36},
00037         {'K',19,MCR 40},
00038         {'L',21,MCR 44},
00039         {'M',23,MCR 48},
00040         {'N',25,MCR 52},
00041         {'P',27,MCR 56},
00042         {'Q',29,MCR 60},
00043         {'R',31,MCR 64},
00044         {'S',33,MCR 68},
00045         {'T',35,MCR 72},
00046         {'U',37,MCR 76},
00047         {'V',39,MCR 80},
00048         {'W',41,MCR 84},
00049         {'X',43,MCR 88},
00050         {'Y',45,MCR 92},
00051         {'Z',47,MCR 96},
00052 };
00053 
00054 book2ManeuverDrive::book2ManeuverDrive() : book2DriveObject (){
00055 }
00056 
00057 book2ManeuverDrive::book2ManeuverDrive(char m) : book2DriveObject (){
00058         this->setModel(m);
00059 }
00060 
00061 void book2ManeuverDrive::setModel (char m){
00062         int set =0; 
00063         int ix;
00064         
00065         for(ix=0;ix<24;ix++){
00066                 if ( maneuverDriveTable[ix].model == m ) {
00067                         set = 1; 
00068                         this->setCost(maneuverDriveTable[ix].cost);
00069                         this->setMass(maneuverDriveTable[ix].mass);
00070                 }
00071         }
00072         if ( set == 1 ) 
00073                 this->book2DriveObject::setModel(m);
00074         else 
00075                 this->book2DriveObject::setModel('?');
00076         
00077 }
00078 
00079 
00080 

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