Ejemplo n.º 1
0
void GameSpecificMenu (){
	char c;
	BOOLEAN cont = TRUE;
	while(cont) {
		printf("\n\nCurrent %dx%d board:  \n", width, length);
		PrintPosition(gInitialPosition, "Gamesman", 0);
		printf("\tGame Options:\n\n"
		       "\tc)\t(C)hange the board size (nxn), currently: %dx%d\n"
		       //"\ti)\tSet the (I)nitial position\n"
		       "\tr)\t(R)eset to default settings\n"
		       "\tb)\t(B)ack to the main menu\n"
		       "\nSelect an option:  ", width, length);
		c = GetMyChar();
		switch(c) {
		case 'c': case 'C':
			ChangeBoardSize();
			break;
		case 'i': case 'I':
			GetInitialPosition();
			break;
		case 'r': case 'R':
			Reset();
			SetupGame();
			break;
		case 'b': case 'B':
			cont = FALSE;
			break;
		default:
			printf("Invalid option!\n");
		}
	}
	//InitializeHelpStrings();
}
Ejemplo n.º 2
0
void GameSpecificMenu()
{
	do {
		printf("\n\t----- Game-specific options for %s -----\n\n", kGameName);

		printf("\tCurrent Initial Position:\n");
		PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn);

		printf("\tI)\tChoose the (I)nitial position\n");
		printf("\tT)\t(T)rapping opponent toggle from %s to %s\n",
		       gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)",
		       !gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)");
		printf("\tD)\tChange the number of (D)ragons (Currently %d)\n",
		       gNumDragons);

		printf("\n\n\tb)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar()) {
		case 'Q': case 'q':
			ExitStageRight();
		case 'H': case 'h':
			HelpMenus();
			break;
		case 'I': case 'i':
			gInitialPosition = GetInitialPosition();
			break;
		case 'T': case 't':
			gToTrapIsToWin = !gToTrapIsToWin;
			break;
		case 'D': case 'd':
			printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS);
			/*scanf("%d", &gNumDragons);*/
			gNumDragons = GetMyInt();
			while (gNumDragons > MAX_DRAGONS || gNumDragons < MIN_DRAGONS) {
				printf("Invalid entry. Please try again\n");
				printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS);
				/*scanf("%d", &gNumDragons);*/
				gNumDragons = GetMyInt();
			}
			InitializeGame();
			break;
		case 'b': case 'B':
			return;
		default:
			printf("\nSorry, I don't know that option. Try another.\n");
			HitAnyKeyToContinue();
			break;
		}
	} while(TRUE);
}
Ejemplo n.º 3
0
void CDrawView::OnInsertObject()
{
	// Invoke the standard Insert Object dialog box to obtain information
	//  for new CDrawItem object.
	COleInsertDialog dlg;
	if (dlg.DoModal() != IDOK)
		return;

	BeginWaitCursor();

	// First create the C++ object
	CDrawOleObj* pObj = new CDrawOleObj(GetInitialPosition());
	ASSERT_VALID(pObj);
	CDrawItem* pItem = new CDrawItem(GetDocument(), pObj);
	ASSERT_VALID(pItem);
	pObj->m_pClientItem = pItem;

	// Now create the OLE object/item
	TRY
	{
		if (!dlg.CreateItem(pObj->m_pClientItem))
			AfxThrowMemoryException();

		// add the object to the document
		/*GetDocument()->*/g_pGuiManager->AddBack(pObj);
		pObj->m_pDocument = GetDocument();
		GetDocument()->SetModifiedFlag();

		// try to get initial presentation data
		pItem->UpdateLink();
		pItem->UpdateExtent();

		// if insert new object -- initially show the object
		if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
			pItem->DoVerb(OLEIVERB_SHOW, this);
	}
	CATCH_ALL(e)
	{
		// clean up item
		pItem->Delete();
		pObj->m_pClientItem = NULL;
		/*GetDocument()->*/g_pGuiManager->Remove(pObj);
		GetDocument()->SetModifiedFlag(TRUE);
		pObj->Remove();

		AfxMessageBox(IDP_FAILED_TO_CREATE);
	}
	END_CATCH_ALL

	EndWaitCursor();
}
Ejemplo n.º 4
0
void GameSpecificMenu()
{
	do {
		printf("\n\t----- Game-specific options for %s -----\n\n", kGameName);

		printf("\tCurrent Initial Position:\n");
		PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn);

		printf("\n\tI)\tChoose the (I)nitial position\n");
		printf("\tC)\tCreate a (C)ustom board\n");
		printf("\tD)\tUse (D)efault board\n");

		printf("\n\n\tB)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar()) {
		case 'Q': case 'q':
			ExitStageRight();
		case 'H': case 'h':
			HelpMenus();
			break;
		case '1': case 'I': case 'i':
			gInitialPosition = GetInitialPosition();
			break;
		case 'c': case 'C':
			kUseCustomBoard = TRUE;
			gCreateCustomBoard();
			break;
		case 'd': case 'D':
			kUseCustomBoard = FALSE;
			break;
		case 'b': case 'B':
			return;
		default:
			printf("\nSorry, I don't know that option. Try another.\n");
			HitAnyKeyToContinue();
			break;
		}
	} while(TRUE);
}