File: boatpositionlog.cpp

package info (click to toggle)
openssn 1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,340 kB
  • sloc: cpp: 10,973; makefile: 80
file content (59 lines) | stat: -rw-r--r-- 1,824 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
                          boatpositionlog.cpp  -  description
                             -------------------
    begin                : Sat Mar 16 2002
    copyright            : (C) 2002 by Michael Bridak
    email                : michael.bridak@verizon.net
$Id: boatpositionlog.cpp,v 1.2 2003/04/14 05:51:03 mbridak Exp $
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License.     *
 *    .                                   *
 *                                                                         *
 ***************************************************************************/


#include "SDL/SDL.h"
#include "boatpositionlog.h"

BoatPositionLog::BoatPositionLog(){
	size = 0;
	position temp;
	temp.lat=0;
	temp.lon=0;
	temp.bearing = 0.0;
	temp.tick = 0;
	for(int x=0; x<10; x++){
		storage[x]=temp;
	}
}
BoatPositionLog::~BoatPositionLog(){
}
/** Recpord the position of the boat. takes a type of
struct {
	float lat;
	float lon;
	double bearing
}; */
void BoatPositionLog::RecBoatPos(position temp){
	if (size > 9){
		PopRecord();
	}
	size ++;
	storage[size-1] = temp;
}
/** Remove the oldest record off stack. */
void BoatPositionLog::PopRecord(){
	for(int x = 0; x < size; x++){
		storage[x] = storage[x+1];
	}
	size --;
}
/** returns a log item */
void BoatPositionLog::GetLogItem(int item, position &loc){
	loc = storage[item];
}