Revision 1 (by (no author), 2006/09/28 22:53:53) Initial import
/// \file boardmanager.h
/// Main include file for main game screen manager

#ifndef BOARDMANAGER_H_INCLUDED
#define BOARDMANAGER_H_INCLUDED

#include <list>
#include <vector>
#include <string>
#include <sstream>
#include "core.h"

extern "C" {
#include <lua.h>
}

struct Space
{
	Space(): object(NULL), background(NULL), status(0)
	{ }
	
	/// Object in the square
	Board::Pawn* object;
	/// Object in the background of the square
	Board::Pawn* background;
	/// Status of space: 0 - Unclaimed, 1 - Red's, 2 - Blue's, 3 - Disputed
	int status;
	/// Amount of red control, 100 = full control
	int red_control;
	/// Amount of blue control, 100 = full control
	int blue_control;
};

class BoardManager
{
	public: // Public static variables
		static const int SpaceSize = 16;
		static const int Width = 24;
		static const int Height = 24;
		
	public: // Public static functions
		static int Trampoline(lua_State* state);
		
	public: // Public variables
		/// Array of each of the board spaces
		Space* spaces;
		/// Lua state of the board
		lua_State* state;
		Board::Board* board;
		
	public: // Public functions
		BoardManager();
		~BoardManager();
		
		/// Advances the game until further instruction is needed
		/// \returns the object awaiting a command, or NULL if none
		Board::Pawn* Advance();
		
		void ConstructBoard();
		void ConstructLuaTable();
		
		void RecalculateStatus();
		
		void LoadObjects(const char* path);
		bool LoadObject(const char* file);
		bool LoadObject(const char* file, const char* data);
};

#endif

// The end