#ifndef _unit_h
#define _unit_h

typedef struct unitprops
{
  short move;
  short movetype;
  short gas;
  short ammo;
  short attacktype;
  short basetype;
	int price;
} unitprops;

typedef struct _subload
{
  short loaded;
  short type;
  short gas;
  short ammo;
  float health;
} _subload;

typedef struct _loadedunit
{
  short loaded;
  short type;
  short gas;
  short ammo;
  float health;
  _subload subload;
} _loadedunit;

class _unit
{
  float frame;
  short x;
  short y;
  vector<int> mlist;
  short moving;
  short destx;
  short desty;
  short maxload;
	short powertint, tintspeed;
  void do_move();
  unitprops get_properties(int type);
  public:
    _unit();
    short otherunit;    
    short type;
    short color;  // what player it belongs to (0, 1, 2, 3), not actual color (makecol())
    short number;
    short ready;
    int price;
    float health;
    short exists;
    short basetype;
    short tilex;
    short tiley;
	  short direction;
	  int rotation;
    short move;
    short movetype;
    short gas;
    short ammo;
    short submerged;
    short attacktype;
    short capturing;
    short missioncritical;
    void create(int utype, int tx, int ty, int tcolor, int tnum);
    void draw();
    void draw(bool increment_frame);
    void set_moves(vector<int> list);
    void supply();
    void kill();
    void set_tiles(int tx, int ty);
    void do_movement();
		void reposition(int offset_x, int offset_y);
    bool can_load_unit(_unit *u);
    bool can_unload_unit(int n);
    bool is_moving();
    int load_unit(_unit *u);
    _loadedunit load[2];
};

extern int unit_price[18];

#endif
