當前位置: 首頁>>代碼示例>>C++>>正文


C++ ObjectManager::setCLI方法代碼示例

本文整理匯總了C++中ObjectManager::setCLI方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::setCLI方法的具體用法?C++ ObjectManager::setCLI怎麽用?C++ ObjectManager::setCLI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager::setCLI方法的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::setCLI方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。