1 /*************************************************************************** 2 boatpositionlog.cpp - description 3 ------------------- 4 begin : Sat Mar 16 2002 5 copyright : (C) 2002 by Michael Bridak 6 email : michael.bridak@verizon.net 7 $Id: boatpositionlog.cpp,v 1.2 2003/04/14 05:51:03 mbridak Exp $ 8 ***************************************************************************/ 9 10 /*************************************************************************** 11 * * 12 * This program is free software; you can redistribute it and/or modify * 13 * it under the terms of the GNU General Public License as published by * 14 * the Free Software Foundation; either version 2 of the License. * 15 * . * 16 * * 17 ***************************************************************************/ 18 19 20 #include "SDL/SDL.h" 21 #include "boatpositionlog.h" 22 BoatPositionLog()23BoatPositionLog::BoatPositionLog(){ 24 size = 0; 25 position temp; 26 temp.lat=0; 27 temp.lon=0; 28 temp.bearing = 0.0; 29 temp.tick = 0; 30 for(int x=0; x<10; x++){ 31 storage[x]=temp; 32 } 33 } ~BoatPositionLog()34BoatPositionLog::~BoatPositionLog(){ 35 } 36 /** Recpord the position of the boat. takes a type of 37 struct { 38 float lat; 39 float lon; 40 double bearing 41 }; */ RecBoatPos(position temp)42void BoatPositionLog::RecBoatPos(position temp){ 43 if (size > 9){ 44 PopRecord(); 45 } 46 size ++; 47 storage[size-1] = temp; 48 } 49 /** Remove the oldest record off stack. */ PopRecord()50void BoatPositionLog::PopRecord(){ 51 for(int x = 0; x < size; x++){ 52 storage[x] = storage[x+1]; 53 } 54 size --; 55 } 56 /** returns a log item */ GetLogItem(int item,position & loc)57void BoatPositionLog::GetLogItem(int item, position &loc){ 58 loc = storage[item]; 59 } 60