summaryrefslogtreecommitdiff
path: root/game/vehicles/vehicle.h
blob: f7defb3f04b5f7606c41a5665cd80b2016ca6172 (plain)
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
#ifndef VEHICLE_H
#define VEHICLE_H

#include "game/physical.h"
#include <game/network/link.h>
#include <game/worldobject.h>
#include <string>

class LinkHistory {
public:
	using Entry = std::pair<LinkWPtr, unsigned char /*dir*/>;
	using Return = std::pair<LinkCPtr, unsigned char /*dir*/>;
	Return add(const LinkWPtr &, unsigned char);
	Return getAt(float) const;

private:
	std::vector<Entry> links;
	float totalLen;
};

class Vehicle : public WorldObject, public Physical {
public:
	Vehicle(const LinkPtr & link, const std::string & obj, const std::string & tex);
	float linkDist {0}; // distance long current link
	float speed {50}; // speed in m/s (~75 km/h)

protected:
	LinkHistory linkHist;
};

#endif