コード例 #1
0
void NetworkClientsToSpectators(CompanyID cid)
{
	/* If our company is changing owner, go to spectators */
	if (cid == _local_company) SetLocalCompany(COMPANY_SPECTATOR);

	NetworkClientInfo *ci;
	FOR_ALL_CLIENT_INFOS(ci) {
		if (ci->client_playas != cid) continue;
		NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name);
		ci->client_playas = COMPANY_SPECTATOR;
	}
}
コード例 #2
0
/* This packet contains info about the client (playas and name)
 *  as client we save this in NetworkClientInfo, linked via 'client_id'
 *  which is always an unique number on a server. */
DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_CLIENT_INFO)
{
	NetworkClientInfo *ci;
	ClientID client_id = (ClientID)p->Recv_uint32();
	CompanyID playas = (CompanyID)p->Recv_uint8();
	char name[NETWORK_NAME_LENGTH];

	p->Recv_string(name, sizeof(name));

	if (this->status < STATUS_AUTHORIZED) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
	if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;

	ci = NetworkFindClientInfoFromClientID(client_id);
	if (ci != NULL) {
		if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) {
			/* Client name changed, display the change */
			NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, name);
		} else if (playas != ci->client_playas) {
			/* The client changed from client-player..
			 * Do not display that for now */
		}

		/* Make sure we're in the company the server tells us to be in,
		 * for the rare case that we get moved while joining. */
		if (client_id == _network_own_client_id) SetLocalCompany(!Company::IsValidID(playas) ? COMPANY_SPECTATOR : playas);

		ci->client_playas = playas;
		strecpy(ci->client_name, name, lastof(ci->client_name));

		SetWindowDirty(WC_CLIENT_LIST, 0);

		return NETWORK_RECV_STATUS_OKAY;
	}

	/* There are at most as many ClientInfo as ClientSocket objects in a
	 * server. Having more Infos than a server can have means something
	 * has gone wrong somewhere, i.e. the server has more Infos than it
	 * has actual clients. That means the server is feeding us an invalid
	 * state. So, bail out! This server is broken. */
	if (!NetworkClientInfo::CanAllocateItem()) return NETWORK_RECV_STATUS_MALFORMED_PACKET;

	/* We don't have this client_id yet, find an empty client_id, and put the data there */
	ci = new NetworkClientInfo(client_id);
	ci->client_playas = playas;
	if (client_id == _network_own_client_id) this->SetInfo(ci);

	strecpy(ci->client_name, name, lastof(ci->client_name));

	SetWindowDirty(WC_CLIENT_LIST, 0);

	return NETWORK_RECV_STATUS_OKAY;
}
コード例 #3
0
DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_CHAT)
{
	if (this->status != STATUS_ACTIVE) return NETWORK_RECV_STATUS_MALFORMED_PACKET;

	char name[NETWORK_NAME_LENGTH], msg[NETWORK_CHAT_LENGTH];
	const NetworkClientInfo *ci = NULL, *ci_to;

	NetworkAction action = (NetworkAction)p->Recv_uint8();
	ClientID client_id = (ClientID)p->Recv_uint32();
	bool self_send = p->Recv_bool();
	p->Recv_string(msg, NETWORK_CHAT_LENGTH);
	int64 data = p->Recv_uint64();

	ci_to = NetworkFindClientInfoFromClientID(client_id);
	if (ci_to == NULL) return NETWORK_RECV_STATUS_OKAY;

	/* Did we initiate the action locally? */
	if (self_send) {
		switch (action) {
			case NETWORK_ACTION_CHAT_CLIENT:
				/* For speaking to client we need the client-name */
				snprintf(name, sizeof(name), "%s", ci_to->client_name);
				ci = NetworkFindClientInfoFromClientID(_network_own_client_id);
				break;

			/* For speaking to company or giving money, we need the company-name */
			case NETWORK_ACTION_GIVE_MONEY:
				if (!Company::IsValidID(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY;
				/* FALL THROUGH */
			case NETWORK_ACTION_CHAT_COMPANY: {
				StringID str = Company::IsValidID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS;
				SetDParam(0, ci_to->client_playas);

				GetString(name, str, lastof(name));
				ci = NetworkFindClientInfoFromClientID(_network_own_client_id);
				break;
			}

			default: return NETWORK_RECV_STATUS_MALFORMED_PACKET;
		}
	} else {
		/* Display message from somebody else */
		snprintf(name, sizeof(name), "%s", ci_to->client_name);
		ci = ci_to;
	}

	if (ci != NULL) {
		NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), self_send, name, msg, data);
	}
	return NETWORK_RECV_STATUS_OKAY;
}
コード例 #4
0
DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_JOIN)
{
	if (this->status < STATUS_AUTHORIZED) return NETWORK_RECV_STATUS_MALFORMED_PACKET;

	ClientID client_id = (ClientID)p->Recv_uint32();

	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id);
	if (ci != NULL) {
		NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, ci->client_name);
	}

	SetWindowDirty(WC_CLIENT_LIST, 0);

	return NETWORK_RECV_STATUS_OKAY;
}
コード例 #5
0
DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_ERROR_QUIT)
{
	if (this->status < STATUS_AUTHORIZED) return NETWORK_RECV_STATUS_MALFORMED_PACKET;

	ClientID client_id = (ClientID)p->Recv_uint32();

	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id);
	if (ci != NULL) {
		NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, NULL, GetNetworkErrorMsg((NetworkErrorCode)p->Recv_uint8()));
		delete ci;
	}

	SetWindowDirty(WC_CLIENT_LIST, 0);

	return NETWORK_RECV_STATUS_OKAY;
}
コード例 #6
0
DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_QUIT)
{
	if (this->status < STATUS_AUTHORIZED) return NETWORK_RECV_STATUS_MALFORMED_PACKET;

	ClientID client_id = (ClientID)p->Recv_uint32();

	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id);
	if (ci != NULL) {
		NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, NULL, STR_NETWORK_MESSAGE_CLIENT_LEAVING);
		delete ci;
	} else {
		DEBUG(net, 0, "Unknown client (%d) is leaving the game", client_id);
	}

	SetWindowDirty(WC_CLIENT_LIST, 0);

	/* If we come here it means we could not locate the client.. strange :s */
	return NETWORK_RECV_STATUS_OKAY;
}
コード例 #7
0
void NetworkUpdateClientName()
{
	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(_network_own_client_id);

	if (ci == NULL) return;

	/* Don't change the name if it is the same as the old name */
	if (strcmp(ci->client_name, _settings_client.network.client_name) != 0) {
		if (!_network_server) {
			MyClient::SendSetName(_settings_client.network.client_name);
		} else {
			if (NetworkFindName(_settings_client.network.client_name)) {
				NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, _settings_client.network.client_name);
				strecpy(ci->client_name, _settings_client.network.client_name, lastof(ci->client_name));
				NetworkUpdateClientInfo(CLIENT_ID_SERVER);
			}
		}
	}
}
コード例 #8
0
ファイル: LobbyState.cpp プロジェクト: qwexsugare/Spelprojekt
void LobbyState::update(float _dt)
{
	if(m_playerId == 0)
		m_menu->Update(_dt, m_hostMayStartGame);
	else
		m_menu->Update(_dt, m_clientMayReady);

	if(GetKeyState(VK_LEFT) < 0)
	{
		if(g_graphicsEngine->getCamera()->getPos().x >= 0)
		{
			FLOAT2 newPos = FLOAT2(g_graphicsEngine->getCamera()->getPos().x, g_graphicsEngine->getCamera()->getPos().y);
			g_graphicsEngine->getCamera()->set( newPos + FLOAT2(-speed * _dt, 0));
			//pl[0]->setPosition(pl[0]->getPosition() + FLOAT3(-0.05f, 0, 0));
		}
	}
	if(GetKeyState(VK_RIGHT) < 0)
	{
		if(g_graphicsEngine->getCamera()->getPos().x <= step*3)
		{
			FLOAT2 newPos = FLOAT2(g_graphicsEngine->getCamera()->getPos().x, g_graphicsEngine->getCamera()->getPos().y);
			g_graphicsEngine->getCamera()->set( newPos + FLOAT2(speed * _dt, 0));
			//pl[0]->setPosition(pl[0]->getPosition() + FLOAT3(0.05f, 0, 0));
		}
	}

	float max = step*3;
	float min = 0;


	float value = this->m_menu->getSlider()->GetValue();

	//camera linear velocity
	float camVel=0.8;
	//distance from the real camera pos to the slider pos
	distToSlider=abs(cameraRealPos-this->m_menu->getSlider()->GetValue() * max)*3;
	//if you are close enough, it will keep a constant speed before it stops
	if(distToSlider < 1.0)
		distToSlider = 1.0;

	//ugly solution for if the enterkey was pressed, fetch chat string
	if(m_menu->wasEnterPressed())
	{
		this->m_network->sendMessage(NetworkTextMessage(m_menu->getChatString()));
		m_menu->resetEnterPressed();
	}
	//camera real pos is the camera position, which tries to reach the position from the slider
	//if the real pos is inside a certain value, it wont move
	this->m_sliderMove = false;
	if(cameraRealPos > this->m_menu->getSlider()->GetValue() * max-0.05 && cameraRealPos < this->m_menu->getSlider()->GetValue() * max + 0.05)
	{
	}
	else
	{	//otherwise, move the cameras pos toward the slider
		if(cameraRealPos<this->m_menu->getSlider()->GetValue() * max)
			cameraRealPos+=_dt*camVel*distToSlider;
		else if(cameraRealPos>this->m_menu->getSlider()->GetValue() * max)
			cameraRealPos-=_dt*camVel*distToSlider;
		g_graphicsEngine->getCamera()->set(FLOAT2(cameraRealPos, 0));
		this->m_sliderMove = true;
	}

	float mouseX = (g_mouse->getPos().x / float(g_graphicsEngine->getScreenSize().x))*2-1;
	 max = step*5;
	if(g_mouse->isLButtonReleased() && mouseX >= -0.58f && mouseX <= 0.58f && !m_sliderMove)
	{
		D3DXVECTOR3 pickDir;
		D3DXVECTOR3 pickOrig;
		float alve = 1.0f/5.0f;
		g_graphicsEngine->getCamera()->calcPick(pickDir, pickOrig, g_mouse->getPos());
		float dist;
		if(m_officer->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::OFFICER;
			m_network->sendMessage(NetworkSelectHeroMessage(0, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*0);
			this->m_menu->getSlider()->setPosition((m_officer->getRoom()->getPosition().x-step*2+0.6)/max);
			//this->m_menu->getSlider()->setPosition((m_officer->getRoom()->getPosition().x));
		} 
		else if(m_redKnight->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::RED_KNIGHT;
			m_network->sendMessage(NetworkSelectHeroMessage(1, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*0);
			this->m_menu->getSlider()->setPosition((m_redKnight->getRoom()->getPosition().x-step*2)/max);
			//this->m_menu->getSlider()->setPosition((m_redKnight->getRoom()->getPosition().x));
		}
		else if(m_engi->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::ENGINEER;
			m_network->sendMessage(NetworkSelectHeroMessage(2, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*2);
			this->m_menu->getSlider()->setPosition((m_engi->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setPosition((m_engi->getRoom()->getPosition().x));
		}
		else if(m_doctor->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::DOCTOR;
			m_network->sendMessage(NetworkSelectHeroMessage(3, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*3);
			this->m_menu->getSlider()->setPosition((m_doctor->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setPosition((m_doctor->getRoom()->getPosition().x));
		}
		else if(m_mentalist->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::THE_MENTALIST;
			m_network->sendMessage(NetworkSelectHeroMessage(4, this->m_menu->getCombat()));
			this->m_menu->getSlider()->setPosition((m_mentalist->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setValue(alve*4);
			//this->m_menu->getSlider()->setPosition((m_mentalist->getRoom()->getPosition().x));
		}
	}
	
	if(m_menu->MainMenuIsDown())
	{
		sf::Packet dispack;
		dispack << (int)NetworkMessage::PLAYERDISCONNECTED;
		this->m_network->sendPacket(dispack);
		this->m_network->disconnect();
	}

	if(this->m_menu->CloseCombatIsDown() && this->m_heroType != Hero::NONE)
	{
		this->m_network->sendMessage(NetworkSelectHeroMessage(this->m_heroType, this->m_menu->getCombat()));
	}
	else if(this->m_menu->RangeCombatIsDown() && this->m_heroType != Hero::NONE)
	{
		this->m_network->sendMessage(NetworkSelectHeroMessage(this->m_heroType, this->m_menu->getCombat()));
	}

	if(this->m_menu->StartGameIsDown())
	{
		// The host has some restrictions
		if(m_playerId == 0)
		{
			if(m_hostMayStartGame)
			{
				//Skicka ready till servern
				m_network->sendMessage(NetworkReadyMessage(true));
			}
		}
		else if(m_heroType != Hero::HERO_TYPE::NONE)
		{
			//Skicka ready till servern
			m_network->sendMessage(NetworkReadyMessage(true));
		}
	}
	else if(this->m_menu->MainMenuIsDown() == true)
	{
		this->setDone(true);
		this->m_nextState = State::MAIN_MENU;
	}

	//Kolla om n�tverket har sagt att spelet har startat
	while(!m_network->startGameQueueEmpty())
	{
		NetworkStartGameMessage e = m_network->startGameQueueFront();
		this->mapName = e.getMapName();
		this->setDone(true);
		this->m_nextState = State::LOADING;
	}

	//kollar om n�n klient skickat ett text medelande
	while(!m_network->networkTextMessageQueueEmpty())
	{
		NetworkTextMessage e = m_network->networkTextMessageFront();
		m_menu->addStringToChat(e.getTxtMessage());
	}

	while(!m_network->heroSelectedQueueEmpty())
	{
		NetworkHeroSelectedMessage nhsm = m_network->heroSelectedQueueFront();

		// Check if a player has disconnected (chosen hero NONE)
		if(nhsm.getHeroId()== Hero::HERO_TYPE::NONE)
		{
			m_menu->removePlayer(nhsm.getPlayerId());
			if(m_playerId == 0)
			{
				m_hostsSuperVector.erase(nhsm.getPlayerId());
				if(m_hostsSuperVector.size() < 2)
				{
					m_hostMayStartGame = true;
				}
			}
		}
		else
		{
			m_heroType = Hero::HERO_TYPE(nhsm.getHeroId());
		
			if(nhsm.getPlayerId() == this->m_playerId)
			{
				m_menu->selectHero(nhsm.getPlayerId(), m_heroType, true);
				// If its the host that picked a hero, he might now be able to start the game
				if(m_playerId == 0)
				{
					// Check how many players are ready
					int notReadyCounter = 0;
					for(map<int, bool>::iterator iter = m_hostsSuperVector.begin(); iter != m_hostsSuperVector.end(); iter++)
					{
						if(!iter->second)
						{
							notReadyCounter++;
						}
					}
					// The host can only ready up if he is the only one not ready.
					if(notReadyCounter < 2)
					{
						m_hostMayStartGame = true;
					}
				}
				else
					m_clientMayReady = true;
			}
			else
			{
				m_menu->selectHero(nhsm.getPlayerId(), m_heroType, false);
			}
			//Select
			switch(nhsm.getHeroId())
			{
				case Hero::HERO_TYPE::OFFICER:
					if(this->m_officer->getCharacter()->getAnimation()->getCurrentAnimation() == "OfficerIdle")
					{
						this->m_officer->getCharacter()->getAnimation()->PlayLoop("OfficerSelectIdle");
						this->m_officer->getCharacter()->getAnimation()->Play("OfficerSelect");
						this->m_officer->getRoom()->setGlowIndex("glowIntensity");
						this->m_officer->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_officer->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::RED_KNIGHT:
					if(this->m_redKnight->getCharacter()->getAnimation()->getCurrentAnimation() == "RedKnightIdle")
					{
						this->m_redKnight->getCharacter()->getAnimation()->PlayLoop("RedKnightSelectIdle");
						this->m_redKnight->getCharacter()->getAnimation()->Play("RedKnightSelect");
						this->m_redKnight->getRoom()->setGlowIndex("glowIntensity1");
						this->m_redKnight->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_redKnight->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::ENGINEER:
					if(this->m_engi->getCharacter()->getAnimation()->getCurrentAnimation() == "EngiIdle")
					{
						this->m_engi->getCharacter()->getAnimation()->PlayLoop("EngiSelectIdle");
						this->m_engi->getCharacter()->getAnimation()->Play("EngiSelect");
						this->m_engi->getRoom()->setGlowIndex("glowIntensity2");
						this->m_engi->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_engi->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::DOCTOR:
					if(this->m_doctor->getCharacter()->getAnimation()->getCurrentAnimation() == "DoctorIdle")
					{
						this->m_doctor->getCharacter()->getAnimation()->PlayLoop("DoctorSelectedIdle");
						this->m_doctor->getCharacter()->getAnimation()->Play("DoctorSelected");
						this->m_doctor->getRoom()->setGlowIndex("glowIntensity3");
						this->m_doctor->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_doctor->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::THE_MENTALIST:
					if(this->m_mentalist->getCharacter()->getAnimation()->getCurrentAnimation() == "MentalistIdle")
					{
						this->m_mentalist->getCharacter()->getAnimation()->PlayLoop("MentalistSelectIdle");
						this->m_mentalist->getCharacter()->getAnimation()->Play("MentalistSelect");
						this->m_mentalist->getRoom()->setGlowIndex("glowIntensity4");
						this->m_mentalist->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_mentalist->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
			}
		}

		bool heroesNotSelected[] = {false, false, false, false, false};
		for(int i = 0; i < 4; i++)
		{
			if(m_menu->getHeroesSelected()[i] != Hero::HERO_TYPE::NONE)
			{
				heroesNotSelected[m_menu->getHeroesSelected()[i]] = true;
			}
		}

		//Deselect
		for(int i = 0; i < numCharacters; i++)
		{
			if(heroesNotSelected[i] == false)
			{
				switch(i)
				{
				case Hero::HERO_TYPE::OFFICER:
					if(this->m_officer->getCharacter()->getAnimation()->getCurrentAnimation() == "OfficerSelectIdle")
					{
						this->m_officer->getCharacter()->getAnimation()->PlayLoop("OfficerIdle");
						this->m_officer->getCharacter()->getAnimation()->Play("OfficerDeselect");
						this->m_officer->getRoom()->setGlowIndex("");
						this->m_officer->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_officer->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::RED_KNIGHT:
					if(this->m_redKnight->getCharacter()->getAnimation()->getCurrentAnimation() == "RedKnightSelectIdle")
					{
						this->m_redKnight->getCharacter()->getAnimation()->PlayLoop("RedKnightIdle");
						this->m_redKnight->getCharacter()->getAnimation()->Play("RedKnightDeselect");
						this->m_redKnight->getRoom()->setGlowIndex("");
						this->m_redKnight->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_redKnight->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::ENGINEER:
					if(this->m_engi->getCharacter()->getAnimation()->getCurrentAnimation() == "EngiSelectIdle")
					{
						this->m_engi->getCharacter()->getAnimation()->PlayLoop("EngiIdle");
						this->m_engi->getCharacter()->getAnimation()->Play("EngiDeselect");
						this->m_engi->getRoom()->setGlowIndex("");
						this->m_engi->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_engi->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::DOCTOR:
					if(this->m_doctor->getCharacter()->getAnimation()->getCurrentAnimation() == "DoctorSelectedIdle")
					{
						this->m_doctor->getCharacter()->getAnimation()->PlayLoop("DoctorIdle");
						this->m_doctor->getCharacter()->getAnimation()->Play("DoctorDeselected");
						this->m_doctor->getRoom()->setGlowIndex("");
						this->m_doctor->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_doctor->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::THE_MENTALIST:
					if(this->m_mentalist->getCharacter()->getAnimation()->getCurrentAnimation() == "MentalistSelectIdle")
					{
						this->m_mentalist->getCharacter()->getAnimation()->PlayLoop("MentalistIdle");
						this->m_mentalist->getCharacter()->getAnimation()->Play("MentalistDeselect");
						this->m_mentalist->getRoom()->setGlowIndex("");
						this->m_mentalist->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_mentalist->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				}
			}
		}
	}

	while(!m_network->playerJoinedMessageQueueEmpty())
	{
		NetworkPlayerJoinedMessage msg = m_network->playerJoinedMessageQueueFront();

		if(msg.getPlayerIndex() == this->m_playerId)
		{
			this->m_menu->setPlayerName(msg.getPlayerIndex(), msg.getName(), true);
		}
		else
		{
			this->m_menu->setPlayerName(msg.getPlayerIndex(), msg.getName(), false);
		}

		if(m_playerId == 0)
		{
			m_hostsSuperVector[msg.getPlayerIndex()] = false;
			if(msg.getPlayerIndex() != 0)
				m_hostMayStartGame = false;
		}
	}
	
	while(!m_network->readyMessageToClientQueueEmpty())
	{
		NetworkReadyMessageToClient msg = m_network->readyMessageToClientQueueFront();
		this->m_menu->setReady(msg.m_playerIndex);
		if(m_playerId == 0)
		{
			m_hostsSuperVector[msg.m_playerIndex] = true;

			// Check how many players are ready
			int notReadyCounter = 0;
			for(map<int, bool>::iterator iter = m_hostsSuperVector.begin(); iter != m_hostsSuperVector.end(); iter++)
			{
				if(!iter->second)
				{
					notReadyCounter++;
				}
			}
			// The host can only ready up if he is the only one not ready.
			if(notReadyCounter < 2)
			{
				if(m_heroType != Hero::HERO_TYPE::NONE)
				{
					m_hostMayStartGame = true;
				}
			}
		}
	}
}