Exemple #1
0
Hotel_Info_Ui::Hotel_Info_Ui( QWidget * parent ) : QWidget( parent )
{
	ownerNum = 0;
	roomTypeNum = 0;
	roomNum = 0;
	restNum = 0;
	tableNum =0;
    ui.setupUi( this );

	QObject::connect(ui.saveHotelInfo, SIGNAL(clicked()), this, SLOT(SaveHotelInfo()));

	QObject::connect(ui.addRoomType, SIGNAL(clicked()), this, SLOT(AddRoomType()));
	QObject::connect(ui.delRoomType, SIGNAL(clicked()), this, SLOT(DeleteRoomType()));
	QObject::connect(ui.saveRoomTypes, SIGNAL(clicked()), this, SLOT(SaveRoomTypes()));

	QObject::connect(ui.addRoomButton, SIGNAL(clicked()), this, SLOT(AddRoom()));
	QObject::connect(ui.remRoomButton, SIGNAL(clicked()), this, SLOT(RemoveRoom()));
	QObject::connect(ui.saveRoomsInfo, SIGNAL(clicked()), this, SLOT(SaveRoomInfo()));

	QObject::connect(ui.addOwnerButton, SIGNAL(clicked()), this, SLOT(AddOwner()));
	QObject::connect(ui.delOwnerButton, SIGNAL(clicked()), this, SLOT(DeleteOwner()));
	QObject::connect(ui.saveOwnerInfo, SIGNAL(clicked()), this, SLOT(SaveOwnerInfo()));

	QObject::connect(ui.addRestButton, SIGNAL(clicked()), this, SLOT(AddRestaurant()));
	QObject::connect(ui.remRestButton, SIGNAL(clicked()), this, SLOT(RemoveRestaurant()));
	QObject::connect(ui.saveRestInfo, SIGNAL(clicked()), this, SLOT(SaveRestaurants()));

	QObject::connect(ui.addTableButton, SIGNAL(clicked()), this, SLOT(AddRestTable()));
	QObject::connect(ui.remTableButton, SIGNAL(clicked()), this, SLOT(RemoveRestTable()));
	QObject::connect(ui.saveTablesInfo, SIGNAL(clicked()), this, SLOT(SaveRestTableInfo()));
}
Exemple #2
0
//-----------------------------------------------------------------------------------------------
void Server::RemoveClientFromRoom( GameID roomID, ConnectedClient& clientToSendRemove )
{
	if( m_gamesAndTheirClients.find( roomID ) == m_gamesAndTheirClients.end() )
	{
		return;
	}

	for( int i = 0; i < m_gamesAndTheirClients[ roomID ].size(); ++i )
	{
		if( m_gamesAndTheirClients[ roomID ][ i ] == clientToSendRemove.connectionID )
		{
			if( i == 0 && roomID != LOBBY_ID )
			{
				//remove all peoples and send them to lobby

				while( m_gamesAndTheirClients[ roomID ].size() > 1 )
				{
					auto foundIter = m_connectedAndActiveClients.find( m_gamesAndTheirClients[ roomID ].back() );

					if( foundIter != m_connectedAndActiveClients.end() )
					{
						PutNewClientInLobbyAndSendListOfCurrentGames( *foundIter->second );
					}

					m_gamesAndTheirClients[ roomID ].pop_back();
				}

				m_gamesAndTheirClients[ roomID ].pop_back();

				RemoveRoom( roomID );
				break;
			}
			else
			{
				//remove from room
				if( roomID != LOBBY_ID )
				{				
					auto foundIter = m_connectedAndActiveClients.find( m_gamesAndTheirClients[ roomID ][ i ] );

					if( foundIter != m_connectedAndActiveClients.end() )
					{
						PutNewClientInLobbyAndSendListOfCurrentGames( *foundIter->second );
					}
				}

				if( i < static_cast< int >( m_connectedAndActiveClients.size() ) -1 )
				{
					m_gamesAndTheirClients[ roomID ][ i ] = m_gamesAndTheirClients[ roomID ].back();
					--i;
				}

				m_gamesAndTheirClients[ roomID ].pop_back();
			}
		}
	}
}
Exemple #3
0
bool BigMamaRoomManager::Prepare(unsigned int nRoomID, unsigned char nPhoneOS, std::string &rCheckKey, std::string &rStage)
{
    DanceBaseRoom *pRoom = FindRoom( nRoomID );

    if ( pRoom == NULL )
        return false;

    pRoom->Prepare();

    if ( !LoadStageInfo( pRoom, nPhoneOS, rStage ) )
    {
        RemoveRoom( nRoomID );

        return false;
    }

    rCheckKey = pRoom->GetCheckCode();

    return true;
}
Exemple #4
0
bool BigMamaRoomManager::End(unsigned int nRoomID, unsigned int nRoleID, unsigned int &rScore, CRoomMarkInfo &rMark)
{
    DanceBaseRoom *pRoom = FindRoom( nRoomID );

    if ( pRoom == NULL )
        return false;
    else if ( pRoom->GetDancerPos( nRoleID ) == INVALID_DANCE_ROOM_POS )
        return false;
    else if ( !pRoom->HasStart() )
        return false;

    if ( pRoom->HasLegalEndTime() )
    {
        pRoom->CalcDanceResult();
        rScore = pRoom->GetDancerScore( nRoleID );
        pRoom->GetDancerMark( nRoleID, rMark );
    }

    pRoom->End();

    RemoveRoom( nRoomID );

    return true;
}
void MysteryDungeonMaker::MakePath()
{
	//ステップ1(部屋のあるセクションの上下左右をチェック)
	int sectionRowNum=dungeonSize->DungeonRowNum();
	int sectionColumnNum=dungeonSize->DungeonColumnNum();
	for (int i = 0; i < sectionRowNum; i++)
	{
		for (int j = 0; j < sectionColumnNum; j++)
		{
			if (sections[i][j].HasRoom())
			{
				for (int k = 0; k < 4; ++k)
				{
					int i_rota=i+up_down[k];
					int j_rota=j+right_left[k];
					if ((0 <= i_rota && i_rota < sectionRowNum) && (0 <= j_rota && j_rota < sectionColumnNum))
					{
						if (sections[i_rota][j_rota].HasRoom())
						{
							ConnectAdjacentRoom(&sections[i][j], &sections[i_rota][j_rota]);
						}
					}
				}
			}
		}
	}

	//ステップ2(部屋のないセクションの上下左右をチェック)
	for (int i = 0; i < sectionRowNum; i++)
	{
		for (int j = 0; j < sectionColumnNum; j++)
		{
			if ( ! sections[i][j].HasRoom())
			{
				std::vector<Section*> aroundSections;
				for (int k = 0; k < 4; ++k)
				{
					int i_rota = i + up_down[k];
					int j_rota = j + right_left[k];
					if ((0 <= i_rota && i_rota < sectionRowNum) && (0 <= j_rota && j_rota < sectionColumnNum))
					{
						if (sections[i_rota][j_rota].HasRoom())
							aroundSections.push_back(&sections[i_rota][j_rota]);
					}
				}

				if (aroundSections.size() == 2)
				{
					if( ! aroundSections[0]->isConnectedTo(*aroundSections[1]))
					{
						MakeRoom(Component(i, j), 1, 1);
						ConnectAdjacentRoom(&sections[i][j], aroundSections[0]);
						ConnectAdjacentRoom(&sections[i][j], aroundSections[1]);
						RemoveRoom(sections[i][j].GetRoom());
						sections[i][j].SetHasPath(true);
					}
				}
			}
		}
	}

	//ステップ3
	std::vector<std::vector<Section*>> groups = ClassifyGroups();
	std::vector<Component>route;
	while (groups.size() > 1)
	{
		DungeonMakerHelper::SortByGroupSize(&groups);
		for (size_t i = 0; i < groups[0].size(); i++)
		{
			route = SearchShortestRoute(*groups[0][i]);
			if ( ! route.empty())
				break;
		}
		
		if (!route.empty())
		{
			Component goal = route[route.size() - 1];
			for (size_t i = 0; i < route.size() - 1; i++)
			{
				if (route[i+1] != goal)
					MakeRoom(route[i + 1], 1, 1);

				Section* sectionMadeRoom = &sections[route[i + 1].i][route[i + 1].j];
				ConnectAdjacentRoom(&sections[route[i].i][route[i].j], sectionMadeRoom);
			}

			for (size_t i = 1; i < route.size() - 1; i++)
			{
				Section* roomRemoved = &sections[route[i].i][route[i].j];
				RemoveRoom(roomRemoved->GetRoom());
				roomRemoved->SetHasPath(true);
			}
		}

		ResetGroupId();
		groups = ClassifyGroups();
	}
}