summaryrefslogtreecommitdiffstats
path: root/Vehicle.cpp
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-03-08 20:36:26 +0000
committerJoursoir <chat@joursoir.net>2021-03-08 20:36:26 +0000
commitac3ab1206a7bddec5312bf974479853429426dfa (patch)
tree26c0aacd3c78b8c2bd2d9db8c21af530d68459e6 /Vehicle.cpp
downloadascii-road-ac3ab1206a7bddec5312bf974479853429426dfa.tar.gz
ascii-road-ac3ab1206a7bddec5312bf974479853429426dfa.tar.bz2
ascii-road-ac3ab1206a7bddec5312bf974479853429426dfa.zip
init project
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;
+}