当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectManager::setGame方法代码示例

本文整理汇总了C++中ObjectManager::setGame方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectManager::setGame方法的具体用法?C++ ObjectManager::setGame怎么用?C++ ObjectManager::setGame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager::setGame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {
	//Input Arrays
	std::vector<std::string> *input;
	std::vector<std::string> *creationInput;
	std::vector<std::string> *commandInput;

	//Setup Game Objects
	//std::cout << "DEBUG - Main - Setting Up String Manip" << std::endl;
	StringHelper *strm = new StringHelper();

	//std::cout << "DEBUG - Main - Setting Up Object Manager" << std::endl;
	ObjectManager *objm = new ObjectManager();
	objm->setStringHelper(strm);

	//std::cout << "DEBUG - Main - Setting Up Object Creator " << std::endl;
	ObjectCreator *objc = new ObjectCreator();
	objc->setObjectManager(objm);
	objm->setObjectCreator(objc);

	//std::cout << "DEBUG - Main -Setting Up Game " << std::endl;
	Game *game = new Game();
	game->setStringHelper(strm);
	game->setObjectManager(objm);
	objm->setGame(game);

	//std::cout << "DEBUG - Main - Setting Up CLI " << std::endl;
	CLI *cli = new CLI();
	cli->setGame(game);
	cli->setObjectManager();
	cli->setStringHelper(strm);
	game->setCLI(cli);
	objm->setCLI(cli);

	//std::cout << "DEBUG - Main - Setting Up Input " << std::endl;
	Input *inp = new Input();
	inp->setGame(game);
	inp->setObjectCreator(objc);
	inp->setObjectManager(objm);
	inp->setStringHelper(strm);
	objm->setInput(inp);

	if(argc > 1) {
		std::string inputFile(argv[1]);
		inp->setInputFilePath(&inputFile);
		inp->checkInputFile();
		input = inp->parseInputFile();
		creationInput = inp->getCreationInput(input);
		commandInput = inp->getCommandInput(input);
		inp->parseCreationInput(creationInput);
		cli->processCommandInput(commandInput);
		objm->setupRoomNeighborPointers();
		objm->setupCreatureRoomPointers();
		objm->setupPcRoomPointers();
		objm->processInitialRoomState();
		cli->startCLI();
	} else {
		std::cout << "Parsing Initial Input - Main.cpp" << std::endl;
		//Parse Input
		input = inp->parseStdInput();
		creationInput = inp->getCreationInput(input);
		commandInput = inp->getCommandInput(input);

		//std::cout << "Setting Up the Game - Main.cpp" << std::endl;
		//Setup Game
		//std::cout << "Parsing Creation Input - Main.cpp" << std::endl;
		inp->parseCreationInput(creationInput);
		//std::cout << "Setting Creature Room Pointers - Main.cpp" << std::endl;
		objm->setupCreatureRoomPointers();
		//std::cout << "Setting Room Neighbor Pointers - Main.cpp" << std::endl;
		objm->setupRoomNeighborPointers();
		objm->processInitialRoomState();
		//std::cout << "Starting CLI - Main.cpp" << std::endl;
		//Start Game
		//std::cout << "Parsing Initial Command Input - Main.cpp" << std::endl;
		cli->processCommandInput(commandInput);
		cli->startCLI();
	}
}
开发者ID:TrueElement,项目名称:CPlusPlus,代码行数:78,代码来源:Main.cpp


注:本文中的ObjectManager::setGame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。