fixed car & cardata
added ifndef
This commit is contained in:
parent
e35b7bd136
commit
d1187fc079
2 changed files with 15 additions and 10 deletions
8
car.c
8
car.c
|
|
@ -9,6 +9,14 @@
|
||||||
*/
|
*/
|
||||||
#include "car.h"
|
#include "car.h"
|
||||||
|
|
||||||
|
struct CarData {
|
||||||
|
CarType type;
|
||||||
|
Color color;
|
||||||
|
double fill_level;
|
||||||
|
double acceleration_rate;
|
||||||
|
int speed;
|
||||||
|
};
|
||||||
|
|
||||||
Car get_car(CarType carType) {
|
Car get_car(CarType carType) {
|
||||||
Car car = {carType, RED, 0.0, 0.0, 0};
|
Car car = {carType, RED, 0.0, 0.0, 0};
|
||||||
return car;
|
return car;
|
||||||
|
|
|
||||||
17
car.h
17
car.h
|
|
@ -8,18 +8,13 @@
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct CarImplementation* Car;
|
#ifndef ___CAR_H
|
||||||
|
#define ___CAR_H
|
||||||
|
|
||||||
|
typedef struct CarData* Car;
|
||||||
typedef enum { AIXAM, FIAT_MULTIPLA, JEEP } CarType;
|
typedef enum { AIXAM, FIAT_MULTIPLA, JEEP } CarType;
|
||||||
typedef enum { RED, GREEN, BLUE, ORANGE, SILVER, BLACK } Color;
|
typedef enum { RED, GREEN, BLUE, ORANGE, SILVER, BLACK } Color;
|
||||||
|
|
||||||
struct CarImplementation {
|
|
||||||
CarType type;
|
|
||||||
Color color;
|
|
||||||
double fill_level;
|
|
||||||
double acceleration_rate;
|
|
||||||
int speed;
|
|
||||||
};
|
|
||||||
|
|
||||||
Car get_car(CarType type);
|
Car get_car(CarType type);
|
||||||
CarType get_type(Car car);
|
CarType get_type(Car car);
|
||||||
Color get_color(Car car);
|
Color get_color(Car car);
|
||||||
|
|
@ -28,4 +23,6 @@ double get_acceleration_rate(Car car);
|
||||||
int get_speed(Car car);
|
int get_speed(Car car);
|
||||||
void set_acceleration_rate(Car car, double acceleration_rate);
|
void set_acceleration_rate(Car car, double acceleration_rate);
|
||||||
void accelerate(Car car);
|
void accelerate(Car car);
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue