#ifndef __FFTSHOP_H__
#define __FFTSHOP_H__

#include <string>
#include "fftfile.h"
#include "gui.h"
#include "units.h"

extern Unit *ship;

typedef struct{
	std::string type;
	std::string baytype;
	std::string holdweapon;
	std::string name;
	std::string desc;
	std::string imagefn;
	std::string fpk;
	unsigned int price;
	unsigned int baseprice;
	SDL_Surface *dispimage;
	int holdamount;
	int baseimport;
	int amount;
	int bayw;
	int bayl;
	int bayd;
	int cargounits;
}__shopitem;

typedef struct{
	__shopitem buyitems[30];
	int stock[30];
	int buynext;
}__shop;

class BuyShop
{
public:
	BuyShop(int sx, int sy, int sw, int sh, __shop sshop, bool sstarting=false);
	~BuyShop();
	void ResetValues();
	void Display();
	int PollEvent(SDL_Event event);
private:
	bool starting;
	__shop shop;
	int x;
	int y;
	int w;
	int h;
	TTF_Font *font;
	TTF_Font *font14;
};

class ShipyardShop
{
public:
	ShipyardShop(int sx, int sy, int sw, int sh, FPKShip **fpkships, bool sstarting=false);
	~ShipyardShop();
	void ResetValues();
	void Display();
	int PollEvent(SDL_Event event);
	void DisplayShipInfo(FPKShip *curship, int curcolor);
	void DisplayShipSlots(FPKShip *curship);
	void ReloadSlotShowGUI(FPKShip *curship);
private:
	GUI *sGUI;
	GUI *slotGUI;
	GUI *slotshow;
	bool starting;
	int prev;
	int back;
	int select;
	int viewslots;
	int next;
	int slotpageup;
	int slotpagedown;
	int back2;
	int prevcolor;
	int nextcolor;
	FPKShip **ships;
	FPKEngine *engine;
	int shipmax;
	int x;
	int y;
	int w;
	int h;
	int cur;
	int curcolor;
	int click;
	int slottopline;
	int slotlines;
	int max_y;
	bool showslots;
	Uint8 cr[6];
	Uint8 cg[6];
	Uint8 cb[6];
	int numcolors;
	TTF_Font *font;
	TTF_Font *font14;
};

int NewShipOptions(int w, int h, FPKShip **fpkships);

#endif /* __FFTSHOP_H__ */

