#ifndef _KNIHOVNA_H_
#define _KNIHOVNA_H_

#define COUNT 100									//urcuje maximalni pocet vrcholu grafu... Pokud je moc velke, zbytecne zabira misto v pameti... Do 500 funguje spolehlive, nad uz za to nerucim



//------------------------------------------Prace s mapou



class TNode
{
public:
int ID;                  //carovy kod
int order;               //poradi objeveni(index v matici)
char name[31];           //nazev (max. 30 znaku)
int neighbour[4];        //vektor sousednich krizovatek (podle ID)
bool terminal;           //je cilova stanice?

};



class TMap
{
public:
int count;              //celkovy pocet krizovatek
TNode node[COUNT];
int edge[COUNT][COUNT];
};
int Save(char *path,TMap *map);                  //ulozi komplet mapu do souboru     char *path,TNode *Node[COUNT],int count,int *edge[COUNT][COUNT]
int Read(char *path,TMap *map);                  //nacte komplet mapu ze souboru

int GetOrder(TMap *map,int ID);
int GetOrder(TMap *map,char *name);
void DeleteNode(TMap *Mapa ,int NodeOrder);



//---------------------hledani cesty


class TNodePF
{
private:
	unsigned int distance;							//vzdalenost od pocatku
	unsigned int ancestor;							//predchudce
	bool fixed;										//pevny vrchol

	static unsigned int nodeCount;					//celkovy pocet vrcholu

public:
        inline bool IsFixed(void){return fixed;};
        inline int GetDistance(void){return distance;};
	inline int GetAncestor(void){return ancestor;};
	inline void Fix(void){fixed=true;};
	inline void Unfix(void){fixed=false;};
	inline void SetDistance(unsigned int dis){distance=dis;};
	inline void SetAncestor(unsigned int anc){ancestor=anc;};
};


int PathFind(TMap *map,int start,int finish,int route[],int *nodesOnRoute,int *routeLenght);
int Preklad(TMap *Mapa,int cesta[],int prelCesta[], int pocet);



#endif