summaryrefslogtreecommitdiffstats
path: root/Vehicle.cpp
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-03-09 21:45:42 +0000
committerJoursoir <chat@joursoir.net>2021-03-09 21:45:42 +0000
commit728efbb79dd76a25283b02259d6344d85d8f447d (patch)
tree5da84537a2eba04d736eaa398d3269444d94b37f /Vehicle.cpp
parenta7b9aa288a65ef456ec3795435c91eba58f2a098 (diff)
downloadascii-road-728efbb79dd76a25283b02259d6344d85d8f447d.tar.gz
ascii-road-728efbb79dd76a25283b02259d6344d85d8f447d.tar.bz2
ascii-road-728efbb79dd76a25283b02259d6344d85d8f447d.zip
some changes in class Vehicle
Diffstat (limited to 'Vehicle.cpp')
-rw-r--r--Vehicle.cpp30
1 files changed, 8 insertions, 22 deletions
diff --git a/Vehicle.cpp b/Vehicle.cpp
index 9a5153c..df1e1e3 100644
--- a/Vehicle.cpp
+++ b/Vehicle.cpp
@@ -2,29 +2,15 @@
#include "Vehicle.hpp"
#include "veh_models.hpp"
+#include "GameWorld.hpp"
-bool Vehicle::Draw(int bound_x)
+bool Vehicle::MoveRight(GameWorld *world)
{
- bool ret = false;
- int i, j, k;
- const struct vehicle_info car = veh_info[type];
+ const struct object_info *car = &veh_store[type];
+ int h = car->height, i;
+ for(i = 0; i < h; i++)
+ world->RedrawCh(pos_y - i, pos_x);
- 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;
+ pos_x++;
+ return world->Draw(car, pos_y, pos_x, false);
}
-
-int Vehicle::GetLength()
-{
- return veh_info[type].length;
-} \ No newline at end of file