Exemplo n.º 1
0
void Game::doUse() {
	if (object != verb)
	{
		if ((object.compare("terminal") || object.compare("keyboard")) && current_room == 6)
		{
			enterCode();
			return;
		}
		Item toUse = player->getItem(object);
		if (toUse.first != "NOITEM")
		{
			if (checkAction(toUse, USE))
			{
				
				cout << "What to do you want to use the " << object << " with?" << endl;
				cout << ">";
				getline(cin, object);
				Item result = room_list[current_room]->getItem(object);
				if (checkAction(result, USE))
				{
					room_list[current_room]->changeState(toUse.first);
				}
				else cout << "You can't use the " << toUse.first << " with the " << object << endl;
			}
			else cout << "You can't use that. " << endl;
		}
		else cout << "You don't have a " << object << endl;
	}
	else {
		cout << "What do you want to use?" << endl;
		cout << ">";
		getline(cin, object);
		doUse();
	}
}
Exemplo n.º 2
0
static void
DECLARE4(emitcode, TIFF*, tif, int, dx, int, x, int, count)
{
    CodeEntry* thisCode;

    switch (fax.pass) {
    case 1:    /* count potential code & pair use */
	thisCode = enterCode(x-dx, count);
	thisCode->c.count++;
	if (dopairs) {
	    if (fax.lastCode)
		enterPair(fax.lastCode, thisCode)->c.count++;
	    fax.lastCode = thisCode;
	}
	break;
    case 2:    /* rescan w/ potential codes */
	thisCode = enterCode(x-dx, count);
	if (fax.lastCode) {
	    CodePairEntry* pair = findPair(fax.lastCode, thisCode);
	    if (pair) {
		pair->c.count++;
		fax.lastCode = 0;
	    } else {
		fax.lastCode->c.count++;
		fax.lastCode = thisCode;
	    }
	} else
	    fax.lastCode = thisCode;
	break;
    case 3:    /* generate encoded output */
	thisCode = enterCode(x-dx, count);
	if (dopairs) {
	    if (fax.lastCode) {
		if (!printPair(tif, fax.lastCode, thisCode)) {
		    printCode(tif, fax.lastCode);
		    fax.lastCode = thisCode;
		} else
		    fax.lastCode = 0;
	    } else
		fax.lastCode = thisCode;
	} else
	    printCode(tif, thisCode);
	break;
    }
}