summaryrefslogtreecommitdiffstats
path: root/Vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Vehicle.cpp')
-rw-r--r--Vehicle.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Vehicle.cpp b/Vehicle.cpp
new file mode 100644
index 0000000..3e71db4
--- /dev/null
+++ b/Vehicle.cpp
@@ -0,0 +1,25 @@
+#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;
+}