私はこれで完全に燃え尽きていますが、なぜ私は得ています:
client.cpp: In member function 'void Client::netRead(int, int)':
client.cpp:158:57: error: no matching function for call to 'Client::nextGameUpdate(sf::Vector2i [0], int [0], sf::IpAddress [0], int&)'
client.cpp:158:57: note: candidate is:
client.cpp:85:6: note: void Client::nextGameUpdate(sf::Vector2i, int, sf::IpAddress, int)
client.cpp:85:6: note: no known conversion for argument 1 from 'sf::Vector2i [0] {aka sf::Vector2<int> [0]}' to 'sf::Vector2i {aka sf::Vector2<int>}'
[Finished in 4.7s]
void Client::nextGameUpdate(sf::Vector2i qq, int ww, sf::IpAddress cc, int dataSize)
{
pListIP[dataSize] = cc;
pListVec[dataSize] = qq;
pListRot[dataSize] = ww;
int num_pListIP = sizeof(pListIP)/sizeof(sf::IpAddress);
if (num_pListIP == lastPlayerCount)
{
return;
}
else if (num_pListIP > lastPlayerCount)
{
int new_players = num_pListIP - lastPlayerCount;
for (new_players; new_players>0; new_players--)
{
addPlayer();
}
}
else if (num_pListIP < lastPlayerCount)
{
int dc_players = lastPlayerCount - num_pListIP;
for (dc_players; dc_players>0; dc_players--)
{
removePlayer();
}
}
lastPlayerCount = num_pListIP;
}
void Client::netRead(int net_step, int dataSize)
{
sf::Packet player_vectors;
sf::Packet player_rotations;
sf::Packet player_ips;
switch (net_step)
{
case 1:
if (socket.receive(player_vectors, sender, senderPort) != sf::Socket::Done)
return;
while (dataSize>0)
{
sf::Vector2i tmp_vec;
player_vectors >> tmp_vec.x >> tmp_vec.y;
pListVec[dataSize] = tmp_vec;
dataSize--;
}
break;
case 2:
if (socket.receive(player_rotations, sender, senderPort) != sf::Socket::Done)
return;
while (dataSize>0)
{
int tmp_rot;
player_rotations >> tmp_rot;
pListRot[dataSize] = tmp_rot;
dataSize--;
}
break;
case 3:
if (socket.receive(player_ips, sender, senderPort) != sf::Socket::Done)
return;
while (dataSize>0)
{
std::string tmp_str;
player_ips >> tmp_str;
sf::IpAddress tmp_ips = tmp_str;
pListIP[dataSize] = tmp_ips;
dataSize--;
}
break;
}
nextGameUpdate(pListVec, pListRot, pListIP, dataSize);
}
ヘッダ
private:
sf::Vector2i pListVec[];
sf::IpAddress pListIP[];
int pListRot[];
sf::Vector2iで埋めようとしている配列と関係があるように感じます... /meは画面をぼんやりと見つめています
とても簡単に言えば。netReadは、非常に基本的な別の関数から情報を取得します。次に、スイッチはnet_stepint..を通過します。
ゲームが続行するために必要なすべてのパケットを受信した後、nextGameUpdate()をトリガーし、3つの配列とdataSizeint変数を送信します。
あなたがこれを理解するならば、前もって感謝します。^^