summaryrefslogtreecommitdiffstats
path: root/Vehicle.cpp
blob: 9a5153c74ab179e443d6d43cd1c31618886f48c4 (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
#include <ncurses.h>

#include "Vehicle.hpp"
#include "veh_models.hpp"

bool Vehicle::Draw(int bound_x)
{
	bool ret = false;
	int i, j, k;
	const struct vehicle_info car = veh_info[type];

	for(i = pos_x, j = car.length-1; i >= 0 && j >= 0; i--, j--) {
		if(i >= bound_x)
			continue;
		ret = true;

		int h = car.height;
		for(k = 0; k < h; k++) {
			if(car.model[k][j] != SUPPORT_CHAR)
				mvaddch(pos_y - (h - k), i, car.model[k][j]);
		}
	}

	return ret;
}

int Vehicle::GetLength()
{
	return veh_info[type].length;
}