/*
 * status.h
 * 
 * Copyright (C) 2005-2007  Josef Kufner <jk@myserver.cz>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#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
