| Revision 1 (by (no author), 2006/09/28 22:53:53) |
Initial import |
/// \file core.h
/// Core classes
#ifndef CORE_H_INCLUDED
#define CORE_H_INCLUDED
#include <list>
#include <vector>
#include <string>
extern "C" {
#include <lua.h>
}
namespace Board
{
void RegisterAll(lua_State* state);
class Card
{
public: // Public static functions
static void Register(lua_State* state);
/// new(name, graphic, level, function)
/// \param name Name of card
/// \param graphic Picture to use for display
/// \param level Relative power of card
/// \param function Function to call when played
/// \returns nil
static int New(lua_State* state);
public: // Public variables
/// Index to self reference
int self;
/// Card's name
std::string name;
/// Graphic to use
int graphic;
/// Card's relative power
int level;
public: // Public functions
Card(const std::string& name, int graphic, int level);
~Card();
/// __metatable.gc()
int Destroy(lua_State* state);
};
class Pawn
{
public: // Public static functions
static void Register(lua_State* state);
/// new(self)
/// \param self Table to use as metatable
/// \returns nil
static int New(lua_State* state);
public: // Public variables
/// Index to self reference
int self;
/// This pawn's hand
std::vector<Card*> hand;
public: // Public functions
Pawn();
/// SetHand(self, hand)
int SetHand(lua_State* state);
/// GetDataTable(self)
/// \returns a table used for storing data
int GetDataTable(lua_State* state);
/// __metatable.gc()
int Destroy(lua_State* state);
};
class Board
{
public: // Public static functions
static void Register(lua_State* state);
static Board* CreateInstance(lua_State* state);
public: // Public variables
/// Index to self reference
int self;
/// Console lines
std::list<std::string> log;
/// Cards known to the game
std::vector<Card*> cards;
/// Objects in the game
std::vector<Pawn*> objects;
public: // Public functions
~Board();
void Write(const std::string& message);
void ShuffleDeck();
/// SetPlayers(self, players)
/// \param players Players to use
/// \returns nil
int SetPlayers(lua_State* state);
/// RegisterCard(self, card)
/// \param card Card to register
/// \returns nil
int RegisterCard(lua_State* state);
/// GetPlayers(self)
/// \returns the the list of players
int GetPlayers(lua_State* state);
/// GetRandomCard(self, level)
/// \param level the level of card to retrieve
/// \returns a random card of the given level
int GetRandomCard(lua_State* state);
/// __metatable.gc()
int Destroy(lua_State* state);
};
}
#endif
// The end