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


C++ Room类代码示例

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


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

示例1: if

void MainWindow::on_NewReservation_clicked()
{
    if("" == ui->CustomerIdReservation->text() || "" == ui->RoomNumberReservation->text())
    {
        QMessageBox::about(0,Title,EmptyRes);
        ui->CustomerIdReservation->setFocus();
    }
    else
    {
        if(ui->CheckInDate->date() < QDate::currentDate())
        {
            QMessageBox::about(0,Title,DateBeforeCurrentDate);
            ui->CheckInDate->setDate(QDate(QDate::currentDate()));
        }
        else if(ui->CheckOutDate->date() < ui->CheckInDate->date())
        {
            QMessageBox::about(0,Title,CheckOutBeforeCheckIn);
            ui->CheckOutDate->setDate(ui->CheckInDate->date());
        }
        else
        {
            Room room;
            Customer customer;

            customer.setId(ui->CustomerIdReservation->text());
            room.setRoomNumber(ui->RoomNumberReservation->text().toInt());

            ResM.roomReservation(ui->CheckInDate->date(),ui->CheckOutDate->date(),room,customer);

            ui->CheckInDate->setDate(QDate(QDate::currentDate()));
            ui->CheckOutDate->setDate(QDate(QDate::currentDate()));
            ui->CustomerIdReservation->setText("");
            ui->RoomNumberReservation->setText("");
            ui->CustomerIdReservation->setFocus();
            showRoomGrid();
        }
    }
}
开发者ID:TheolZacharopoulos,项目名称:tl2hotel,代码行数:38,代码来源:mainwindow.cpp

示例2: onPhaseChange

    bool onPhaseChange(ServerPlayer *player) const
    {
        if (player->getPhase() == Player::Start) {
            Room *room = player->getRoom();
            player->setMark("juao", 0);

            LogMessage log;
            log.type = "#JuaoObtain";
            log.from = player;
            log.arg = objectName();
            room->sendLog(log);

            DummyCard *dummy = new DummyCard;

            foreach (int card_id, player->getPile("hautain")) {
                dummy->addSubcard(card_id);
            }

            player->obtainCard(dummy, false);
            delete dummy;

            player->skip(Player::Draw);
        }
开发者ID:DGAH,项目名称:QSanguosha-v2,代码行数:23,代码来源:wisdom.cpp

示例3: blankRoom

    void Maze::displayRoom(Room &room)
    {
        using std::cout;
        using std::endl;

        blankRoom();
        prepareRoom(room);

        cout << endl << endl;
        cout << endl << endl << "          " << room.getName() << endl << endl;

        for(int y = 0; y < 18; y++)
        {
            cout << "          " << workRoomM[y] << endl;
        }

        cout << endl << endl << room.getDescription() << endl;


        cout << endl << exits(room) << endl << getFlashMessage() << endl << endl;;
        cout << endl << endl << endl;

    } //end displayRoom()
开发者ID:burlingk,项目名称:lgpgame,代码行数:23,代码来源:game_maze.cpp

示例4: onPhaseChange

    virtual bool onPhaseChange(ServerPlayer *player) const{
        if(player->getPhase() == Player::Start){
            Room *room = player->getRoom();
            player->setMark("juao", 0);
            ServerPlayer *xuyou = room->findPlayerBySkillName(objectName());
            foreach(int card_id, player->getPile("hautain")){
                if(!xuyou)
                    room->throwCard(card_id);
                else
                    room->obtainCard(player, card_id);
            }
            if(!xuyou)
                return false;

            LogMessage log;
            log.type = "#JuaoObtain";
            log.from = player;
            log.arg = objectName();
            log.to << xuyou;
            room->sendLog(log);

            player->skip(Player::Draw);
        }
开发者ID:654865468,项目名称:QSanguosha,代码行数:23,代码来源:wisdom.cpp

示例5: switch

void CatalogApp::keyDown( KeyEvent event )
{
	switch( event.getChar() ){
		case ' ':	mRoom.togglePower();			break;
		case 'n':	mRenderNames = !mRenderNames;	break;
		case 'b':	mRenderBrightStars = !mRenderBrightStars;	break;
		case 'f':	mRenderFaintStars = !mRenderFaintStars;		break;
		case '1':	setView( 0, 1 );				break;
		case '2':	setView( 0, 2 );				break;
		case '3':	setView( 0, 3 );				break;
		case '4':	setView( 3, 0 );				break;
		default:									break;
	}
}
开发者ID:safetydank,项目名称:Eyeo2012,代码行数:14,代码来源:CatalogApp.cpp

示例6: canFitRoom

bool WorldGeneratorContext::canFitRoom(const Room &first, const Room &second, const Direction::Value direction) const
{
	const int width = second.width();
	const int height = second.height();

	const IRoomPlacementStrategy *strategy = m_selector.select(direction);
	const Coordinate offset = strategy->position(first, second);

	for(int x = 0; x < width; x++)
	{
		for(int y = 0; y < height; y++)
		{
			Coordinate coordinate(offset.first + x, offset.second + y);

			if(isTileGenerated(coordinate))
			{
				return false;
			}
		}
	}

	return true;
}
开发者ID:MemoryLeek,项目名称:ld28,代码行数:23,代码来源:WorldGeneratorContext.cpp

示例7: onEffect

void FireAttack::onEffect(const CardEffectStruct &effect) const
{
    Room *room = effect.from->getRoom();
    if (effect.to->isKongcheng())
        return;

    const Card *card = room->askForCardShow(effect.to, effect.from, objectName());
    room->showCard(effect.to, card->getEffectiveId());

    QString suit_str = card->getSuitString();
    QString pattern = QString(".%1").arg(suit_str.at(0).toUpper());
    QString prompt = QString("@fire-attack:%1::%2").arg(effect.to->objectName()).arg(suit_str);
    if (effect.from->isAlive()) {
        const Card *card_to_throw = room->askForCard(effect.from, pattern, prompt);
        if (card_to_throw)
            room->damage(DamageStruct(this, effect.from, effect.to, 1, DamageStruct::Fire));
        else
            effect.from->setFlags("FireAttackFailed_" + effect.to->objectName()); // For AI
    }

    if (card->isVirtualCard())
        delete card;
}
开发者ID:popkc,项目名称:QSanguosha-v2,代码行数:23,代码来源:maneuvering.cpp

示例8: locker

void MapData::searchDoorNames(RoomRecipient * recipient, QString s, Qt::CaseSensitivity cs)
{
  QMutexLocker locker(&mapLock);
  Room * r = 0;

  for(vector<Room *>::iterator i = roomIndex.begin(); i != roomIndex.end(); ++i)
  {
    r = *i;
    if (r) {
      ExitsList exits = r->getExitsList();
      for(ExitsList::const_iterator exitIter = exits.begin(); exitIter != exits.end(); ++exitIter)
      {
        const Exit & e = *exitIter;
        if (QString((e)[0].toString()).contains(s, cs))
        {
          locks[r->getId()].insert(recipient);
          recipient->receiveRoom(this, r);
          break;
        }
      }
    }
  }
}
开发者ID:GPUWorks,项目名称:MMapper,代码行数:23,代码来源:mapdata.cpp

示例9: onDamaged

    virtual void onDamaged(ServerPlayer *target, const DamageStruct &damage) const{
        if(target->askForSkillInvoke(objectName(), QVariant::fromValue(damage))){
            target->getRoom()->playSkillEffect(objectName());

            target->drawCards(1);
            if(target->isKongcheng())
                return;
            Room *room = target->getRoom();
            room->showAllCards(target);

            QList<const Card *> cards = target->getHandcards();
            Card::Color color = cards.first()->getColor();
            bool same_color = true;
            foreach(const Card *card, cards){
                if(card->getColor() != color){
                    same_color = false;
                    break;
                }
            }

            if(same_color && damage.from && !damage.from->isKongcheng())
                room->askForDiscard(damage.from, objectName(), 1, 1);
        }
开发者ID:gaodayihao,项目名称:GSanguosha,代码行数:23,代码来源:yjcm2012-package.cpp

示例10: readin_room

void readin_room(Hashtable<Room> * map, Hashtable<wordobj> * dictionary)
{
	Room * curr = new Room();
	ifstream rooms("rooms.txt");
	string temp;
	int count = 0;
	rooms >>temp;
	curr->setname(temp);
	while(true)
	{
		if(count == 0) //0 is description for room
		{
			rooms >> temp;
			if(temp == "|" || temp == "")  // | is end of file character 
				break;
			while(rooms.peek() != '\n')
			{
				curr->setdesc(temp);
				rooms >> temp;
			}
			curr->setdesc(temp);
		}
		else if(count == 1) //items in room
开发者ID:dsprague1,项目名称:Text_based_engine,代码行数:23,代码来源:parser.cpp

示例11: onEffect

void DelayedTrick::onEffect(const CardEffectStruct &effect) const{
    Room *room = effect.to->getRoom();

    if(!movable)
        room->throwCard(this);

    LogMessage log;
    log.from = effect.to;
    log.type = "#DelayedTrick";
    log.arg = effect.card->objectName();
    room->sendLog(log);

    JudgeStruct judge_struct = judge;
    judge_struct.who = effect.to;
    room->judge(judge_struct);

    if(judge_struct.isBad()){
        room->throwCard(this);
        takeEffect(effect.to);
    }else if(movable){
        onNullified(effect.to);
    }
}
开发者ID:skypu,项目名称:QSanguosha,代码行数:23,代码来源:standard.cpp

示例12: onEffect

void Analeptic::onEffect(const CardEffectStruct &effect) const{
    Room *room = effect.to->getRoom();

    // do animation
    QString who = effect.to->objectName();
    QString animation_str = QString("analeptic:%1:%2").arg(who).arg(who);
    room->broadcastInvoke("animate", animation_str);

    if(effect.to->hasFlag("dying")){
        // recover hp
        RecoverStruct recover;
        recover.card = this;
        recover.who = effect.from;
        room->recover(effect.to, recover);
    }else{
        LogMessage log;
        log.type = "#Drank";
        log.from = effect.from;
        room->sendLog(log);

        room->setPlayerFlag(effect.to, "drank");
    }
}
开发者ID:ubun,项目名称:SakuraSlash,代码行数:23,代码来源:maneuvering.cpp

示例13: trigger

    virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
        Room *room = player->getRoom();
        DamageStruct damage = data.value<DamageStruct>();
        if(event == Predamage){
            if(!(damage.to->getArmor() && damage.to->getArmor()->objectName() == "wall"))
                return false;
            if(!player->askForSkillInvoke(objectName(), data))
                return false;
            room->throwCard(damage.to->getArmor());
            LogMessage log;
            log.type = "#CatapultDamage";
            log.from = damage.to;
            log.to << player;
            log.arg = QString::number(damage.damage);
            log.arg2 = QString::number(damage.damage + 1);
            room->sendLog(log);

            damage.damage ++;
            data = QVariant::fromValue(damage);
        }

        return false;
    }
开发者ID:Lycio,项目名称:FolkExtensionMod,代码行数:23,代码来源:chibi-card.cpp

示例14: rand

void Actor::walk(Engine* engine) {
	engine->broadcast(this, this->currentRoom, true);

	auto possibleDirs = this->currentRoom->getExits();

	int diceRoll = rand() % possibleDirs.size();

	string chosenDir = possibleDirs[diceRoll];

	Room* nextRoom = this->currentRoom->exits[chosenDir];

	Room* prevRoom = this->currentRoom;

	nextRoom->addChar(this);

	prevRoom->removeChar(this);

	if(this->playerInRoom() != 0) {
		this->printActor();
	}

	engine->broadcast(this, this->currentRoom, false);
}
开发者ID:vholmer,项目名称:Hurricane-Warp,代码行数:23,代码来源:actor.cpp

示例15: json_array

json_t *JsonApi::buildJsonHome()
{
    json_t *jdata = json_array();

    for (int iroom = 0;iroom < ListeRoom::Instance().size();iroom++)
    {
        Room *room = ListeRoom::Instance().get_room(iroom);
        json_t *jroom = json_object();

        json_t *jitems = json_pack("{s:o, s:o}",
                                   "inputs", buildJsonRoomIO<Input>(room),
                                   "outputs", buildJsonRoomIO<Output>(room));

        json_object_set_new(jroom, "type", json_string(room->get_type().c_str()));
        json_object_set_new(jroom, "name", json_string(room->get_name().c_str()));
        json_object_set_new(jroom, "hits", json_string(Utils::to_string(room->get_hits()).c_str()));
        json_object_set_new(jroom, "items", jitems);

        json_array_append_new(jdata, jroom);
    }

    return jdata;
}
开发者ID:choovin,项目名称:calaos_base,代码行数:23,代码来源:JsonApi.cpp


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