/***************************************************************************** * Copyright (C) 2005 Eliot * Authors: Olivier Teuliere * * $Id: game_factory.h,v 1.2 2005/03/03 22:14:41 ipkiss Exp $ * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef _GAME_FACTORY_H_ #define _GAME_FACTORY_H_ #include "game.h" #include "training.h" #include "freegame.h" #include "duplicate.h" class GameFactory { public: static GameFactory *Instance(); static void Destroy(); /************************* * Functions to create and destroy a game * The dictionary does not belong to the * game (ie: it won't be destroyed by ~Game) *************************/ Training *createTraining(const Dictionary &iDic); FreeGame *createFreeGame(const Dictionary &iDic); Duplicate *createDuplicate(const Dictionary &iDic); //Game *loadGame(FILE *fin, const Dictionary &iDic); Game *createFromCmdLine(int argc, char **argv); void releaseGame(Game &iGame); private: GameFactory(); virtual ~GameFactory(); /// The unique instance of the class static GameFactory *m_factory; /// Initial dictionary (it could be changed later) Dictionary m_dic; /** Parameters specified on the command-line */ //@{ /// Dictionary string m_dicStr; /// Game mode string m_modeStr; /// Number of human players int m_human; /// Number of AI players int m_ai; //@} /// Print command-line usage void printUsage(const string &iBinaryName) const; /// Print version void printVersion() const; }; #endif // _GAME_FACTORY_H_