This commit is contained in:
Quentin Bazin 2020-06-22 00:59:24 +02:00
parent dc4140074d
commit 7981c4525d
4 changed files with 16 additions and 11 deletions

View File

@ -84,7 +84,7 @@ class ClientWorld : public World, public gk::Drawable {
ClientCommandHandler *m_client = nullptr;
gk::Camera *m_camera = nullptr;
mutable gk::Vector4f m_closestInitializedChunk{0, 0, 0, 1000000};
mutable gk::Vector4d m_closestInitializedChunk{0, 0, 0, 1000000};
const Sky *m_sky = nullptr;
};

View File

@ -74,9 +74,9 @@ class Player : public gk::ISerializable {
u16 m_dimension = 0;
float m_viewAngleH;
float m_viewAngleV;
float m_viewAngleRoll;
float m_viewAngleH = 0;
float m_viewAngleV = 0;
float m_viewAngleRoll = 0;
u16 m_clientID = 0;

View File

@ -75,15 +75,20 @@ void ChatCommandHandler::teleportationCommand(const std::vector<std::string> &co
m_server.sendChatMessage(0, "Usage: /tp x y z", &client);
}
else {
s32 x = std::stoi(command.at(1));
s32 y = std::stoi(command.at(2));
s32 z = std::stoi(command.at(3));
try {
s32 x = std::stoi(command.at(1));
s32 y = std::stoi(command.at(2));
s32 z = std::stoi(command.at(3));
m_server.setPlayerPosition(client.id, x, y, z);
m_server.setPlayerPosition(client.id, x, y, z);
m_server.sendPlayerPosUpdate(client.id, true);
m_server.sendPlayerPosUpdate(client.id, true);
m_server.sendChatMessage(0, "Teleported to " + std::to_string(x) + " " + std::to_string(y) + " " + std::to_string(z), &client);
m_server.sendChatMessage(0, "Teleported to " + std::to_string(x) + " " + std::to_string(y) + " " + std::to_string(z), &client);
}
catch (std::out_of_range &e) {
m_server.sendChatMessage(0, "Invalid coordinates", &client);
}
}
}

View File

@ -131,7 +131,7 @@ void ServerWorld::sendChunkData(const ClientInfo &client, ServerChunk &chunk) {
chunk.setSent(true);
chunk.setChanged(false);
// std::cout << "Chunk at (" << chunk->x() << ", " << chunk->y() << ", " << chunk->z() << ") sent to client" << std::endl;
// std::cout << "Chunk at (" << chunk.x() << ", " << chunk.y() << ", " << chunk.z() << ") sent to client" << std::endl;
}
void ServerWorld::sendRequestedData(ClientInfo &client, int cx, int cy, int cz) {