/*
  vehicle.h: header for C equivalent of:

  class Vehicle
  {
      string      name;                 // each vehicle has a name for clarity
      Vector2     pos;                  // where this vehicle is at present
      Vector2     dir;                  // what direction this vehicle is going
      double      speed default 0;      // speed of this vehicle in metres per second
      int         people_cur default 1; // how many people the vehicle is carrying
      int         people_max default 4; // how many people the vehicle can carry
      void method move(double T);       // move in the current direction for T seconds
      void method print();              // display this vehicle
  }
*/

typedef struct Vehicle *Vehicle;	    // all objects are pointers

// foreach method, declare a type definition to make life easier
// note that every method, and hence method signature, takes "this" first.
typedef void   (*Vehicle_move        )( Vehicle this, double t );
typedef void   (*Vehicle_print       )( Vehicle this );
typedef void   (*Vehicle_dispose     )( Vehicle this );

struct Vehicle
{
	char *             isa;            // attributes
        char *             name;
        Vector2            pos;
        Vector2            dir;
        double             speed;
        int                people_cur;
        int                people_max;
	Vehicle_move       move;            // methods
	Vehicle_print      print;
	Vehicle_dispose    dispose;         // deconstructor
};

extern Vehicle new_Vehicle( char * name, Vector2 pos, Vector2 dir, double speed, int people_cur, int people_max );
extern Vehicle alloc_Vehicle( void );
extern void init_Vehicle( Vehicle v, char * name, Vector2 pos, Vector2 dir, double speed, int people_cur, int people_max );
