void sendNetviewInstantiate(Player *player, QString key, quint16 ViewId, quint16 OwnerId, UVector pos, UQuaternion rot) { QByteArray data(1,1); data += stringToData(key); QByteArray data2(4,0); data2[0]=ViewId; data2[1]=ViewId>>8; data2[2]=OwnerId; data2[3]=OwnerId>>8; data += data2; data += vectorToData(pos); data += quaternionToData(rot); sendMessage(player, MsgUserReliableOrdered6, data); }
void Player::savePonies(Player *player, QList<Pony> ponies) { win.logMessage("UDP: Saving ponies for "+QString().setNum(player->pony.netviewId)+" ("+player->name+")", sysTag); QDir playerPath(QDir::currentPath()); playerPath.cd("data"); playerPath.cd("players"); playerPath.mkdir(player->name.toLatin1()); QFile file(QDir::currentPath()+"/data/players/"+player->name.toLatin1()+"/ponies.dat"); file.open(QIODevice::ReadWrite | QIODevice::Truncate); for (int i=0; i<ponies.size(); i++) { file.write(ponies[i].ponyData); file.write(vectorToData(ponies[i].pos)); file.write(stringToData(ponies[i].sceneName.toLower())); } }
void sendNetviewInstantiate(Player *player) { win.logMessage("UDP: Send instantiate for/to "+QString().setNum(player->pony.netviewId)); QByteArray data(1,1); data += stringToData("PlayerBase"); QByteArray data2(4,0); data2[0]=player->pony.netviewId; data2[1]=player->pony.netviewId>>8; data2[2]=player->pony.id; data2[3]=player->pony.id>>8; data += data2; data += vectorToData(player->pony.pos); data += quaternionToData(player->pony.rot); sendMessage(player, MsgUserReliableOrdered6, data); win.logMessage(QString("Instantiate at ")+QString().setNum(player->pony.pos.x)+" " +QString().setNum(player->pony.pos.y)+" " +QString().setNum(player->pony.pos.z)); }
void sendNetviewInstantiate(Player *src, Player *dst) { win.logMessage("UDP: Send instantiate for "+QString().setNum(src->pony.netviewId) +" to "+QString().setNum(dst->pony.netviewId)); QByteArray data(1,1); data += stringToData("PlayerBase"); QByteArray data2(4,0); data2[0]=src->pony.netviewId; data2[1]=src->pony.netviewId>>8; data2[2]=src->pony.id; data2[3]=src->pony.id>>8; data += data2; data += vectorToData(src->pony.pos); data += quaternionToData(src->pony.rot); sendMessage(dst, MsgUserReliableOrdered6, data); //win.logMessage(QString("Instantiate at ")+QString().setNum(rSrc.pony.pos.x)+" " // +QString().setNum(rSrc.pony.pos.y)+" " // +QString().setNum(rSrc.pony.pos.z)); }