From 4e44cec4a2a29cfee132bbe1ee722fbc5168db87 Mon Sep 17 00:00:00 2001 From: jonas Date: Mon, 10 Dec 2018 17:54:50 +0100 Subject: Removed program specific files, updated dependencies --- AmpelJonas/cCar.cpp | 84 ----------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 AmpelJonas/cCar.cpp (limited to 'AmpelJonas/cCar.cpp') diff --git a/AmpelJonas/cCar.cpp b/AmpelJonas/cCar.cpp deleted file mode 100644 index 50122ac..0000000 --- a/AmpelJonas/cCar.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "cCar.h" - -cCar::cCar(int _direction, int *_phase) -{ - pPhase = _phase; - iDirection = _direction; - if (iDirection ==_CAR_DIR_NORTH) { //South or north - car = new cObject(4, 4); - car->setPosition(_SIZE_X_ / 2 - 4, - 4 ); - car->drawRectangle('+', 'X', sPos{ 0,0 }, sPos{3,3}, _COL_RED, _COL_RED); - } - else if (iDirection == _CAR_DIR_SOUTH) { //South or north - car = new cObject(4, 4); - car->setPosition(_SIZE_X_ / 2 +1, _SIZE_Y_); - car->drawRectangle('+', 'X', sPos{ 0,0 }, sPos{ 3,3 }, _COL_RED, _COL_RED); - } - else if(iDirection == _CAR_DIR_WEST){ - car = new cObject(6, 3); - car->setPosition( -6, _SIZE_Y_ / 2 + 1); - car->drawRectangle('+', ' ', sPos{ 0,0 }, sPos{5, 2}, _COL_BLUE, _COL_BLUE); - car->drawText("AUTO", sPos{ 1,1 }, _COL_BLUE); - } - else if (iDirection == _CAR_DIR_EAST) - { - car = new cObject(6, 3); - car->setPosition(_SIZE_X_, _SIZE_Y_ / 2 -3); - car->drawRectangle('+', ' ', sPos{ 0,0 }, sPos{ 5, 2 }, _COL_BLUE, _COL_BLUE); - car->drawText("AUTO", sPos{ 1,1 }, _COL_BLUE); - } -} - -cCar::~cCar() -{ - delete car; -} - -cObject *cCar::getObject() -{ - return car; -} - -void cCar::drive() -{ - sPos oldPos; - switch(iDirection) - { - case _CAR_DIR_EAST: - oldPos = car->getPosition(); - if (!((*pPhase != 5 && *pPhase != 4) && oldPos.x == (_SIZE_X_ / 2) + 11)){ - car->setPosition(oldPos.x - 1, oldPos.y); - } - if (oldPos.x < -6) { - car->setPosition(_SIZE_X_, oldPos.y); - } - break; - case _CAR_DIR_WEST: - oldPos = car->getPosition(); - if (!((*pPhase != 5 && *pPhase != 4) && oldPos.x == (_SIZE_X_ / 2) - 15)){ - car->setPosition(oldPos.x + 1, oldPos.y); - } - if (oldPos.x > _SIZE_X_) { - car->setPosition(-6 , oldPos.y); - } - break; - case _CAR_DIR_NORTH: - oldPos = car->getPosition(); - if (!((*pPhase != 0 && *pPhase != 9 && *pPhase != -1) && oldPos.y == (_SIZE_Y_ / 2) - 11)) { - car->setPosition(oldPos.x, oldPos.y + 1); - } - if (oldPos.y > _SIZE_Y_) { - car->setPosition(oldPos.x, -4); - } - break; - case _CAR_DIR_SOUTH: - oldPos = car->getPosition(); - if (!((*pPhase != 0 && *pPhase != 9 && *pPhase != -1) && oldPos.y == (_SIZE_Y_ / 2) + 8)) { - car->setPosition(oldPos.x, oldPos.y - 1); - } - if (oldPos.y < -4) { - car->setPosition(oldPos.x, _SIZE_Y_); - } - break; - } -} -- cgit v1.2.3