-------------------------------------------------------------------------------- - BEGIN API 0.1 -------------------------------------------------------------------------------- int Init(void); - Perform initialization. Must be able to handle all calls upon returning. - Set up any needed structures, set default values, etc. - Function: - return: 0 = success, !0 = failure void Shutdown(void); - Called just before plugin unloading. No calls will be made after this. - Free any memory, close files, etc. const char* Name(void); - Plugin identifying name. - Information use only. - Examples: Chess Wars, TicTacEXTREME - NOTE: Return string must be valid from after Init() and until Shutdown(). - Function: - return: NULL terminated C string const char* Author(void); - Plugin author name. - Information use only. - Examples: Joey, Billy Bob - NOTE: Return string must be valid from after Init() and until Shutdown(). - Function: - return: NULL terminated C string const char* Type(void); - Game type identification. - Used to identify matching clients. - Examples: TicTacToe, Amazons. - Will be compared case insensitively (TicTacToe = tictactoe = TICTACTOE). - NOTE: Return string must be valid from after Init() and until Shutdown(). - Function: - return: NULL terminated C string const char* Version(void); - Plugin version. - Used for identifying matching clients. - Examples: 0.1, KarmicKoala. - NOTE: Return string must be valid from after Init() and until Shutdown(). - Function: - return: NULL terminated C style string const char* APIVersion(void); - Identifies what DIDCGAF plugin version it was written against. - Must be numeric and will be compared to other versions. - Examples: 0.1, 2.5. - NOTE: Return string must be valid from after Init() and until Shutdown(). - Function: - return: NULL terminated C string int NumberOfPlayers(void); - Returns number of players this game supports given game. - Function: - return: Number of players per game void* CreateGame(void); - Creates a new game instance. Must be ready to accept players upon return. - Create any structures, do tracking, logging, etc. - Function: - return: Non-NULL = success (whatever plugin uses to track games), NULL = failure int SetGameOption(void* game, const char* option); - Called after CreateGame() and before StartGame(). - For setting plugin defined user options (board size, game style, etc). - Function: - game: The game returned by CreateGame(). - option: C style string containing option name and value. - return: 0 = success, !0 = failure int AddPlayer(void* game, void* player); - Called after CreateGame. Associates a player with the game. - Create any structures, do tracking, logging, etc. - Function: - game: The game returned by CreateGame(). - player: Unique identifying pointer for this player. - return: 0 = success, !0 = failure int RemovePlayer(void* game, void* player); - Called after CreateGame. - Player guaranteed to have been successfully associated with AddPlayer(). - Function: - game: The game returned by CreateGame(). - player: Unique identifying pointer for this player. - return: 0 = success, !0 = failure void* GetPlayer(void* game, int playerNumber); - Called after CreateGame(). - Returns player data associated with given index. - Function: - game: The game returned by CreateGame(). - index: The player index to retrieve, in range [1,NumberOfPlayers()] - return: Non-NULL = success (player associated with number), NULL = failure (invalid index, other errors) int GetPlayerNumber(void* game, void* player) - Called after CreateGame() - Returns player number associated with given player data. - Function: - game: The game returned by CreateGame(). - player: The player whose number is being requested. - return: >0 = success (player's number), 0 = failure (player not associated with game), <0 = failure (internal error) int PlayerCount(void* game); - Called after CreateGame(). - Returns number of players associated with the game. - Function: - game: The game returned by CreateGame(). - return: >0 = success (number of players), <0 = failure (internal error) int StartGame(void* game); - Called after CreateGame, AddPlayer and SetGameOption calls. - Confirm all settings valid, init board, init players, etc. - Function: - game: The game returned by CreateGame(). - return: 0 = success, >0 = failure (not enough players, bad options, etc), <0 = failure (internal error) void* GetNextPlayer(void* game); - Called after CreateGame() and StartGame(). - Returns player data for the next player to move. - Function: - game: The game returned by CreateGame(). - return: Non-NULL = success, NULL = failure (no next player, internal errors) int ValidateMove(void* game, void* player, const char* move); - Called any time a player makes a move. - Update board state, track who's move it is, etc. - Move string represents the entirety of a players move. Defined by plugin creator. - Function: - game: The game returned by CreateGame(). - player: The player making the move. Guaranteed equal to GetNextPlayer(). - move: C style string representing a move. - return: 0 = success (valid move), !0 = failure (invalid move) int GetGameStatus(void* game); - Queries progress of the game. - Called after StartGame(). - Function: - game: The game returned by CreateGame(). - return: enum PLUGIN_GAME_STATUS (see definition in PluginCommon.h) void DestroyGame(void* game); - Clean up any related structures associated with the game, do logging, etc. - Function: - game: The game returned by CreateGame() -------------------------------------------------------------------------------- - END API 0.1 --------------------------------------------------------------------------------