#ifndef NETBOARD_STATUS_H
#define NETBOARD_STATUS_H

typedef enum {
	S_OFFLINE,		/* nothing at all */
	S_CONNECTING,		/* network backend launched, waiting
				   for connection */
	S_CONNECTED,		/* connection is ok */
	S_LOAD_STARTING,	/* starting new game */
	S_LOADING,		/* game selected, game backend launched,
				   loading player's roles and getting acks
				   from others */
	S_LOADED,		/* all game backeds are ready */
	S_GAME_CHECK,		/* game backend chcecking, if game can be started */
	S_GAME_STARTING,	/* waiting to ack game start */
	S_GAME_PLAYING,		/* game in progress */
	S_GAME_ENDING,		/* game over, syncing all clients */

	S_OUT_OF_SYNC,		/* client is confused, waiting for clue */
	
	S_DISCONNECTING,	/* closing connection */
	S_EXITING,		/* disconnect & exit */

	S_MAX,
	S_NOCHANGE		/* no change - this is not a state, just value */
} STATUS;

struct s_status_table {
	void	(*fn_enter)(void);
	void	(*fn_leave)(void);
	STATUS	next_ok,
		next_err;
};

extern struct s_status_table status_table[];

void switch_to_status(STATUS status);
STATUS get_status();

#endif
