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"
|
||||
|
||||
struct CarData {
|
||||
CarType type;
|
||||
Color color;
|
||||
double fill_level;
|
||||
double acceleration_rate;
|
||||
int speed;
|
||||
};
|
||||
|
||||
Car get_car(CarType carType) {
|
||||
Car car = {carType, RED, 0.0, 0.0, 0};
|
||||
return car;
|
||||
|
|
|
|||
15
car.h
15
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 { 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);
|
||||
CarType get_type(Car car);
|
||||
Color get_color(Car car);
|
||||
|
|
@ -29,3 +24,5 @@ int get_speed(Car car);
|
|||
void set_acceleration_rate(Car car, double acceleration_rate);
|
||||
void accelerate(Car car);
|
||||
void init();
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue