Exemplo n.º 1
0
ServerInfo::ServerInfo(char* bufOut, int &offsetOut)
{
	this->mServerName		= GetFromBufS(bufOut, offsetOut);
	this->mNumPlayers		= (int)GetFromBufC(bufOut, offsetOut);
	this->mMaxNumPlayers	= (int)GetFromBufC(bufOut, offsetOut);
	this->mGameMode			= (int)GetFromBufC(bufOut, offsetOut);
	this->mIP				= GetFromBufS(bufOut, offsetOut);
}
Exemplo n.º 2
0
void MsgHandler::ReceiveCastSpell(char* buf, int &offset, int index)
{
	if(index >= 0 && index < this->mNet->GetNumPlayers())
	{
		int casterIndex = (int)GetFromBufC(buf, offset);
		if(casterIndex < this->mNet->GetNumPlayers())
		{
			int spellIndex = (int)GetFromBufC(buf, offset);
			char spells[5];
			spells[0] = (char)spellIndex;
			this->mNet->GetBall(casterIndex)->AddKeyInput(spells, 1, 0, D3DXVECTOR3(), false);
		}
	}
}
Exemplo n.º 3
0
void MsgHandler::ReceiveDropPlayer(char* buf, int &offset)
{
	int index = (int)GetFromBufC(buf, offset);
	if(index > 0 && index < this->mNet->GetNumPlayers() && index != this->mNet->GetIndex())
	{
		this->mNet->DropPlayer(index);
	}
}
Exemplo n.º 4
0
string GetFromBufS(char* buf, int &offsetOut)
{
	string out = "";
	while(buf[offsetOut] != ';')
	{
		out += GetFromBufC(buf, offsetOut);
	}
	offsetOut += sizeof(char);
	return out;
}